[Python-checkins] r63556 - in doctools/trunk: CHANGES sphinx/quickstart.py sphinx/util/__init__.py

georg.brandl python-checkins at python.org
Fri May 23 15:47:34 CEST 2008


Author: georg.brandl
Date: Fri May 23 15:47:34 2008
New Revision: 63556

Log:
Handle project names with spaces.


Modified:
   doctools/trunk/CHANGES
   doctools/trunk/sphinx/quickstart.py
   doctools/trunk/sphinx/util/__init__.py

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Fri May 23 15:47:34 2008
@@ -20,6 +20,8 @@
 
 * Fix determination of the title in HTML help output.
 
+* Handle project names containing spaces.
+
 
 Release 0.3 (May 6, 2008)
 =========================

Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py	(original)
+++ doctools/trunk/sphinx/quickstart.py	Fri May 23 15:47:34 2008
@@ -12,6 +12,7 @@
 import sys, os, time
 from os import path
 
+from sphinx.util import make_filename
 from sphinx.util.console import purple, bold, red, nocolor
 
 
@@ -143,7 +144,7 @@
 #html_file_suffix = ''
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = '%(project)sdoc'
+htmlhelp_basename = '%(project_fn)sdoc'
 
 
 # Options for LaTeX output
@@ -158,7 +159,7 @@
 # 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)s.tex', '%(project)s Documentation', '%(author)s', 'manual'),
+  ('%(master)s', '%(project_fn)s.tex', '%(project)s Documentation', '%(author)s', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
@@ -380,6 +381,7 @@
     do_prompt(d, 'makefile', 'Create Makefile? (y/n)',
               os.name == 'posix' and 'y' or 'n', boolean)
 
+    d['project_fn'] = make_filename(d['project'])
     d['year'] = time.strftime('%Y')
     d['now'] = time.asctime()
     d['underline'] = len(d['project']) * '='

Modified: doctools/trunk/sphinx/util/__init__.py
==============================================================================
--- doctools/trunk/sphinx/util/__init__.py	(original)
+++ doctools/trunk/sphinx/util/__init__.py	Fri May 23 15:47:34 2008
@@ -249,3 +249,9 @@
         _pat_cache[pat] = re.compile(_translate_pattern(pat))
     match = _pat_cache[pat].match
     return filter(match, names)
+
+
+no_fn_re = r'[:/\\?*%|"\'<>. \t]'
+
+def make_filename(string):
+    return no_fn_re.sub('', string)


More information about the Python-checkins mailing list