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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Mon Apr 4 12:06:26 CEST 2022


Author: michal_h21
Date: 2022-04-04 10:06:26 +0000 (Mon, 04 Apr 2022)
New Revision: 1106

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-html4.tex
Log:
fixed whitespace issues in inline minted

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-03-31 21:06:00 UTC (rev 1105)
+++ trunk/lit/ChangeLog	2022-04-04 10:06:26 UTC (rev 1106)
@@ -1,3 +1,9 @@
+2022-04-04  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (minted.4ht): fixed spurious whitespace produced by
+	\mintinline.
+	* tex4ht-html4.tex (html4.4ht): disable ht-fonts for inline Minted.
+
 2022-03-31  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-html4.tex (html4.4ht): support frames and background colors

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2022-03-31 21:06:00 UTC (rev 1105)
+++ trunk/lit/tex4ht-4ht.tex	2022-04-04 10:06:26 UTC (rev 1106)
@@ -24816,20 +24816,42 @@
 % minted.4ht (|version), generated from |jobname.tex
 % Copyright 2020-2021 TeX Users Group
 |<TeX4ht license text|>
+
+|<minted inline fixes|>
+|<minted background color|>
+|<minted background color|>
+|<minted input fixes|>
+
+\Hinput{minted}
+\endinput
+>>> \AddFile{9}{minted}
+
+Support for inline Minted listings. We need to take care of
+newline and space characters, as they produce unwanted white space
+in the generated HTML.
+
+\<minted inline fixes\><<<
 \NewConfigure{InlineCode}{2}
+% this is a hack to hide a newline that is produced, and which causes spurious space in the output
+\NewConfigure{MintedHideNewline}{2} 
+\Configure{MintedHideNewline}{\HCode{<!--}}{\HCode{-->}}
 
 \def\:tempa#1{%
   \endgroup%
   \begingroup%
-  \Configure{BVerbatimInput}{\HCode{}}{}{}{}{}\a:InlineCode% The \HCode is necessary for correct paragraph handling
+  \Configure{BVerbatimInput}{\HCode{}\ht:special{t4ht@(}}% \HCode is necessary for correct paragraph handlingling
+  {\a:MintedHideNewline}{\ht:special{t4ht@)}}{}{}% also hide newline and spurious spaces
+  \a:InlineCode%
   \begingroup%
-  \o:minted at inline@iii:{#1}%
+  \o:minted at inline@iii:{#1}\b:MintedHideNewline%
   \b:InlineCode%
   \endgroup%
 }
 
 \HLet\minted at inline@iii\:tempa
+>>>
 
+\<minted background color\><<<
 % support for background color in Minted listings
 \NewConfigure{MintedColorbg}{2}
 \renewenvironment{minted at colorbg}[1]{%
@@ -24839,14 +24861,8 @@
   \a:MintedColorbg%
   }
   {\b:MintedColorbg\medskip\noindent}
+>>>
 
-|<minted input fixes|>
-
-\Hinput{minted}
-\endinput
->>> \AddFile{9}{minted}
-
-
 Minted sometimes produces unexpected results. For example, << characters 
 get translated to guilelemets. To prevent that, we define new configuration,
 mintedfixes, where we can redefine macrod used by Minted to produce correct

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2022-03-31 21:06:00 UTC (rev 1105)
+++ trunk/lit/tex4ht-html4.tex	2022-04-04 10:06:26 UTC (rev 1106)
@@ -15206,7 +15206,8 @@
 
 Configuration for the inline code
 \<configure html4 minted\><<<
-\Configure{InlineCode}{\HCode{<code>}}{\HCode{</code>}}
+\Configure{InlineCode}{\HCode{<code class="minted-inline">}\NoFonts}{\EndNoFonts\HCode{</code>}}
+\Css{code.minted-inline{font-family:monospace,monospace;}}
 >>>
 
 Configuration for listings with colored backgrounds



More information about the tex4ht-commits mailing list.