docs/rstjinja.py: add jinja processing for building latex (pdf) docs
This commit is contained in:
parent
a28d0f6c80
commit
ffffccf7a0
@ -6,18 +6,28 @@ def rstjinja(app, docname, source):
|
|||||||
Render our pages as a jinja template for fancy templating goodness.
|
Render our pages as a jinja template for fancy templating goodness.
|
||||||
"""
|
"""
|
||||||
# Make sure we're outputting HTML
|
# Make sure we're outputting HTML
|
||||||
if app.builder.format != 'html':
|
if app.builder.format not in ("html", "latex"):
|
||||||
return
|
return
|
||||||
|
|
||||||
# we only want our one jinja template to run through this func
|
# we only want our one jinja template to run through this func
|
||||||
if "shared-bindings/support_matrix" not in docname:
|
if "shared-bindings/support_matrix" not in docname:
|
||||||
return
|
return
|
||||||
|
|
||||||
src = source[0]
|
src = rendered = source[0]
|
||||||
print(docname)
|
print(docname)
|
||||||
rendered = app.builder.templates.render_string(
|
|
||||||
src, app.config.html_context
|
if app.builder.format == "html":
|
||||||
)
|
rendered = app.builder.templates.render_string(
|
||||||
|
src, app.config.html_context
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
from sphinx.util.template import BaseRenderer
|
||||||
|
renderer = BaseRenderer()
|
||||||
|
rendered = renderer.render_string(
|
||||||
|
src,
|
||||||
|
app.config.html_context
|
||||||
|
)
|
||||||
|
|
||||||
source[0] = rendered
|
source[0] = rendered
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
|
Loading…
Reference in New Issue
Block a user