Merge pull request #4518 from tk0miya/register_author_as_confval

Add new confval "author" and use it for lazy evaluation
This commit is contained in:
Takeshi KOMIYA 2018-01-31 09:26:23 +09:00 committed by GitHub
commit 5b7432b1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 6 deletions

View File

@ -12,6 +12,9 @@ Incompatible changes
:ref:`ext-metadata`. :ref:`ext-metadata`.
* Sphinx expects source parser modules to have supported file formats as * Sphinx expects source parser modules to have supported file formats as
``Parser.supported`` attribute ``Parser.supported`` attribute
* The default value of :confval:`epub_author` and :confval:`epub_publisher` are
changed from ``'unknown'`` to the value of :confval:`author`. This is same as
a ``conf.py`` file sphinx-build generates.
Deprecated Deprecated
---------- ----------
@ -26,6 +29,7 @@ Features added
* Add ``sphinx.config.Any`` to represent the config value accepts any type of * Add ``sphinx.config.Any`` to represent the config value accepts any type of
value value
* :confval:`source_suffix` allows a mapping fileext to file types * :confval:`source_suffix` allows a mapping fileext to file types
* Add :confval:`author` as a configuration value
Bugs fixed Bugs fixed
---------- ----------

View File

@ -475,6 +475,10 @@ Project information
The documented project's name. The documented project's name.
.. confval:: author
The author name(s) of the document. The default value is ``'unknown'``.
.. confval:: copyright .. confval:: copyright
A copyright statement in the style ``'2008, Author Name'``. A copyright statement in the style ``'2008, Author Name'``.
@ -1434,8 +1438,8 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
.. confval:: epub_author .. confval:: epub_author
The author of the document. This is put in the Dublin Core metadata. The The author of the document. This is put in the Dublin Core metadata. It
default value is ``'unknown'``. defaults to the :confval:`author` option.
.. confval:: epub_contributor .. confval:: epub_contributor
@ -1456,8 +1460,8 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
.. confval:: epub_publisher .. confval:: epub_publisher
The publisher of the document. This is put in the Dublin Core metadata. You The publisher of the document. This is put in the Dublin Core metadata. You
may use any sensible string, e.g. the project homepage. The default value is may use any sensible string, e.g. the project homepage. The defaults to the
``'unknown'``. :confval:`author` option.
.. confval:: epub_copyright .. confval:: epub_copyright

View File

@ -231,9 +231,9 @@ def setup(app):
app.add_config_value('epub_theme', 'epub', 'html') app.add_config_value('epub_theme', 'epub', 'html')
app.add_config_value('epub_theme_options', {}, 'html') app.add_config_value('epub_theme_options', {}, 'html')
app.add_config_value('epub_title', lambda self: self.html_title, 'html') app.add_config_value('epub_title', lambda self: self.html_title, 'html')
app.add_config_value('epub_author', 'unknown', 'html') app.add_config_value('epub_author', lambda self: self.author, 'html')
app.add_config_value('epub_language', lambda self: self.language or 'en', 'html') app.add_config_value('epub_language', lambda self: self.language or 'en', 'html')
app.add_config_value('epub_publisher', 'unknown', 'html') app.add_config_value('epub_publisher', lambda self: self.author, 'html')
app.add_config_value('epub_copyright', lambda self: self.copyright, 'html') app.add_config_value('epub_copyright', lambda self: self.copyright, 'html')
app.add_config_value('epub_identifier', 'unknown', 'html') app.add_config_value('epub_identifier', 'unknown', 'html')
app.add_config_value('epub_scheme', 'unknown', 'html') app.add_config_value('epub_scheme', 'unknown', 'html')

View File

@ -103,6 +103,7 @@ class Config(object):
config_values = dict( config_values = dict(
# general options # general options
project = ('Python', 'env'), project = ('Python', 'env'),
author = ('unknown', 'env'),
copyright = ('', 'html'), copyright = ('', 'html'),
version = ('', 'env'), version = ('', 'env'),
release = ('', 'env'), release = ('', 'env'),