mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2983: Rename `epub3_description
and
epub3_contributor
to
epub_description
and
epub_contributor
`.
This commit is contained in:
parent
9358ea239b
commit
ec934d476a
3
CHANGES
3
CHANGES
@ -4,6 +4,9 @@ Release 1.5 alpha2 (in development)
|
|||||||
Incompatible changes
|
Incompatible changes
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
* #2983: Rename ``epub3_description`` and ``epub3_contributor`` to
|
||||||
|
``epub_description`` and ``epub_contributor``.
|
||||||
|
|
||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ epub_max_image_width = 0
|
|||||||
epub_show_urls = 'inline'
|
epub_show_urls = 'inline'
|
||||||
epub_use_index = False
|
epub_use_index = False
|
||||||
epub_guide = (('toc', 'contents.xhtml', u'Table of Contents'),)
|
epub_guide = (('toc', 'contents.xhtml', u'Table of Contents'),)
|
||||||
epub3_description = 'Sphinx documentation generator system manual'
|
epub_description = 'Sphinx documentation generator system manual'
|
||||||
|
|
||||||
latex_documents = [('contents', 'sphinx.tex', 'Sphinx Documentation',
|
latex_documents = [('contents', 'sphinx.tex', 'Sphinx Documentation',
|
||||||
'Georg Brandl', 'manual', 1)]
|
'Georg Brandl', 'manual', 1)]
|
||||||
|
@ -1289,18 +1289,21 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
|
|||||||
The title of the document. It defaults to the :confval:`html_title` option
|
The title of the document. It defaults to the :confval:`html_title` option
|
||||||
but can be set independently for epub creation.
|
but can be set independently for epub creation.
|
||||||
|
|
||||||
.. confval:: epub3_description
|
.. confval:: epub_description
|
||||||
|
|
||||||
The description of the document. The default value is ``''``.
|
The description of the document. The default value is ``''``.
|
||||||
|
|
||||||
.. versionadded:: 1.4
|
.. versionadded:: 1.4
|
||||||
|
|
||||||
|
.. versionchanged:: 1.5
|
||||||
|
Renamed from ``epub3_description``
|
||||||
|
|
||||||
.. 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. The
|
||||||
default value is ``'unknown'``.
|
default value is ``'unknown'``.
|
||||||
|
|
||||||
.. confval:: epub3_contributor
|
.. confval:: epub_contributor
|
||||||
|
|
||||||
The name of a person, organization, etc. that played a secondary role in
|
The name of a person, organization, etc. that played a secondary role in
|
||||||
the creation of the content of an EPUB Publication. The default value is
|
the creation of the content of an EPUB Publication. The default value is
|
||||||
@ -1308,6 +1311,9 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
|
|||||||
|
|
||||||
.. versionadded:: 1.4
|
.. versionadded:: 1.4
|
||||||
|
|
||||||
|
.. versionchanged:: 1.5
|
||||||
|
Renamed from ``epub3_contributor``
|
||||||
|
|
||||||
.. confval:: epub_language
|
.. confval:: epub_language
|
||||||
|
|
||||||
The language of the document. This is put in the Dublin Core metadata. The
|
The language of the document. This is put in the Dublin Core metadata. The
|
||||||
@ -1467,7 +1473,7 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
|
|||||||
|
|
||||||
.. versionadded:: 1.2
|
.. versionadded:: 1.2
|
||||||
|
|
||||||
.. confval:: epub3_writing_mode
|
.. confval:: epub_writing_mode
|
||||||
|
|
||||||
It specifies writing direction. It can accept ``'horizontal'`` (default) and
|
It specifies writing direction. It can accept ``'horizontal'`` (default) and
|
||||||
``'vertical'``
|
``'vertical'``
|
||||||
@ -1476,7 +1482,7 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
|
|||||||
:header-rows: 1
|
:header-rows: 1
|
||||||
:stub-columns: 1
|
:stub-columns: 1
|
||||||
|
|
||||||
- * ``epub3_writing_mode``
|
- * ``epub_writing_mode``
|
||||||
* ``'horizontal'``
|
* ``'horizontal'``
|
||||||
* ``'vertical'``
|
* ``'vertical'``
|
||||||
- * writing-mode [#]_
|
- * writing-mode [#]_
|
||||||
@ -1503,7 +1509,7 @@ the `Dublin Core metadata <http://dublincore.org/>`_.
|
|||||||
.. versionadded:: 1.4
|
.. versionadded:: 1.4
|
||||||
|
|
||||||
.. deprecated:: 1.5
|
.. deprecated:: 1.5
|
||||||
Use ``epub3_writing_mode``.
|
Use ``epub_writing_mode`` instead.
|
||||||
|
|
||||||
.. _latex-options:
|
.. _latex-options:
|
||||||
|
|
||||||
|
@ -111,13 +111,6 @@ class Epub3Builder(EpubBuilder):
|
|||||||
content_template = PACKAGE_DOC_TEMPLATE
|
content_template = PACKAGE_DOC_TEMPLATE
|
||||||
doctype = DOCTYPE
|
doctype = DOCTYPE
|
||||||
|
|
||||||
# Warning deprecated option
|
|
||||||
def init(self):
|
|
||||||
if self.config.epub3_page_progression_direction:
|
|
||||||
self.warn('epub3_page_progression_direction option is deprecated'
|
|
||||||
' from 1.5. Use epub3_writing_mode instead of this.')
|
|
||||||
super(Epub3Builder, self).init()
|
|
||||||
|
|
||||||
# Finish by building the epub file
|
# Finish by building the epub file
|
||||||
def handle_finish(self):
|
def handle_finish(self):
|
||||||
"""Create the metainfo files and finally the epub."""
|
"""Create the metainfo files and finally the epub."""
|
||||||
@ -135,8 +128,8 @@ class Epub3Builder(EpubBuilder):
|
|||||||
"""
|
"""
|
||||||
metadata = super(Epub3Builder, self).content_metadata(
|
metadata = super(Epub3Builder, self).content_metadata(
|
||||||
files, spine, guide)
|
files, spine, guide)
|
||||||
metadata['description'] = self.esc(self.config.epub3_description)
|
metadata['description'] = self.esc(self.config.epub_description)
|
||||||
metadata['contributor'] = self.esc(self.config.epub3_contributor)
|
metadata['contributor'] = self.esc(self.config.epub_contributor)
|
||||||
metadata['page_progression_direction'] = self._page_progression_direction()
|
metadata['page_progression_direction'] = self._page_progression_direction()
|
||||||
metadata['ibook_scroll_axis'] = self._ibook_scroll_axis()
|
metadata['ibook_scroll_axis'] = self._ibook_scroll_axis()
|
||||||
metadata['date'] = self.esc(datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"))
|
metadata['date'] = self.esc(datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"))
|
||||||
@ -144,25 +137,25 @@ class Epub3Builder(EpubBuilder):
|
|||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
def _page_progression_direction(self):
|
def _page_progression_direction(self):
|
||||||
if self.config.epub3_writing_mode == 'horizontal':
|
if self.config.epub_writing_mode == 'horizontal':
|
||||||
page_progression_direction = 'ltr'
|
page_progression_direction = 'ltr'
|
||||||
elif self.config.epub3_writing_mode == 'vertical':
|
elif self.config.epub_writing_mode == 'vertical':
|
||||||
page_progression_direction = 'rtl'
|
page_progression_direction = 'rtl'
|
||||||
else:
|
else:
|
||||||
page_progression_direction = 'default'
|
page_progression_direction = 'default'
|
||||||
return page_progression_direction
|
return page_progression_direction
|
||||||
|
|
||||||
def _ibook_scroll_axis(self):
|
def _ibook_scroll_axis(self):
|
||||||
if self.config.epub3_writing_mode == 'horizontal':
|
if self.config.epub_writing_mode == 'horizontal':
|
||||||
scroll_axis = 'vertical'
|
scroll_axis = 'vertical'
|
||||||
elif self.config.epub3_writing_mode == 'vertical':
|
elif self.config.epub_writing_mode == 'vertical':
|
||||||
scroll_axis = 'horizontal'
|
scroll_axis = 'horizontal'
|
||||||
else:
|
else:
|
||||||
scroll_axis = 'default'
|
scroll_axis = 'default'
|
||||||
return scroll_axis
|
return scroll_axis
|
||||||
|
|
||||||
def _css_writing_mode(self):
|
def _css_writing_mode(self):
|
||||||
if self.config.epub3_writing_mode == 'vertical':
|
if self.config.epub_writing_mode == 'vertical':
|
||||||
editing_mode = 'vertical-rl'
|
editing_mode = 'vertical-rl'
|
||||||
else:
|
else:
|
||||||
editing_mode = 'horizontal-tb'
|
editing_mode = 'horizontal-tb'
|
||||||
@ -263,11 +256,28 @@ class Epub3Builder(EpubBuilder):
|
|||||||
self.files.append(outname)
|
self.files.append(outname)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_config_values(app):
|
||||||
|
if app.config.epub3_description is not None:
|
||||||
|
app.warn('epub3_description is deprecated. Use epub_description instead.')
|
||||||
|
app.config.epub_description = app.config.epub3_description
|
||||||
|
|
||||||
|
if app.config.epub3_contributor is not None:
|
||||||
|
app.warn('epub3_contributor is deprecated. Use epub_contributor instead.')
|
||||||
|
app.config.epub_contributor = app.config.epub3_contributor
|
||||||
|
|
||||||
|
if app.config.epub3_page_progression_direction is not None:
|
||||||
|
app.warn('epub3_page_progression_direction option is deprecated'
|
||||||
|
' from 1.5. Use epub_writing_mode instead.')
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.setup_extension('sphinx.builders.epub')
|
app.setup_extension('sphinx.builders.epub')
|
||||||
app.add_builder(Epub3Builder)
|
app.add_builder(Epub3Builder)
|
||||||
|
app.connect('builder-inited', validate_config_values)
|
||||||
|
|
||||||
app.add_config_value('epub3_description', '', 'epub3', string_classes)
|
app.add_config_value('epub_description', '', 'epub3', string_classes)
|
||||||
app.add_config_value('epub3_contributor', 'unknown', 'epub3', string_classes)
|
app.add_config_value('epub_contributor', 'unknown', 'epub3', string_classes)
|
||||||
app.add_config_value('epub3_writing_mode', 'horizontal', 'epub3', string_classes)
|
app.add_config_value('epub_writing_mode', 'horizontal', 'epub3', string_classes)
|
||||||
app.add_config_value('epub3_page_progression_direction', '', 'epub3', string_classes)
|
app.add_config_value('epub3_description', None, 'epub3', string_classes)
|
||||||
|
app.add_config_value('epub3_contributor', None, 'epub3', string_classes)
|
||||||
|
app.add_config_value('epub3_page_progression_direction', None, 'epub3', string_classes)
|
||||||
|
Loading…
Reference in New Issue
Block a user