Skip to content

Instantly share code, notes, and snippets.

@navilan
Created February 6, 2012 15:59
Show Gist options
  • Save navilan/1752832 to your computer and use it in GitHub Desktop.
Save navilan/1752832 to your computer and use it in GitHub Desktop.
A hyde plugin to add a context function to jinja and related
#<site_root>/functions.py
from hyde.plugin import Plugin
def quoted(var):
return '"%s"' % var
class MyJinjaLoader(Plugin):
def template_loaded(self, template):
template.env.globals['quoted'] = quoted
{{ quoted('abc') }}
mode: development
media_root: media # Relative path from content folder.
media_url: /media # URL where the media files are served from.
base_url: / # The base url for autogenerated links.
plugins:
- hyde.ext.plugins.meta.MetaPlugin
- hyde.ext.plugins.auto_extend.AutoExtendPlugin
- hyde.ext.plugins.sorter.SorterPlugin
- hyde.ext.plugins.tagger.TaggerPlugin
- hyde.ext.plugins.syntext.SyntextPlugin
- hyde.ext.plugins.textlinks.TextlinksPlugin
- functions.MyJinjaLoader
#...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment