Rename `\internalreference to \crossref`

This commit is contained in:
Takeshi KOMIYA
2016-03-02 22:58:17 +09:00
parent 8bdefa24d1
commit d91fd33de5
4 changed files with 16 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ Features added
* #2340: Math extension: support alignment of multiple equations for MathJAX.
* #2338: Define ``\titlereference`` macro to redefine the style of ``title-reference`` roles.
* Define ``\menuselection`` and ``\accelerator`` macros to redefine the style of `menuselection` roles.
* Define ``\internalreference`` macro to redefine the style of references
* Define ``\crossref`` macro to redefine the style of references
* #2301: Texts in the classic html theme should be hyphenated.
* #2355: Define ``\termref`` macro to redefine the style of ``term`` roles.

View File

@@ -149,7 +149,7 @@
\newcommand{\titlereference}[1]{\emph{#1}}
\newcommand{\menuselection}[1]{\emph{#1}}
\newcommand{\accelerator}[1]{\underline{#1}}
\newcommand{\internalreference}[1]{\emph{#1}}
\newcommand{\crossref}[1]{\emph{#1}}
\newcommand{\termref}[1]{\emph{#1}}
% Redefine the Verbatim environment to allow border and background colors.

View File

@@ -1624,7 +1624,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
# mark up as termreference
self.body.append(r'\termref{')
else:
self.body.append(r'\internalreference{')
self.body.append(r'\crossref{')
if self.builder.config.latex_show_pagerefs and not \
self.in_production_list:
self.context.append('}}} (%s)' % self.hyperpageref(id))

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]{\\internalreference{{[}bar{]}}}}' in result
assert '{\\hyperref[footnote:bar]{\\crossref{{[}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,8 +416,7 @@ 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]{\\internalreference{{[}AuthorYear{]}}}}.}'
in result)
'{\\hyperref[index:authoryear]{\\crossref{{[}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
@@ -446,12 +445,11 @@ 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]'
'{\\internalreference{The section with a reference to \\phantomsection'
'\\label{index:id1}{\\hyperref[index:authoryear]{\\internalreference'
'{{[}AuthorYear{]}}}}}}}' in result)
'{\\crossref{The section with a reference to \\phantomsection\\label{index:id1}'
'{\\hyperref[index:authoryear]{\\crossref{{[}AuthorYear{]}}}}}}}' in result)
assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to]'
'{\\internalreference{The section with a reference to }}}' in result)
'{\\crossref{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
@@ -482,12 +480,11 @@ 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]'
'{\\internalreference{The section with a reference to \\phantomsection'
'\\label{index:id1}{\\hyperref[index:authoryear]{\\internalreference'
'{{[}AuthorYear{]}}}}}}}' in result)
'{\\crossref{The section with a reference to \\phantomsection\\label{index:id1}'
'{\\hyperref[index:authoryear]{\\crossref{{[}AuthorYear{]}}}}}}}' in result)
assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to]{\\internalreference'
'{The section with a reference to }}}' in result)
'\\string-with\\string-a\\string-reference\\string-to]'
'{\\crossref{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}'
@@ -520,12 +517,11 @@ 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]'
'{\\internalreference{The section with a reference to \\phantomsection'
'\\label{index:id1}{\\hyperref[index:authoryear]{\\internalreference'
'{{[}AuthorYear{]}}}}}}}' in result)
'{\\crossref{The section with a reference to \\phantomsection\\label{index:id1}'
'{\\hyperref[index:authoryear]{\\crossref{{[}AuthorYear{]}}}}}}}' in result)
assert ('\\phantomsection\\label{index:id27}{\\hyperref[index:the\\string-section'
'\\string-with\\string-a\\string-reference\\string-to]{\\internalreference'
'{The section with a reference to }}}' in result)
'\\string-with\\string-a\\string-reference\\string-to]'
'{\\crossref{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