From 23741ca693c71bf986f9728d0b4178d4a2e32212 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 29 Jan 2018 23:29:26 +0900 Subject: [PATCH 1/2] Add :confval:`author` as a configuration value --- CHANGES | 1 + doc/config.rst | 4 ++++ sphinx/config.py | 1 + 3 files changed, 6 insertions(+) diff --git a/CHANGES b/CHANGES index 88e2600cf..b8f167f5f 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Features added * Add :event:`config-inited` event * Add ``sphinx.config.Any`` to represent the config value accepts any type of value +* Add :confval:`author` as a configuration value Bugs fixed ---------- diff --git a/doc/config.rst b/doc/config.rst index 830fb69a0..9e92f083e 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -451,6 +451,10 @@ Project information The documented project's name. +.. confval:: author + + The author name(s) of the document. The default value is ``'unknown'``. + .. confval:: copyright A copyright statement in the style ``'2008, Author Name'``. diff --git a/sphinx/config.py b/sphinx/config.py index 29883b0cd..5d9a9258c 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -102,6 +102,7 @@ class Config(object): config_values = dict( # general options project = ('Python', 'env'), + author = ('unknown', 'env'), copyright = ('', 'html'), version = ('', 'env'), release = ('', 'env'), From 41769f1e30bc825b2b57f1ebcb6896c8ebda6531 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 29 Jan 2018 23:29:26 +0900 Subject: [PATCH 2/2] config: `epub_authr` and `epub_publisher` refers `author` by default --- CHANGES | 3 +++ doc/config.rst | 8 ++++---- sphinx/builders/epub3.py | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index b8f167f5f..cad3b9b0a 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,9 @@ Incompatible changes * #4460: extensions which stores any data to environment should return the version of its env data structure as metadata. In detail, please see :ref:`ext-metadata`. +* 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 ---------- diff --git a/doc/config.rst b/doc/config.rst index 9e92f083e..2e9ddf07c 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1414,8 +1414,8 @@ the `Dublin Core metadata `_. .. confval:: epub_author - The author of the document. This is put in the Dublin Core metadata. The - default value is ``'unknown'``. + The author of the document. This is put in the Dublin Core metadata. It + defaults to the :confval:`author` option. .. confval:: epub_contributor @@ -1436,8 +1436,8 @@ the `Dublin Core metadata `_. .. confval:: epub_publisher 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 - ``'unknown'``. + may use any sensible string, e.g. the project homepage. The defaults to the + :confval:`author` option. .. confval:: epub_copyright diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py index c98c4b853..2a1b743e0 100644 --- a/sphinx/builders/epub3.py +++ b/sphinx/builders/epub3.py @@ -231,9 +231,9 @@ def setup(app): app.add_config_value('epub_theme', 'epub', '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_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_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_identifier', 'unknown', 'html') app.add_config_value('epub_scheme', 'unknown', 'html')