summaryrefslogtreecommitdiff
path: root/tests/test_directive_code.py
diff options
context:
space:
mode:
authorjfbu <jfbu@free.fr>2016-06-12 19:35:47 +0200
committerjfbu <jfbu@free.fr>2016-06-15 08:53:24 +0200
commit5510653d6ebe7f7f6b834879a66d18071e16a5d6 (patch)
tree45ec6d4dbe9f6020108f6fb56b083fdc2b489f26 /tests/test_directive_code.py
parent8608387585b6d24945a4ba94f80f50714425a6d4 (diff)
downloadsphinx-git-5510653d6ebe7f7f6b834879a66d18071e16a5d6.tar.gz
Fix #2629. Add new config option ``latex_keep_old_macro_names``
The cause of the issue was a clash about ``\titleref`` macro being already defined in memoir class context. To avoid similar problems, this makes the text styling macros ``\strong``, ``\code``, ``\bfcode``, ``\email``, ``\tablecontinued``, ``\titleref``, ``\menuselection``, ``\accelerator``, ``\crossref``, ``\termref``, ``\optional``, also available with ``\sphinx`` prefix, with a conf.py boolean option to let sphinx.sty only define ``\sphinx``-prefixed macros. As default value is False, backwards compatibility is maintained. On this occasion, some internal non-public macros have been renamed with prefix ``\spx@``. The command find . -name '*.sty' -exec grep -l \\\\spx@ {} \; has been executed in TeXLive 2015 and 2016 installations to check no package defines macros starting with ``\spx@``. Some internal macros having public names (because they are written by latex.py into the body of the latex document) have been renamed to have ``\sphinx`` prefix. The macros in sphinx.sty starting with \py@, or \DU, or \PYG have not been modified. Similarly ``\release``, ``\version``, ``\releasename``, etc... have not been renamed.
Diffstat (limited to 'tests/test_directive_code.py')
-rw-r--r--tests/test_directive_code.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py
index 4adb04cfb..5871f0321 100644
--- a/tests/test_directive_code.py
+++ b/tests/test_directive_code.py
@@ -65,8 +65,8 @@ def test_code_block_caption_html(app, status, warning):
def test_code_block_caption_latex(app, status, warning):
app.builder.build_all()
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
- caption = '\\SphinxSetupCaptionForVerbatim{literal-block}{caption \\emph{test} rb}'
- label = '\\def\\SphinxLiteralBlockLabel{\\label{caption:caption-test-rb}}'
+ caption = '\\sphinxSetupCaptionForVerbatim{literal-block}{caption \\emph{test} rb}'
+ label = '\\def\\sphinxLiteralBlockLabel{\\label{caption:caption-test-rb}}'
link = '\hyperref[caption:caption-test-rb]' \
'{Listing \\ref{caption:caption-test-rb}}'
assert caption in latex
@@ -78,12 +78,12 @@ def test_code_block_caption_latex(app, status, warning):
def test_code_block_namedlink_latex(app, status, warning):
app.builder.build_all()
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
- label1 = '\def\SphinxLiteralBlockLabel{\label{caption:name-test-rb}}'
+ label1 = '\def\sphinxLiteralBlockLabel{\label{caption:name-test-rb}}'
link1 = '\\hyperref[caption:name\\string-test\\string-rb]'\
- '{\\crossref{\\DUrole{std,std-ref}{Ruby}}'
- label2 = '\def\SphinxLiteralBlockLabel{\label{namedblocks:some-ruby-code}}'
+ '{\\sphinxcrossref{\\DUrole{std,std-ref}{Ruby}}'
+ label2 = '\def\sphinxLiteralBlockLabel{\label{namedblocks:some-ruby-code}}'
link2 = '\\hyperref[namedblocks:some\\string-ruby\\string-code]'\
- '{\\crossref{\\DUrole{std,std-ref}{the ruby code}}}'
+ '{\\sphinxcrossref{\\DUrole{std,std-ref}{the ruby code}}}'
assert label1 in latex
assert link1 in latex
assert label2 in latex
@@ -252,8 +252,8 @@ def test_literalinclude_caption_html(app, status, warning):
def test_literalinclude_caption_latex(app, status, warning):
app.builder.build('index')
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
- caption = '\\SphinxSetupCaptionForVerbatim{literal-block}{caption \\textbf{test} py}'
- label = '\\def\\SphinxLiteralBlockLabel{\\label{caption:caption-test-py}}'
+ caption = '\\sphinxSetupCaptionForVerbatim{literal-block}{caption \\textbf{test} py}'
+ label = '\\def\\sphinxLiteralBlockLabel{\\label{caption:caption-test-py}}'
link = '\hyperref[caption:caption-test-py]' \
'{Listing \\ref{caption:caption-test-py}}'
assert caption in latex
@@ -265,12 +265,12 @@ def test_literalinclude_caption_latex(app, status, warning):
def test_literalinclude_namedlink_latex(app, status, warning):
app.builder.build('index')
latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
- label1 = '\def\SphinxLiteralBlockLabel{\label{caption:name-test-py}}'
+ label1 = '\def\sphinxLiteralBlockLabel{\label{caption:name-test-py}}'
link1 = '\\hyperref[caption:name\\string-test\\string-py]'\
- '{\\crossref{\\DUrole{std,std-ref}{Python}}'
- label2 = '\def\SphinxLiteralBlockLabel{\label{namedblocks:some-python-code}}'
+ '{\\sphinxcrossref{\\DUrole{std,std-ref}{Python}}'
+ label2 = '\def\sphinxLiteralBlockLabel{\label{namedblocks:some-python-code}}'
link2 = '\\hyperref[namedblocks:some\\string-python\\string-code]'\
- '{\\crossref{\\DUrole{std,std-ref}{the python code}}}'
+ '{\\sphinxcrossref{\\DUrole{std,std-ref}{the python code}}}'
assert label1 in latex
assert link1 in latex
assert label2 in latex