From f6958fce869feeb261bf0666d5c264d4c4557f32 Mon Sep 17 00:00:00 2001 From: milde Date: Fri, 2 Sep 2011 21:09:13 +0000 Subject: [PATCH] Turn off code parsing in the standalone functional tests to get identical results with/without installed Pygments highlighter. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk@7120 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../expected/standalone_rst_html4css1.html | 20 ++++---- .../functional/expected/standalone_rst_latex.tex | 20 ++++---- .../expected/standalone_rst_pseudoxml.txt | 53 ++++++---------------- .../functional/expected/standalone_rst_xetex.tex | 20 ++++---- docutils/test/functional/input/data/standard.txt | 9 ++-- .../functional/tests/_standalone_rst_defaults.py | 1 + 6 files changed, 55 insertions(+), 68 deletions(-) diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html index adfb9bec6..414ade49f 100644 --- a/docutils/test/functional/expected/standalone_rst_html4css1.html +++ b/docutils/test/functional/expected/standalone_rst_html4css1.html @@ -840,17 +840,20 @@ text, footnotes [1]

2.14.9   Code

-

Blocks of source code can be set with the code directive. If the -code language is specified, the content is parsed and tagged by the -Pygments [6] syntax highlighter and can be formatted with a style sheet:

+

Blocks of source code can be set with the code directive. If the code +language is specified, the content is parsed and tagged by the Pygments [6] +syntax highlighter and can be formatted with a style sheet. (Code parsing +is turned off using the syntax-highlight config setting in the test +conversions in order to get identical results with/without installed +Pygments highlighter.)

-print 'This is Python code.'
+print 'This is Python code.'
 

There is an option for line numbers with optional start value:

- 8 # print integers from 0 to 9:
- 9 for i in range(10):
-10     print i
+ 8 # print integers from 0 to 9:
+ 9 for i in range(10):
+10     print i
 

For inline code snippets, there is the code role, which can be used directly (the code will not be parsed/tagged, as the language is not @@ -858,8 +861,7 @@ known) or as base for special code roles, e.g.,

