summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-06-16 19:56:53 +0200
committerGeorg Brandl <georg@python.org>2009-06-16 19:56:53 +0200
commit71d862289c1bfc29fa75e18d82cb10ec89fc92bb (patch)
treefb0ba8e074b7b85330552661d27a5174bf18e0e3 /doc
parent5fe00b16a887c8c555e3991bfed9425ab1c684e2 (diff)
parente145da7f37734a0ead0aaa6e1f6700eb2a48b264 (diff)
downloadsphinx-71d862289c1bfc29fa75e18d82cb10ec89fc92bb.tar.gz
merge with 0.6
Diffstat (limited to 'doc')
-rw-r--r--doc/concepts.rst12
-rw-r--r--doc/conf.py7
-rw-r--r--doc/config.rst15
-rw-r--r--doc/ext/autosummary.rst218
-rw-r--r--doc/ext/doctest.rst6
-rw-r--r--doc/ext/extlinks.rst47
-rw-r--r--doc/extensions.rst1
-rw-r--r--doc/markup/code.rst6
-rw-r--r--doc/theming.rst1
9 files changed, 307 insertions, 6 deletions
diff --git a/doc/concepts.rst b/doc/concepts.rst
index e6d5fa02..27767211 100644
--- a/doc/concepts.rst
+++ b/doc/concepts.rst
@@ -89,6 +89,15 @@ tables of contents. The ``toctree`` directive is the central element.
Numbering then starts at the heading of ``foo``. Sub-toctrees are
automatically numbered (don't give the ``numbered`` flag to those).
+ If you want only the titles of documents in the tree to show up, not other
+ headings of the same level, you can use the ``titlesonly`` option::
+
+ .. toctree::
+ :titlesonly:
+
+ foo
+ bar
+
You can use "globbing" in toctree directives, by giving the ``glob`` flag
option. All entries are then matched against the list of available
documents, and matches are inserted into the list alphabetically. Example::
@@ -139,6 +148,9 @@ tables of contents. The ``toctree`` directive is the central element.
Added "numbered" and "hidden" options as well as external links and
support for "self" references.
+ .. versionchanged:: 1.0
+ Added "titlesonly" option.
+
Special names
-------------
diff --git a/doc/conf.py b/doc/conf.py
index e1a48aa2..e3952a0b 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -6,7 +6,10 @@ import sys, os, re
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.addons.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo']
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
+ 'sphinx.ext.autosummary']
+
+extlinks = {'issue': ('http://bugs.python.org/issue', 'issue ')}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -71,7 +74,7 @@ latex_logo = '_static/sphinx.png'
# Additional stuff for the LaTeX preamble.
latex_elements = {
- 'fontpkg': '\\usepackage{palatino}'
+ 'fontpkg': '\\usepackage{palatino}',
}
# Put TODOs into the output.
diff --git a/doc/config.rst b/doc/config.rst
index 2e96a749..17e6b452 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -245,6 +245,7 @@ Project information
* ``ru`` -- Russian
* ``sl`` -- Slovenian
* ``uk_UA`` -- Ukrainian
+ * ``zh_CN`` -- Simplified Chinese
* ``zh_TW`` -- Traditional Chinese
.. confval:: today
@@ -514,6 +515,12 @@ that use Sphinx' HTMLWriter class.
to translate document trees to HTML. Default is ``None`` (use the builtin
translator).
+.. confval:: html_show_copyright
+
+ If true, "(C) Copyright ..." is shown in the HTML footer. Default is ``True``.
+
+ .. versionadded:: 1.0
+
.. confval:: html_show_sphinx
If true, "Created using Sphinx" is shown in the HTML footer. Default is
@@ -653,6 +660,14 @@ These options influence LaTeX output.
``'shorthandoff'``
``'printmodindex'``
+.. confval:: latex_docclass
+
+ A dictionary mapping ``'howto'`` and ``'manual'`` to names of real document
+ classes that will be used as the base for the two Sphinx classes. Default
+ is to use ``'article'`` for ``'howto'`` and ``'report'`` for ``'manual'``.
+
+ .. versionadded:: 1.0
+
.. confval:: latex_additional_files
A list of file names, relative to the configuration directory, to copy to the
diff --git a/doc/ext/autosummary.rst b/doc/ext/autosummary.rst
index a9255857..e9130b33 100644
--- a/doc/ext/autosummary.rst
+++ b/doc/ext/autosummary.rst
@@ -6,4 +6,220 @@
.. module:: sphinx.ext.autosummary
:synopsis: Generate autodoc summaries
-TBW.
+.. versionadded:: 0.6
+
+This extension generates function/method/attribute summary lists, similar to
+those output e.g. by Epydoc and other API doc generation tools. This is
+especially useful when your docstrings are long and detailed, and putting each
+one of them on a separate page makes them easier to read.
+
+The :mod:`sphinx.ext.autosummary` extension does this in two parts:
+
+1. There is an :dir:`autosummary` directive for generating summary listings that
+ contain links to the documented items, and short summary blurbs extracted
+ from their docstrings.
+
+2. The convenience script :program:`sphinx-autogen` or the new
+ :confval:`autosummary_generate` config value can be used to generate short
+ "stub" files for the entries listed in the :dir:`autosummary` directives.
+ These by default contain only the corresponding :mod:`sphinx.ext.autodoc`
+ directive.
+
+
+.. directive:: autosummary
+
+ Insert a table that contains links to documented items, and a short summary
+ blurb (the first sentence of the docstring) for each of them. The
+ :dir:`autosummary` directive can also optionally serve as a :dir:`toctree`
+ entry for the included items.
+
+ For example, ::
+
+ .. currentmodule:: sphinx
+
+ .. autosummary::
+
+ environment.BuildEnvironment
+ util.relative_uri
+
+ produces a table like this:
+
+ .. currentmodule:: sphinx
+
+ .. autosummary::
+
+ environment.BuildEnvironment
+ util.relative_uri
+
+ .. currentmodule:: sphinx.ext.autosummary
+
+ Autosummary preprocesses the docstrings and signatures with the same
+ :event:`autodoc-process-docstring` and :event:`autodoc-process-signature`
+ hooks as :mod:`~sphinx.ext.autodoc`.
+
+
+ **Options**
+
+ * If you want the :dir:`autosummary` table to also serve as a :dir:`toctree`
+ entry, use the ``toctree`` option, for example::
+
+ .. autosummary::
+ :toctree: DIRNAME
+
+ sphinx.environment.BuildEnvironment
+ sphinx.util.relative_uri
+
+ The ``toctree`` option also signals to the :program:`sphinx-autogen` script
+ that stub pages should be generated for the entries listed in this
+ directive. The option accepts a directory name as an argument;
+ :program:`sphinx-autogen` will by default place its output in this
+ directory. If no argument is given, output is placed in the same directory
+ as the file that contains the directive.
+
+ * If you don't want the :dir:`autosummary` to show function signatures in the
+ listing, include the ``nosignatures`` option::
+
+ .. autosummary::
+ :nosignatures:
+
+ sphinx.environment.BuildEnvironment
+ sphinx.util.relative_uri
+
+ * You can specify a custom template with the ``template`` option.
+ For example, ::
+
+ .. autosummary::
+ :template: mytemplate.rst
+
+ sphinx.environment.BuildEnvironment
+
+ would use the template :file:`mytemplate.rst` in your
+ :confval:`templates_path` to generate the pages for all entries
+ listed. See `Customizing templates`_ below.
+
+
+:program:`sphinx-autogen` -- generate autodoc stub pages
+--------------------------------------------------------
+
+The :program:`sphinx-autogen` script can be used to conveniently generate stub
+documentation pages for items included in :dir:`autosummary` listings.
+
+For example, the command ::
+
+ $ sphinx-autogen -o generated *.rst
+
+will read all :dir:`autosummary` tables in the :file:`*.rst` files that have the
+``:toctree:`` option set, and output corresponding stub pages in directory
+``generated`` for all documented items. The generated pages by default contain
+text of the form::
+
+ sphinx.util.relative_uri
+ ========================
+
+ .. autofunction:: sphinx.util.relative_uri
+
+If the ``-o`` option is not given, the script will place the output files in the
+directories specified in the ``:toctree:`` options.
+
+
+Generating stub pages automatically
+-----------------------------------
+
+If you do not want to create stub pages with :program:`sphinx-autogen`, you can
+also use this new config value:
+
+.. confval:: autosummary_generate
+
+ Boolean indicating whether to scan all found documents for autosummary
+ directives, and to generate stub pages for each.
+
+ Can also be a list of documents for which stub pages should be generated.
+
+ The new files will be placed in the directories specified in the
+ ``:toctree:`` options of the directives.
+
+
+Customizing templates
+---------------------
+
+You can customize the stub page templates, in a similar way as the HTML Jinja
+templates, see :ref:`templating`. (:class:`~sphinx.application.TemplateBridge`
+is not supported.)
+
+.. note::
+
+ If you find yourself spending much time tailoring the stub templates, this
+ may indicate that it's a better idea to write custom narrative documentation
+ instead.
+
+Autosummary uses the following template files:
+
+- :file:`autosummary/base.rst` -- fallback template
+- :file:`autosummary/module.rst` -- template for modules
+- :file:`autosummary/class.rst` -- template for classes
+- :file:`autosummary/function.rst` -- template for functions
+- :file:`autosummary/attribute.rst` -- template for class attributes
+- :file:`autosummary/method.rst` -- template for class methods
+
+The following variables available in the templates:
+
+.. data:: name
+
+ Name of the documented object, excluding the module and class parts.
+
+.. data:: objname
+
+ Name of the documented object, excluding the module parts.
+
+.. data:: fullname
+
+ Full name of the documented object, including module and class parts.
+
+.. data:: module
+
+ Name of the module the documented object belongs to.
+
+.. data:: class
+
+ Name of the class the documented object belongs to. Only available for
+ methods and attributes.
+
+.. data:: underline
+
+ A string containing ``len(full_name) * '='``.
+
+.. data:: members
+
+ List containing names of all members of the module or class. Only available
+ for modules and classes.
+
+.. data:: functions
+
+ List containing names of "public" functions in the module. Here, "public"
+ here means that the name does not start with an underscore. Only available
+ for modules.
+
+.. data:: classes
+
+ List containing names of "public" classes in the module. Only available for
+ modules.
+
+.. data:: exceptions
+
+ List containing names of "public" exceptions in the module. Only available
+ for modules.
+
+.. data:: methods
+
+ List containing names of "public" methods in the class. Only available for
+ classes.
+
+.. data:: methods
+
+ List containing names of "public" attributes in the class. Only available
+ for classes.
+
+.. note::
+
+ You can use the :dir:`autosummary` directive in the stub pages. However,
+ stub pages are not generated automatically recursively.
diff --git a/doc/ext/doctest.rst b/doc/ext/doctest.rst
index 19905dc7..6bd5efb6 100644
--- a/doc/ext/doctest.rst
+++ b/doc/ext/doctest.rst
@@ -173,9 +173,9 @@ There are also these config values for customizing the doctest extension:
Some more documentation text.
- (Note that no special ``::`` is needed to introduce the block; docutils
- recognizes it from the leading ``>>>``. Also, no additional indentation is
- necessary, though it doesn't hurt.)
+ (Note that no special ``::`` is used to introduce a doctest block; docutils
+ recognizes them from the leading ``>>>``. Also, no additional indentation is
+ used, though it doesn't hurt.)
If this value is left at its default value, the above snippet is interpreted
by the doctest builder exactly like the following::
diff --git a/doc/ext/extlinks.rst b/doc/ext/extlinks.rst
new file mode 100644
index 00000000..fb101ff3
--- /dev/null
+++ b/doc/ext/extlinks.rst
@@ -0,0 +1,47 @@
+:mod:`sphinx.ext.extlinks` -- Markup to shorten external links
+==============================================================
+
+.. module:: sphinx.ext.extlinks
+ :synopsis: Allow inserting external links with common base URLs easily.
+.. moduleauthor:: Georg Brandl
+
+.. versionadded:: 1.0
+
+
+This extension is meant to help with the common pattern of having many external
+links that point to URLs on one and the same site, e.g. links to bug trackers,
+version control web interfaces, or simply subpages in other websites. It does
+so by providing aliases to base URLs, so that you only need to give the subpage
+name when creating a link.
+
+Let's assume that you want to include many links to issues at the Sphinx
+tracker, at :samp:`http://bitbucket.org/birkenfeld/sphinx/issue/{num}`. Typing
+this URL again and again is tedious, so you can use :mod:`~sphinx.ext.extlinks`
+to avoid repeating yourself.
+
+The extension adds one new config value:
+
+.. confval:: extlinks
+
+ This config value must be a dictionary of external sites, mapping unique
+ short alias names to a base URL and a *prefix*. For example, to create an
+ alias for the above mentioned issues, you would add ::
+
+ extlinks = {'issue': ('http://bitbucket.org/birkenfeld/sphinx/issue/',
+ 'issue ')}
+
+ Now, you can use the alias name as a new role, e.g. ``:issue:`123```. This
+ then inserts a link to http://bitbucket.org/birkenfeld/sphinx/issue/123.
+
+ The link *caption* depends on the second item in the tuple, the *prefix*:
+
+ - If the prefix is ``None``, the link caption is the full URL.
+ - If the prefix is the empty string, the link caption is the partial URL
+ given in the role content (``123`` in this case.)
+ - If the prefix is a non-empty string, the link caption is the partial URL,
+ prepended by the prefix -- in the above example, the link caption would be
+ ``issue 123``.
+
+ You can also use the usual "explicit title" syntax supported by other roles
+ that generate links, i.e. ``:issue:`this issue <123>```. In this case, the
+ *prefix* is not relevant.
diff --git a/doc/extensions.rst b/doc/extensions.rst
index 5eb26c14..0bc9b5b7 100644
--- a/doc/extensions.rst
+++ b/doc/extensions.rst
@@ -51,6 +51,7 @@ These extensions are built in and can be activated by respective entries in the
ext/ifconfig
ext/coverage
ext/todo
+ ext/extlinks
Third-party extensions
diff --git a/doc/markup/code.rst b/doc/markup/code.rst
index 93cd127b..8c223297 100644
--- a/doc/markup/code.rst
+++ b/doc/markup/code.rst
@@ -143,11 +143,17 @@ Includes
string option, only lines that precede the first lines containing that string
are included.
+ You can prepend and/or append a line to the included code, using the
+ ``prepend`` and ``append`` option, respectively. This is useful e.g. for
+ highlighting PHP code that doesn't include the ``<?php``/``?>`` markers.
+
.. versionadded:: 0.4.3
The ``encoding`` option.
.. versionadded:: 0.6
The ``pyobject``, ``lines``, ``start-after`` and ``end-before`` options,
as well as support for absolute filenames.
+ .. versionadded:: 1.0
+ The ``prepend`` and ``append`` options.
.. rubric:: Footnotes
diff --git a/doc/theming.rst b/doc/theming.rst
index d1d3b27a..5b4b648c 100644
--- a/doc/theming.rst
+++ b/doc/theming.rst
@@ -86,6 +86,7 @@ Sphinx comes with a selection of themes to choose from:
- **bgcolor** (CSS color): Body background color.
- **textcolor** (CSS color): Body text color.
- **linkcolor** (CSS color): Body link color.
+ - **visitedlinkcolor** (CSS color): Body color for visited links.
- **headbgcolor** (CSS color): Background color for headings.
- **headtextcolor** (CSS color): Text color for headings.
- **headlinkcolor** (CSS color): Link color for headings.