[Python-checkins] r62766 - in doctools/trunk: CHANGES doc/config.rst sphinx/builder.py sphinx/config.py sphinx/quickstart.py
georg.brandl
python-checkins at python.org
Tue May 6 16:25:30 CEST 2008
Author: georg.brandl
Date: Tue May 6 16:25:29 2008
New Revision: 62766
Log:
Add html_file_suffix value.
Modified:
doctools/trunk/CHANGES
doctools/trunk/doc/config.rst
doctools/trunk/sphinx/builder.py
doctools/trunk/sphinx/config.py
doctools/trunk/sphinx/quickstart.py
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Tue May 6 16:25:29 2008
@@ -1,3 +1,13 @@
+Changes in trunk
+================
+
+New features added
+------------------
+
+* A new config value, `html_file_suffix`, can be used to set the HTML file
+ suffix to e.g. ``.xhtml``.
+
+
Release 0.3 (May 6, 2008)
=========================
Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst (original)
+++ doctools/trunk/doc/config.rst Tue May 6 16:25:29 2008
@@ -262,6 +262,13 @@
served (without trailing slash), e.g. ``"http://docs.python.org"``. The
default is ``''``.
+.. confval:: html_file_suffix
+
+ If nonempty, this is the file name suffix for generated HTML files. The
+ default is ``".html"``.
+
+ .. versionadded:: 0.4
+
.. confval:: html_translator_class
A string with the fully-qualified name of a HTML Translator class, that is, a
Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py (original)
+++ doctools/trunk/sphinx/builder.py Tue May 6 16:25:29 2008
@@ -275,6 +275,8 @@
"""Load templates."""
self.init_templates()
self.init_translator_class()
+ if self.config.html_out_suffix:
+ self.out_suffix = self.config.html_file_suffix
def init_translator_class(self):
if self.config.html_translator_class:
@@ -556,7 +558,7 @@
# --------- these are overwritten by the Pickle builder
def get_target_uri(self, docname, typ=None):
- return docname + '.html'
+ return docname + self.out_suffix
def handle_page(self, pagename, addctx, templatename='page.html',
outfilename=None):
@@ -577,7 +579,7 @@
output = self.templates.render(templatename, ctx)
if not outfilename:
- outfilename = path.join(self.outdir, os_path(pagename) + '.html')
+ outfilename = path.join(self.outdir, os_path(pagename) + self.out_suffix)
ensuredir(path.dirname(outfilename)) # normally different from self.outdir
try:
f = codecs.open(outfilename, 'w', 'utf-8')
@@ -629,7 +631,7 @@
if sidebarfile:
ctx['customsidebar'] = sidebarfile
if not outfilename:
- outfilename = path.join(self.outdir, os_path(pagename) + '.fpickle')
+ outfilename = path.join(self.outdir, os_path(pagename) + self.out_suffix)
ensuredir(path.dirname(outfilename))
f = open(outfilename, 'wb')
try:
@@ -686,6 +688,11 @@
# don't copy the reST source
copysource = False
+ def init(self):
+ StandaloneHTMLBuilder.init(self)
+ # the output files for HTML help must be .html only
+ self.out_suffix = '.html'
+
def handle_finish(self):
build_hhx(self, self.outdir, self.config.htmlhelp_basename)
Modified: doctools/trunk/sphinx/config.py
==============================================================================
--- doctools/trunk/sphinx/config.py (original)
+++ doctools/trunk/sphinx/config.py Tue May 6 16:25:29 2008
@@ -58,8 +58,9 @@
html_use_modindex = (True, False),
html_copy_source = (True, False),
html_use_opensearch = ('', False),
+ html_file_suffix = (None, False),
- # HTML help options
+ # HTML help only options
htmlhelp_basename = ('pydoc', False),
# LaTeX options
Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py (original)
+++ doctools/trunk/sphinx/quickstart.py Tue May 6 16:25:29 2008
@@ -139,6 +139,9 @@
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
# Output file base name for HTML help builder.
htmlhelp_basename = '%(project)sdoc'
More information about the Python-checkins
mailing list