Properly escape authors and titles put into quickstart latex_documents setting.

This commit is contained in:
Georg Brandl
2008-10-16 19:43:15 +00:00
parent efd474b296
commit 688ef9dc1f
2 changed files with 10 additions and 5 deletions
+6 -2
View File
@@ -16,6 +16,7 @@ TERM_ENCODING = getattr(sys.stdin, 'encoding', None)
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 = '> '
@@ -188,8 +189,8 @@ htmlhelp_basename = '%(project_fn)sdoc'
# 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
@@ -461,7 +462,10 @@ directly.'''
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'])
+4 -3
View File
@@ -110,7 +110,7 @@ def test_quickstart_all_answers(tempdir):
'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',
@@ -133,13 +133,14 @@ def test_quickstart_all_answers(tempdir):
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()