Skip to content
Browse files

does something with the doc options

  • Loading branch information...
1 parent 80eb712 commit 0e8c304adc801dce151d062410808a3b8e2514cb @dash1291 committed Apr 1, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 build.py
View
30 build.py
@@ -0,0 +1,30 @@
+import re
+
+from jinja2 import Template
+import markdown
+
+# Walk through the directories
+# Convert .md's to .html's
+# Build homepage links
+# Build archive page
+
+def build_options(doc_string):
+ # build a json object of doc options for easy access
+ opt_start = re.search('-+\n', doc_string).end()
+ opt_end = re.search('\n-+', doc_string).start()
+ opt_string = doc_string[opt_start: opt_end].replace('\n', ',')
+ options = eval('{' + opt_string + '}')
+ return options
+
+def strip_options(doc_string):
+ # coz I don't need those options to render as HTML
+ opt_end = re.search('\n-+', doc_string).start()
+ return doc_string[opt_end:]
+
+def build_page(doc_path):
+ doc_string = doc_path.read()
+ options = build_options(doc_string)
+ doc_string = strip_options(doc_string)
+ html = markdown.markdown(doc_string)
+
+ # build further with jinja2

0 comments on commit 0e8c304

Please sign in to comment.
Something went wrong with that request. Please try again.