Created
December 2, 2015 23:23
-
-
Save ericholscher/f560d339c452c5a010da to your computer and use it in GitHub Desktop.
A basic extension that parses the RST as a jinja template before rendering as RST
This file contains hidden or 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
def on_source_read(app, docname, source): | |
src = source[0] | |
if hasattr(app.builder, 'globalcontext'): | |
app.info('Using global context') | |
source[0] = app.builder.templates.render_string(src, app.builder.globalcontext) | |
else: | |
source[0] = app.builder.templates.render_string(src, {}) | |
def setup(app): | |
app.connect("source-read", on_source_read) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment