Define `\internalreference` macro to redefine the style of references

This commit is contained in:
Takeshi KOMIYA
2016-02-25 22:07:18 +09:00
parent cea81e7a70
commit a682ab2e57
4 changed files with 21 additions and 15 deletions

View File

@@ -397,7 +397,7 @@ def test_footnote(app, status, warning):
assert '\\footnote[1]{\nnumbered\n}' in result
assert '\\footnote[2]{\nauto numbered\n}' in result
assert '\\footnote[3]{\nnamed\n}' in result
assert '{\\hyperref[footnote:bar]{\\emph{{[}bar{]}}}}' in result
assert '{\\hyperref[footnote:bar]{\\internalreference{{[}bar{]}}}}' in result
assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} ' in result
assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} \ncite' in result
assert '\\bibitem[bar]{bar}{\\phantomsection\\label{footnote:bar} \ncite\n}' in result
@@ -416,7 +416,8 @@ def test_reference_in_caption(app, status, warning):
print(status.getvalue())
print(warning.getvalue())
assert ('\\caption{This is the figure caption with a reference to \\label{index:id2}'
'{\\hyperref[index:authoryear]{\\emph{{[}AuthorYear{]}}}}.}' in result)
'{\\hyperref[index:authoryear]{\\internalreference{{[}AuthorYear{]}}}}.}'
in result)
assert '\\chapter{The section with a reference to {[}AuthorYear{]}}' in result
assert '\\caption{The table title with a reference to {[}AuthorYear{]}}' in result
assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result
@@ -445,11 +446,12 @@ def test_latex_show_urls_is_inline(app, status, warning):
assert 'Auto footnote number \\footnote[1]{\nfootnote in baz\n} in baz.rst' in result
assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]'
'{\\emph{The section with a reference to \\phantomsection\\label{index:id1}'
'{\\hyperref[index:authoryear]{\\emph{{[}AuthorYear{]}}}}}}}' in result)
'{\\internalreference{The section with a reference to \\phantomsection'
'\\label{index:id1}{\\hyperref[index:authoryear]{\\internalreference'
'{{[}AuthorYear{]}}}}}}}' in result)
assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section '
'with a reference to }}}' in result)
'\\string-with\\string-a\\string-reference\\string-to]'
'{\\internalreference{The section with a reference to }}}' in result)
assert 'First footnote: \\footnote[2]{\nFirst\n}' in result
assert 'Second footnote: \\footnote[1]{\nSecond\n}' in result
assert '\\href{http://sphinx-doc.org/}{Sphinx} (http://sphinx-doc.org/)' in result
@@ -480,11 +482,12 @@ def test_latex_show_urls_is_footnote(app, status, warning):
assert 'Auto footnote number \\footnote[2]{\nfootnote in baz\n} in baz.rst' in result
assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]'
'{\\emph{The section with a reference to \\phantomsection\\label{index:id1}'
'{\\hyperref[index:authoryear]{\\emph{{[}AuthorYear{]}}}}}}}' in result)
'{\\internalreference{The section with a reference to \\phantomsection'
'\\label{index:id1}{\\hyperref[index:authoryear]{\\internalreference'
'{{[}AuthorYear{]}}}}}}}' in result)
assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section '
'with a reference to }}}' in result)
'\\string-with\\string-a\\string-reference\\string-to]{\\internalreference'
'{The section with a reference to }}}' in result)
assert 'First footnote: \\footnote[3]{\nFirst\n}' in result
assert 'Second footnote: \\footnote[1]{\nSecond\n}' in result
assert ('\\href{http://sphinx-doc.org/}{Sphinx}'
@@ -517,11 +520,12 @@ def test_latex_show_urls_is_no(app, status, warning):
assert 'Auto footnote number \\footnote[1]{\nfootnote in baz\n} in baz.rst' in result
assert ('\\phantomsection\\label{index:id26}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to\\string-authoryear]'
'{\\emph{The section with a reference to \\phantomsection\\label{index:id1}'
'{\\hyperref[index:authoryear]{\\emph{{[}AuthorYear{]}}}}}}}' in result)
'{\\internalreference{The section with a reference to \\phantomsection'
'\\label{index:id1}{\\hyperref[index:authoryear]{\\internalreference'
'{{[}AuthorYear{]}}}}}}}' in result)
assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to]{\\emph{The section '
'with a reference to }}}' in result)
'\\string-with\\string-a\\string-reference\\string-to]{\\internalreference'
'{The section with a reference to }}}' in result)
assert 'First footnote: \\footnote[2]{\nFirst\n}' in result
assert 'Second footnote: \\footnote[1]{\nSecond\n}' in result
assert '\\href{http://sphinx-doc.org/}{Sphinx}' in result