From 44722a1b837397ac3ec7d70b79fab72ad5c03638 Mon Sep 17 00:00:00 2001 From: milde Date: Wed, 30 Jun 2021 07:48:12 +0000 Subject: Reorganise functional tests. Move additional tests for special features or problems specific to the output format from the "standalone_..." generic test case to additional tests. Use unit test instead of functional test for the fix in r6155 (hyperlink references in substitutions). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8784 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- .../test/functional/expected/latex_cornercases.tex | 908 ++++++++++++++++++++- docutils/test/functional/expected/latex_memoir.tex | 792 +----------------- .../functional/expected/misc_rst_html4css1.html | 62 +- .../functional/expected/standalone_rst_latex.tex | 796 +----------------- .../functional/expected/standalone_rst_xetex.tex | 789 +----------------- .../test/functional/input/data/hyperlinking.txt | 2 +- .../test/functional/input/data/latex_encoding.txt | 10 +- .../test/functional/input/data/nonalphanumeric.txt | 2 +- .../test/functional/input/data/option_lists.txt | 6 +- .../test/functional/input/data/section_titles.txt | 50 +- .../test/functional/input/data/tables_latex.txt | 2 +- docutils/test/functional/input/data/unicode.txt | 2 +- docutils/test/functional/input/data/urls.txt | 14 +- .../test/functional/input/latex_cornercases.txt | 29 +- .../test/functional/input/link_in_substitution.txt | 23 - .../test/functional/input/misc_rst_html4css1.txt | 5 + .../test/functional/input/standalone_rst_latex.txt | 15 +- .../test/functional/input/standalone_rst_xetex.txt | 31 +- .../test/functional/tests/misc_rst_html4css1.py | 6 +- 19 files changed, 1043 insertions(+), 2501 deletions(-) delete mode 100644 docutils/test/functional/input/link_in_substitution.txt create mode 100644 docutils/test/functional/input/misc_rst_html4css1.txt (limited to 'docutils/test/functional') diff --git a/docutils/test/functional/expected/latex_cornercases.tex b/docutils/test/functional/expected/latex_cornercases.tex index 5621bb156..2e5c89807 100644 --- a/docutils/test/functional/expected/latex_cornercases.tex +++ b/docutils/test/functional/expected/latex_cornercases.tex @@ -4,13 +4,22 @@ \usepackage{ifthen} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} +\DeclareUnicodeCharacter{21D4}{\ensuremath{\Leftrightarrow}} +\DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}} +\DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}} +\usepackage{alltt} +\usepackage{amsmath} \usepackage{booktabs} +\usepackage{float} % extended float configuration +\floatplacement{figure}{H} % place figures here definitely \usepackage{graphicx} \usepackage{multirow} +\usepackage{pifont} \setcounter{secnumdepth}{0} \usepackage{longtable,ltcaption,array} \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables +\usepackage{textcomp} % text symbol macros %%% Custom LaTeX preamble % PDF Standard Fonts @@ -22,6 +31,79 @@ %%% Fallback definitions for Docutils-specific commands +% class handling for environments (block-level elements) +% \begin{DUclass}{spam} tries \DUCLASSspam and +% \end{DUclass}{spam} tries \endDUCLASSspam +\ifx\DUclass\undefined % poor man's "provideenvironment" + \newenvironment{DUclass}[1]% + {% "#1" does not work in end-part of environment. + \def\DocutilsClassFunctionName{DUCLASS#1} + \csname \DocutilsClassFunctionName \endcsname}% + {\csname end\DocutilsClassFunctionName \endcsname}% +\fi + +% Provide a length variable and set default, if it is new +\providecommand*{\DUprovidelength}[2]{ + \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{} +} + +% admonition environment (specially marked topic) +\ifx\DUadmonition\undefined % poor man's "provideenvironment" + \newbox{\DUadmonitionbox} + \newenvironment{DUadmonition}% + {\begin{center} + \begin{lrbox}{\DUadmonitionbox} + \begin{minipage}{0.9\linewidth} + }% + { \end{minipage} + \end{lrbox} + \fbox{\usebox{\DUadmonitionbox}} + \end{center} + } +\fi + +% legend environment (in figures and formal tables) +\ifthenelse{\isundefined{\DUlegend}}{ + \newenvironment{DUlegend}{\small}{} +}{} + +% line block environment +\DUprovidelength{\DUlineblockindent}{2.5em} +\ifthenelse{\isundefined{\DUlineblock}}{ + \newenvironment{DUlineblock}[1]{% + \list{}{\setlength{\partopsep}{\parskip} + \addtolength{\partopsep}{\baselineskip} + \setlength{\topsep}{0pt} + \setlength{\itemsep}{0.15\baselineskip} + \setlength{\parsep}{0pt} + \setlength{\leftmargin}{#1}} + \raggedright + } + {\endlist} +}{} + +% list of command line options +\providecommand*{\DUoptionlistlabel}[1]{\bfseries #1 \hfill} +\DUprovidelength{\DUoptionlistindent}{3cm} +\ifthenelse{\isundefined{\DUoptionlist}}{ + \newenvironment{DUoptionlist}{% + \list{}{\setlength{\labelwidth}{\DUoptionlistindent} + \setlength{\rightmargin}{1cm} + \setlength{\leftmargin}{\rightmargin} + \addtolength{\leftmargin}{\labelwidth} + \addtolength{\leftmargin}{\labelsep} + \renewcommand{\makelabel}{\DUoptionlistlabel}} + } + {\endlist} +}{} + +% title for topics, admonitions, unsupported section levels, and sidebar +\providecommand*{\DUtitle}[1]{% + \smallskip\noindent\textbf{#1}\smallskip} + +% titlereference standard role +\providecommand*{\DUroletitlereference}[1]{\textsl{#1}} + % transition (break / fancybreak / anonymous section) \providecommand*{\DUtransition}{% \hspace*{\fill}\hrulefill\hspace*{\fill} @@ -34,20 +116,824 @@ \usepackage{bookmark} \urlstyle{same} % normal text font (alternatives: tt, rm, sf) }{} -\hypersetup{ - pdftitle={Some Tests for the LaTeX Writer}, -} %%% Body \begin{document} -\title{Some Tests for the LaTeX Writer% - \label{some-tests-for-the-latex-writer}} -\author{} -\date{} -\maketitle - -These tests contain unusual combinations of syntax elements which may cause -trouble for the LaTeX writer but do not need to be tested with other writers. + + +\section{Additional Tests for the LaTeX Writer% + \label{additional-tests-for-the-latex-writer}% +} + +These tests contain syntax elements and combinations which may cause +trouble for the LaTeX writer. + + +\section{Section heading levels% + \label{section-heading-levels}% +} + + +\section{Level 1% + \label{level-1}% +} + +Nested sections + + +\subsection{Level 2% + \label{level-2}% +} + +reach at some level + + +\subsubsection{Level 3% + \label{level-3}% +} + +(depending on the document class and output format) + + +\paragraph{level 4% + \label{level-4}% +} + +a level + + +\subparagraph{level 5% + \label{level-5}% +} + +that is not supported by the output format. + + +\begin{DUclass}{sectionVI} +\DUtitle{level 6% + \label{level-6}% +} +\end{DUclass} + +Unsupported in LaTeX and HTML5 +(HTML5 reserves the 1st level for the document title). + + +\begin{DUclass}{sectionVII} +\DUtitle{level 7% + \label{level-7}% +} +\end{DUclass} + +Unsupported in HTML4. + + +\begin{DUclass}{sectionVIII} +\DUtitle{level 8% + \label{level-8}% +} +\end{DUclass} + +Unsupported in ODT. + + +\section{Section titles with inline markup% + \label{section-titles-with-inline-markup}% + \label{references}% +} + + +\subsection{\emph{emphasized}, H\textsubscript{2}O, $x^2$, and \hyperref[references]{references}% + \label{emphasized-h2o-x-2-and-references}% +} + + +\subsection{Substitutions work% + \label{substitutions-fail}% +} + + +\section{More Tables% + \label{more-tables}% +} + +A table with multi-paragraph multicolumn cells: + +\setlength{\DUtablewidth}{\linewidth}% +\begin{longtable*}{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|} +\hline + +test + & +\textbf{bold hd} + & \multicolumn{3}{p{0.41\DUtablewidth}|}{% +multicolumn 1 + +With a second paragraph +} & +\emph{emph hd} + \\ +\hline +\multicolumn{2}{|p{0.31\DUtablewidth}|}{% +multicolumn 2 + +With a second paragraph +} & +cell + & +cell + & +cell + & +cell + \\ +\hline + +cell + & \multicolumn{2}{p{0.36\DUtablewidth}|}{% +multicolumn 3 (one line, +but very very very very +very looooong) +} & +cell + & +cell + & +cell + \\ +\hline + +cell + & +cell + & +cell + & \multicolumn{3}{p{0.38\DUtablewidth}|}{% +Short multicolumn 4 +} \\ +\hline +\end{longtable*} + +Tables with multi-paragraph multirow cells currently fail due to a LaTeX +limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}). + +A table with multirow header and column-widths set by LaTeX: + +\begin{longtable*}{|l|l|} +\hline +\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ +\cline{2-2} + & \textbf{Description} \\ +\hline +\endfirsthead +\hline +\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ +\cline{2-2} + & \textbf{Description} \\ +\hline +\endhead +\multicolumn{2}{c}{\hfill ... continued on next page} \\ +\endfoot +\endlastfoot +\multicolumn{2}{|l|}{multicollumn cell} \\ +\hline +\end{longtable*} + +In a table with column-widths set by LaTeX, each cell has just one line. +Paragraphs are merged (a warning is given). + +\begin{longtable*}{|l|l|} +\hline +11 & first paragraph +second paragraph +third paragraph \\ +\hline +21 & 22 \\ +\hline +\end{longtable*} + +% This file is used by the standalone_rst_latex test. + + +\section{Option lists% + \label{option-lists}% +} + +The LaTeX-2e description environment is used for definition lists. +The definition is continued on the same line as the term, this should +not happen if an option-list is at the top of the definition. + +If the option list is not at the first element in the definition, it +is contained in a quote + +\begin{quote} +\begin{DUoptionlist} +\item[-{}-help] show help + +\item[-v] verbose +\end{DUoptionlist} +\end{quote} + +\begin{description} +\item[{In a definition list:}] \leavevmode +\begin{DUoptionlist} +\item[-{}-help] show help + +\item[-v] verbose +\end{DUoptionlist} + +\end{description} + + +\section{Monospaced non-alphanumeric characters% + \label{monospaced-non-alphanumeric-characters}% +} + +These are all ASCII characters except a-zA-Z0-9 and space: + +\texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::} + +\texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}} + +\texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} + +The two lines of non-alphanumeric characters should both have the same +width as the third line. + + +\section{Non-ASCII characters% + \label{non-ascii-characters}% +} + +Punctuation and footnote symbols + +\setlength{\DUtablewidth}{\linewidth}% +\begin{longtable*}{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|} +\hline + +– + & +en-dash + \\ +\hline + +— + & +em-dash + \\ +\hline + +‘ + & +single turned comma quotation mark + \\ +\hline + +’ + & +single comma quotation mark + \\ +\hline + +‚ + & +low single comma quotation mark + \\ +\hline + +“ + & +double turned comma quotation mark + \\ +\hline + +” + & +double comma quotation mark + \\ +\hline + +„ + & +low double comma quotation mark + \\ +\hline + +† + & +dagger + \\ +\hline + +‡ + & +double dagger + \\ +\hline + +\ding{169} + & +black diamond suit + \\ +\hline + +\ding{170} + & +black heart suit + \\ +\hline + +♠ + & +black spade suit + \\ +\hline + +♣ + & +black club suit + \\ +\hline + +… + & +ellipsis + \\ +\hline + +™ + & +trade mark sign + \\ +\hline + +⇔ + & +left-right double arrow + \\ +\hline +\end{longtable*} + +The \DUroletitlereference{Latin-1 extended} Unicode block + +\setlength{\DUtablewidth}{\linewidth}% +\begin{longtable*}{|p{0.051\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|} +\hline + +% + & +0 + & +1 + & +2 + & +3 + & +4 + & +5 + & +6 + & +7 + & +8 + & +9 + \\ +\hline + +160 + & & +¡ + & +¢ + & +£ + & & +¥ + & +¦ + & +§ + & +¨ + & +© + \\ +\hline + +170 + & +ª + & +« + & +¬ + & +\- + & +® + & +¯ + & +° + & +± + & +² + & +³ + \\ +\hline + +180 + & +´ + & +µ + & +¶ + & +· + & +¸ + & +¹ + & +º + & +» + & +¼ + & +½ + \\ +\hline + +190 + & +¾ + & +¿ + & +À + & +Á + & +Â + & +Ã + & +Ä + & +Å + & +Æ + & +Ç + \\ +\hline + +200 + & +È + & +É + & +Ê + & +Ë + & +Ì + & +Í + & +Î + & +Ï + & +Ð + & +Ñ + \\ +\hline + +210 + & +Ò + & +Ó + & +Ô + & +Õ + & +Ö + & +× + & +Ø + & +Ù + & +Ú + & +Û + \\ +\hline + +220 + & +Ü + & +Ý + & +Þ + & +ß + & +à + & +á + & +â + & +ã + & +ä + & +å + \\ +\hline + +230 + & +æ + & +ç + & +è + & +é + & +ê + & +ë + & +ì + & +í + & +î + & +ï + \\ +\hline + +240 + & +ð + & +ñ + & +ò + & +ó + & +ô + & +õ + & +ö + & +÷ + & +ø + & +ù + \\ +\hline + +250 + & +ú + & +û + & +ü + & +ý + & +þ + & +ÿ + & & & & \\ +\hline +\end{longtable*} + +\begin{itemize} +\item The following line should not be wrapped, because it uses +no-break spaces (\textbackslash{}u00a0): + +X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X + +\item Line wrapping with/without breakpoints marked by soft hyphens +(\textbackslash{}u00ad): + +pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch + +pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch +\end{itemize} + + +\section{Encoding special chars% + \label{encoding-special-chars}% +} + +The LaTeX Info pages lists under \textquotedbl{}2.18 Special Characters\textquotedbl{} + +\begin{quote} +The following characters play a special role in LaTeX and are called +\textquotedbl{}special printing characters\textquotedbl{}, or simply \textquotedbl{}special characters\textquotedbl{}. + +\begin{quote} +\# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \} +\end{quote} +\end{quote} + +The special chars verbatim: + +\begin{quote} +\begin{alltt} +# $ % & ~ _ ^ \textbackslash{} \{ \} +\end{alltt} +\end{quote} + +However also \emph{square brackets} {[}{]} need special care. + +\begin{quote} +Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check +if the token right after the macro name is an opening bracket. +In that case the contents between that bracket and the following +closing bracket on the same grouping level are taken as the +optional argument. What makes this unintuitive is the fact that +the square brackets aren't grouping characters themselves, so in +your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of +{[}... (without the closing bracket). +\end{quote} + +Compare the items in the following lists: + +\begin{itemize} +\item simple item + +\item {[}bracketed{]} item +\end{itemize} + +\begin{description} +\item[{simple}] +description term + +\item[{{[}bracketed{]}}] +description term + +\end{description} + +The OT1 font-encoding differs from ASCII for the less-than, greater-than +and bar characters (< | >) except for typewriter font \DUroletitlereference{cmtt} +(\texttt{< | >}). + + +\section{Hyperlinks and -targets% + \label{hyperlinks-and-targets}% +} + +In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a +% +\phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or +caption: + +\setlength{\DUtablewidth}{\linewidth}% +\begin{longtable}{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|} +\caption{Table with % +\label{hypertarget-in-table-title}hypertarget in table title.}\\ +\hline + +False + & +True + & +None + \\ +\hline +\end{longtable} +\label{table-label} + +\begin{figure} +\phantomsection\label{figure-label} +\noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} +\caption{Figure with % +\label{hypertarget-in-figure-caption}hypertarget in figure caption.} +\begin{DUlegend} +Legend with % +\phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend. +\end{DUlegend} +\end{figure} + +\includegraphics{../../../docs/user/rst/images/biohazard.png} +\phantomsection\label{image-label} + +See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text}, +\hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title}, +\hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption}, +\hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and +\hyperref[image-label]{image label}. + + +\section{External references% + \label{external-references}% +} + +Long URLs should be wrapped in the PDF. This can be achieved with the +\texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content +(name) of a reference node equals the link URL. + +\begin{description} +\item[{Example:}] +a long URL that should wrap in the output +\url{http://docutils.sourceforge.net/docs/user/latex.html\#id79} + +\end{description} + +If the argument contains any \textquotedbl{}\%\textquotedbl{}, \textquotedbl{}\#\textquotedbl{}, or \textquotedbl{}\textasciicircum{}\textasciicircum{}\textquotedbl{}, or ends with \texttt{\textbackslash{}}, it can't +be used in the argument to another command. The argument must not contain +unbalanced braces. + +The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a \textquotedbl{}http:\textquotedbl{} or \textquotedbl{}ftp:\textquotedbl{} URL +and not recognized as part of it: + +\begin{DUlineblock}{0em} +\item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name +\item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{} +\item[] \url{http://www.example.org/XML}/strange\{n\}ame +\end{DUlineblock} + +They can, however be used in paths and/or filenames. + +Handling by the LaTeX writer: + +\begin{itemize} +\item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped: + +\begin{DUlineblock}{0em} +\item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#} +\url{http://www.w3.org/XML/Schema\#dev} +\item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%} +\url{http://example.org/Schema\%dev} +\item[] \href{A:DOS\\path\\}{file with DOS path} \url{A:DOS\\path\\} +\end{DUlineblock} + +\begin{DUclass}{note} +\begin{DUadmonition} +\DUtitle{Note} + +These URLs are typeset inside a LaTeX command without error. + +\begin{DUlineblock}{0em} +\item[] \url{http://www.w3.org/XML/Schema\#dev} +\item[] \url{http://example.org/Schema\%dev} +\item[] \url{A:DOS\\path\\} +\end{DUlineblock} +\end{DUadmonition} +\end{DUclass} +\end{itemize} + +\begin{itemize} +\item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX's special syntax for characters results in \textquotedbl{}strange\textquotedbl{} replacements +(both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). A warning is given. + +\href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}: +\url{../strange^^name} + +\item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}): + +\begin{quote} +\begin{alltt} +`file with \{ <../strange\{name>`__ +`<../strange\{name>`__ +\end{alltt} +\end{quote} + +while balanced braces are suported: + +\begin{DUlineblock}{0em} +\item[] \url{../strange{n}ame} +\item[] \url{../st{r}ange{n}ame} +\item[] \url{../{st{r}ange{n}ame}} +\end{DUlineblock} +\end{itemize} \section{Block Quotes% diff --git a/docutils/test/functional/expected/latex_memoir.tex b/docutils/test/functional/expected/latex_memoir.tex index 30bdd5ab1..57e8f1001 100644 --- a/docutils/test/functional/expected/latex_memoir.tex +++ b/docutils/test/functional/expected/latex_memoir.tex @@ -4,9 +4,6 @@ \usepackage{ifthen} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} -\DeclareUnicodeCharacter{21D4}{\ensuremath{\Leftrightarrow}} -\DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}} -\DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}} \usepackage{alltt} \usepackage{amsmath} \usepackage[british,french,ngerman,english]{babel} @@ -24,7 +21,6 @@ \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables \usepackage{tabularx} -\usepackage{textcomp} % text symbol macros %%% Custom LaTeX preamble % PDF Standard Fonts @@ -1252,10 +1248,6 @@ allowed (e.g. inside a directive). \DUfootnotetext{footnote-11}{footnote-reference-19}{10}{% \url{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#metadata} } -% -\DUfootnotetext{footnote-12}{footnote-reference-20}{11}{% -\url{A:DOS\\path\\} -} \subsection{2.14.7   Replacement Text% @@ -1922,7 +1914,8 @@ Cases with the \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMS } Test syntax elements which may cause trouble for the LaTeX writer but might -not need to be tested with other writers (e.g. the HTML writer). +not need to be tested with other writers. See also the +\textquotedbl{}latex\_cornercases\textquotedbl{} test. \section{3.1   Custom Roles in LaTeX% @@ -2068,786 +2061,7 @@ writer for image, table, and line block elements. \item[] Tel.: 0123/456789 \end{DUlineblock} - -\section{3.3   More Tables% - \label{more-tables}% -} - -A table with multi-paragraph multicolumn cells: - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|} -\hline - -test - & -\textbf{bold hd} - & \multicolumn{3}{p{0.41\DUtablewidth}|}{% -multicolumn 1 - -With a second paragraph -} & -\emph{emph hd} - \\ -\hline -\multicolumn{2}{|p{0.31\DUtablewidth}|}{% -multicolumn 2 - -With a second paragraph -} & -cell - & -cell - & -cell - & -cell - \\ -\hline - -cell - & \multicolumn{2}{p{0.36\DUtablewidth}|}{% -multicolumn 3 (one line, -but very very very very -very looooong) -} & -cell - & -cell - & -cell - \\ -\hline - -cell - & -cell - & -cell - & \multicolumn{3}{p{0.38\DUtablewidth}|}{% -Short multicolumn 4 -} \\ -\hline -\end{longtable*} - -Tables with multi-paragraph multirow cells currently fail due to a LaTeX -limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}). - -A table with multirow header and column-widths set by LaTeX: - -\begin{longtable*}{|l|l|} -\hline -\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ -\cline{2-2} - & \textbf{Description} \\ -\hline -\endfirsthead -\hline -\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ -\cline{2-2} - & \textbf{Description} \\ -\hline -\endhead -\multicolumn{2}{c}{\hfill ... continued on next page} \\ -\endfoot -\endlastfoot -\multicolumn{2}{|l|}{multicollumn cell} \\ -\hline -\end{longtable*} - -In a table with column-widths set by LaTeX, each cell has just one line. -Paragraphs are merged (a warning is given). - -\begin{longtable*}{|l|l|} -\hline -11 & first paragraph -second paragraph -third paragraph \\ -\hline -21 & 22 \\ -\hline -\end{longtable*} - -% This file is used by the standalone_rst_latex test. - - -\section{3.4   Option lists% - \label{option-lists-1}% -} - -The LaTeX-2e description environment is used for definition lists. -The definition is continued on the same line as the term, this should -not happen if a option-list is at the top of the definition. - -If the option list is not at the first element in the definition, it -is contained in a quote - -\begin{quote} -\begin{DUoptionlist} -\item[-{}-help] show help - -\item[-v] verbose -\end{DUoptionlist} -\end{quote} - -\begin{description} -\item[{In a definition list:}] \leavevmode -\begin{DUoptionlist} -\item[-{}-help] show help - -\item[-v] verbose -\end{DUoptionlist} - -\end{description} - - -\section{3.5   Monospaced non-alphanumeric characters% - \label{monospaced-non-alphanumeric-characters}% -} - -These are all ASCII characters except a-zA-Z0-9 and space: - -\texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::} - -\texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}} - -\texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} - -The two lines of non-alphanumeric characters should both have the same -width as the third line. - - -\section{3.6   Non-ASCII characters% - \label{non-ascii-characters}% -} - -Punctuation and footnote symbols - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|} -\hline - -– - & -en-dash - \\ -\hline - -— - & -em-dash - \\ -\hline - -‘ - & -single turned comma quotation mark - \\ -\hline - -’ - & -single comma quotation mark - \\ -\hline - -‚ - & -low single comma quotation mark - \\ -\hline - -“ - & -double turned comma quotation mark - \\ -\hline - -” - & -double comma quotation mark - \\ -\hline - -„ - & -low double comma quotation mark - \\ -\hline - -† - & -dagger - \\ -\hline - -‡ - & -double dagger - \\ -\hline - -\ding{169} - & -black diamond suit - \\ -\hline - -\ding{170} - & -black heart suit - \\ -\hline - -♠ - & -black spade suit - \\ -\hline - -♣ - & -black club suit - \\ -\hline - -… - & -ellipsis - \\ -\hline - -™ - & -trade mark sign - \\ -\hline - -⇔ - & -left-right double arrow - \\ -\hline -\end{longtable*} - -The \DUroletitlereference{Latin-1 extended} Unicode block - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.051\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|} -\hline - -% - & -0 - & -1 - & -2 - & -3 - & -4 - & -5 - & -6 - & -7 - & -8 - & -9 - \\ -\hline - -160 - & & -¡ - & -¢ - & -£ - & & -¥ - & -¦ - & -§ - & -¨ - & -© - \\ -\hline - -170 - & -ª - & -« - & -¬ - & -\- - & -® - & -¯ - & -° - & -± - & -² - & -³ - \\ -\hline - -180 - & -´ - & -µ - & -¶ - & -· - & -¸ - & -¹ - & -º - & -» - & -¼ - & -½ - \\ -\hline - -190 - & -¾ - & -¿ - & -À - & -Á - & -Â - & -Ã - & -Ä - & -Å - & -Æ - & -Ç - \\ -\hline - -200 - & -È - & -É - & -Ê - & -Ë - & -Ì - & -Í - & -Î - & -Ï - & -Ð - & -Ñ - \\ -\hline - -210 - & -Ò - & -Ó - & -Ô - & -Õ - & -Ö - & -× - & -Ø - & -Ù - & -Ú - & -Û - \\ -\hline - -220 - & -Ü - & -Ý - & -Þ - & -ß - & -à - & -á - & -â - & -ã - & -ä - & -å - \\ -\hline - -230 - & -æ - & -ç - & -è - & -é - & -ê - & -ë - & -ì - & -í - & -î - & -ï - \\ -\hline - -240 - & -ð - & -ñ - & -ò - & -ó - & -ô - & -õ - & -ö - & -÷ - & -ø - & -ù - \\ -\hline - -250 - & -ú - & -û - & -ü - & -ý - & -þ - & -ÿ - & & & & \\ -\hline -\end{longtable*} - -\begin{itemize} -\item The following line should not be wrapped, because it uses -no-break spaces (\textbackslash{}u00a0): - -X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X - -\item Line wrapping with/without breakpoints marked by soft hyphens -(\textbackslash{}u00ad): - -pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch - -pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch -\end{itemize} - - -\section{3.7   Encoding special chars% - \label{encoding-special-chars}% -} - -The LaTeX Info pages lists under \textquotedbl{}2.18 Special Characters\textquotedbl{} - -\begin{quote} -The following characters play a special role in LaTeX and are called -\textquotedbl{}special printing characters\textquotedbl{}, or simply \textquotedbl{}special characters\textquotedbl{}. - -\begin{quote} -\# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \} -\end{quote} -\end{quote} - -The special chars verbatim: - -\begin{quote} -\begin{alltt} -# $ % & ~ _ ^ \textbackslash{} \{ \} -\end{alltt} -\end{quote} - -However also \emph{square brackets} {[}{]} need special care. - -\begin{quote} -Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check -if the token right after the macro name is an opening bracket. -In that case the contents between that bracket and the following -closing bracket on the same grouping level are taken as the -optional argument. What makes this unintuitive is the fact that -the square brackets aren't grouping characters themselves, so in -your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of -{[}... (without the closing bracket). -\end{quote} - -Compare the items in the following lists: - -\begin{itemize} -\item simple item - -\item {[}bracketed{]} item -\end{itemize} - -\begin{description} -\item[{simple}] -description term - -\item[{{[}bracketed{]}}] -description term - -\end{description} - -The OT1 font-encoding has different characters for the less-than, -greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}: - -\begin{quote} -\begin{alltt} -< | > -\end{alltt} -\end{quote} - - -\section{3.8   Hyperlinks and -targets% - \label{hyperlinks-and-targets}% -} - -In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a -% -\phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or -caption: - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable}{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|} -\caption{Table with % -\label{hypertarget-in-table-title}hypertarget in table title.}\\ -\hline - -False - & -True - & -None - \\ -\hline -\end{longtable} -\label{table-label} - -\begin{figure} -\phantomsection\label{figure-label} -\noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} -\caption{Figure with % -\label{hypertarget-in-figure-caption}hypertarget in figure caption.} -\begin{DUlegend} -Legend with % -\phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend. -\end{DUlegend} -\end{figure} - -\includegraphics{../../../docs/user/rst/images/biohazard.png} -\phantomsection\label{image-label} - -See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text}, -\hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title}, -\hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption}, -\hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and -\hyperref[image-label]{image label}. - - -\section{3.9   External references% - \label{external-references}% -} - -Long URLs should be wrapped in the PDF. This can be achieved with the -\texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content -(name) of a reference node equals the link URL. - -\begin{description} -\item[{Example:}] -a long URL that should wrap in the output -\url{http://docutils.sourceforge.net/docs/user/latex.html\#id79} - -\end{description} - -If the argument contains any \textquotedbl{}\%\textquotedbl{}, \textquotedbl{}\#\textquotedbl{}, or \textquotedbl{}\textasciicircum{}\textasciicircum{}\textquotedbl{}, or ends with \texttt{\textbackslash{}}, it can't -be used in the argument to another command. The argument must not contain -unbalanced braces. - -The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a \textquotedbl{}http:\textquotedbl{} or \textquotedbl{}ftp:\textquotedbl{} URL -and not recognized as part of it: - -\begin{DUlineblock}{0em} -\item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name -\item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{} -\item[] \url{http://www.example.org/XML}/strange\{n\}ame -\end{DUlineblock} - -They can, however be used in paths and/or filenames. - -Handling by the LaTeX writer: - -\begin{itemize} -\item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped: - -\begin{DUlineblock}{0em} -\item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#} -\url{http://www.w3.org/XML/Schema\#dev} -\item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%} -\url{http://example.org/Schema\%dev} -\item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{footnote-reference-20}{footnote-12}{11} \url{A:DOS\\path\\}\DUfootnotemark{footnote-reference-21}{footnote-12}{11} -\end{DUlineblock} - -\DUadmonition[note]{ -\DUtitle[note]{Note} - -These URLs are typeset inside a LaTeX command without error. - -\begin{DUlineblock}{0em} -\item[] \url{http://www.w3.org/XML/Schema\#dev} -\item[] \url{http://example.org/Schema\%dev} -\item[] \url{A:DOS\\path\\}\DUfootnotemark{footnote-reference-22}{footnote-12}{11} -\end{DUlineblock} -} -\end{itemize} - -\begin{itemize} -\item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX's special syntax for characters results in \textquotedbl{}strange\textquotedbl{} replacements -(both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). A warning is given. - -\href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}: -\url{../strange^^name} - -\item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}): - -\begin{quote} -\begin{alltt} -`file with \{ <../strange\{name>`__ -`<../strange\{name>`__ -\end{alltt} -\end{quote} - -while balanced braces are suported: - -\begin{DUlineblock}{0em} -\item[] \url{../strange{n}ame} -\item[] \url{../st{r}ange{n}ame} -\item[] \url{../{st{r}ange{n}ame}} -\end{DUlineblock} -\end{itemize} - - -\section{3.10   Section titles with \hyperref[inline-markup]{inline markup}% - \label{section-titles-with-inline-markup}% -} - - -\subsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$% - \label{emphasized-h2o-and-x-2}% -} - - -\subsection{3.10.2   Substitutions work% - \label{substitutions-fail}% -} - - -\section{3.11   Deeply nested sections% - \label{deeply-nested-sections}% -} - -In LaTeX and HTML, - - -\subsection{3.11.1   Level 3% - \label{level-3}% -} - -nested sections - - -\subsubsection{3.11.1.1   level 4% - \label{level-4}% -} - -reach at some level - - -\paragraph{3.11.1.1.1   level 5% - \label{level-5}% -} - -(depending on the document class) - - -\subparagraph{3.11.1.1.1.1   level 6% - \label{level-6}% -} - -an unsupported level. - -% unusual combinations (currently separately tested) -% .. include:: data/latex_cornercases.txt - -% Preface for System Messages: +% preface for System Messages: \chapter{4   Error Handling% diff --git a/docutils/test/functional/expected/misc_rst_html4css1.html b/docutils/test/functional/expected/misc_rst_html4css1.html index dd92ac0d6..b6e94b6e9 100644 --- a/docutils/test/functional/expected/misc_rst_html4css1.html +++ b/docutils/test/functional/expected/misc_rst_html4css1.html @@ -4,22 +4,60 @@ -link_in_substitution.txt +Additional tests with html4css1 + + -
+
+

Additional tests with html4css1

- -

Test the interaction of transforms.references.Substitutions and -transforms.references.ExternalLinks.

-

reStructuredText is cool!

-

There is a preferred alternative:

-

reStructuredText is cool!

-

This only works for the case where the entire substitution is a -reference, not when the reference is embedded as part of the -substitution:

-

unstructured reStructuredText is uncool!

+
+

Section heading levels

+
+
+

Level 1

+

Nested sections

+
+

Level 2

+

reach at some level

+
+

Level 3

+

(depending on the document class and output format)

+
+

level 4

+

a level

+
+
level 5
+

that is not supported by the output format.

+
+
level 6
+

Unsupported in LaTeX and HTML5 +(HTML5 reserves the 1st level for the document title).

+
+
level 7
+

Unsupported in HTML4.

+
+
level 8
+

Unsupported in ODT.

+
+
+
+
+
+
+
+
+
+

Section titles with inline markup

+
+

emphasized, H2O, x2, and references

+
+
+

Substitutions work

+
+
diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex index bd2fd3abc..60c20d63c 100644 --- a/docutils/test/functional/expected/standalone_rst_latex.tex +++ b/docutils/test/functional/expected/standalone_rst_latex.tex @@ -4,9 +4,6 @@ \usepackage{ifthen} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} -\DeclareUnicodeCharacter{21D4}{\ensuremath{\Leftrightarrow}} -\DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}} -\DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}} \usepackage{alltt} \usepackage{amsmath} \usepackage[british,french,ngerman,english]{babel} @@ -24,7 +21,6 @@ \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables \usepackage{tabularx} -\usepackage{textcomp} % text symbol macros %%% Custom LaTeX preamble % PDF Standard Fonts @@ -1273,10 +1269,6 @@ allowed (e.g. inside a directive). \DUfootnotetext{footnote-11}{footnote-reference-19}{10}{% \url{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#metadata} } -% -\DUfootnotetext{footnote-12}{footnote-reference-20}{11}{% -\url{A:DOS\\path\\} -} \subsubsection{2.14.7   Replacement Text% @@ -1944,7 +1936,8 @@ Cases with the \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMS } Test syntax elements which may cause trouble for the LaTeX writer but might -not need to be tested with other writers (e.g. the HTML writer). +not need to be tested with other writers. See also the +“latex\_cornercases” test. \subsection{3.1   Custom Roles in LaTeX% @@ -2090,790 +2083,7 @@ writer for image, table, and line block elements. \item[] Tel.: 0123/456789 \end{DUlineblock} - -\subsection{3.3   More Tables% - \label{more-tables}% -} - -A table with multi-paragraph multicolumn cells: - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|} -\hline - -test - & -\textbf{bold hd} - & \multicolumn{3}{p{0.41\DUtablewidth}|}{% -multicolumn 1 - -With a second paragraph -} & -\emph{emph hd} - \\ -\hline -\multicolumn{2}{|p{0.31\DUtablewidth}|}{% -multicolumn 2 - -With a second paragraph -} & -cell - & -cell - & -cell - & -cell - \\ -\hline - -cell - & \multicolumn{2}{p{0.36\DUtablewidth}|}{% -multicolumn 3 (one line, -but very very very very -very looooong) -} & -cell - & -cell - & -cell - \\ -\hline - -cell - & -cell - & -cell - & \multicolumn{3}{p{0.38\DUtablewidth}|}{% -Short multicolumn 4 -} \\ -\hline -\end{longtable*} - -Tables with multi-paragraph multirow cells currently fail due to a LaTeX -limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}). - -A table with multirow header and column-widths set by LaTeX: - -\begin{longtable*}{|l|l|} -\hline -\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ -\cline{2-2} - & \textbf{Description} \\ -\hline -\endfirsthead -\hline -\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ -\cline{2-2} - & \textbf{Description} \\ -\hline -\endhead -\multicolumn{2}{c}{\hfill ... continued on next page} \\ -\endfoot -\endlastfoot -\multicolumn{2}{|l|}{multicollumn cell} \\ -\hline -\end{longtable*} - -In a table with column-widths set by LaTeX, each cell has just one line. -Paragraphs are merged (a warning is given). - -\begin{longtable*}{|l|l|} -\hline -11 & first paragraph -second paragraph -third paragraph \\ -\hline -21 & 22 \\ -\hline -\end{longtable*} - -% This file is used by the standalone_rst_latex test. - - -\subsection{3.4   Option lists% - \label{option-lists-1}% -} - -The LaTeX-2e description environment is used for definition lists. -The definition is continued on the same line as the term, this should -not happen if a option-list is at the top of the definition. - -If the option list is not at the first element in the definition, it -is contained in a quote - -\begin{quote} -\begin{DUoptionlist} -\item[-{}-help] show help - -\item[-v] verbose -\end{DUoptionlist} -\end{quote} - -\begin{description} -\item[{In a definition list:}] \leavevmode -\begin{DUoptionlist} -\item[-{}-help] show help - -\item[-v] verbose -\end{DUoptionlist} - -\end{description} - - -\subsection{3.5   Monospaced non-alphanumeric characters% - \label{monospaced-non-alphanumeric-characters}% -} - -These are all ASCII characters except a-zA-Z0-9 and space: - -\texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::} - -\texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}} - -\texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} - -The two lines of non-alphanumeric characters should both have the same -width as the third line. - - -\subsection{3.6   Non-ASCII characters% - \label{non-ascii-characters}% -} - -Punctuation and footnote symbols - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|} -\hline - -– - & -en-dash - \\ -\hline - -— - & -em-dash - \\ -\hline - -‘ - & -single turned comma quotation mark - \\ -\hline - -’ - & -single comma quotation mark - \\ -\hline - -‚ - & -low single comma quotation mark - \\ -\hline - -“ - & -double turned comma quotation mark - \\ -\hline - -” - & -double comma quotation mark - \\ -\hline - -„ - & -low double comma quotation mark - \\ -\hline - -† - & -dagger - \\ -\hline - -‡ - & -double dagger - \\ -\hline - -\ding{169} - & -black diamond suit - \\ -\hline - -\ding{170} - & -black heart suit - \\ -\hline - -♠ - & -black spade suit - \\ -\hline - -♣ - & -black club suit - \\ -\hline - -… - & -ellipsis - \\ -\hline - -™ - & -trade mark sign - \\ -\hline - -⇔ - & -left-right double arrow - \\ -\hline -\end{longtable*} - -The \DUroletitlereference{Latin-1 extended} Unicode block - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.051\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|} -\hline - -% - & -0 - & -1 - & -2 - & -3 - & -4 - & -5 - & -6 - & -7 - & -8 - & -9 - \\ -\hline - -160 - & & -¡ - & -¢ - & -£ - & & -¥ - & -¦ - & -§ - & -¨ - & -© - \\ -\hline - -170 - & -ª - & -« - & -¬ - & -\- - & -® - & -¯ - & -° - & -± - & -² - & -³ - \\ -\hline - -180 - & -´ - & -µ - & -¶ - & -· - & -¸ - & -¹ - & -º - & -» - & -¼ - & -½ - \\ -\hline - -190 - & -¾ - & -¿ - & -À - & -Á - & -Â - & -Ã - & -Ä - & -Å - & -Æ - & -Ç - \\ -\hline - -200 - & -È - & -É - & -Ê - & -Ë - & -Ì - & -Í - & -Î - & -Ï - & -Ð - & -Ñ - \\ -\hline - -210 - & -Ò - & -Ó - & -Ô - & -Õ - & -Ö - & -× - & -Ø - & -Ù - & -Ú - & -Û - \\ -\hline - -220 - & -Ü - & -Ý - & -Þ - & -ß - & -à - & -á - & -â - & -ã - & -ä - & -å - \\ -\hline - -230 - & -æ - & -ç - & -è - & -é - & -ê - & -ë - & -ì - & -í - & -î - & -ï - \\ -\hline - -240 - & -ð - & -ñ - & -ò - & -ó - & -ô - & -õ - & -ö - & -÷ - & -ø - & -ù - \\ -\hline - -250 - & -ú - & -û - & -ü - & -ý - & -þ - & -ÿ - & & & & \\ -\hline -\end{longtable*} - -\begin{itemize} -\item The following line should not be wrapped, because it uses -no-break spaces (\textbackslash{}u00a0): - -X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X - -\item Line wrapping with/without breakpoints marked by soft hyphens -(\textbackslash{}u00ad): - -pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch - -pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch -\end{itemize} - - -\subsection{3.7   Encoding special chars% - \label{encoding-special-chars}% -} - -The LaTeX Info pages lists under “2.18 Special Characters” - -\begin{quote} -The following characters play a special role in LaTeX and are called -“special printing characters”, or simply “special characters”. - -\begin{quote} -\# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \} -\end{quote} -\end{quote} - -The special chars verbatim: - -\begin{quote} -\begin{alltt} -# $ % & ~ _ ^ \textbackslash{} \{ \} -\end{alltt} -\end{quote} - -However also \emph{square brackets} {[}{]} need special care. - -\begin{quote} -Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check -if the token right after the macro name is an opening bracket. -In that case the contents between that bracket and the following -closing bracket on the same grouping level are taken as the -optional argument. What makes this unintuitive is the fact that -the square brackets aren’t grouping characters themselves, so in -your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of -{[}… (without the closing bracket). -\end{quote} - -Compare the items in the following lists: - -\begin{itemize} -\item simple item - -\item {[}bracketed{]} item -\end{itemize} - -\begin{description} -\item[{simple}] -description term - -\item[{{[}bracketed{]}}] -description term - -\end{description} - -The OT1 font-encoding has different characters for the less-than, -greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}: - -\begin{quote} -\begin{alltt} -< | > -\end{alltt} -\end{quote} - - -\subsection{3.8   Hyperlinks and -targets% - \label{hyperlinks-and-targets}% -} - -In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a -% -\phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or -caption: - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable}{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|} -\caption{Table with % -\label{hypertarget-in-table-title}hypertarget in table title.}\\ -\hline - -False - & -True - & -None - \\ -\hline -\end{longtable} -\label{table-label} - -\begin{figure} -\phantomsection\label{figure-label} -\noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} -\caption{Figure with % -\label{hypertarget-in-figure-caption}hypertarget in figure caption.} -\begin{DUlegend} -Legend with % -\phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend. -\end{DUlegend} -\end{figure} - -\includegraphics{../../../docs/user/rst/images/biohazard.png} -\phantomsection\label{image-label} - -See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text}, -\hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title}, -\hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption}, -\hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and -\hyperref[image-label]{image label}. - - -\subsection{3.9   External references% - \label{external-references}% -} - -Long URLs should be wrapped in the PDF. This can be achieved with the -\texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content -(name) of a reference node equals the link URL. - -\begin{description} -\item[{Example:}] -a long URL that should wrap in the output -\url{http://docutils.sourceforge.net/docs/user/latex.html\#id79} - -\end{description} - -If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t -be used in the argument to another command. The argument must not contain -unbalanced braces. - -The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL -and not recognized as part of it: - -\begin{DUlineblock}{0em} -\item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name -\item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{} -\item[] \url{http://www.example.org/XML}/strange\{n\}ame -\end{DUlineblock} - -They can, however be used in paths and/or filenames. - -Handling by the LaTeX writer: - -\begin{itemize} -\item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped: - -\begin{DUlineblock}{0em} -\item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#} -\url{http://www.w3.org/XML/Schema\#dev} -\item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%} -\url{http://example.org/Schema\%dev} -\item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{footnote-reference-20}{footnote-12}{11} \url{A:DOS\\path\\}\DUfootnotemark{footnote-reference-21}{footnote-12}{11} -\end{DUlineblock} - -\begin{DUclass}{note} -\begin{DUadmonition} -\DUtitle{Note} - -These URLs are typeset inside a LaTeX command without error. - -\begin{DUlineblock}{0em} -\item[] \url{http://www.w3.org/XML/Schema\#dev} -\item[] \url{http://example.org/Schema\%dev} -\item[] \url{A:DOS\\path\\}\DUfootnotemark{footnote-reference-22}{footnote-12}{11} -\end{DUlineblock} -\end{DUadmonition} -\end{DUclass} -\end{itemize} - -\begin{itemize} -\item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX’s special syntax for characters results in “strange” replacements -(both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). A warning is given. - -\href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}: -\url{../strange^^name} - -\item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}): - -\begin{quote} -\begin{alltt} -`file with \{ <../strange\{name>`__ -`<../strange\{name>`__ -\end{alltt} -\end{quote} - -while balanced braces are suported: - -\begin{DUlineblock}{0em} -\item[] \url{../strange{n}ame} -\item[] \url{../st{r}ange{n}ame} -\item[] \url{../{st{r}ange{n}ame}} -\end{DUlineblock} -\end{itemize} - - -\subsection{3.10   Section titles with \hyperref[inline-markup]{inline markup}% - \label{section-titles-with-inline-markup}% -} - - -\subsubsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$% - \label{emphasized-h2o-and-x-2}% -} - - -\subsubsection{3.10.2   Substitutions work% - \label{substitutions-fail}% -} - - -\subsection{3.11   Deeply nested sections% - \label{deeply-nested-sections}% -} - -In LaTeX and HTML, - - -\subsubsection{3.11.1   Level 3% - \label{level-3}% -} - -nested sections - - -\paragraph{3.11.1.1   level 4% - \label{level-4}% -} - -reach at some level - - -\subparagraph{3.11.1.1.1   level 5% - \label{level-5}% -} - -(depending on the document class) - - -\begin{DUclass}{sectionVI} -\DUtitle{3.11.1.1.1.1   level 6% - \label{level-6}% -} -\end{DUclass} - -an unsupported level. - -% unusual combinations (currently separately tested) -% .. include:: data/latex_cornercases.txt - -% Preface for System Messages: +% preface for System Messages: \section{4   Error Handling% diff --git a/docutils/test/functional/expected/standalone_rst_xetex.tex b/docutils/test/functional/expected/standalone_rst_xetex.tex index fff783b69..cc91acd4a 100644 --- a/docutils/test/functional/expected/standalone_rst_xetex.tex +++ b/docutils/test/functional/expected/standalone_rst_xetex.tex @@ -1141,10 +1141,6 @@ allowed (e.g. inside a directive). \DUfootnotetext{footnote-12}{footnote-reference-20}{11}{% \url{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#metadata} } -% -\DUfootnotetext{footnote-13}{footnote-reference-21}{12}{% -\url{A:DOS\\path\\} -} \subsubsection{2.14.7   Replacement Text% @@ -1812,7 +1808,8 @@ Cases with the \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMS } Test syntax elements which may cause trouble for the LaTeX writer but might -not need to be tested with other writers (e.g. the HTML writer). +not need to be tested with other writers. See also the +“latex\_cornercases” test. \subsection{3.1   Custom Roles in LaTeX% @@ -1958,785 +1955,7 @@ writer for image, table, and line block elements. \item[] Tel.: 0123/456789 \end{DUlineblock} - -\subsection{3.3   More Tables% - \label{more-tables}% -} - -A table with multi-paragraph multicolumn cells: - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.133\DUtablewidth}|p{0.179\DUtablewidth}|p{0.179\DUtablewidth}|p{0.110\DUtablewidth}|p{0.121\DUtablewidth}|p{0.145\DUtablewidth}|} -\hline - -test - & -\textbf{bold hd} - & \multicolumn{3}{p{0.41\DUtablewidth}|}{% -multicolumn 1 - -With a second paragraph -} & -\emph{emph hd} - \\ -\hline -\multicolumn{2}{|p{0.31\DUtablewidth}|}{% -multicolumn 2 - -With a second paragraph -} & -cell - & -cell - & -cell - & -cell - \\ -\hline - -cell - & \multicolumn{2}{p{0.36\DUtablewidth}|}{% -multicolumn 3 (one line, -but very very very very -very looooong) -} & -cell - & -cell - & -cell - \\ -\hline - -cell - & -cell - & -cell - & \multicolumn{3}{p{0.38\DUtablewidth}|}{% -Short multicolumn 4 -} \\ -\hline -\end{longtable*} - -Tables with multi-paragraph multirow cells currently fail due to a LaTeX -limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}). - -A table with multirow header and column-widths set by LaTeX: - -\begin{longtable*}{|l|l|} -\hline -\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ -\cline{2-2} - & \textbf{Description} \\ -\hline -\endfirsthead -\hline -\multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\ -\cline{2-2} - & \textbf{Description} \\ -\hline -\endhead -\multicolumn{2}{c}{\hfill ... continued on next page} \\ -\endfoot -\endlastfoot -\multicolumn{2}{|l|}{multicollumn cell} \\ -\hline -\end{longtable*} - -In a table with column-widths set by LaTeX, each cell has just one line. -Paragraphs are merged (a warning is given). - -\begin{longtable*}{|l|l|} -\hline -11 & first paragraph -second paragraph -third paragraph \\ -\hline -21 & 22 \\ -\hline -\end{longtable*} - -% This file is used by the standalone_rst_latex test. - - -\subsection{3.4   Option lists% - \label{option-lists-1}% -} - -The LaTeX-2e description environment is used for definition lists. -The definition is continued on the same line as the term, this should -not happen if a option-list is at the top of the definition. - -If the option list is not at the first element in the definition, it -is contained in a quote - -\begin{quote} -\begin{DUoptionlist} -\item[--help] show help - -\item[-v] verbose -\end{DUoptionlist} -\end{quote} - -\begin{description} -\item[{In a definition list:}] \leavevmode -\begin{DUoptionlist} -\item[--help] show help - -\item[-v] verbose -\end{DUoptionlist} - -\end{description} - - -\subsection{3.5   Monospaced non-alphanumeric characters% - \label{monospaced-non-alphanumeric-characters}% -} - -These are all ASCII characters except a-zA-Z0-9 and space: - -\texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'''((()))***+++,,,---...///:::} - -\texttt{;;;<<<===>>>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_```\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}} - -\texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} - -The two lines of non-alphanumeric characters should both have the same -width as the third line. - - -\subsection{3.6   Non-ASCII characters% - \label{non-ascii-characters}% -} - -Punctuation and footnote symbols - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|} -\hline - -– - & -en-dash - \\ -\hline - -— - & -em-dash - \\ -\hline - -‘ - & -single turned comma quotation mark - \\ -\hline - -’ - & -single comma quotation mark - \\ -\hline - -‚ - & -low single comma quotation mark - \\ -\hline - -“ - & -double turned comma quotation mark - \\ -\hline - -” - & -double comma quotation mark - \\ -\hline - -„ - & -low double comma quotation mark - \\ -\hline - -† - & -dagger - \\ -\hline - -‡ - & -double dagger - \\ -\hline - -♦ - & -black diamond suit - \\ -\hline - -♥ - & -black heart suit - \\ -\hline - -♠ - & -black spade suit - \\ -\hline - -♣ - & -black club suit - \\ -\hline - -… - & -ellipsis - \\ -\hline - -™ - & -trade mark sign - \\ -\hline - -⇔ - & -left-right double arrow - \\ -\hline -\end{longtable*} - -The \DUroletitlereference{Latin-1 extended} Unicode block - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable*}{|p{0.051\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|p{0.028\DUtablewidth}|} -\hline - % - & -0 - & -1 - & -2 - & -3 - & -4 - & -5 - & -6 - & -7 - & -8 - & -9 - \\ -\hline - -160 - & & -¡ - & -¢ - & -£ - & & -¥ - & -¦ - & -§ - & -¨ - & -© - \\ -\hline - -170 - & -ª - & -« - & -¬ - & -\- - & -® - & -¯ - & -° - & -± - & -² - & -³ - \\ -\hline - -180 - & -´ - & -µ - & -¶ - & -· - & -¸ - & -¹ - & -º - & -» - & -¼ - & -½ - \\ -\hline - -190 - & -¾ - & -¿ - & -À - & -Á - & -Â - & -Ã - & -Ä - & -Å - & -Æ - & -Ç - \\ -\hline - -200 - & -È - & -É - & -Ê - & -Ë - & -Ì - & -Í - & -Î - & -Ï - & -Ð - & -Ñ - \\ -\hline - -210 - & -Ò - & -Ó - & -Ô - & -Õ - & -Ö - & -× - & -Ø - & -Ù - & -Ú - & -Û - \\ -\hline - -220 - & -Ü - & -Ý - & -Þ - & -ß - & -à - & -á - & -â - & -ã - & -ä - & -å - \\ -\hline - -230 - & -æ - & -ç - & -è - & -é - & -ê - & -ë - & -ì - & -í - & -î - & -ï - \\ -\hline - -240 - & -ð - & -ñ - & -ò - & -ó - & -ô - & -õ - & -ö - & -÷ - & -ø - & -ù - \\ -\hline - -250 - & -ú - & -û - & -ü - & -ý - & -þ - & -ÿ - & & & & \\ -\hline -\end{longtable*} - -\begin{itemize} -\item The following line should not be wrapped, because it uses -no-break spaces (\textbackslash{}u00a0): - -X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X - -\item Line wrapping with/without breakpoints marked by soft hyphens -(\textbackslash{}u00ad): - -pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch - -pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch -\end{itemize} - - -\subsection{3.7   Encoding special chars% - \label{encoding-special-chars}% -} - -The LaTeX Info pages lists under “2.18 Special Characters” - -\begin{quote} -The following characters play a special role in LaTeX and are called -“special printing characters”, or simply “special characters”. - -\begin{quote} -\# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \} -\end{quote} -\end{quote} - -The special chars verbatim: - -\begin{quote} -\begin{alltt} -# $ % & ~ _ ^ \textbackslash{} \{ \} -\end{alltt} -\end{quote} - -However also \emph{square brackets} {[}{]} need special care. - -\begin{quote} -Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check -if the token right after the macro name is an opening bracket. -In that case the contents between that bracket and the following -closing bracket on the same grouping level are taken as the -optional argument. What makes this unintuitive is the fact that -the square brackets aren’t grouping characters themselves, so in -your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of -{[}… (without the closing bracket). -\end{quote} - -Compare the items in the following lists: - -\begin{itemize} -\item simple item - -\item {[}bracketed{]} item -\end{itemize} - -\begin{description} -\item[{simple}] -description term - -\item[{{[}bracketed{]}}] -description term - -\end{description} - -The OT1 font-encoding has different characters for the less-than, -greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}: - -\begin{quote} -\begin{alltt} -< | > -\end{alltt} -\end{quote} - - -\subsection{3.8   Hyperlinks and -targets% - \label{hyperlinks-and-targets}% -} - -In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a -% -\phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or -caption: - -\setlength{\DUtablewidth}{\linewidth}% -\begin{longtable}{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|} -\caption{Table with % -\label{hypertarget-in-table-title}hypertarget in table title.}\\ -\hline - -False - & -True - & -None - \\ -\hline -\end{longtable} -\label{table-label} - -\begin{figure} -\phantomsection\label{figure-label} -\noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}} -\caption{Figure with % -\label{hypertarget-in-figure-caption}hypertarget in figure caption.} -\begin{DUlegend} -Legend with % -\phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend. -\end{DUlegend} -\end{figure} - -\includegraphics{../../../docs/user/rst/images/biohazard.png} -\phantomsection\label{image-label} - -See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text}, -\hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title}, -\hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption}, -\hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and -\hyperref[image-label]{image label}. - - -\subsection{3.9   External references% - \label{external-references}% -} - -Long URLs should be wrapped in the PDF. This can be achieved with the -\texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content -(name) of a reference node equals the link URL. - -\begin{description} -\item[{Example:}] -a long URL that should wrap in the output -\url{http://docutils.sourceforge.net/docs/user/latex.html\#id79} - -\end{description} - -If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t -be used in the argument to another command. The argument must not contain -unbalanced braces. - -The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL -and not recognized as part of it: - -\begin{DUlineblock}{0em} -\item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name -\item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{} -\item[] \url{http://www.example.org/XML}/strange\{n\}ame -\end{DUlineblock} - -They can, however be used in paths and/or filenames. - -Handling by the LaTeX writer: - -\begin{itemize} -\item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped: - -\begin{DUlineblock}{0em} -\item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#} -\url{http://www.w3.org/XML/Schema\#dev} -\item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%} -\url{http://example.org/Schema\%dev} -\item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{footnote-reference-21}{footnote-13}{12} \url{A:DOS\\path\\}\DUfootnotemark{footnote-reference-22}{footnote-13}{12} -\end{DUlineblock} - -\begin{DUclass}{note} -\begin{DUadmonition} -\DUtitle{Note} - -These URLs are typeset inside a LaTeX command without error. - -\begin{DUlineblock}{0em} -\item[] \url{http://www.w3.org/XML/Schema\#dev} -\item[] \url{http://example.org/Schema\%dev} -\item[] \url{A:DOS\\path\\}\DUfootnotemark{footnote-reference-23}{footnote-13}{12} -\end{DUlineblock} -\end{DUadmonition} -\end{DUclass} -\end{itemize} - -\begin{itemize} -\item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX’s special syntax for characters results in “strange” replacements -(both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). A warning is given. - -\href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}: -\url{../strange^^name} - -\item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}): - -\begin{quote} -\begin{alltt} -`file with \{ <../strange\{name>`__ -`<../strange\{name>`__ -\end{alltt} -\end{quote} - -while balanced braces are suported: - -\begin{DUlineblock}{0em} -\item[] \url{../strange{n}ame} -\item[] \url{../st{r}ange{n}ame} -\item[] \url{../{st{r}ange{n}ame}} -\end{DUlineblock} -\end{itemize} - - -\subsection{3.10   Section titles with \hyperref[inline-markup]{inline markup}% - \label{section-titles-with-inline-markup}% -} - - -\subsubsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$% - \label{emphasized-h2o-and-x-2}% -} - - -\subsubsection{3.10.2   Substitutions work% - \label{substitutions-fail}% -} - - -\subsection{3.11   Deeply nested sections% - \label{deeply-nested-sections}% -} - -In LaTeX and HTML, - - -\subsubsection{3.11.1   Level 3% - \label{level-3}% -} - -nested sections - - -\paragraph{3.11.1.1   level 4% - \label{level-4}% -} - -reach at some level - - -\subparagraph{3.11.1.1.1   level 5% - \label{level-5}% -} - -(depending on the document class) - - -\begin{DUclass}{sectionVI} -\DUtitle{3.11.1.1.1.1   level 6% - \label{level-6}% -} -\end{DUclass} - -an unsupported level. \section{4   Tests for the XeTeX writer% @@ -2750,10 +1969,10 @@ Français, Føroyskt, Хальмг, Íslenska, עברית , Қазақша, Kurd Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português, Română, Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük, Võro, ייִדיש , Žemaitėška. -Currently, there is extended support for 28 languages in the +There is extended support for more than 40 languages in the \href{http://ctan.org/pkg/polyglossia}{polyglossia}\DUfootnotemark{footnote-reference-16}{footnote-9}{8} package. -% System Messages: +% preface for System Messages: \section{5   Error Handling% diff --git a/docutils/test/functional/input/data/hyperlinking.txt b/docutils/test/functional/input/data/hyperlinking.txt index f960828e3..b88e34cf1 100644 --- a/docutils/test/functional/input/data/hyperlinking.txt +++ b/docutils/test/functional/input/data/hyperlinking.txt @@ -1,5 +1,5 @@ Hyperlinks and -targets ------------------------ +======================= In LaTeX, we must set an explicit anchor (``\phantomsection``) for a _`hypertarget in plain text` or in a figure but not in a longtable or diff --git a/docutils/test/functional/input/data/latex_encoding.txt b/docutils/test/functional/input/data/latex_encoding.txt index 96ee9f10d..2544757fa 100644 --- a/docutils/test/functional/input/data/latex_encoding.txt +++ b/docutils/test/functional/input/data/latex_encoding.txt @@ -1,5 +1,5 @@ Encoding special chars ----------------------- +====================== The LaTeX Info pages lists under "2.18 Special Characters" @@ -34,8 +34,6 @@ simple [bracketed] description term -The OT1 font-encoding has different characters for the less-than, -greater-than and bar, < | >, except for typewriter font `cmtt`:: - - < | > - +The OT1 font-encoding differs from ASCII for the less-than, greater-than +and bar characters (< | >) except for typewriter font `cmtt` +(``< | >``). diff --git a/docutils/test/functional/input/data/nonalphanumeric.txt b/docutils/test/functional/input/data/nonalphanumeric.txt index 4c4ee7343..1acf48df0 100644 --- a/docutils/test/functional/input/data/nonalphanumeric.txt +++ b/docutils/test/functional/input/data/nonalphanumeric.txt @@ -1,5 +1,5 @@ Monospaced non-alphanumeric characters --------------------------------------- +====================================== These are all ASCII characters except a-zA-Z0-9 and space: diff --git a/docutils/test/functional/input/data/option_lists.txt b/docutils/test/functional/input/data/option_lists.txt index 285143244..41369373a 100644 --- a/docutils/test/functional/input/data/option_lists.txt +++ b/docutils/test/functional/input/data/option_lists.txt @@ -1,11 +1,11 @@ .. This file is used by the standalone_rst_latex test. Option lists ------------- +============ -The LaTeX-2e description environment is used for definition lists. +The LaTeX-2e description environment is used for definition lists. The definition is continued on the same line as the term, this should -not happen if a option-list is at the top of the definition. +not happen if an option-list is at the top of the definition. If the option list is not at the first element in the definition, it is contained in a quote diff --git a/docutils/test/functional/input/data/section_titles.txt b/docutils/test/functional/input/data/section_titles.txt index 7dfe97966..dc8b4bcd2 100644 --- a/docutils/test/functional/input/data/section_titles.txt +++ b/docutils/test/functional/input/data/section_titles.txt @@ -1,28 +1,46 @@ -Section titles with `inline markup`_ ------------------------------------- +Section heading levels +====================== -*emphasized*, H\ :sub:`2`\ O and :math:`x^2` -```````````````````````````````````````````` -Substitutions |fail| -```````````````````` -.. |fail| replace:: work +Level 1 +======= +Nested sections -Deeply nested sections ----------------------- -In LaTeX and HTML, +Level 2 +------- +reach at some level Level 3 ``````` -nested sections +(depending on the document class and output format) level 4 ^^^^^^^ -reach at some level +a level level 5 -::::::: -(depending on the document class) ++++++++ +that is not supported by the output format. level 6 -+++++++ -an unsupported level. +::::::: +Unsupported in LaTeX and HTML5 +(HTML5 reserves the 1st level for the document title). + +level 7 +####### +Unsupported in HTML4. + +level 8 +<<<<<<< +Unsupported in ODT. + +.. _references: + +Section titles with inline markup +================================== + +*emphasized*, H\ :sub:`2`\ O, :math:`x^2`, and references_ +---------------------------------------------------------- +Substitutions |fail| +-------------------- +.. |fail| replace:: work diff --git a/docutils/test/functional/input/data/tables_latex.txt b/docutils/test/functional/input/data/tables_latex.txt index 2fbfdd1d6..beecf6b21 100644 --- a/docutils/test/functional/input/data/tables_latex.txt +++ b/docutils/test/functional/input/data/tables_latex.txt @@ -1,5 +1,5 @@ More Tables ------------ +=========== A table with multi-paragraph multicolumn cells: diff --git a/docutils/test/functional/input/data/unicode.txt b/docutils/test/functional/input/data/unicode.txt index 4ac693ffb..90dfbce7a 100644 --- a/docutils/test/functional/input/data/unicode.txt +++ b/docutils/test/functional/input/data/unicode.txt @@ -1,5 +1,5 @@ Non-ASCII characters --------------------- +==================== Punctuation and footnote symbols diff --git a/docutils/test/functional/input/data/urls.txt b/docutils/test/functional/input/data/urls.txt index 3da9b30a8..a3c8a9129 100644 --- a/docutils/test/functional/input/data/urls.txt +++ b/docutils/test/functional/input/data/urls.txt @@ -1,5 +1,5 @@ External references -------------------- +=================== Long URLs should be wrapped in the PDF. This can be achieved with the ``\url`` command which is used by the LaTeX writer whenever the content @@ -16,7 +16,7 @@ unbalanced braces. The characters ^, {, }, and ``\`` are invalid in a "http:" or "ftp:" URL and not recognized as part of it: - + | http://www.example.org/strange^^name | http://www.example.org\\using\\DOS\\paths\\ | http://www.example.org/XML/strange{n}ame @@ -32,15 +32,15 @@ Handling by the LaTeX writer: | `URL with % `__ http://example.org/Schema%dev | `file with DOS path`__ `A:DOS\\path\\`__ - + .. note:: These URLs are typeset inside a LaTeX command without error. - + | http://www.w3.org/XML/Schema#dev | http://example.org/Schema%dev | `A:DOS\\path\\`__ -__ -__ +__ +__ __ A:DOS\\path\\ @@ -56,7 +56,7 @@ __ A:DOS\\path\\ `<../strange{name>`__ while balanced braces are suported: - + | `<../strange{n}ame>`__ | `<../st{r}ange{n}ame>`__ | `<../{st{r}ange{n}ame}>`__ diff --git a/docutils/test/functional/input/latex_cornercases.txt b/docutils/test/functional/input/latex_cornercases.txt index 095d835e1..fa37bdb03 100644 --- a/docutils/test/functional/input/latex_cornercases.txt +++ b/docutils/test/functional/input/latex_cornercases.txt @@ -1,11 +1,21 @@ -Some Tests for the LaTeX Writer -=============================== +Additional Tests for the LaTeX Writer +===================================== + +These tests contain syntax elements and combinations which may cause +trouble for the LaTeX writer. + +.. include:: data/section_titles.txt +.. include:: data/tables_latex.txt +.. include:: data/option_lists.txt +.. include:: data/nonalphanumeric.txt +.. include:: data/unicode.txt +.. include:: data/latex_encoding.txt +.. include:: data/hyperlinking.txt +.. include:: data/urls.txt -These tests contain unusual combinations of syntax elements which may cause -trouble for the LaTeX writer but do not need to be tested with other writers. Block Quotes ------------- +============ This block quote comes directly after the section heading and is followed by a paragraph. @@ -26,7 +36,7 @@ This is another paragraph. More Block Quotes ------------------ +================= Block quote followed by a transition. @@ -36,7 +46,7 @@ More Block Quotes Images ------- +====== Image with 20% width: @@ -50,7 +60,7 @@ Image with 100% width: Rowspanning tables ------------------- +================== Several rowspanning cells in a table. @@ -138,7 +148,7 @@ LaTeX writer needs bookkeeping to write out the required number of extra +-------+----+ Nested tables -------------- +============= TODO: Set alignment of nested tables without creating too much vertical space. @@ -211,4 +221,3 @@ Set alignment of nested tables without creating too much vertical space. +-----------------------------------------+-----------------+ | | cell 3, 2 | +-----------------------------------------+-----------------+ - diff --git a/docutils/test/functional/input/link_in_substitution.txt b/docutils/test/functional/input/link_in_substitution.txt deleted file mode 100644 index 8197a0c5c..000000000 --- a/docutils/test/functional/input/link_in_substitution.txt +++ /dev/null @@ -1,23 +0,0 @@ -Test the interaction of transforms.references.Substitutions and -transforms.references.ExternalLinks. - -|rest| is cool! - -.. |rest| replace:: reStructuredText_ - -.. _reStructuredText: http://docutils.sourceforge.net/rst.html - -There is a preferred alternative: - -|rst|_ is cool! - -.. |rst| replace:: reStructuredText -.. _rst: http://docutils.sourceforge.net/rst.html - -This only works for the case where the entire substitution is a -reference, not when the reference is embedded as part of the -substitution: - -|urst| is uncool! - -.. |urst| replace:: unstructured reStructuredText_ diff --git a/docutils/test/functional/input/misc_rst_html4css1.txt b/docutils/test/functional/input/misc_rst_html4css1.txt new file mode 100644 index 000000000..45b176ab9 --- /dev/null +++ b/docutils/test/functional/input/misc_rst_html4css1.txt @@ -0,0 +1,5 @@ +=============================== +Additional tests with html4css1 +=============================== + +.. include:: data/section_titles.txt diff --git a/docutils/test/functional/input/standalone_rst_latex.txt b/docutils/test/functional/input/standalone_rst_latex.txt index d97fc42b3..d9a33178d 100644 --- a/docutils/test/functional/input/standalone_rst_latex.txt +++ b/docutils/test/functional/input/standalone_rst_latex.txt @@ -11,20 +11,11 @@ Tests for the LaTeX writer ========================== Test syntax elements which may cause trouble for the LaTeX writer but might -not need to be tested with other writers (e.g. the HTML writer). +not need to be tested with other writers. See also the +"latex_cornercases" test. .. include:: data/custom_roles_latex.txt .. include:: data/classes_latex.txt -.. include:: data/tables_latex.txt -.. include:: data/option_lists.txt -.. include:: data/nonalphanumeric.txt -.. include:: data/unicode.txt -.. include:: data/latex_encoding.txt -.. include:: data/hyperlinking.txt -.. include:: data/urls.txt -.. include:: data/section_titles.txt -.. unusual combinations (currently separately tested) - .. include:: data/latex_cornercases.txt -.. Preface for System Messages: +.. preface for System Messages: .. include:: data/errors.txt diff --git a/docutils/test/functional/input/standalone_rst_xetex.txt b/docutils/test/functional/input/standalone_rst_xetex.txt index 6428a1215..4dc3c4ff5 100644 --- a/docutils/test/functional/input/standalone_rst_xetex.txt +++ b/docutils/test/functional/input/standalone_rst_xetex.txt @@ -1,28 +1,5 @@ -.. include:: data/standard.txt -.. currently not implemented in LaTeX: - .. include:: data/header_footer.txt -.. include:: data/table_colspan.txt -.. include:: data/table_rowspan.txt -.. include:: data/list_table.txt -.. include:: data/custom_roles.txt -.. include:: data/math.txt - -Tests for the LaTeX writer -========================== - -Test syntax elements which may cause trouble for the LaTeX writer but might -not need to be tested with other writers (e.g. the HTML writer). - -.. include:: data/custom_roles_latex.txt -.. include:: data/classes_latex.txt -.. include:: data/tables_latex.txt -.. include:: data/option_lists.txt -.. include:: data/nonalphanumeric.txt -.. include:: data/unicode.txt -.. include:: data/latex_encoding.txt -.. include:: data/hyperlinking.txt -.. include:: data/urls.txt -.. include:: data/section_titles.txt +.. include:: standalone_rst_latex.txt + :end-before: preface for System Messages: Tests for the XeTeX writer ========================== @@ -34,10 +11,10 @@ Français, Føroyskt, Хальмг, Íslenska, עברית , Қазақша, Kurd Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português, Română, Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük, Võro, ייִדיש , Žemaitėška. -Currently, there is extended support for 28 languages in the +There is extended support for more than 40 languages in the polyglossia_ package. .. _polyglossia: http://ctan.org/pkg/polyglossia -.. System Messages: +.. preface for System Messages: .. include:: data/errors.txt diff --git a/docutils/test/functional/tests/misc_rst_html4css1.py b/docutils/test/functional/tests/misc_rst_html4css1.py index 7ee1921f6..145dc49a0 100644 --- a/docutils/test/functional/tests/misc_rst_html4css1.py +++ b/docutils/test/functional/tests/misc_rst_html4css1.py @@ -1,5 +1,5 @@ # Source and destination file names. -test_source = "link_in_substitution.txt" +test_source = "misc_rst_html4css1.txt" test_destination = "misc_rst_html4css1.html" # Keyword parameters passed to publish_file. @@ -8,7 +8,7 @@ parser_name = "rst" writer_name = "html4css1" # Settings -# test for encoded attribute value: -settings_overrides['stylesheet'] = 'foo&bar.css' +# test for encoded attribute value in optional stylesheet name: +settings_overrides['stylesheet'] = 'foo&bar.css, html4css1.css' settings_overrides['stylesheet_path'] = '' settings_overrides['embed_stylesheet'] = False -- cgit v1.2.1