Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aa06544

Browse files
committed
Added labels to images in the gallery
- Right now it's just the filename of the example - It should perhaps be a string that we define in the example file (like in scikits-image / scikits-learn)
1 parent 5e8d808 commit aa06544

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

doc/_static/mpl.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,18 @@ table.docutils td {
566566
width: 30em;
567567
}
568568

569+
figure {
570+
margin: 1em;
571+
display: inline-block;
572+
}
573+
574+
figure img {
575+
margin-left: auto;
576+
margin-right: auto;
577+
}
578+
579+
figcaption {
580+
text-align: center;
581+
}
582+
583+

doc/sphinxext/gen_gallery.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
</h4>"""
4242

4343
link_template = """\
44-
<a href="{link}"><img src="{thumb}" border="0" alt="{basename}"/></a>
44+
<figure>
45+
<a href="{link}"><img src="{thumb}" border="0" alt="{basename}"/></a><br>
46+
<figcaption><a href="{link}">{title}</a></figcaption>
47+
</figure>
4548
"""
4649

4750
toc_template = """\
@@ -122,7 +125,8 @@ def gen_gallery(app, doctree):
122125
link = 'examples/%s/%s.html'%(subdir, basename)
123126
rows.append(link_template.format(link=link,
124127
thumb=thumbfile,
125-
basename=basename))
128+
basename=basename
129+
title=basename))
126130

127131
if len(data) == 0:
128132
warnings.warn("No thumbnails were found in %s" % subdir)

doc/sphinxext/gen_rst.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def generate_example_rst(app):
121121
rstfile = '%s.rst'%basename
122122
outrstfile = os.path.join(rstdir, rstfile)
123123

124+
# XXX make into title
124125
fhsubdirIndex.write(' %s <%s>\n'%(os.path.basename(basename),rstfile))
125126

126127
do_plot = (subdir in example_subdirs

0 commit comments

Comments
 (0)