Commits

Anonymous committed e15ef58

Add html_file_suffix value.

  • Participants
  • Parent commits 1aebc14

Comments (0)

Files changed (5)

+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)
 =========================
 
    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

sphinx/builder.py

         """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:
     # --------- 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):
 
         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')
         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:
     # 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)
 
         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

sphinx/quickstart.py

 # 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'