rename numfig_prefix to numfig_format. later is better for the purpose.

This commit is contained in:
Takayuki Shimizukawa
2014-10-10 00:19:17 +09:00
parent 6261c8b68d
commit d289870f48
6 changed files with 7 additions and 7 deletions

View File

@@ -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.

View File

@@ -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'``.

View File

@@ -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'),

View File

@@ -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:

View File

@@ -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>')

View File

@@ -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):