From a042f4449b8f43fc77f33ecc46771d5cfc2c48ef Mon Sep 17 00:00:00 2001 From: wiemann Date: Fri, 18 Nov 2005 19:23:52 +0000 Subject: moved container test to the end of standard.txt test data file; implemented container for latex2e git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@4076 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/docutils/writers/latex2e.py | 6 ++ .../expected/standalone_rst_html4css1.html | 88 +++++++++--------- .../functional/expected/standalone_rst_latex.tex | 49 ++++++---- .../expected/standalone_rst_pseudoxml.txt | 101 ++++++++++++--------- docutils/test/functional/input/data/standard.txt | 9 ++ .../functional/input/standalone_rst_html4css1.txt | 6 -- 6 files changed, 148 insertions(+), 111 deletions(-) (limited to 'docutils') diff --git a/docutils/docutils/writers/latex2e.py b/docutils/docutils/writers/latex2e.py index 21b525d93..695160dd4 100644 --- a/docutils/docutils/writers/latex2e.py +++ b/docutils/docutils/writers/latex2e.py @@ -1060,6 +1060,12 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_contact(self, node): self.depart_docinfo_item(node) + def visit_container(self, node): + pass + + def depart_container(self, node): + pass + def visit_copyright(self, node): self.visit_docinfo_item(node, 'copyright') diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html index a898da047..f95d99cb9 100644 --- a/docutils/test/functional/expected/standalone_rst_html4css1.html +++ b/docutils/test/functional/expected/standalone_rst_html4css1.html @@ -125,13 +125,14 @@ They are transformed from section titles after parsing. -->
  • 2.15   Substitution Definitions
  • 2.16   Comments
  • 2.17   Raw text
  • -
  • 2.18   Colspanning tables
  • -
  • 2.19   Rowspanning tables
  • -
  • 2.20   Complex tables
  • -
  • 2.21   List Tables
  • +
  • 2.18   Container
  • +
  • 2.19   Colspanning tables
  • +
  • 2.20   Rowspanning tables
  • +
  • 2.21   Complex tables
  • +
  • 2.22   List Tables
  • -
  • 3   Error Handling
  • +
  • 3   Error Handling
  • @@ -476,7 +477,7 @@ Here's a reference to the next footnote: [4]Here's an unreferenced footnote, with a reference to a -nonexistent footnote: [5]_. +nonexistent footnote: [5]_.
    @@ -489,7 +490,7 @@ nonexistent footnote: [CIT2002], and a [nonexistent]_ +

    Here's a reference to the above, [CIT2002], and a [nonexistent]_ citation.

    @@ -503,7 +504,7 @@ hyperlink targets are also possible.

    "Python [5]".

    Targets may be indirect and anonymous. Thus this phrase may also refer to the Targets section.

    -

    Here's a `hyperlink reference without a target`_, which generates an +

    Here's a `hyperlink reference without a target`_, which generates an error.

    2.13.1   Duplicate Target Names

    @@ -515,34 +516,34 @@ explicit targets will generate "warning" (level-2) system messages.

    2.13.2   Duplicate Target Names

    Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like -this: `Duplicate Target Names`_), an error is generated.

    +this: `Duplicate Target Names`_), an error is generated.

    2.14   Directives

    These are just a sample of the many reStructuredText Directives. For others, please see http://docutils.sourceforge.net/docs/ref/rst/directives.html.

    -

    2.14.1   Document Parts

    +

    2.14.1   Document Parts

    An example of the "contents" directive can be seen above this section (a local, untitled table of contents) and at the beginning of the document (a document-wide table of contents).

    -

    2.14.2   Images

    +

    2.14.2   Images

    An image directive (also clickable -- a hyperlink reference):

    ../../../docs/user/rst/images/title.png

    Image with multiple IDs:

    @@ -610,7 +611,7 @@ document (a document-wide table o ../../../docs/user/rst/images/biohazard.png
    -

    2.14.3   Admonitions

    +

    2.14.3   Admonitions

    Attention!

    Directives at large.

    @@ -659,7 +660,7 @@ Reader discretion is strongly advised.

    -

    2.14.4   Topics, Sidebars, and Rubrics

    +

    2.14.4   Topics, Sidebars, and Rubrics

    -

    2.14.5   Target Footnotes

    +

    2.14.5   Target Footnotes

    @@ -691,11 +692,11 @@ background color.

    -

    2.14.7   Compound Paragraph

    +

    2.14.7   Compound Paragraph

    Compound 1, paragraph 1.

    Compound 1, paragraph 2.

    @@ -763,7 +764,7 @@ paragraph.
    -

    2.14.8   Parsed Literal Blocks

    +

    2.14.8   Parsed Literal Blocks

     This is a parsed literal block.
         This line is indented.  The next line is blank.
    @@ -795,7 +796,14 @@ Double-dashes - - "- -" - - must be escaped somehow in HTML output. -->
     A test.Second test.
    Another test with myclass set.

    This is the fourth test with myrawroleclass set.

    Fifth test in HTML.
    Line two.
    -

    2.18   Colspanning tables

    +

    2.18   Container

    +
    +

    paragraph 1

    +

    paragraph 2

    +
    +
    +
    +

    2.19   Colspanning tables

    This table has a cell spanning two columns:

    @@ -833,7 +841,7 @@ Fifth test in HTML.
    Line two.
    -

    2.19   Rowspanning tables

    +

    2.20   Rowspanning tables

    Here's a table with cells spanning several rows:

    @@ -866,7 +874,7 @@ cell.
    -

    2.20   Complex tables

    +

    2.21   Complex tables

    Here's a complex table, which should test all features.

    @@ -915,7 +923,7 @@ empty: -->
    -

    2.21   List Tables

    +

    2.22   List Tables

    Here's a list table exercising all features:

    @@ -949,32 +957,28 @@ crunchy, now would it?
    -

    3   Error Handling

    +

    3   Error Handling

    Any errors caught during processing will generate system messages.

    There should be five messages in the following, auto-generated section, "Docutils System Messages":

    -
    -

    paragraph 1

    -

    paragraph 2

    -

    Docutils System Messages

    System Message: ERROR/3 (functional/input/data/standard.txt, line 100); backlink

    Undefined substitution referenced: "problematic".
    -
    -

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 358); backlink

    +
    +

    System Message: ERROR/3 (functional/input/standalone_rst_html4css1.txt, line 358); backlink

    Unknown target name: "5".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 367); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 367); backlink

    Unknown target name: "nonexistent".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 394); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 394); backlink

    Unknown target name: "hyperlink reference without a target".
    -
    -

    System Message: ERROR/3 (functional/input/data/standard.txt, line 407); backlink

    +
    +

    System Message: ERROR/3 (functional/input/data/standard.txt, line 407); backlink

    Duplicate target name, cannot be used as a unique reference: "duplicate target names".
    diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex index 4f318f90a..42cb057a9 100644 --- a/docutils/test/functional/expected/standalone_rst_latex.tex +++ b/docutils/test/functional/expected/standalone_rst_latex.tex @@ -208,9 +208,11 @@ reStructuredText construct. \item {} \href{\#raw-text}{2.17~~~Raw text} -\item {} \href{\#colspanning-tables}{2.18~~~Colspanning tables} +\item {} \href{\#container}{2.18~~~Container} -\item {} \href{\#rowspanning-tables}{2.19~~~Rowspanning tables} +\item {} \href{\#colspanning-tables}{2.19~~~Colspanning tables} + +\item {} \href{\#rowspanning-tables}{2.20~~~Rowspanning tables} \end{list} @@ -885,9 +887,9 @@ A right-aligned image: {\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}} A figure directive: -\begin{figure}[htbp]\begin{center} +\begin{figure}[htbp]\begin{flushright} -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} \caption{A figure is an image with a caption and/or a legend:}{\small \begin{longtable}[c]{|p{0.16\locallinewidth}|p{0.56\locallinewidth}|} \hline @@ -912,31 +914,31 @@ Well it is, isn't it? \end{longtable} This paragraph is also part of the legend. -}\end{center}\end{figure} +}\end{flushright}\end{figure} This paragraph might flow around the figure... A centered figure: -\begin{figure}[htbp]\begin{center} +\begin{figure}[htbp]\begin{flushcenter} -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} \caption{This is the caption.}{\small This is the legend. The legend may consist of several paragraphs. -}\end{center}\end{figure} +}\end{flushcenter}\end{figure} This paragraph might flow around the figure... A left-aligned figure: -\begin{figure}[htbp]\begin{center} +\begin{figure}[htbp]\begin{flushleft} -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=50]{../../../docs/user/rst/images/biohazard.png} \caption{This is the caption.}{\small This is the legend. The legend may consist of several paragraphs. -}\end{center}\end{figure} +}\end{flushleft}\end{figure} This paragraph might flow around the figure... @@ -944,15 +946,15 @@ Now widths: An image 2 em wide: -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png} An image 2 em wide and 30 pixel high: -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png} An image occupying 70{\%} of the line width: -\includegraphics{../../../docs/user/rst/images/biohazard.png} +\includegraphics[width=70%]{../../../docs/user/rst/images/biohazard.png} An image 3 cm high: @@ -1253,11 +1255,22 @@ A test.Second test.Another test with myclass set. This is the fourth test with myrawroleclass set. Fifth test in LaTeX.\\Line two. +%___________________________________________________________________________ + +\hypertarget{container}{} +\pdfbookmark[1]{2.18~~~Container}{container} +\subsection*{2.18~~~Container} + +paragraph 1 + +paragraph 2 + + %___________________________________________________________________________ \hypertarget{colspanning-tables}{} -\pdfbookmark[1]{2.18~~~Colspanning tables}{colspanning-tables} -\subsection*{2.18~~~Colspanning tables} +\pdfbookmark[1]{2.19~~~Colspanning tables}{colspanning-tables} +\subsection*{2.19~~~Colspanning tables} This table has a cell spanning two columns: @@ -1316,8 +1329,8 @@ True %___________________________________________________________________________ \hypertarget{rowspanning-tables}{} -\pdfbookmark[1]{2.19~~~Rowspanning tables}{rowspanning-tables} -\subsection*{2.19~~~Rowspanning tables} +\pdfbookmark[1]{2.20~~~Rowspanning tables}{rowspanning-tables} +\subsection*{2.20~~~Rowspanning tables} Here's a table with cells spanning several rows: diff --git a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt index 22c8f4bde..edce5591d 100644 --- a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt +++ b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt @@ -294,31 +294,37 @@ Raw text - + 2.18    - Colspanning tables + Container - + 2.19    - Rowspanning tables + Colspanning tables - + 2.20    - Complex tables + Rowspanning tables - + 2.21    + Complex tables + + + + + 2.22    List Tables - + 3    Error Handling @@ -968,7 +974,7 @@ Here's an unreferenced footnote, with a reference to a nonexistent footnote: - + [5]_ .
    @@ -987,7 +993,7 @@ CIT2002 , and a - + [nonexistent]_ citation. @@ -1038,7 +1044,7 @@ Here's a - + `hyperlink reference without a target`_ , which generates an error. @@ -1060,7 +1066,7 @@ Since there are two "Duplicate Target Names" section headers, we cannot uniquely refer to either of them by name. If we try to (like this: - + `Duplicate Target Names`_ ), an error is generated.
    @@ -1072,49 +1078,49 @@ - + 2.14.1    Document Parts - + 2.14.2    Images - + 2.14.3    Admonitions - + 2.14.4    Topics, Sidebars, and Rubrics - + 2.14.5    Target Footnotes - + 2.14.6    Replacement Text - + 2.14.7    Compound Paragraph - + 2.14.8    Parsed Literal Blocks @@ -1125,7 +1131,7 @@ http://docutils.sourceforge.net/docs/ref/rst/directives.html .
    - + <title auto="1" refid="id71"> <generated classes="sectnum"> 2.14.1    Document Parts @@ -1140,7 +1146,7 @@ table of contents ). <section ids="images" names="images"> - <title auto="1" refid="id71"> + <title auto="1" refid="id72"> <generated classes="sectnum"> 2.14.2    Images @@ -1241,7 +1247,7 @@ An image 3 cm high: <image height="3cm" uri="../../../docs/user/rst/images/biohazard.png"> <section ids="admonitions" names="admonitions"> - <title auto="1" refid="id72"> + <title auto="1" refid="id73"> <generated classes="sectnum"> 2.14.3    Admonitions @@ -1291,7 +1297,7 @@ You can make up your own admonition too. <target ids="docutils" names="docutils" refuri="http://docutils.sourceforge.net/"> <section ids="topics-sidebars-and-rubrics" names="topics,\ sidebars,\ and\ rubrics"> - <title auto="1" refid="id73"> + <title auto="1" refid="id74"> <generated classes="sectnum"> 2.14.4    Topics, Sidebars, and Rubrics @@ -1316,7 +1322,7 @@ <rubric> This is a rubric <section ids="target-footnotes" names="target\ footnotes"> - <title auto="1" refid="id74"> + <title auto="1" refid="id75"> <generated classes="sectnum"> 2.14.5    Target Footnotes @@ -1333,7 +1339,7 @@ <reference refuri="http://docutils.sourceforge.net/"> http://docutils.sourceforge.net/ <section ids="replacement-text" names="replacement\ text"> - <title auto="1" refid="id75"> + <title auto="1" refid="id76"> <generated classes="sectnum"> 2.14.6    Replacement Text @@ -1354,7 +1360,7 @@ the best language around <section ids="compound-paragraph" names="compound\ paragraph"> - <title auto="1" refid="id76"> + <title auto="1" refid="id77"> <generated classes="sectnum"> 2.14.7    Compound Paragraph @@ -1440,7 +1446,7 @@ <paragraph> Compound 7, another paragraph. <section ids="parsed-literal-blocks" names="parsed\ literal\ blocks"> - <title auto="1" refid="id77"> + <title auto="1" refid="id78"> <generated classes="sectnum"> 2.14.8    Parsed Literal Blocks @@ -1521,10 +1527,20 @@ Fifth test in HTML.<br />Line two. <raw format="latex" xml:space="preserve"> Fifth test in LaTeX.\\Line two. - <section ids="colspanning-tables" names="colspanning\ tables"> + <section ids="container" names="container"> <title auto="1" refid="id65"> <generated classes="sectnum"> 2.18    + Container + <container classes="custom"> + <paragraph> + paragraph 1 + <paragraph> + paragraph 2 + <section ids="colspanning-tables" names="colspanning\ tables"> + <title auto="1" refid="id66"> + <generated classes="sectnum"> + 2.19    Colspanning tables <paragraph> This table has a cell spanning two columns: @@ -1593,9 +1609,9 @@ <paragraph> True <section ids="rowspanning-tables" names="rowspanning\ tables"> - <title auto="1" refid="id66"> + <title auto="1" refid="id67"> <generated classes="sectnum"> - 2.19    + 2.20    Rowspanning tables <paragraph> Here's a table with cells spanning several rows: @@ -1645,9 +1661,9 @@ <paragraph> body row 3 <section ids="complex-tables" names="complex\ tables"> - <title auto="1" refid="id67"> + <title auto="1" refid="id68"> <generated classes="sectnum"> - 2.20    + 2.21    Complex tables <paragraph> Here's a complex table, which should test all features. @@ -1730,9 +1746,9 @@ --> <entry> <section ids="list-tables" names="list\ tables"> - <title auto="1" refid="id68"> + <title auto="1" refid="id69"> <generated classes="sectnum"> - 2.21    + 2.22    List Tables <paragraph> Here's a list table exercising all features: @@ -1787,7 +1803,7 @@ <paragraph> On a stick! <section ids="error-handling" names="error\ handling"> - <title auto="1" refid="id69"> + <title auto="1" refid="id70"> <generated classes="sectnum"> 3    Error Handling @@ -1798,26 +1814,21 @@ section, "Docutils System Messages": <comment xml:space="preserve"> section should be added by Docutils automatically - <container classes="custom"> - <paragraph> - paragraph 1 - <paragraph> - paragraph 2 <section classes="system-messages"> <title> Docutils System Messages <system_message backrefs="id24" ids="id23" level="3" line="100" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Undefined substitution referenced: "problematic". - <system_message backrefs="id79" ids="id78" level="3" line="358" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> + <system_message backrefs="id80" ids="id79" level="3" line="358" source="functional/input/standalone_rst_html4css1.txt" type="ERROR"> <paragraph> Unknown target name: "5". - <system_message backrefs="id81" ids="id80" level="3" line="367" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id82" ids="id81" level="3" line="367" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "nonexistent". - <system_message backrefs="id83" ids="id82" level="3" line="394" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id84" ids="id83" level="3" line="394" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Unknown target name: "hyperlink reference without a target". - <system_message backrefs="id85" ids="id84" level="3" line="407" source="functional/input/data/standard.txt" type="ERROR"> + <system_message backrefs="id86" ids="id85" level="3" line="407" source="functional/input/data/standard.txt" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "duplicate target names". diff --git a/docutils/test/functional/input/data/standard.txt b/docutils/test/functional/input/data/standard.txt index ea904eaec..c3e12d199 100644 --- a/docutils/test/functional/input/data/standard.txt +++ b/docutils/test/functional/input/data/standard.txt @@ -731,3 +731,12 @@ This is the :raw-role:`fourth test` with myrawroleclass set. .. raw:: latex Fifth test in LaTeX.\\Line two. + +Container +--------- + +.. container:: custom + + paragraph 1 + + paragraph 2 diff --git a/docutils/test/functional/input/standalone_rst_html4css1.txt b/docutils/test/functional/input/standalone_rst_html4css1.txt index 4b1e2fdda..05f0287d0 100644 --- a/docutils/test/functional/input/standalone_rst_html4css1.txt +++ b/docutils/test/functional/input/standalone_rst_html4css1.txt @@ -5,9 +5,3 @@ .. include:: data/table_complex.txt .. include:: data/list_table.txt .. include:: data/errors.txt - -.. container:: custom - - paragraph 1 - - paragraph 2 -- cgit v1.2.1
    list table with integral header