Change html_sourcelink_txt -> html_sourcelink_suffix

This commit is contained in:
Matthias Geier
2016-05-17 09:34:01 +02:00
parent b5ae1b0846
commit 5559150578
4 changed files with 8 additions and 8 deletions

View File

@@ -870,10 +870,10 @@ that use Sphinx's HTMLWriter class.
.. versionadded:: 0.6
.. confval:: html_sourcelink_txt
.. confval:: html_sourcelink_suffix
If true, ``.txt`` is appended to source links (see
:confval:`html_show_sourcelink`). Default is ``True``.
Suffix to be appended to source links (see :confval:`html_show_sourcelink`),
unless they have this suffix already. Default is ``'.txt'``.
.. versionadded:: 1.5

View File

@@ -409,8 +409,8 @@ class StandaloneHTMLBuilder(Builder):
# the name for the copied source
if self.config.html_copy_source:
sourcename = docname + source_suffix
if self.config.html_sourcelink_txt and source_suffix != '.txt':
sourcename += '.txt'
if source_suffix != self.config.html_sourcelink_suffix:
sourcename += self.config.html_sourcelink_suffix
else:
sourcename = ''

View File

@@ -121,7 +121,7 @@ class Config(object):
html_split_index = (False, 'html'),
html_copy_source = (True, 'html'),
html_show_sourcelink = (True, 'html'),
html_sourcelink_txt = (True, 'html'),
html_sourcelink_suffix = ('.txt', 'html'),
html_use_opensearch = ('', 'html'),
html_file_suffix = (None, 'html', string_classes),
html_link_suffix = (None, 'html', string_classes),

View File

@@ -989,8 +989,8 @@ def test_html_extra_path(app, status, warning):
assert (app.outdir / 'background.png').exists()
@with_app(buildername='html', confoverrides={'html_sourcelink_txt': False})
def test_html_sourcelink_txt(app, status, warning):
@with_app(buildername='html', confoverrides={'html_sourcelink_suffix': ''})
def test_html_sourcelink_suffix(app, status, warning):
app.builder.build_all()
content_otherext = (app.outdir / 'otherext.html').text()
content_images = (app.outdir / 'images.html').text()