summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-01 12:33:35 +0000
committerbrian m. carlson <sandals@crustytoothpaste.net>2018-03-01 12:33:35 +0000
commit6f2400926e0e50c5a08c507e1a3febd58be2b967 (patch)
tree05ab636912dbc45c33879481d71d9945c4bc49d3 /bin
parent36e0d78d15930ebc3c853235ea2e3fb0703e7a5e (diff)
Process spaces in AsciiDoc files into tabs
Diffstat (limited to 'bin')
-rwxr-xr-xbin/process-spaces15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/process-spaces b/bin/process-spaces
new file mode 100755
index 0000000..23cab67
--- /dev/null
+++ b/bin/process-spaces
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+
+require 'optparse'
+
+nspaces = 4
+
+OptionParser.new do |opts|
+ opts.on('-s SPACES', '--spaces=SPACES', 'Number of spaces') do |s|
+ nspaces = s.to_i
+ end
+end.parse!
+
+while (l = gets)
+ print l.gsub(/^(\t*)( {#{nspaces}})/, "\\1\t")
+end