Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support text builder #615

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@
{{ output.data[datatype] | escape_latex | ansi2latex | indent | indent }}
\\end{sphinxVerbatim}

.. raw:: text

{{ output.data[datatype] | indent | indent }}

{%- elif datatype in ['image/svg+xml', 'image/png', 'image/jpeg', 'application/pdf'] %}

.. image:: {{ output.metadata.filenames[datatype] | posix_path }}
Expand Down Expand Up @@ -2254,6 +2258,14 @@ def depart_admonition_latex(self, node):
self.body.append('\\end{sphinxadmonition}\n')


def visit_admonition_text(self, node):
self.new_state(0)


def depart_admonition_text(self, node):
self.end_state()


def depart_gallery_html(self, node):
for title, uri, filename, tooltip in node['entries']:
if tooltip:
Expand Down Expand Up @@ -2318,16 +2330,20 @@ def setup(app):
app.add_directive('nbgallery', NbGallery)
app.add_node(CodeAreaNode,
html=(do_nothing, depart_codearea_html),
latex=(visit_codearea_latex, depart_codearea_latex))
latex=(visit_codearea_latex, depart_codearea_latex),
text=(do_nothing, do_nothing))
app.add_node(FancyOutputNode,
html=(do_nothing, do_nothing),
latex=(visit_fancyoutput_latex, depart_fancyoutput_latex))
latex=(visit_fancyoutput_latex, depart_fancyoutput_latex),
text=(do_nothing, do_nothing))
app.add_node(AdmonitionNode,
html=(visit_admonition_html, depart_admonition_html),
latex=(visit_admonition_latex, depart_admonition_latex))
latex=(visit_admonition_latex, depart_admonition_latex),
text=(visit_admonition_text, depart_admonition_text))
app.add_node(GalleryNode,
html=(do_nothing, depart_gallery_html),
latex=(do_nothing, do_nothing))
latex=(do_nothing, do_nothing),
text=(do_nothing, do_nothing))
app.connect('builder-inited', builder_inited)
app.connect('config-inited', config_inited)
app.connect('html-page-context', html_page_context)
Expand Down