Created
February 6, 2012 15:59
-
-
Save navilan/1752832 to your computer and use it in GitHub Desktop.
A hyde plugin to add a context function to jinja and related
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#<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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ quoted('abc') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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