[Python-checkins] r64290 - in doctools/trunk: CHANGES doc/config.rst sphinx/builder.py sphinx/config.py sphinx/directives/desc.py sphinx/quickstart.py sphinx/templates/layout.html

georg.brandl python-checkins at python.org
Sun Jun 15 10:48:06 CEST 2008


Author: georg.brandl
Date: Sun Jun 15 10:48:06 2008
New Revision: 64290

Log:
Add html_favicon config value.


Modified:
   doctools/trunk/CHANGES
   doctools/trunk/doc/config.rst
   doctools/trunk/sphinx/builder.py
   doctools/trunk/sphinx/config.py
   doctools/trunk/sphinx/directives/desc.py
   doctools/trunk/sphinx/quickstart.py
   doctools/trunk/sphinx/templates/layout.html

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Sun Jun 15 10:48:06 2008
@@ -4,42 +4,53 @@
 New features added
 ------------------
 
-* A new config value, `html_file_suffix`, can be used to set the HTML file
-  suffix to e.g. ``.xhtml``.
+* ``tocdepth`` can be given as a file-wide metadata entry, and
+  specifies the maximum depth of a TOC of this file.
 
-* The `autodoc` extension accepts signatures for functions, methods and
-  classes now that override the signature got via introspection from
-  Python code.
+* HTML output:
 
-* The new config value `html_use_index` can be used to switch index
-  generation in HTML documents off.
+  - The "previous" and "next" links have a more logical structure, so
+    that by following "next" links you can traverse the entire TOC
+    tree.
 
-* The new `exclude_trees` config option can be used to exclude whole
-  subtrees from the search for source files.
+  - The new event `html-page-context` can be used to include custom
+    values into the context used when rendering an HTML template.
 
-* The directories in the `html_static_path` can now contain subdirectories.
+  - Document metadata is now in the default template context, under
+    the name `metadata`.
 
-* The new config value `html_short_title` can be used to set a shorter
-  title for the documentation which is then used in the navigation bar.
+  - The new config value `html_favicon` can be used to set a favicon
+    for the HTML output.  Thanks to Sebastian Wiesner.
 
-* The new config value `html_show_sphinx` can be used to control whether
-  a link to Sphinx is added to the HTML footer.
+  - The new config value `html_use_index` can be used to switch index
+    generation in HTML documents off.
 
-* Defaults for configuration values can now be callables, which allows
-  dynamic defaults.
+  - The new config value `html_short_title` can be used to set a
+    shorter title for the documentation which is then used in the
+    navigation bar.
+
+  - The new config value `html_show_sphinx` can be used to control
+    whether a link to Sphinx is added to the HTML footer.
 
-* The new ``html-page-context`` event can be used to include custom values
-  into the context used when rendering an HTML template.
+  - The new config value `html_file_suffix` can be used to set the
+    HTML file suffix to e.g. ``.xhtml``.
 
-* Add document metadata to the values in the default template context.
+  - The directories in the `html_static_path` can now contain
+    subdirectories.
 
-* Let the "previous" and "next" to more logical documents, so that by
-  following "next" links you can traverse the entire TOC tree.
+* The new config value `exclude_trees` can be used to exclude whole
+  subtrees from the search for source files.
+
+* Defaults for configuration values can now be callables, which allows
+  dynamic defaults.
 
-* Added TextBuilder to create plain-text output.
+* The new TextBuilder creates plain-text output.
 
-* ``tocdepth`` can be given as a file-wide metadata entry, and specifies
-  the maximum depth of a TOC of this file.
+* Extensions:
+    
+  - The `autodoc` extension accepts signatures for functions, methods
+    and classes now that override the signature got via introspection
+    from Python code.
 
 Bugs fixed
 ----------

Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst	(original)
+++ doctools/trunk/doc/config.rst	Sun Jun 15 10:48:06 2008
@@ -202,6 +202,15 @@
    below) that is the logo of the docs.  It is placed at the top of the sidebar;
    its width should therefore not exceed 200 pixels.  Default: ``None``.
 
+.. confval:: html_favicon
+
+   If given, this must be the name of an image file (within the static path, see
+   below) that is the favicon of the docs.  Modern browsers use this as icon for
+   tabs, windows and bookmarks.  It should be a Windows-style icon file
+   (``.ico``), which is 16x16 or 32x32 pixels large.  Default: ``None``.
+
+   .. versionadded:: 0.4
+
 .. confval:: html_static_path
 
    A list of paths that contain custom static files (such as style sheets or

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Sun Jun 15 10:48:06 2008
@@ -321,6 +321,11 @@
         logo = self.config.html_logo and \
                path.basename(self.config.html_logo) or ''
 
+        favicon = self.config.html_favicon and \
+                  path.basename(self.config.html_favicon) or ''
+        if os.path.splitext(favicon)[1] != '.ico':
+            self.warn('html_favicon is not an .ico file')
+
         if not isinstance(self.config.html_use_opensearch, basestring):
             self.warn('html_use_opensearch config value must now be a string')
 
@@ -342,6 +347,7 @@
             builder = self.name,
             parents = [],
             logo = logo,
+            favicon = favicon,
             len = len, # the built-in
         )
 

Modified: doctools/trunk/sphinx/config.py
==============================================================================
--- doctools/trunk/sphinx/config.py	(original)
+++ doctools/trunk/sphinx/config.py	Sun Jun 15 10:48:06 2008
@@ -50,6 +50,7 @@
         html_short_title = (lambda self: self.html_title, False),
         html_style = ('default.css', False),
         html_logo = (None, False),
+        html_favicon = (None, False),
         html_static_path = ([], False),
         html_last_updated_fmt = ('%b %d, %Y', False),
         html_use_smartypants = (True, False),

Modified: doctools/trunk/sphinx/directives/desc.py
==============================================================================
--- doctools/trunk/sphinx/directives/desc.py	(original)
+++ doctools/trunk/sphinx/directives/desc.py	Sun Jun 15 10:48:06 2008
@@ -445,3 +445,6 @@
 
 target_directive.content = 0
 target_directive.arguments = (1, 0, 1)
+
+# note, the target directive is not registered here, it is used by the application
+# when registering additional xref types

Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py	(original)
+++ doctools/trunk/sphinx/quickstart.py	Sun Jun 15 10:48:06 2008
@@ -112,6 +112,11 @@
 # the sidebar.
 #html_logo = None
 
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".

Modified: doctools/trunk/sphinx/templates/layout.html
==============================================================================
--- doctools/trunk/sphinx/templates/layout.html	(original)
+++ doctools/trunk/sphinx/templates/layout.html	Sun Jun 15 10:48:06 2008
@@ -119,12 +119,15 @@
     <script type="text/javascript" src="{{ pathto('_static/jquery.js', 1) }}"></script>
     <script type="text/javascript" src="{{ pathto('_static/interface.js', 1) }}"></script>
     <script type="text/javascript" src="{{ pathto('_static/doctools.js', 1) }}"></script>
-    {%- endif %}
-    {%- if use_opensearch and builder != 'htmlhelp' %}
+    {%- if use_opensearch %}
     <link rel="search" type="application/opensearchdescription+xml"
           title="Search within {{ docstitle }}"
           href="{{ pathto('_static/opensearch.xml', 1) }}"/>
     {%- endif %}
+    {%- if favicon %}
+    <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
+    {%- endif %}
+    {%- endif %}
 {%- block rellinks %}
     {%- if hasdoc('about') %}
     <link rel="author" title="About these documents" href="{{ pathto('about') }}" />


More information about the Python-checkins mailing list