summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/expected/standalone_rst_latex.tex7
-rw-r--r--test/functional/expected/standalone_rst_xetex.tex7
-rwxr-xr-xtest/test_writers/test_latex2e.py35
3 files changed, 35 insertions, 14 deletions
diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex
index 54308b6c0..6e652c0c6 100644
--- a/test/functional/expected/standalone_rst_latex.tex
+++ b/test/functional/expected/standalone_rst_latex.tex
@@ -10,11 +10,6 @@
% Prevent side-effects if French hyphenation patterns are not loaded:
\frenchbsetup{StandardLayout}
\AtBeginDocument{\selectlanguage{english}\noextrasfrench}
-% basic code highlight:
-\providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-\providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-\providecommand*\DUrolekeyword[1]{\textbf{#1}}
-\providecommand*\DUrolestring[1]{\textit{#1}}
\usepackage{color}
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
@@ -44,7 +39,7 @@
}
% abstract title
-\providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
+\providecommand*{\DUtitleabstract}[1]{\centering\textbf{#1}}
% admonition (specially marked topic)
\providecommand{\DUadmonition}[2][class-arg]{%
diff --git a/test/functional/expected/standalone_rst_xetex.tex b/test/functional/expected/standalone_rst_xetex.tex
index a5abbb198..730e4c835 100644
--- a/test/functional/expected/standalone_rst_xetex.tex
+++ b/test/functional/expected/standalone_rst_xetex.tex
@@ -8,11 +8,6 @@
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{british,french,german}
-% basic code highlight:
-\providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-\providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
-\providecommand*\DUrolekeyword[1]{\textbf{#1}}
-\providecommand*\DUrolestring[1]{\textit{#1}}
\usepackage{color}
\usepackage{float} % float configuration
\floatplacement{figure}{H} % place figures here definitely
@@ -40,7 +35,7 @@
}
% abstract title
-\providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
+\providecommand*{\DUtitleabstract}[1]{\centering\textbf{#1}}
% admonition (specially marked topic)
\providecommand{\DUadmonition}[2][class-arg]{%
diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py
index e81c1430b..97ac130a0 100755
--- a/test/test_writers/test_latex2e.py
+++ b/test/test_writers/test_latex2e.py
@@ -61,6 +61,26 @@ latex_preamble = r"""% PDF Standard Fonts
""",
stylesheet = '',
fallbacks = '',
+fallbacks_highlight = r"""% basic code highlight:
+\providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
+\providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
+\providecommand*\DUrolekeyword[1]{\textbf{#1}}
+\providecommand*\DUrolestring[1]{\textit{#1}}
+
+% inline markup (custom roles)
+% \DUrole{#1}{#2} tries \DUrole#1{#2}
+\providecommand*{\DUrole}[2]{%
+ \ifcsname DUrole#1\endcsname%
+ \csname DUrole#1\endcsname{#2}%
+ \else% backwards compatibility: try \docutilsrole#1{#2}
+ \ifcsname docutilsrole#1\endcsname%
+ \csname docutilsrole#1\endcsname{#2}%
+ \else%
+ #2%
+ \fi%
+ \fi%
+}
+""",
pdfsetup = r"""
% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
@@ -124,6 +144,17 @@ Und damit \foreignlanguage{spanish}{basta}!
"""],
]
+totest['code role'] = [
+[":code:`x=1`",
+head_template.substitute(dict(parts, requirements = parts['requirements']+
+r"""\usepackage{color}
+""", fallbacks = parts['fallbacks_highlight'])) + r"""
+\texttt{\DUrole{code}{x=1}}
+
+\end{document}
+"""],
+]
+
totest['table_of_contents'] = [
# input
["""\
@@ -485,7 +516,7 @@ head_table + r"""
# The "[" needs to be protected (otherwise it will be seen as an
# option to "\\", "\item", etc. ).
-totest['brackett_protection'] = [
+totest['bracket_protection'] = [
# input
["""\
::
@@ -549,7 +580,7 @@ This is a *section title*
This is the *document*.
""",
-head_template.substitute(dict(parts,
+head_template.substitute(dict(parts,
requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n',
pdfsetup=parts['pdfsetup'] + r"""\hypersetup{
pdftitle={This is the Title},