summaryrefslogtreecommitdiff
path: root/keyboards/nyquist/keymaps/hexwire/keymap_converter.py
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-06-01 12:58:33 -0400
committerGitHub <noreply@github.com>2017-06-01 12:58:33 -0400
commit9069edd9344ae280cf7a638b3f8e6c9e53bbfd67 (patch)
treebbb404f2d53bca461e9e8b199b07bdc08d11f44c /keyboards/nyquist/keymaps/hexwire/keymap_converter.py
parentd548693c8be93792605c413d7258aeeb0dcc4f34 (diff)
parentaae727d9ecce60906b26ee9a5a5d72f6fd25d9e4 (diff)
Merge pull request #1347 from nooges/nyquist
Add Nyquist keyboard support
Diffstat (limited to 'keyboards/nyquist/keymaps/hexwire/keymap_converter.py')
-rwxr-xr-xkeyboards/nyquist/keymaps/hexwire/keymap_converter.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/keyboards/nyquist/keymaps/hexwire/keymap_converter.py b/keyboards/nyquist/keymaps/hexwire/keymap_converter.py
new file mode 100755
index 0000000000..683f64da45
--- /dev/null
+++ b/keyboards/nyquist/keymaps/hexwire/keymap_converter.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+import re
+
+class KeymapConverter:
+
+ def __init__(self, filename):
+ self.filename = filename
+
+ def read_keymaps(self):
+ with open(self.filename) as f:
+ lines = f.readlines()
+
+ mode = 0
+ for line in lines:
+ line = line[:-1]
+ if mode == 0:
+ if "KC_KEYMAP" in line:
+ matches = re.match(r'.*\[(.*)\] = .*', line)
+ if matches:
+ layer_name = matches.group(1)
+ layer_name = layer_name[1:].capitalize()
+ print '###', layer_name
+ print '```'
+ mode = 1
+ elif mode == 1:
+ if "//" in line:
+ print line[4:]
+ elif ")" in line:
+ mode = 0
+ print '```'
+ print
+ elif line[-1] == ',':
+ print "|" + line[5:-1] + "|"
+ else:
+ print "|" + line[5:] + "|"
+
+converter = KeymapConverter('keymap.c')
+converter.read_keymaps()