From aa065444170d6b29d81e4c1d3c1686f16f6e5a1d Mon Sep 17 00:00:00 2001 From: Trevor Bekolay Date: Fri, 28 Jun 2013 13:21:04 -0500 Subject: [PATCH] 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) --- doc/_static/mpl.css | 15 +++++++++++++++ doc/sphinxext/gen_gallery.py | 8 ++++++-- doc/sphinxext/gen_rst.py | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/_static/mpl.css b/doc/_static/mpl.css index bd174f670d49..3c996ccc7b14 100644 --- a/doc/_static/mpl.css +++ b/doc/_static/mpl.css @@ -566,3 +566,18 @@ table.docutils td { width: 30em; } +figure { + margin: 1em; + display: inline-block; +} + +figure img { + margin-left: auto; + margin-right: auto; +} + +figcaption { + text-align: center; +} + + diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py index 1c4c2b56a9a6..4d1a77a3245e 100644 --- a/doc/sphinxext/gen_gallery.py +++ b/doc/sphinxext/gen_gallery.py @@ -41,7 +41,10 @@ """ link_template = """\ -{basename} +
+ {basename}
+
{title}
+
""" toc_template = """\ @@ -122,7 +125,8 @@ def gen_gallery(app, doctree): link = 'examples/%s/%s.html'%(subdir, basename) rows.append(link_template.format(link=link, thumb=thumbfile, - basename=basename)) + basename=basename + title=basename)) if len(data) == 0: warnings.warn("No thumbnails were found in %s" % subdir) diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py index fecd56b85e42..c7e01585f83e 100644 --- a/doc/sphinxext/gen_rst.py +++ b/doc/sphinxext/gen_rst.py @@ -121,6 +121,7 @@ def generate_example_rst(app): rstfile = '%s.rst'%basename outrstfile = os.path.join(rstdir, rstfile) + # XXX make into title fhsubdirIndex.write(' %s <%s>\n'%(os.path.basename(basename),rstfile)) do_plot = (subdir in example_subdirs