Luke Plant avatar Luke Plant committed 3205cba

Split schemes into several wiki pages

Comments (0)

Files changed (2)

bibleverses/config.py

 VERSESPAGENAME = "BibleMemorisationVerses"
 TOPICSPAGENAME = "BibleMemorisationTopics"
 SCHEMESPAGENAME = "BibleMemorisationSchemes"
+SCHEMESPAGENAMEPREFIX = "BibleMemorisationSchemes/"
 
+AUTHOR = "luke"

bibleverses/update.py

 from writewiki import write_page
 from StringIO import StringIO
 
-from config import VERSESPAGENAME, TOPICSPAGENAME, SCHEMESPAGENAME
+from config import VERSESPAGENAME, TOPICSPAGENAME, SCHEMESPAGENAME, SCHEMESPAGENAMEPREFIX
 
 def write_pages():
     verses = get_verses()
     schemes = get_schemes()
     write_page(VERSESPAGENAME, make_done_page(verses))
     write_page(TOPICSPAGENAME, make_topics_page(verses, topictree, extras))
-    write_page(SCHEMESPAGENAME, make_schemes_page(verses, topictree, schemes))
+    build_schemes(verses, topictree, schemes)
+    write_page(SCHEMESPAGENAME, make_scheme_index_page(schemes, SCHEMESPAGENAMEPREFIX))
+    for scheme in schemes:
+        write_scheme_page(SCHEMESPAGENAMEPREFIX, scheme, make_scheme_page(scheme))
 
     print "Verses: %d" % len(verses)
     print "Topics: %d" % len(get_topic_entries(verses))
     print "Schemes: %d" % len(schemes)
 
+def scheme_page_name(prefix, scheme):
+    return prefix + scheme.name.title().replace(" ", "")
+
+def write_scheme_page(prefix, scheme, text):
+    write_page(scheme_page_name(prefix, scheme), text)
+
 def make_hebrew_verse(text):
     return u"""
 {{{
         
     return buf.getvalue()
 
-def make_schemes_page(verses, topictree, schemes):
+def make_scheme_page(scheme):
     buf = StringIO()
     buf.write(u"""
-= Bible Memorisation Schemes =
-
-[[TOC]]
+= Bible Memorisation Scheme - %s =
 
 This page is autogenerated from BibleMemorisationYaml, BibleMemorisationTopicYaml and BibleMemorisationSchemeYaml - do not edit
+""" % scheme.name)
+    buf.write(scheme.description + u"\n\n")
+    for item in scheme.items:
+        buf.write(u"\nbible:\"%s\"\n" % item.verse.verse)
+        for e in item.entries:
+            buf.write(u" * '''%s'''" % e.topic)
+            if e.comment:
+                buf.write(u" :: %s" % e.comment)
+            buf.write(u"\n")
+        write_verse_text(item.verse, buf)
+    buf.write(u"""
+
+----
+[[AutoNav()]]
 """)
-    build_schemes(verses, topictree, schemes)
-    for s in schemes:
-        buf.write(u"\n== %s ==\n" % s.name)
-        buf.write(s.description + u"\n\n")
-        for item in s.items:
-            buf.write(u"\nbible:\"%s\"\n" % item.verse.verse)
-            for e in item.entries:
-                buf.write(u" * '''%s'''" % e.topic)
-                if e.comment:
-                    buf.write(u" :: %s" % e.comment)
-                buf.write(u"\n")
-            write_verse_text(item.verse, buf)
+    return buf.getvalue()
+
+def make_scheme_index_page(schemes, prefix):
+    buf = StringIO()
+    buf.write(u"""= Bible Memorisation Schemes =
+
+This page is autogenerated from BibleMemorisationYaml, BibleMemorisationTopicYaml and BibleMemorisationSchemeYaml - do not edit
+
+""")
+    for scheme in schemes:        
+        buf.write(u" * [wiki:%s %s]\n" % (scheme_page_name(prefix, scheme), scheme.name))
+    buf.write(u"""
+
+----
+[[AutoNav()]]
+""")
+
     return buf.getvalue()
 
 if __name__ == '__main__':
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.