| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4a21e05 commit 8ea0835
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,15 @@ | |||
| 1 | 1 | # Derived from code on Eric Holscher's blog, found at: | |
| 2 | 2 | # https://www.ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/ | |
| 3 | 3 | ||
| 4 | + import re | ||
| 5 | + | ||
| 6 | + def render_with_jinja(docname, source): | ||
| 7 | + if "shared-bindings/support_matrix" in docname: | ||
| 8 | + return True | ||
| 9 | + if re.search('^\s+.. jinja$', source[0], re.M): | ||
| 10 | + return True | ||
| 11 | + return False | ||
| 12 | + | ||
| 4 | 13 | def rstjinja(app, docname, source): | |
| 5 | 14 | """ | |
| 6 | 15 | Render our pages as a jinja template for fancy templating goodness. | |
@@ -9,12 +18,12 @@ def rstjinja(app, docname, source): | |||
| 9 | 18 | if app.builder.format not in ("html", "latex"): | |
| 10 | 19 | return | |
| 11 | 20 | ||
| 12 | - # we only want our one jinja template to run through this func | ||
| 13 | - if "shared-bindings/support_matrix" not in docname: | ||
| 21 | + # we only want specific files to run through this func | ||
| 22 | + if not render_with_jinja(docname, source): | ||
| 14 | 23 | return | |
| 15 | 24 | ||
| 16 | 25 | src = rendered = source[0] | |
| 17 | - print(docname) | ||
| 26 | + print(f"rendering {docname} as jinja templates") | ||
| 18 | 27 | ||
| 19 | 28 | if app.builder.format == "html": | |
| 20 | 29 | rendered = app.builder.templates.render_string( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments