Skip to content

Commit

Permalink
HTML: Create gallery elements according to Sphinx Gallery 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Aug 28, 2022
1 parent 67f5b06 commit b5b614e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2323,29 +2323,23 @@ def depart_admonition_text(self, node):


def depart_gallery_html(self, node):
self.body.append('<div class="sphx-glr-thumbnails">\n')
for title, uri, filename, tooltip in node['entries']:
if tooltip:
tooltip = ' tooltip="{}"'.format(html.escape(tooltip))
self.body.append("""\
<div class="sphx-glr-thumbcontainer"{tooltip}>
<div class="figure align-center">
<img alt="thumbnail" src="{filename}" />
<p class="caption">
<span class="caption-text">
<a class="reference internal" href="{uri}">
<span class="std std-ref">{title}</span>
</a>
</span>
</p>
</div>
<img alt="{title}" src="{filename}" />
<p><a class="reference internal" href="{uri}"><span class="std std-ref">{title}</span></a></p>
<div class="sphx-glr-thumbnail-title">{title}</div>
</div>
""".format(
uri=html.escape(uri),
title=html.escape(title),
tooltip=tooltip,
filename=html.escape(filename),
))
self.body.append('<div class="sphx-glr-clear"></div>')
self.body.append('</div>\n')


def do_nothing(self, node):
Expand Down

0 comments on commit b5b614e

Please sign in to comment.