diff options
author | shimizukawa <shimizukawa@gmail.com> | 2014-10-10 00:19:17 +0900 |
---|---|---|
committer | shimizukawa <shimizukawa@gmail.com> | 2014-10-10 00:19:17 +0900 |
commit | 0d5e691cffc1ece99a0cc0d13e8c5732ab7f4f84 (patch) | |
tree | 86685fafc89abd9128e2f6d9d232d350d1fb1539 | |
parent | bd5a35333114331c907385f50017d5374a32c41f (diff) | |
download | sphinx-0d5e691cffc1ece99a0cc0d13e8c5732ab7f4f84.tar.gz |
rename `numfig_prefix` to `numfig_format`. later is better for the purpose.
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | doc/config.rst | 4 | ||||
-rw-r--r-- | sphinx/config.py | 2 | ||||
-rw-r--r-- | sphinx/domains/std.py | 2 | ||||
-rw-r--r-- | sphinx/writers/html.py | 2 | ||||
-rw-r--r-- | tests/test_build_html.py | 2 |
6 files changed, 7 insertions, 7 deletions
@@ -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. diff --git a/doc/config.rst b/doc/config.rst index e7e2455d..8a2b76be 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -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'``. diff --git a/sphinx/config.py b/sphinx/config.py index 77d6779d..d198cac4 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -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'), diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 03228da2..aa0aa3aa 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -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: diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py index eefbc25d..95de7ce7 100644 --- a/sphinx/writers/html.py +++ b/sphinx/writers/html.py @@ -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>') diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 65fdc9fc..539140db 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -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): |