Handle project names with spaces.

This commit is contained in:
Georg Brandl 2008-05-23 13:47:34 +00:00
parent a72511e770
commit 85ab5bf4a4
3 changed files with 12 additions and 2 deletions

View File

@ -20,6 +20,8 @@ Bugs fixed
* Fix determination of the title in HTML help output.
* Handle project names containing spaces.
Release 0.3 (May 6, 2008)
=========================

View File

@ -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_last_updated_fmt = '%%b %%d, %%Y'
#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 @@ htmlhelp_basename = '%(project)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)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 @@ directly.'''
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']) * '='

View File

@ -249,3 +249,9 @@ def patfilter(names, pat):
_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)