diff options
author | tk0miya <i.tkomiya@gmail.com> | 2014-10-27 11:02:54 +0900 |
---|---|---|
committer | tk0miya <i.tkomiya@gmail.com> | 2014-10-27 11:02:54 +0900 |
commit | 0cdbb2161edeca086b0ef7bd49a61b2e0e0ad1d8 (patch) | |
tree | fe892b69f167ef3d9e5d86c5b48cafe682e21f76 /tests | |
parent | cf5c0d4a83f3ea45963ab0c6cc2ab55794b058ab (diff) | |
download | sphinx-0cdbb2161edeca086b0ef7bd49a61b2e0e0ad1d8.tar.gz |
Fix #1603 :numref: doesn't work correctly when label contain underscore
If label contains underscore, the underscores are replaced with hyphens on normalization.
:numref: confuses the normalization with explicit notation.
This fix uses `target` variable insted of labelid to check the role is explicit or not.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/roots/test-numfig/index.rst | 8 | ||||
-rw-r--r-- | tests/test_build_html.py | 4 | ||||
-rw-r--r-- | tests/test_build_latex.py | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/roots/test-numfig/index.rst b/tests/roots/test-numfig/index.rst index 7bdf135c..7779fe91 100644 --- a/tests/roots/test-numfig/index.rst +++ b/tests/roots/test-numfig/index.rst @@ -17,7 +17,7 @@ test-tocdepth should be Fig.2 -.. _table1: +.. _table-1: .. csv-table:: should be Table 1 :header-rows: 0 @@ -29,7 +29,7 @@ test-tocdepth hello,world -.. _code1: +.. _code_1: .. code-block:: python :caption: should be List 1 @@ -44,7 +44,7 @@ test-tocdepth * Fig.1 is :numref:`fig1` * Fig.2.2 is :numref:`Figure# <fig22>` -* Table.1 is :numref:`table1` +* Table.1 is :numref:`table-1` * Table.2.2 is :numref:`Table:# <table22>` -* List.1 is :numref:`code1` +* List.1 is :numref:`code_1` * List.2.2 is :numref:`Code-# <code22>` diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 539140db..47c30b2e 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -476,9 +476,9 @@ def test_numfig_disabled(app, status, warning): "span[@class='caption-number']", None, True), (".//li/code/span", '^fig1$', True), (".//li/code/span", '^Figure#$', True), - (".//li/code/span", '^table1$', True), + (".//li/code/span", '^table-1$', True), (".//li/code/span", '^Table:#$', True), - (".//li/code/span", '^code1$', True), + (".//li/code/span", '^code_1$', True), (".//li/code/span", '^Code-#$', True), ], 'foo.html': [ diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 3b6dd3e2..83b55caf 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -103,9 +103,9 @@ def test_numref(app, status, warning): print(warning.getvalue()) assert '\\ref{index:fig1}' in result assert '\\ref{baz:fig22}' in result - assert '\\ref{index:table1}' in result + assert '\\ref{index:table-1}' in result assert '\\ref{baz:table22}' in result - assert '\\ref{index:code1}' in result + assert '\\ref{index:code-1}' in result assert '\\ref{baz:code22}' in result |