SF.net SVN: docutils:[9555] trunk/docutils

milde--- via Docutils-checkins <[email protected]>
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 9555
          http://sourceforge.net/p/docutils/code/9555
Author:   milde
Date:     2024-03-11 14:55:04 +0000 (Mon, 11 Mar 2024)
Log Message:
-----------
LaTeX writers: more compact description list.

Drop empty line before `\end{description}`.

Modified Paths:
--------------
    trunk/docutils/HISTORY.txt
    trunk/docutils/docutils/nodes.py
    trunk/docutils/docutils/writers/latex2e/__init__.py
    trunk/docutils/test/functional/expected/latex_cornercases.tex
    trunk/docutils/test/functional/expected/latex_leavevmode.tex
    trunk/docutils/test/functional/expected/latex_memoir.tex
    trunk/docutils/test/functional/expected/standalone_rst_latex.tex
    trunk/docutils/test/functional/expected/standalone_rst_xetex.tex

Modified: trunk/docutils/HISTORY.txt
===================================================================
--- trunk/docutils/HISTORY.txt	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/HISTORY.txt	2024-03-11 14:55:04 UTC (rev 9555)
@@ -171,6 +171,7 @@
 * docutils/writers/latex2e/__init__.py
 
   - Fix placement of hyperlink target (label) for tables (bug #440).
+  - More compact option-list and description-list.
 
 * docutils/writers/manpage.py
 

Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/docutils/nodes.py	2024-03-11 14:55:04 UTC (rev 9555)
@@ -316,7 +316,7 @@
         Return the first node in the iterator returned by findall(),
         or None if the iterable is empty.
 
-        Parameter list is the same as of traverse.  Note that `include_self`
+        Parameter list is the same as of `findall()`.  Note that `include_self`
         defaults to False, though.
         """
         try:

Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py	2024-03-11 14:55:04 UTC (rev 9555)
@@ -1911,7 +1911,7 @@
         pass
 
     def depart_definition(self, node):
-        self.out.append('\n')                # TODO: just pass?
+        pass
 
     def visit_definition_list(self, node):
         self.duclass_open(node)
@@ -1925,7 +1925,8 @@
         pass
 
     def depart_definition_list_item(self, node):
-        pass
+        if node.next_node(descend=False, siblings=True) is not None:
+            self.out.append('\n')                # TODO: just pass?
 
     def visit_description(self, node):
         self.out.append(' ')

Modified: trunk/docutils/test/functional/expected/latex_cornercases.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_cornercases.tex	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/test/functional/expected/latex_cornercases.tex	2024-03-11 14:55:04 UTC (rev 9555)
@@ -253,7 +253,6 @@
 
 \item[-v]  verbose
 \end{DUoptionlist}
-
 \end{description}
 
 
@@ -682,7 +681,6 @@
 \begin{description}
 \item[{definition:}] 
 list
-
 \end{description}
  & 
 cell 3, 2
@@ -858,7 +856,6 @@
 
 \item[{{[}bracketed{]}}] 
 description term
-
 \end{description}
 
 The OT1 font-encoding differs from ASCII for the less-than, greater-than
@@ -924,7 +921,6 @@
 \item[{Example:}] 
 a long URL that should wrap in the output
 \url{https://docutils.sourceforge.io/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

Modified: trunk/docutils/test/functional/expected/latex_leavevmode.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_leavevmode.tex	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/test/functional/expected/latex_leavevmode.tex	2024-03-11 14:55:04 UTC (rev 9555)
@@ -226,9 +226,7 @@
 \begin{description}
 \item[{Yes.}] 
 Independent of the nesting level.
-
 \end{description}
-
 \end{description}
 
 \item[{Option List}] \leavevmode
@@ -313,7 +311,6 @@
 LaTeX environment.
 \end{DUadmonition}
 \end{DUclass}
-
 \end{description}
 
 
@@ -344,7 +341,6 @@
 
 \item This holds for all elements that normally need \texttt{\textbackslash{}leavevmode}.
 \end{itemize}
-
 \end{description}
 
 
@@ -401,7 +397,6 @@
 \item[{Raw Block Text}] \leavevmode
 “Raw” blocks are always preceded by
 \verb|\leavevmode|, just in case.
-
 \end{description}
 
 \end{document}

Modified: trunk/docutils/test/functional/expected/latex_memoir.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_memoir.tex	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/test/functional/expected/latex_memoir.tex	2024-03-11 14:55:04 UTC (rev 9555)
@@ -472,7 +472,6 @@
 
 \item[{Term}] (\textbf{classifier one})(\textbf{classifier two})
 Definition
-
 \end{description}
 
 
@@ -1373,7 +1372,6 @@
 \begin{description}
 \item[{a definition}] 
 list,
-
 \end{description}
 a paragraph, an image:
 \includegraphics{../../../docs/user/rst/images/biohazard.png}
@@ -1875,7 +1873,6 @@
 $\vec{R}$        \texttt{\textbackslash{}vec\{R\}}
  \\
 \end{longtable*}
-
 \end{description}
 
 % \widetilde{xxx}

Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex	2024-03-11 14:55:04 UTC (rev 9555)
@@ -473,7 +473,6 @@
 
 \item[{Term}] (\textbf{classifier one})(\textbf{classifier two})
 Definition
-
 \end{description}
 
 
@@ -1394,7 +1393,6 @@
 \begin{description}
 \item[{a definition}] 
 list,
-
 \end{description}
 a paragraph, an image:
 \includegraphics{../../../docs/user/rst/images/biohazard.png}
@@ -1897,7 +1895,6 @@
 $\vec{R}$        \texttt{\textbackslash{}vec\{R\}}
  \\
 \end{longtable*}
-
 \end{description}
 
 % \widetilde{xxx}

Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex	2024-03-10 11:34:27 UTC (rev 9554)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex	2024-03-11 14:55:04 UTC (rev 9555)
@@ -475,7 +475,6 @@
 
 \item[{Term}] (\textbf{classifier one})(\textbf{classifier two})
 Definition
-
 \end{description}
 
 
@@ -1433,7 +1432,6 @@
 \begin{description}
 \item[{a definition}] 
 list,
-
 \end{description}
 a paragraph, an image:
 \includegraphics{../../../docs/user/rst/images/biohazard.png}
@@ -1936,7 +1934,6 @@
 $\vec{R}$        \texttt{\textbackslash{}vec\{R\}}
  \\
 \end{longtable*}
-
 \end{description}
 
 % \widetilde{xxx}

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
Docutils-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.