SF.net SVN: docutils:[10159 ] trunk/docutils
milde--- via Docutils-checkins <[email protected]> Sun, 08 Jun 2025 21:24:13 +0000
| Newsgroups | gmane.text.docutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 10159
http://sourceforge.net/p/docutils/code/10159
Author: milde
Date: 2025-06-08 21:24:13 +0000 (Sun, 08 Jun 2025)
Log Message:
-----------
Latex writer: Re-style system messages.
Capitalise title, make it red.
Fix anchor position.
Modified Paths:
--------------
trunk/docutils/HISTORY.rst
trunk/docutils/docutils/writers/latex2e/__init__.py
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.rst
===================================================================
--- trunk/docutils/HISTORY.rst 2025-06-08 21:23:57 UTC (rev 10158)
+++ trunk/docutils/HISTORY.rst 2025-06-08 21:24:13 UTC (rev 10159)
@@ -33,6 +33,7 @@
- `LaTeXTranslator.visit_inline()` now inserts labels for the
node's IDs.
- Disable "hyperref" footnote handling to avoid "empty anchor" warnings.
+ - Re-style system messages.
* docutils/writers/manpage.py
Modified: trunk/docutils/docutils/writers/latex2e/__init__.py
===================================================================
--- trunk/docutils/docutils/writers/latex2e/__init__.py 2025-06-08 21:23:57 UTC (rev 10158)
+++ trunk/docutils/docutils/writers/latex2e/__init__.py 2025-06-08 21:24:13 UTC (rev 10159)
@@ -3029,24 +3029,25 @@
if self.settings.legacy_class_functions:
self.fallbacks['title'] = PreambleCmds.title_legacy
node['classes'] = ['system-message']
+ self.out.append('\n')
+ self.append_hypertargets(node)
self.visit_admonition(node)
if self.settings.legacy_class_functions:
- self.out.append('\n\\DUtitle[system-message]{system-message\n')
+ self.out.append('\n\\DUtitle[system-message]'
+ '{\\color{red}System Message}\n')
else:
- self.out.append('\n\\DUtitle{system-message\n')
- self.append_hypertargets(node)
+ self.out.append('\n\\DUtitle{\\color{red}System Message}\n')
try:
- line = ', line~%s' % node['line']
+ line = f", line~{node['line']}"
except KeyError:
line = ''
- self.out.append('}\n\n{\\color{red}%s/%s} in \\texttt{%s}%s\n' %
- (node['type'], node['level'],
- self.encode(node['source']), line))
+ self.out.append(f"\n{node['type']}/{node['level']} in "
+ f"\\texttt{{{self.encode(node['source'])}}}{line}\n")
if len(node['backrefs']) == 1:
- self.out.append('\n\\hyperlink{%s}{' % node['backrefs'][0])
- self.context.append('}')
+ self.out.append(f"\n\\hyperlink{{{node['backrefs'][0]}}}{{")
+ self.context.append('}\n')
else:
- backrefs = ['\\hyperlink{%s}{%d}' % (href, i+1)
+ backrefs = [f'\\hyperlink{{{href}}}{{{i+1}}}\n'
for (i, href) in enumerate(node['backrefs'])]
self.context.append('backrefs: ' + ' '.join(backrefs))
Modified: trunk/docutils/test/functional/expected/latex_memoir.tex
===================================================================
--- trunk/docutils/test/functional/expected/latex_memoir.tex 2025-06-08 21:23:57 UTC (rev 10158)
+++ trunk/docutils/test/functional/expected/latex_memoir.tex 2025-06-08 21:24:13 UTC (rev 10159)
@@ -2069,54 +2069,59 @@
\chapter[Docutils System Messages]{\color{red}Docutils System Messages%
}
+\raisebox{1em}{\hypertarget{system-message-1}{}}
\DUadmonition[system-message]{
-\DUtitle[system-message]{system-message
-\raisebox{1em}{\hypertarget{system-message-1}{}}}
+\DUtitle[system-message]{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~99
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~99
\hyperlink{problematic-1}{
Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
-}}
+}
+}
+\raisebox{1em}{\hypertarget{system-message-2}{}}
\DUadmonition[system-message]{
-\DUtitle[system-message]{system-message
-\raisebox{1em}{\hypertarget{system-message-2}{}}}
+\DUtitle[system-message]{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~390
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~390
\hyperlink{footnote-reference-8}{
Unknown target name: \textquotedbl{}5\textquotedbl{}.
-}}
+}
+}
+\raisebox{1em}{\hypertarget{system-message-3}{}}
\DUadmonition[system-message]{
-\DUtitle[system-message]{system-message
-\raisebox{1em}{\hypertarget{system-message-3}{}}}
+\DUtitle[system-message]{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~399
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~399
\hyperlink{citation-reference-3}{
Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
-}}
+}
+}
+\raisebox{1em}{\hypertarget{system-message-4}{}}
\DUadmonition[system-message]{
-\DUtitle[system-message]{system-message
-\raisebox{1em}{\hypertarget{system-message-4}{}}}
+\DUtitle[system-message]{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~426
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~426
\hyperlink{problematic-2}{
Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
-}}
+}
+}
+\raisebox{1em}{\hypertarget{system-message-5}{}}
\DUadmonition[system-message]{
-\DUtitle[system-message]{system-message
-\raisebox{1em}{\hypertarget{system-message-5}{}}}
+\DUtitle[system-message]{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~439
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~439
\hyperlink{problematic-3}{
Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
-}}
+}
+}
\end{document}
Modified: trunk/docutils/test/functional/expected/standalone_rst_latex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2025-06-08 21:23:57 UTC (rev 10158)
+++ trunk/docutils/test/functional/expected/standalone_rst_latex.tex 2025-06-08 21:24:13 UTC (rev 10159)
@@ -2084,64 +2084,69 @@
\section[Docutils System Messages]{\color{red}Docutils System Messages%
}
+\raisebox{1em}{\hypertarget{system-message-1}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-1}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~99
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~99
\hyperlink{problematic-1}{
Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-2}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-2}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~390
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~390
\hyperlink{footnote-reference-8}{
Unknown target name: \textquotedbl{}5\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-3}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-3}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~399
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~399
\hyperlink{citation-reference-3}{
Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-4}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-4}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~426
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~426
\hyperlink{problematic-2}{
Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-5}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-5}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~439
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~439
\hyperlink{problematic-3}{
Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
\end{document}
Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex
===================================================================
--- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2025-06-08 21:23:57 UTC (rev 10158)
+++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2025-06-08 21:24:13 UTC (rev 10159)
@@ -2130,64 +2130,69 @@
\section[Docutils System Messages]{\color{red}Docutils System Messages%
}
+\raisebox{1em}{\hypertarget{system-message-1}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-1}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~99
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~99
\hyperlink{problematic-1}{
Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-2}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-2}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~390
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~390
\hyperlink{footnote-reference-8}{
Unknown target name: \textquotedbl{}5\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-3}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-3}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~399
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~399
\hyperlink{citation-reference-3}{
Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-4}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-4}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~426
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~426
\hyperlink{problematic-2}{
Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
+\raisebox{1em}{\hypertarget{system-message-5}{}}
\begin{DUclass}{system-message}
\begin{DUadmonition}
-\DUtitle{system-message
-\raisebox{1em}{\hypertarget{system-message-5}{}}}
+\DUtitle{\color{red}System Message}
-{\color{red}ERROR/3} in \texttt{functional/input/data/standard.rst}, line~439
+ERROR/3 in \texttt{functional/input/data/standard.rst}, line~439
\hyperlink{problematic-3}{
Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
-}\end{DUadmonition}
+}
+\end{DUadmonition}
\end{DUclass}
\end{document}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.