aboutsummaryrefslogtreecommitdiffstats
path: root/flibbit.py
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-10-20 06:46:52 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-10-20 06:46:52 -0400
commit85c1c72db022bba891868afd3375e39dbe245701 (patch)
tree9d86a3db825667362a8c89a98a205586015aec94 /flibbit.py
parentabcfcc62cc62dfc088d30d5a6b6c36d6c89f7b07 (diff)
downloadlibrambutan-85c1c72db022bba891868afd3375e39dbe245701.tar.gz
librambutan-85c1c72db022bba891868afd3375e39dbe245701.zip
initial check-in of arduino docs in RST format (converted using wget+pandoc)
Diffstat (limited to 'flibbit.py')
-rw-r--r--flibbit.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/flibbit.py b/flibbit.py
new file mode 100644
index 0000000..5f149d4
--- /dev/null
+++ b/flibbit.py
@@ -0,0 +1,26 @@
+import os
+import shutil
+import re
+from os.path import *
+
+src = '/Users/mbolivar/foo/arduino.cc/en/Reference'
+dst = '/Users/mbolivar/hack/leaf/libmaple/docs/source/arduino'
+
+fs = [x for x in os.listdir(src) if x.endswith('.rst')]
+
+def process(line):
+ if re.match('-+$', line.rstrip()):
+ return '=' * (len(line) - 1) + '\n'
+ elif re.match('\^+$', line.rstrip()):
+ return '-' * (len(line) - 1) + '\n'
+ return line
+
+for f in fs:
+ print 'processing:', f
+ with open(join(src,f), 'r') as f_in:
+ with open(join(dst, basename(f)), 'w') as f_out:
+ label = '.. _arduino-%s:\n\n' % (f.split('.')[0])
+ f_out.write(label)
+ for line in list(f_in.readlines())[20:-22]:
+ f_out.write(process(line))
+