[Python-checkins] r66923 - in doctools/trunk: sphinx/quickstart.py tests/test_quickstart.py

georg.brandl python-checkins at python.org
Thu Oct 16 21:43:15 CEST 2008


Author: georg.brandl
Date: Thu Oct 16 21:43:15 2008
New Revision: 66923
Log:
Properly escape authors and titles put into quickstart latex_documents setting.
Modified:
 doctools/trunk/sphinx/quickstart.py
 doctools/trunk/tests/test_quickstart.py
Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py	(original)
+++ doctools/trunk/sphinx/quickstart.py	Thu Oct 16 21:43:15 2008
@@ -16,6 +16,7 @@
 
 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 @@
 # 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 @@
 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'])
Modified: doctools/trunk/tests/test_quickstart.py
==============================================================================
--- doctools/trunk/tests/test_quickstart.py	(original)
+++ doctools/trunk/tests/test_quickstart.py	Thu Oct 16 21:43:15 2008
@@ -110,7 +110,7 @@
 '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 @@
 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()


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /