From b467001df190d3aa8867d3d37976183178b90e47 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 24 Nov 2016 11:34:38 -0500 Subject: [PATCH] FIX: workaround py2 unicode issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 9a8ed26f0b58ee5eeb4611fb1f7290b2c25e6b1f backported #7436 which fixed a warning about non explicitly encoded non-ascii characters. This 'just works' on python3, but we need to explicitly make the string with the unicode (¶ for the links) as unicode for py2. We can not use `from __future__ import unicode_literals` due to issues with shpinx expecting bytes (str) not unicode. --- doc/sphinxext/gen_gallery.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py index d03e4e005c66..74544ae66595 100644 --- a/doc/sphinxext/gen_gallery.py +++ b/doc/sphinxext/gen_gallery.py @@ -1,4 +1,4 @@ -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- import codecs import os import re @@ -14,7 +14,7 @@ multiimage = re.compile('(.*?)(_\d\d){1,2}') # generate a thumbnail gallery of examples -gallery_template = """\ +gallery_template = u"""\ {{% extends "layout.html" %}} {{% set title = "Thumbnail gallery" %}} @@ -35,7 +35,7 @@ {{% endblock %}} """ -header_template = """\ +header_template = u"""\

{title} @@ -48,7 +48,7 @@ """ -toc_template = """\ +toc_template = u"""\
  • {title}
  • """ @@ -133,10 +133,10 @@ def gen_gallery(app, doctree): warnings.warn("No thumbnails were found in %s" % subdir) # Close out the
    opened up at the top of this loop - rows.append("
    ") + rows.append(u"

    ") - content = gallery_template.format(toc='\n'.join(toc_rows), - gallery='\n'.join(rows)) + content = gallery_template.format(toc=u'\n'.join(toc_rows), + gallery=u'\n'.join(rows)) # Only write out the file if the contents have actually changed. # Otherwise, this triggers a full rebuild of the docs