[tex4ht-commits] [SCM] tex4ht updated: r1097 - trunk/lit

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Thu Mar 24 18:17:15 CET 2022


Author: michal_h21
Date: 2022-03-24 17:17:15 +0000 (Thu, 24 Mar 2022)
New Revision: 1097

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-html4.tex
Log:
fixed issues with newlines and spurious spaces in listings

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-03-24 14:16:31 UTC (rev 1096)
+++ trunk/lit/ChangeLog	2022-03-24 17:17:15 UTC (rev 1097)
@@ -1,5 +1,9 @@
 2021-03-24  Michal Hoftich  <michal.h21 at gmail.com>
 
+	* tex4ht-4ht.tex (listings.4ht): ignore spurious spaces at beginning
+	of listings.
+	* tex4ht-html4.tex (html4.4ht): removed extra <br> tags, fixed
+	issues with extra newlines.
 	* tex4ht-4ht.tex (biblatex.4ht): removed spurious whitespace after
 	backrefences.
 

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2022-03-24 14:16:31 UTC (rev 1096)
+++ trunk/lit/tex4ht-4ht.tex	2022-03-24 17:17:15 UTC (rev 1097)
@@ -30938,19 +30938,21 @@
    \lst at newlinetrue
 }%
 \HLet\lst at NewLine\:tempa
-\def\lst at InputListing#1{% 
-    \begingroup 
-      \lsthk at PreSet \gdef\lst at intname{#1}% 
+\def\:tempa#1{
+    \begingroup%
+      \lsthk at PreSet\gdef\lst at intname{#1}% 
       \expandafter\lstset\expandafter{\lst at set}% 
-      \lsthk at DisplayStyle 
-      \catcode\active=\active 
-      \a:lstinputlisting \lst at Init\relax \let\lst at gobble\z@ 
-      \lst at SkipToFirst 
+      \lsthk at DisplayStyle%
+      \catcode\active=\active%
+      \a:lstinputlisting\special{t4ht@[}\lst at Init\relax \let\lst at gobble\z@%
+      \lst at SkipToFirst%
       \lst at ifprint \def\lst at next{\input{#1}}% 
-             \else \let\lst at next\@empty \fi 
-      \lst at next \lst at DeInit 
-      \b:lstinputlisting
+             \else \let\lst at next\@empty \fi%
+      \special{t4ht@]}\lst at next \lst at DeInit%
+      \b:lstinputlisting%
     \endgroup} 
+
+\HLet\lst at InputListing\:tempa 
 \NewConfigure{lstinputlisting}{2}
 >>>
 

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2022-03-24 14:16:31 UTC (rev 1096)
+++ trunk/lit/tex4ht-html4.tex	2022-03-24 17:17:15 UTC (rev 1097)
@@ -15287,7 +15287,7 @@
     \HCode{<!--l. \the\inputlineno-->}%
     \gdef\start:LstLn{%
        \HCode{<pre class="lstlisting" id="listing-\listingN">}%
-       \gdef\start:LstLn{|<nbsp|>\HCode{<br />\Hnewline}}}
+       \gdef\start:LstLn{\HCode{\Hnewline}}}
     \bgroup%
     % we put the closing </div> here in order to support floating listings
     % https://tex.stackexchange.com/a/615703/2891
@@ -15301,7 +15301,7 @@
    {\egroup\par}
    {} {}
 \Css{.lstlisting .label{margin-right:0.5em; }}
-\Css{pre.lstlisting{font-family: monospace,monospace; white-space: nowrap; 
+\Css{pre.lstlisting{font-family: monospace,monospace; white-space: pre-wrap; 
                     margin-top:0.5em; margin-bottom:0.5em;
                    }}
 >>>
@@ -15311,13 +15311,13 @@
    {\ifvmode \IgnorePar\fi \EndP  
     \HCode{<!--l. \the\inputlineno-->}%  
     \gHAdvance\listingN by 1%
+    \gdef\start:LstLn{\gdef\start:LstLn{\HCode{\Hnewline}}}% ignore first newline, to prevent spurious line
     \HCode{<pre class="lstinputlisting" id="listing-\listingN">}%  
     \bgroup\ttfamily%\special{t4ht@(}%  
        \Configure{listings}%
          {{\everypar{}\leavevmode}}%  
          {{\everypar{}\leavevmode}}%  
-         {|<nbsp|>%
-             \HCode{<br />\Hnewline<span class="label">}}%  
+         {\start:LstLn \HCode{<span class="label">}}%  
          {\HCode{</span>}}%  
    }  
    {%\special{t4ht@)}
@@ -15325,7 +15325,7 @@
     \ifvmode \IgnorePar\fi \EndP  \HCode{</pre>}\par}% 
 \Css{pre.lstinputlisting{
    font-family: monospace,monospace;
-   white-space: nowrap;
+   white-space: pre-wrap; 
 }}
 \Css{.lstinputlisting .label{margin-right:0.5em;}}
 >>>



More information about the tex4ht-commits mailing list.