John Mulligan avatar John Mulligan committed b482b52

small stuff

Comments (0)

Files changed (2)

muyhomepage2/app/build.py

 class TemplateConfig(configuration.Config):
     def __init__(self):
         configuration.Config.__init__(self)
-        self._jenv = jinja2.Environment()
+        self._jenv = None
 
     def templateloader(self):
-        return jinja2.FileSystemLoader('/home/john/projects/newgenerator/skins/default')
+        p = '/home/john/projects/newgenerator/skins/default'
+        loader = jinja2.FileSystemLoader(p)
+        return loader
 
     def templateenv(self):
+        if not self._jenv:
+            self._jenv = jinja2.Environment(loader=self.templateloader())
         return self._jenv
 
 
     print 'Building:', pctx.page.title
     tname = pctx.template()
     scope = dict(current=pctx, site=website, config=config)
-    template = config.templateloader().load(config.templateenv(), tname)
+    env = config.templateenv()
+    template = env.get_template(tname)
     fp = open(os.path.join(config.destination(), pctx.finalname()), 'w')
     try:
         fp.write(template.render(scope).encode(ENCODING))

muyhomepage2/text/wikirst.py

 # TODO cleanup
+#  This module was nearly directly ported from the muyhomepage/filament
+#  version 1. It has only been minimally updated.
 
 import re
 import docutils
             target, text = content.split('|', 1)
         else:
             target = text = content
-        target = './%s' % util.encodetitle(target)
+        target = './%s.html' % util.encodetitle(target)
         return '<a href="%s" class="wikilink">%s</a>' % (target, text)
-        assert 1 == 2, content
 
     def bracecmd(self, content):
-        return content
+        # this was a bad idea from the start
+        if content == 'start brackets':
+            return '[['
+        if content == 'end brackets':
+            return ']]'
+        assert (not content), content
 
 
 BRACKET_CMD = 'bracket'
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.