Commits

Anonymous committed cecbd3a

Properly escape authors and titles put into quickstart latex_documents setting.

  • Participants
  • Parent commits 0e14878

Comments (0)

Files changed (2)

File sphinx/quickstart.py

 
 from sphinx.util import make_filename
 from sphinx.util.console import purple, bold, red, turquoise, nocolor
+from sphinx.util.texescape import tex_escape_map
 
 
 PROMPT_PREFIX = '> '
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, document class [howto/manual]).
 latex_documents = [
-  ('%(master)s', '%(project_fn)s.tex', u'%(project_doc)s',
-   u'%(author)s', 'manual'),
+  ('%(master)s', '%(project_fn)s.tex', ur'%(project_doc_texescaped)s',
+   ur'%(author_texescaped)s', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
         repr('sphinx.ext.' + name) for name in ('autodoc', 'doctest', 'intersphinx')
         if d['ext_' + name].upper() in ('Y', 'YES'))
     d['copyright'] = time.strftime('%Y') + ', ' + d['author']
+    d['author_texescaped'] = unicode(d['author']).translate(tex_escape_map)
     d['project_doc'] = d['project'] + ' Documentation'
+    d['project_doc_texescaped'] = \
+        unicode(d['project'] + ' Documentation').translate(tex_escape_map)
 
     if not path.isdir(d['path']):
         mkdir_p(d['path'])

File tests/test_quickstart.py

         'Separate source and build': 'y',
         'Name prefix for templates': '_',
         'Project name': 'STASI\xe2\x84\xa2',
-        'Author name': 'Wolfgang Sch\xc3\xa4uble',
+        'Author name': 'Wolfgang Sch\xc3\xa4uble & G. Beckstein',
         'Project version': '2.0',
         'Project release': '2.0.1',
         'Source file suffix': '.txt',
     assert ns['source_suffix'] == '.txt'
     assert ns['master_doc'] == 'contents'
     assert ns['project'] == u'STASI™'
-    assert ns['copyright'] == u'%s, Wolfgang Schäuble' % time.strftime('%Y')
+    assert ns['copyright'] == u'%s, Wolfgang Schäuble & G. Beckstein' % \
+           time.strftime('%Y')
     assert ns['version'] == '2.0'
     assert ns['release'] == '2.0.1'
     assert ns['html_static_path'] == ['_static']
     assert ns['latex_documents'] == [
         ('contents', 'STASI.tex', u'STASI™ Documentation',
-         u'Wolfgang Schäuble', 'manual')]
+         ur'Wolfgang Schäuble \& G. Beckstein', 'manual')]
 
     assert (tempdir / 'build').isdir()
     assert (tempdir / 'source' / '_static').isdir()