texlive[74176] Master/texmf-dist: listings: spurious </p> from list

commits+karl at tug.org commits+karl at tug.org
Thu Feb 20 22:55:56 CET 2025


Revision: 74176
          https://tug.org/svn/texlive?view=revision&revision=74176
Author:   karl
Date:     2025-02-20 22:55:55 +0100 (Thu, 20 Feb 2025)
Log Message:
-----------
listings: spurious </p> from list and escaped LaTeX code in comments, tex4ht r1647-8

Revision Links:
--------------
    https://tug.org/svn/texlive?view=revision&revision=1647

Modified Paths:
--------------
    trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
    trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
    trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex
    trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht
    trunk/Master/texmf-dist/tex/generic/tex4ht/listings.4ht

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2025-02-20 21:40:57 UTC (rev 74175)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog	2025-02-20 21:55:55 UTC (rev 74176)
@@ -1,3 +1,13 @@
+2025-02-20  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (listings.4ht): fixed support for escaped LaTeX
+	code in comments.
+	https://puszcza.gnu.org.ua/bugs/index.php?648
+
+	* tex4ht-html4.tex (html4.4ht): remove spurious </p> tags from
+	Listings.
+	https://puszcza.gnu.org.ua/bugs/?648
+
 2025-02-19  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-ooffice.tex (ooffice.4ht): make \OOstyle declarations

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex	2025-02-20 21:40:57 UTC (rev 74175)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-4ht.tex	2025-02-20 21:55:55 UTC (rev 74176)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-4ht.tex 1643 2025-02-18 12:03:37Z michal_h21 $
+% $Id: tex4ht-4ht.tex 1648 2025-02-20 16:59:57Z michal_h21 $
 % tex tex4ht-4ht   or   ht tex tex4ht-4ht
 %
 % Copyright 2009-2025 TeX Users Group    
@@ -34139,6 +34139,17 @@
 \NewConfigure{listings-init}{2}
 >>>
 
