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

milde--- via Docutils-checkins <[email protected]> Thu, 06 Mar 2025 08:40:50 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10016
          http://sourceforge.net/p/docutils/code/10016
Author:   milde
Date:     2025-03-06 08:40:49 +0000 (Thu, 06 Mar 2025)
Log Message:
-----------
Improve formatting of LaTeX source for bibliographic fields.

The generated PDF is unchanged.

Modified Paths:
--------------
    trunk/docutils/docutils/writers/latex2e/__init__.py
    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/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py	2025-03-05 17:06:53 UTC (rev 10015)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py	2025-03-06 08:40:49 UTC (rev 10016)
@@ -1962,10 +1962,14 @@
                       nodes.date, nodes.organization)):
             self.push_output_collector([])  # see depart_docinfo_item()
         else:
-            self.out.append('\\textbf{%s}: &\n\t'
-                            % self.language_label(node.tagname))
+            label = self.language_label(node.tagname)
+            self.out.append('\\textbf{%s}: &' % label)
             if isinstance(node, nodes.address):
-                self.out.append('{\\raggedright\n')
+                self.out.append(' {\\raggedright\n')
+            elif len(label) + len(node.astext()) > 64:
+                self.out.append('\n  ')
+            else:
+                self.out.append(' ')
 
     def depart_docinfo_item(self, node) -> None:
         self.insert_newline = False  # reset change with <address> node
@@ -1985,7 +1989,7 @@
                 self.author_stack[-1].append(text)
         else:
             if isinstance(node, nodes.address):
-                self.out.append(' }')
+                self.out.append('}')
             self.out.append(' \\\\\n')
 
     def visit_doctest_block(self, node) -> None:

Modified: trunk/docutils/test/functional/expected/latex_leavevmode.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_leavevmode.tex	2025-03-05 17:06:53 UTC (rev 10015)
+++ trunk/docutils/test/functional/expected/latex_leavevmode.tex	2025-03-06 08:40:49 UTC (rev 10016)
@@ -162,14 +162,11 @@
 % Docinfo
 \begin{center}
 \begin{tabularx}{\DUdocinfowidth}{lX}
-\textbf{Author}: &
-	Hänsel \\
-\textbf{Author}: &
-	Gretel \\
-\textbf{Address}: &
-	{\raggedright
+\textbf{Author}: & Hänsel \\
+\textbf{Author}: & Gretel \\
+\textbf{Address}: & {\raggedright
 123 Example Street\\
-Example, EX  Canada } \\
+Example, EX  Canada} \\
 \textbf{Generic Docinfo List Field}: &
 \begin{itemize}
 \item This is a list.

Modified: trunk/docutils/test/functional/expected/latex_memoir.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_memoir.tex	2025-03-05 17:06:53 UTC (rev 10015)
+++ trunk/docutils/test/functional/expected/latex_memoir.tex	2025-03-06 08:40:49 UTC (rev 10016)
@@ -221,14 +221,11 @@
 % Docinfo
 \begin{center}
 \begin{tabularx}{\DUdocinfowidth}{lX}
-\textbf{Status}: &
-	This is a \textquotedbl{}work in progress\textquotedbl{} \\
-\textbf{Revision}: &
-	is managed by a version control system. \\
-\textbf{Version}: &
-	1 \\
+\textbf{Status}: & This is a \textquotedbl{}work in progress\textquotedbl{} \\
+\textbf{Revision}: & is managed by a version control system. \\
+\textbf{Version}: & 1 \\
 \textbf{Copyright}: &
-	This document has been placed in the public domain. You
+  This document has been placed in the public domain. You
 may do with it as you wish. You may copy, modify,
 redistribute, reattribute, sell, buy, rent, lease,
 destroy, or improve it, quote it at length, excerpt,

Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex	2025-03-05 17:06:53 UTC (rev 10015)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex	2025-03-06 08:40:49 UTC (rev 10016)
@@ -209,33 +209,22 @@
 % Docinfo
 \begin{center}
 \begin{tabularx}{\DUdocinfowidth}{lX}
