mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
rename numfig_prefix
to numfig_format
. later is better for the purpose.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -53,7 +53,7 @@ Features added
|
||||
search can now handle these. Thanks to Shibukawa Yoshiki.
|
||||
* PR#296, PR#303, #76: numfig feature: Assign numbers to figures, tables and
|
||||
code-blocks. This feature is configured with `numfig`, `numfig_secnum_depth`
|
||||
and `numfig_prefix`. Also `numref` role is available. Thanks to Takeshi
|
||||
and `numfig_format`. Also `numref` role is available. Thanks to Takeshi
|
||||
Komiya.
|
||||
* PR#202: Allow "." and "~" prefixed references in ``:param:`` doc fields
|
||||
for Python.
|
||||
|
@@ -238,10 +238,10 @@ General configuration
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. confval:: numfig_prefix
|
||||
.. confval:: numfig_format
|
||||
|
||||
A dictionary mapping ``'figure'``, ``'table'`` and ``'code-block'`` to
|
||||
strings that are used for prefix of figure numbers. Default is to use
|
||||
strings that are used for format of figure numbers. Default is to use
|
||||
``'Fig. %s'`` for ``'figure'``, ``'Table %s'`` for ``'table'`` and
|
||||
``'Listing %s'`` for ``'code-block'``.
|
||||
|
||||
|
@@ -72,7 +72,7 @@ class Config(object):
|
||||
nitpick_ignore = ([], 'html'),
|
||||
numfig = (False, 'env'),
|
||||
numfig_secnum_depth = (1, 'env'),
|
||||
numfig_prefix = ({'figure': l_('Fig. %s'),
|
||||
numfig_format = ({'figure': l_('Fig. %s'),
|
||||
'table': l_('Table %s'),
|
||||
'code-block': l_('Listing %s')},
|
||||
'env'),
|
||||
|
@@ -637,7 +637,7 @@ class StandardDomain(Domain):
|
||||
|
||||
title = contnode.astext()
|
||||
if labelid == title:
|
||||
prefix = env.config.numfig_prefix.get(figtype, '')
|
||||
prefix = env.config.numfig_format.get(figtype, '')
|
||||
title = prefix.replace('%s', '#')
|
||||
newtitle = prefix % '.'.join(map(str, fignumber))
|
||||
else:
|
||||
|
@@ -255,7 +255,7 @@ class HTMLTranslator(BaseTranslator):
|
||||
def append_fignumber(figtype, figure_id):
|
||||
if figure_id in self.builder.fignumbers.get(figtype, {}):
|
||||
self.body.append('<span class="caption-number">')
|
||||
prefix = self.builder.config.numfig_prefix.get(figtype, '')
|
||||
prefix = self.builder.config.numfig_format.get(figtype, '')
|
||||
numbers = self.builder.fignumbers[figtype][figure_id]
|
||||
self.body.append(prefix % '.'.join(map(str, numbers)) + ' ')
|
||||
self.body.append('</span>')
|
||||
|
@@ -713,7 +713,7 @@ def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
|
||||
@gen_with_app(buildername='html', testroot='numfig',
|
||||
confoverrides={'numfig': True,
|
||||
'numfig_prefix': {'figure': 'Figure:%s',
|
||||
'numfig_format': {'figure': 'Figure:%s',
|
||||
'table': 'Tab_%s',
|
||||
'code-block': 'Code-%s'}})
|
||||
def test_numfig_with_prefix(app, status, warning):
|
||||
|
Reference in New Issue
Block a user