summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorsommersoft <sommersoft@gmail.com>2019-07-04 01:19:56 -0500
committersommersoft <sommersoft@gmail.com>2019-07-04 01:19:56 -0500
commit4342383d9595914786475aa55c001864333ddcc1 (patch)
treebcdfda700a6bf1055519bf9182c6e393eb668f53 /docs
parentf1256c0b35d8ff3e1893bd345a6ff29c2ee2e752 (diff)
add jinja extension; update shared-bindings/index.rst to use jinja
Diffstat (limited to 'docs')
-rw-r--r--docs/rstjinja.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/rstjinja.py b/docs/rstjinja.py
new file mode 100644
index 000000000..a92f2280c
--- /dev/null
+++ b/docs/rstjinja.py
@@ -0,0 +1,24 @@
+# Derived from code on Eric Holscher's blog, found at:
+# https://www.ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/
+
+def rstjinja(app, docname, source):
+ """
+ Render our pages as a jinja template for fancy templating goodness.
+ """
+ # Make sure we're outputting HTML
+ if app.builder.format != 'html':
+ return
+
+ # we only want our one jinja template to run through this func
+ if "shared-bindings/index" not in docname:
+ return
+
+ src = source[0]
+ print(docname)
+ rendered = app.builder.templates.render_string(
+ src, app.config.html_context
+ )
+ source[0] = rendered
+
+def setup(app):
+ app.connect("source-read", rstjinja)