aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb
diff options
context:
space:
mode:
authorGravatar Jack Humbert <jack.humb@gmail.com>2017-06-01 12:58:33 -0400
committerGravatar GitHub <noreply@github.com>2017-06-01 12:58:33 -0400
commit9069edd9344ae280cf7a638b3f8e6c9e53bbfd67 (patch)
treebbb404f2d53bca461e9e8b199b07bdc08d11f44c /keyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb
parentd548693c8be93792605c413d7258aeeb0dcc4f34 (diff)
parentaae727d9ecce60906b26ee9a5a5d72f6fd25d9e4 (diff)
downloadqmk_firmware-9069edd9344ae280cf7a638b3f8e6c9e53bbfd67.tar.gz
Merge pull request #1347 from nooges/nyquist
Add Nyquist keyboard support
Diffstat (limited to 'keyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb')
-rwxr-xr-xkeyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/keyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb b/keyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb
new file mode 100755
index 000000000..7285b008a
--- /dev/null
+++ b/keyboards/nyquist/keymaps/hexwire/keymap_to_readme.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+
+class KeymapConverter
+
+ def initialize(filename)
+ @filename = filename
+ @mode = :search
+ end
+
+ def read_keymaps
+ lines = IO.readlines(@filename)
+ lines.each { |line| parse_line line[0..-2] }
+ end
+
+ def parse_line(line)
+ case @mode
+ when :search
+ if line =~ /KC_KEYMAP/
+ puts "### #{line}"
+ puts "```"
+ @mode = :parse
+ end
+ when :parse
+ if line =~ /\)/
+ @mode = :search
+ puts "```\n\n"
+ else
+ line = line[4..-1]
+ line.sub!(/(,)^-/m, "|")
+ line.sub!(/( {4})/, " |")
+
+ puts line
+ end
+ end
+ end
+
+end
+
+converter = KeymapConverter.new('keymap.c')
+converter.read_keymaps