+This configuration should prevent linebreaks and collapsed spaces for escaped LaTeX commands 
+inside listings. It assumes that listings-init contains TeX4ht specials that disables and enables spaces,
+and OutputBox and PostOutput hooks provided by Listings should insert markup for the current text color.
+
+See \Link[https://puszcza.gnu.org.ua/bugs/?648]{}{}for example\EndLink.
+
+\<listings sty\><<<
+\pend:def\lst at escapebegin{\csname b:listings-init\endcsname\nobreak\hbox\bgroup\lsthk at OutputBox}
+\append:def\lst at escapeend{\lsthk at PostOutput\egroup\csname a:listings-init\endcsname}
+>>>
+
 Use the TextStyle hook to insert markup for inline listings. This hook can 
 be used also in other contexts, so we need to execute it conditionally, 
 based on the \Verb|\lst at ifmode| condition. 

Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex	2025-02-20 21:40:57 UTC (rev 74175)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex	2025-02-20 21:55:55 UTC (rev 74176)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-html4.tex 1642 2025-02-16 14:49:05Z karl $
+% $Id: tex4ht-html4.tex 1647 2025-02-20 11:12:32Z michal_h21 $
 % Compile 4 times: latex tex4ht-html4
 % Copy html4.4ht into the work directory before all but the last compilation.
 %
@@ -15506,13 +15506,13 @@
 \Configure{listings}
    {\ifvmode \IgnorePar\fi \EndP%
     {\everypar{}\leavevmode}\HCode{<!--l. \the\inputlineno-->}%
-     \ifnum \listings:Depth=0 \HCode{<pre class="listings" id="listing-\listingN">}\else%
+     \ifnum \listings:Depth=0 \HtmlParOff\HCode{<pre class="listings" id="listing-\listingN">}\else%
                               \HCode{<span class="listings-nested" id="listing-\listingN">}\fi%
      \gHAdvance\listings:Depth by 1%
      \gdef\start:LstLn{}%
    }
    {\gHAdvance\listings:Depth by -1
-    \ifnum \listings:Depth=0 \HCode{</pre>}\else
+    \ifnum \listings:Depth=0 \HCode{</pre>}\HtmlParON\else
                              \HCode{</span>}\fi
    }
    {\start:LstLn\HCode{<span class="label">}%
@@ -15551,7 +15551,7 @@
 
 \<configure html4 listings\><<<
 \ConfigureEnv{lstlisting}
-   {\ifvmode \IgnorePar\fi \EndP  
+   {\ifvmode \IgnorePar\fi \EndP\HtmlParOff  
     \HCode{<!--l. \the\inputlineno-->}%
     \gdef\start:LstLn{%
        \HCode{<pre class="lstlisting" id="listing-\listingN">}%
@@ -15566,17 +15566,17 @@
          {\start:LstLn \HCode{<span class="label">}}
          {\HCode{</span>}}%
    }
-   {\egroup\par}
+   {\egroup\HtmlParOn\par}
    {} {}
 \Css{.lstlisting .label{margin-right:0.5em; }}
 \Css{pre.lstlisting{font-family: monospace,monospace; white-space: pre-wrap; 
-                    margin-top:0.5em; margin-bottom:0.5em;
+                    margin-top:0.5em; margin-bottom:0.5em; text-align: left;
                    }}
 >>>
 
 \<configure html4 listings\><<<
 \Configure{lstinputlisting}  
-   {\ifvmode \IgnorePar\fi \EndP  
+   {\ifvmode \IgnorePar\fi \EndP\HtmlParOff 
     \HCode{<!--l. \the\inputlineno-->}%  
     \gdef\start:LstLn{\HCode{<pre class="lstinputlisting" id="listing-\listingN">}\gdef\start:LstLn{\HCode{\Hnewline}}}% ignore first newline, to prevent spurious line
     \bgroup\ttfamily%\special{t4ht@(}%  
@@ -15588,10 +15588,11 @@
    }  
    {%\special{t4ht@)}
     \egroup%  
-    \ifvmode \IgnorePar\fi \EndP  \HCode{</pre>}\par}% 
+    \ifvmode \IgnorePar\fi \EndP  \HCode{</pre>}\HtmlParOn\par}% 
 \Css{pre.lstinputlisting{
    font-family: monospace,monospace;
    white-space: pre-wrap; 
+   text-align: left;
 }}
 \Css{.lstinputlisting .label{margin-right:0.5em;}}
 >>>

Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht	2025-02-20 21:40:57 UTC (rev 74175)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht	2025-02-20 21:55:55 UTC (rev 74176)
@@ -1,4 +1,4 @@
-% html4.4ht (2025-02-16-06:48), generated from tex4ht-html4.tex
+% html4.4ht (2025-02-20-13:18), generated from tex4ht-html4.tex
 % Copyright 2009-2025 TeX Users Group
 % Copyright 1997-2009 Eitan M. Gurari
 %
@@ -17,7 +17,7 @@
 %
 % If you modify this program, changing the
 % version identification would be appreciated.
-\immediate\write-1{version 2025-02-16-06:48}
+\immediate\write-1{version 2025-02-20-13:18}
 
 \exit:ifnot{8859-6,% 
 CJK,% 
@@ -37959,13 +37959,13 @@
 \Configure{listings}
    {\ifvmode \IgnorePar\fi \EndP%
     {\everypar{}\leavevmode}\HCode{<!--l. \the\inputlineno-->}%
-     \ifnum \listings:Depth=0 \HCode{<pre class="listings" id="listing-\listingN">}\else%
+     \ifnum \listings:Depth=0 \HtmlParOff\HCode{<pre class="listings" id="listing-\listingN">}\else%
                               \HCode{<span class="listings-nested" id="listing-\listingN">}\fi%
      \gHAdvance\listings:Depth by 1%
      \gdef\start:LstLn{}%
    }
    {\gHAdvance\listings:Depth by -1
-    \ifnum \listings:Depth=0 \HCode{</pre>}\else
+    \ifnum \listings:Depth=0 \HCode{</pre>}\HtmlParON\else
                              \HCode{</span>}\fi
    }
    {\start:LstLn\HCode{<span class="label">}%
@@ -37976,7 +37976,7 @@
                    }}
 \Configure{listings-init}{\ttfamily\ht:special{t4ht@(}}{\ht:special{t4ht@)}}
 \ConfigureEnv{lstlisting}
-   {\ifvmode \IgnorePar\fi \EndP
+   {\ifvmode \IgnorePar\fi \EndP\HtmlParOff
     \HCode{<!--l. \the\inputlineno-->}%
     \gdef\start:LstLn{%
        \HCode{<pre class="lstlisting" id="listing-\listingN">}%
@@ -37991,14 +37991,14 @@
          {\start:LstLn \HCode{<span class="label">}}
          {\HCode{</span>}}%
    }
-   {\egroup\par}
+   {\egroup\HtmlParOn\par}
    {} {}
 \Css{.lstlisting .label{margin-right:0.5em; }}
 \Css{pre.lstlisting{font-family: monospace,monospace; white-space: pre-wrap;
-                    margin-top:0.5em; margin-bottom:0.5em;
+                    margin-top:0.5em; margin-bottom:0.5em; text-align: left;
                    }}
 \Configure{lstinputlisting}
-   {\ifvmode \IgnorePar\fi \EndP
+   {\ifvmode \IgnorePar\fi \EndP\HtmlParOff
     \HCode{<!--l. \the\inputlineno-->}%
     \gdef\start:LstLn{\HCode{<pre class="lstinputlisting" id="listing-\listingN">}\gdef\start:LstLn{\HCode{\Hnewline}}}% ignore first newline, to prevent spurious line
     \bgroup\ttfamily%\special{t4ht@(}%
@@ -38010,10 +38010,11 @@
    }
    {%\special{t4ht@)}
     \egroup%
-    \ifvmode \IgnorePar\fi \EndP  \HCode{</pre>}\par}%
+    \ifvmode \IgnorePar\fi \EndP  \HCode{</pre>}\HtmlParOn\par}%
 \Css{pre.lstinputlisting{
    font-family: monospace,monospace;
    white-space: pre-wrap;
+   text-align: left;
 }}
 \Css{.lstinputlisting .label{margin-right:0.5em;}}
 \lst at AddToHook{PostOutput}{\HCode{</span>}}%

Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/listings.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/listings.4ht	2025-02-20 21:40:57 UTC (rev 74175)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/listings.4ht	2025-02-20 21:55:55 UTC (rev 74176)
@@ -1,4 +1,4 @@
-% listings.4ht (2025-01-23-12:56), generated from tex4ht-4ht.tex
+% listings.4ht (2025-02-20-13:18), generated from tex4ht-4ht.tex
 % Copyright 2001-2009 Eitan M. Gurari
 % Copyright 2009-2025 TeX Users Group
 %
@@ -17,7 +17,7 @@
 %
 % If you modify this program, changing the
 % version identification would be appreciated.
-\immediate\write-1{version 2025-01-23-12:56}
+\immediate\write-1{version 2025-02-20-13:18}
 
 \@ifpackageloaded{xcolor}{}{%
 \RequirePackage{xcolor}
@@ -44,6 +44,8 @@
 \append:defI\lst at Init{\csname a:listings-init\endcsname\global\lstnesttrue}
 \pend:def\lst at DeInit{\csname b:listings-init\endcsname\global\lstnestfalse}
 \NewConfigure{listings-init}{2}
+\pend:def\lst at escapebegin{\csname b:listings-init\endcsname\nobreak\hbox\bgroup\lsthk at OutputBox}
+\append:def\lst at escapeend{\lsthk at PostOutput\egroup\csname a:listings-init\endcsname}
 \lst at AddToHook{TextStyle}{%
    \Configure{listings}{}{}{}{}%
    \lst at ifmode\else%



More information about the tex-live-commits mailing list.