-\textbf{Author}: &
-	David Goodger \\
-\textbf{Address}: &
-	{\raggedright
+\textbf{Author}: & David Goodger \\
+\textbf{Address}: & {\raggedright
 123 Example Street\\
 Example, EX  Canada\\
-A1B 2C3 } \\
-\textbf{Contact}: &
-	\href{mailto:[email protected]}{[email protected]} \\
-\textbf{Author}: &
-	Me \\
-\textbf{Author}: &
-	Myself \\
-\textbf{Author}: &
-	I \\
-\textbf{Organization}: &
-	humankind \\
-\textbf{Date}: &
-	Now, or yesterday.  Or maybe even \emph{before} yesterday. \\
-\textbf{Status}: &
-	This is a “work in progress” \\
-\textbf{Revision}: &
-	is managed by a version control system. \\
-\textbf{Version}: &
-	1 \\
+A1B 2C3} \\
+\textbf{Contact}: & \href{mailto:[email protected]}{[email protected]} \\
+\textbf{Author}: & Me \\
+\textbf{Author}: & Myself \\
+\textbf{Author}: & I \\
+\textbf{Organization}: & humankind \\
+\textbf{Date}: & Now, or yesterday.  Or maybe even \emph{before} yesterday. \\
+\textbf{Status}: & This is a “work in progress” \\
+\textbf{Revision}: & is managed by a version control system. \\
+\textbf{Version}: & 1 \\
 \textbf{Copyright}: &
-	This document has been placed in the public domain. You
+  This document has been placed in the public domain. You
 may do with it as you wish. You may copy, modify,
 redistribute, reattribute, sell, buy, rent, lease,
 destroy, or improve it, quote it at length, excerpt,

Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex	2025-03-05 17:06:53 UTC (rev 10015)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex	2025-03-06 08:40:49 UTC (rev 10016)
@@ -76,33 +76,22 @@
 % Docinfo
 \begin{center}
 \begin{tabularx}{\DUdocinfowidth}{lX}
-\textbf{Author}: &
-	David Goodger \\
-\textbf{Address}: &
-	{\raggedright
+\textbf{Author}: & David Goodger \\
+\textbf{Address}: & {\raggedright
 123 Example Street\\
 Example, EX  Canada\\
-A1B 2C3 } \\
-\textbf{Contact}: &
-	\href{mailto:[email protected]}{[email protected]} \\
-\textbf{Author}: &
-	Me \\
-\textbf{Author}: &
-	Myself \\
-\textbf{Author}: &
-	I \\
-\textbf{Organization}: &
-	humankind \\
-\textbf{Date}: &
-	Now, or yesterday.  Or maybe even \emph{before} yesterday. \\
-\textbf{Status}: &
-	This is a “work in progress” \\
-\textbf{Revision}: &
-	is managed by a version control system. \\
-\textbf{Version}: &
-	1 \\
+A1B 2C3} \\
+\textbf{Contact}: & \href{mailto:[email protected]}{[email protected]} \\
+\textbf{Author}: & Me \\
+\textbf{Author}: & Myself \\
+\textbf{Author}: & I \\
+\textbf{Organization}: & humankind \\
+\textbf{Date}: & Now, or yesterday.  Or maybe even \emph{before} yesterday. \\
+\textbf{Status}: & This is a “work in progress” \\
+\textbf{Revision}: & is managed by a version control system. \\
+\textbf{Version}: & 1 \\
 \textbf{Copyright}: &
-	This document has been placed in the public domain. You
+  This document has been placed in the public domain. You
 may do with it as you wish. You may copy, modify,
 redistribute, reattribute, sell, buy, rent, lease,
 destroy, or improve it, quote it at length, excerpt,

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