Docutils uses LaTeX syntax for math directives and roles: -\alpha = f(x) - prints +\alpha = f(x) prints α=f(x).
diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex index 28e8f7e50..ac8a5b2da 100644 --- a/docutils/test/functional/expected/standalone_rst_latex.tex +++ b/docutils/test/functional/expected/standalone_rst_latex.tex @@ -1376,21 +1376,24 @@ text},~footnotes\DUfootnotemark{id22}{id8}{1},~% \label{code}% } -Blocks of source code can be set with the \DUroletitlereference{code} directive. If the -code language is specified, the content is parsed and tagged by the -\href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6} syntax highlighter and can be formatted with a style sheet: +Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code +language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6} +syntax highlighter and can be formatted with a style sheet. (Code parsing +is turned off using the \texttt{syntax-highlight} config setting in the test +conversions in order to get identical results with/without installed +Pygments highlighter.) % \begin{quote}{\ttfamily \raggedright \noindent -\DUrole{k}{print}~\DUrole{s}{'This~is~Python~code.'} +print~'This~is~Python~code.' } \end{quote} There is an option for line numbers with optional start value: % \begin{quote}{\ttfamily \raggedright \noindent -\DUrole{l}{\DUrole{n}{~8~}}\DUrole{c}{\#~print~integers~from~0~to~9:}~\\ -\DUrole{ln}{~9~}\DUrole{k}{for}~\DUrole{n}{i}~\DUrole{ow}{in}~\DUrole{nb}{range}\DUrole{p}{(}\DUrole{mi}{10}\DUrole{p}{):}~\\ -\DUrole{ln}{10~}~~~~\DUrole{k}{print}~\DUrole{n}{i} +\DUrole{l}{\DUrole{n}{~8~}}\#~print~integers~from~0~to~9:\\ +\DUrole{ln}{~9~}for~i~in~range(10):\\ +\DUrole{ln}{10~}~~~~print~i } \end{quote} @@ -1403,8 +1406,7 @@ known) or as base for special code roles, e.g., \begin{quote} Docutils uses LaTeX syntax for math directives and roles: -\texttt{\DUrole{code}{\DUrole{latex}{\DUrole{tex}{\DUrole{k}{\textbackslash{}alpha} = f(x) -}}}} prints $\alpha = f(x)$. +\texttt{\DUrole{code}{\DUrole{latex}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}}} prints $\alpha = f(x)$. \end{quote} diff --git a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt index 6a89816c1..58347116d 100644 --- a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt @@ -1615,56 +1615,35 @@ Blocks of source code can be set with the code - directive. If the - code language is specified, the content is parsed and tagged by the + directive. If the code + language is specified, the content is parsed and tagged by the Pygments 6 - syntax highlighter and can be formatted with a style sheet: + + syntax highlighter and can be formatted with a style sheet. (Code parsing + is turned off using the + + syntax-highlight + config setting in the test + conversions in order to get identical results with/without installed + Pygments highlighter.) - - print - - - 'This is Python code.' + print 'This is Python code.' There is an option for line numbers with optional start value: 8 - - # print integers from 0 to 9: - + # print integers from 0 to 9: 9 - - for - - - i - - - in - - - range - - ( - - 10 - - ): - + for i in range(10): 10 - - - print - - - i + print i For inline code snippets, there is the @@ -1677,9 +1656,7 @@ Docutils uses LaTeX syntax for math directives and roles: - - \alpha - = f(x) + \alpha = f(x) prints \alpha = f(x) diff --git a/docutils/test/functional/expected/standalone_rst_xetex.tex b/docutils/test/functional/expected/standalone_rst_xetex.tex index 8034c0a12..670da275d 100644 --- a/docutils/test/functional/expected/standalone_rst_xetex.tex +++ b/docutils/test/functional/expected/standalone_rst_xetex.tex @@ -1375,21 +1375,24 @@ text},~footnotes\DUfootnotemark{id22}{id8}{1},~% \label{code}% } -Blocks of source code can be set with the \DUroletitlereference{code} directive. If the -code language is specified, the content is parsed and tagged by the -\href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6} syntax highlighter and can be formatted with a style sheet: +Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code +language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6} +syntax highlighter and can be formatted with a style sheet. (Code parsing +is turned off using the \texttt{syntax-highlight} config setting in the test +conversions in order to get identical results with/without installed +Pygments highlighter.) % \begin{quote}{\ttfamily \raggedright \noindent -\DUrole{k}{print}~\DUrole{s}{'This~is~Python~code.'} +print~'This~is~Python~code.' } \end{quote} There is an option for line numbers with optional start value: % \begin{quote}{\ttfamily \raggedright \noindent -\DUrole{l}{\DUrole{n}{~8~}}\DUrole{c}{\#~print~integers~from~0~to~9:}~\\ -~\DUrole{ln}{~9~}~\DUrole{k}{for}~\DUrole{n}{i}~\DUrole{ow}{in}~\DUrole{nb}{range}\DUrole{p}{(}\DUrole{mi}{10}\DUrole{p}{):}~\\ -~\DUrole{ln}{10~}~~~~\DUrole{k}{print}~\DUrole{n}{i} +\DUrole{l}{\DUrole{n}{~8~}}\#~print~integers~from~0~to~9:\\ +~\DUrole{ln}{~9~}for~i~in~range(10):\\ +~\DUrole{ln}{10~}~~~~print~i } \end{quote} @@ -1402,8 +1405,7 @@ known) or as base for special code roles, e.g., \begin{quote} Docutils uses LaTeX syntax for math directives and roles: -\texttt{\DUrole{code}{\DUrole{latex}{\DUrole{tex}{\DUrole{k}{\textbackslash{}alpha} = f(x) -}}}} prints $\alpha = f(x)$. +\texttt{\DUrole{code}{\DUrole{latex}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}}} prints $\alpha = f(x)$. \end{quote} diff --git a/docutils/test/functional/input/data/standard.txt b/docutils/test/functional/input/data/standard.txt index d2979844f..aa4d431d2 100644 --- a/docutils/test/functional/input/data/standard.txt +++ b/docutils/test/functional/input/data/standard.txt @@ -758,9 +758,12 @@ Parsed Literal Blocks Code ```` -Blocks of source code can be set with the `code` directive. If the -code language is specified, the content is parsed and tagged by the -Pygments_ syntax highlighter and can be formatted with a style sheet: +Blocks of source code can be set with the `code` directive. If the code +language is specified, the content is parsed and tagged by the Pygments_ +syntax highlighter and can be formatted with a style sheet. (Code parsing +is turned off using the ``syntax-highlight`` config setting in the test +conversions in order to get identical results with/without installed +Pygments highlighter.) .. code:: python diff --git a/docutils/test/functional/tests/_standalone_rst_defaults.py b/docutils/test/functional/tests/_standalone_rst_defaults.py index b51704929..5efebbee0 100644 --- a/docutils/test/functional/tests/_standalone_rst_defaults.py +++ b/docutils/test/functional/tests/_standalone_rst_defaults.py @@ -4,3 +4,4 @@ parser_name = "rst" # Settings. settings_overrides['sectsubtitle_xform'] = 1 +settings_overrides['syntax_highlight'] = 'none' -- 2.11.4.GIT