mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add html_file_suffix value.
This commit is contained in:
parent
356d5f6ed7
commit
cc6b4ee1ec
10
CHANGES
10
CHANGES
@ -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)
|
Release 0.3 (May 6, 2008)
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
@ -262,6 +262,13 @@ that use Sphinx' HTMLWriter class.
|
|||||||
served (without trailing slash), e.g. ``"http://docs.python.org"``. The
|
served (without trailing slash), e.g. ``"http://docs.python.org"``. The
|
||||||
default is ``''``.
|
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
|
.. confval:: html_translator_class
|
||||||
|
|
||||||
A string with the fully-qualified name of a HTML Translator class, that is, a
|
A string with the fully-qualified name of a HTML Translator class, that is, a
|
||||||
|
@ -275,6 +275,8 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
"""Load templates."""
|
"""Load templates."""
|
||||||
self.init_templates()
|
self.init_templates()
|
||||||
self.init_translator_class()
|
self.init_translator_class()
|
||||||
|
if self.config.html_out_suffix:
|
||||||
|
self.out_suffix = self.config.html_file_suffix
|
||||||
|
|
||||||
def init_translator_class(self):
|
def init_translator_class(self):
|
||||||
if self.config.html_translator_class:
|
if self.config.html_translator_class:
|
||||||
@ -556,7 +558,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
# --------- these are overwritten by the Pickle builder
|
# --------- these are overwritten by the Pickle builder
|
||||||
|
|
||||||
def get_target_uri(self, docname, typ=None):
|
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',
|
def handle_page(self, pagename, addctx, templatename='page.html',
|
||||||
outfilename=None):
|
outfilename=None):
|
||||||
@ -577,7 +579,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
|
|
||||||
output = self.templates.render(templatename, ctx)
|
output = self.templates.render(templatename, ctx)
|
||||||
if not outfilename:
|
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
|
ensuredir(path.dirname(outfilename)) # normally different from self.outdir
|
||||||
try:
|
try:
|
||||||
f = codecs.open(outfilename, 'w', 'utf-8')
|
f = codecs.open(outfilename, 'w', 'utf-8')
|
||||||
@ -629,7 +631,7 @@ class PickleHTMLBuilder(StandaloneHTMLBuilder):
|
|||||||
if sidebarfile:
|
if sidebarfile:
|
||||||
ctx['customsidebar'] = sidebarfile
|
ctx['customsidebar'] = sidebarfile
|
||||||
if not outfilename:
|
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))
|
ensuredir(path.dirname(outfilename))
|
||||||
f = open(outfilename, 'wb')
|
f = open(outfilename, 'wb')
|
||||||
try:
|
try:
|
||||||
@ -686,6 +688,11 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder):
|
|||||||
# don't copy the reST source
|
# don't copy the reST source
|
||||||
copysource = False
|
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):
|
def handle_finish(self):
|
||||||
build_hhx(self, self.outdir, self.config.htmlhelp_basename)
|
build_hhx(self, self.outdir, self.config.htmlhelp_basename)
|
||||||
|
|
||||||
|
@ -58,8 +58,9 @@ class Config(object):
|
|||||||
html_use_modindex = (True, False),
|
html_use_modindex = (True, False),
|
||||||
html_copy_source = (True, False),
|
html_copy_source = (True, False),
|
||||||
html_use_opensearch = ('', False),
|
html_use_opensearch = ('', False),
|
||||||
|
html_file_suffix = (None, False),
|
||||||
|
|
||||||
# HTML help options
|
# HTML help only options
|
||||||
htmlhelp_basename = ('pydoc', False),
|
htmlhelp_basename = ('pydoc', False),
|
||||||
|
|
||||||
# LaTeX options
|
# LaTeX options
|
||||||
|
@ -139,6 +139,9 @@ html_last_updated_fmt = '%%b %%d, %%Y'
|
|||||||
# base URL from which the finished HTML is served.
|
# base URL from which the finished HTML is served.
|
||||||
#html_use_opensearch = ''
|
#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.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = '%(project)sdoc'
|
htmlhelp_basename = '%(project)sdoc'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user