[tex4ht-commits] [SCM] tex4ht updated: r1105 - trunk/lit
Michal Hoftich
INVALID.NOREPLY at gnu.org.ua
Thu Mar 31 23:06:01 CEST 2022
Author: michal_h21
Date: 2022-03-31 21:06:00 +0000 (Thu, 31 Mar 2022)
New Revision: 1105
Modified:
trunk/lit/ChangeLog
trunk/lit/tex4ht-html4.tex
Log:
added support for background and frames for other listings environments, fixed environment id updating
Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog 2022-03-30 12:06:52 UTC (rev 1104)
+++ trunk/lit/ChangeLog 2022-03-31 21:06:00 UTC (rev 1105)
@@ -1,3 +1,9 @@
+2022-03-31 Michal Hoftich <michal.h21 at gmail.com>
+
+ * tex4ht-html4.tex (html4.4ht): support frames and background colors
+ in custom Listings environments.
+ https://tex.stackexchange.com/a/639135/2891
+
2022-03-30 Michal Hoftich <michal.h21 at gmail.com>
* tex4ht-sty.tex (tex4ht.sty): don't redefine \IfFileExists. It can
Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex 2022-03-30 12:06:52 UTC (rev 1104)
+++ trunk/lit/tex4ht-html4.tex 2022-03-31 21:06:00 UTC (rev 1105)
@@ -15245,21 +15245,29 @@
fixed size fonts (see listings.dtx)}
>>>
+This configuration is used mainly when user defines new environment using \verb|lstnewenvironment|.
+
\<configure html4 listings\><<<
+\HAssign\listingN=0
\HAssign\listings:Depth = 0
\Configure{listings}
- {\ifvmode \IgnorePar\fi \EndP
+ {\ifvmode \IgnorePar\fi \EndP%
{\everypar{}\leavevmode}\HCode{<!--l. \the\inputlineno-->}%
- \ifnum \listings:Depth=0 \HCode{<pre class="listings">}\else
- \HCode{<span class="listings-nested">}\fi
- \gHAdvance\listings:Depth by 1
+ \ifnum \listings:Depth=0 \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
\HCode{</span>}\fi
}
- {|<nbsp|>\HCode{<br /><span class="label">}}
+ {\start:LstLn\HCode{<span class="label">}%
+ \gdef\start:LstLn{\HCode{\Hnewline}}}%
{\HCode{</span>}}%
+\Css{pre.listings{font-family: monospace,monospace; white-space: pre-wrap;
+ margin-top:0.5em; margin-bottom:0.5em;
+ }}
>>>
\<configure html4 listings\><<<
@@ -15289,10 +15297,8 @@
\<configure html4 listings\><<<
-\HAssign\listingN=0
\ConfigureEnv{lstlisting}
{\ifvmode \IgnorePar\fi \EndP
- \gHAdvance\listingN by 1
\HCode{<!--l. \the\inputlineno-->}%
\gdef\start:LstLn{%
\HCode{<pre class="lstlisting" id="listing-\listingN">}%
@@ -15319,14 +15325,12 @@
\Configure{lstinputlisting}
{\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">}%
+ \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@(}%
\Configure{listings}%
{{\everypar{}\leavevmode}}%
{{\everypar{}\leavevmode}}%
- {\start:LstLn \HCode{<span class="label">}}%
+ {\start:LstLn\HCode{<span class="label">}}%
{\HCode{</span>}}%
}
{%\special{t4ht@)}
@@ -15371,7 +15375,8 @@
\<configure html4 listings\><<<
\lst at AddToHook{Init}{%
-\bgroup%
+ \gHAdvance\listingN by 1% increase the ID before we save colors.
+ \bgroup%
% handle backround color and border in listings
\ifx\lst at fillcolor\@empty\else%
\lst at fillcolor%
More information about the tex4ht-commits
mailing list.