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

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Thu Dec 3 22:43:22 CET 2020


Author: michal_h21
Date: 2020-12-03 23:43:22 +0200 (Thu, 03 Dec 2020)
New Revision: 852

Modified:
   trunk/lit/ChangeLog
   trunk/lit/Makefile
   trunk/lit/mktex4ht-cnf.tex
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-html4.tex
Log:
Added support for the tcolorbox package

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2020-11-29 22:00:35 UTC (rev 851)
+++ trunk/lit/ChangeLog	2020-12-03 21:43:22 UTC (rev 852)
@@ -1,3 +1,9 @@
+2020-12-03  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-4ht.tex (tcolorbox.4ht),
+	tex4ht-html4.tex (html4.4ht): added support for the tcolorbox package.
+	https://tex.stackexchange.com/a/573314/2891
+
 2020-11-29  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-ooffice.tex (ooffice.4ht): simplified configuration of \paragraph

Modified: trunk/lit/Makefile
===================================================================
--- trunk/lit/Makefile	2020-11-29 22:00:35 UTC (rev 851)
+++ trunk/lit/Makefile	2020-12-03 21:43:22 UTC (rev 852)
@@ -116,7 +116,7 @@
   reading.4ht \
   scrartcl.4ht scrbook.4ht scrreprt.4ht scrjura.4ht sectionbreak.4ht \
 	skak.4ht spanish.4ht subscript.4ht svg.4ht \
-  tabu.4ht titlesec.4ht tocloft.4ht tuenc-luatex.4ht tuenc-xetex.4ht \
+  tabu.4ht tcolorbox.4ht titlesec.4ht tocloft.4ht tuenc-luatex.4ht tuenc-xetex.4ht \
   usepackage.4ht usepackage-fontspec.4ht \
   wrapfig.4ht \
   xcolor.4ht xr.4ht xr-hyper.4ht 

Modified: trunk/lit/mktex4ht-cnf.tex
===================================================================
--- trunk/lit/mktex4ht-cnf.tex	2020-11-29 22:00:35 UTC (rev 851)
+++ trunk/lit/mktex4ht-cnf.tex	2020-12-03 21:43:22 UTC (rev 852)
@@ -349,6 +349,7 @@
 \AddFile{9}{tuenc-luatex}
 \AddFile{9}{framed}
 \AddFile{9}{mdframed}
+\AddFile{9}{tcolorbox}
 \AddFile{9}{skak}
 \AddFile{9}{animate}
 \AddFile{9}{sectionbreak}

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2020-11-29 22:00:35 UTC (rev 851)
+++ trunk/lit/tex4ht-4ht.tex	2020-12-03 21:43:22 UTC (rev 852)
@@ -26283,7 +26283,76 @@
 \endinput
 >>> \AddFile{9}{mdframed}
 
+%%%%%%%%%%%%%%%%%%%%%%%
+\Section{tcolorbox}
+%%%%%%%%%%%%%%%%%%%%%%%
 
+\<tcolorbox.4ht\><<<
+% tcolorbox.4ht (|version), generated from |jobname.tex
+% Copyright 2020 TeX Users Group
+|<TeX4ht license text|>
+
+% use custom counter that increments for every \tcolorbox
+\newcounter{:tcbcolcount}
+
+\def\tcb at drawcolorbox{%
+  \stepcounter{:tcbcolcount}%
+  % save text and background colors for use in CSS
+  \get:xcolorcss{tcbcolbacktitle}\:tcbcolbacktitle%
+  \get:xcolorcss{tcbcoltitle}\:tcbcoltitle%
+  \get:xcolorcss{tcbcolback}\:tcbcolback%
+  \get:xcolorcss{tcbcolframe}\:tcbcolframe%
+  \get:xcolorcss{tcbcolupper}\:tcbcolupper%
+  % make unique ID for this box
+  \def\:tcbcolid{tcolobox-\arabic{:tcbcolcount}}
+  % Open box
+  \a:tcolorbox%
+  % save label, if it is set
+  \ifdefined\tcolorbox:label:key%
+    \label{\tcolorbox:label:key}%
+  \fi%
+  % open title
+  \b:tcolorbox%
+  \kvtcb at before@title\kvtcb at title\kvtcb at after@title%
+  % close title and open main box
+  \c:tcolorbox%
+  \box\tcb at upperbox%
+  % deal with lower box, if it is set
+  \iftcb at hasLower%
+    \a:tcolorlowerbox%
+    \box\tcb at lowerbox%
+    \b:tcolorlowerbox%
+  \fi%
+  % close box
+  \d:tcolorbox%
+}
+
+% overwrite other versions of box drawing macros
+\let\tcb at drawcolorbox@standalone\tcb at drawcolorbox
+
+\NewConfigure{tcolorbox}{4}
+\NewConfigure{tcolorlowerbox}{2}
+
+% we need to save label for a later use
+\def\:tempa#1{%
+  \xdef\tcolorbox:label:key{#1}%
+  \o:tcb at set@label:{#1}%
+}
+\HLet\tcb at set@label\:tempa
+
+
+% this is a trick to fix issues with paragraphs
+% spurious end </p> tags were inserted
+\def\tcb at minipage#1{\SaveEndP\vbox\bgroup\par}
+\def\endtcb at savebox{\EndP\egroup\RecallEndP}
+
+\Hinput{tcolorbox}
+\endinput
+
+
+
+>>> \AddFile{9}{tcolorbox}
+
 %%%%%%%%%%%%%%%%%%%%%%%
 \Section{dvipsnam}
 %%%%%%%%%%%%%%%%%%%%%%%

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2020-11-29 22:00:35 UTC (rev 851)
+++ trunk/lit/tex4ht-html4.tex	2020-12-03 21:43:22 UTC (rev 852)
@@ -16100,6 +16100,34 @@
 }
 >>>
 
+%%%%%%%%%%%%%%%%%
+\section{tcolorbox}
+%%%%%%%%%%%%%%%%%
+
+
+
+\<configure html4 tcolorbox\><<<
+\Configure{tcolorbox}
+{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="tcolorbox \@currenvir" id="\:tcbcolid">} 
+  % \tcbcolid and colors are defined in tcolorbox.4ht
+  \Css{\#\:tcbcolid\space .tcolorbox-title{color: \:tcbcoltitle; background-color: \:tcbcolframe;}}
+  \Css{\#\:tcbcolid\space .tcolorbox-content{color: \:tcbcolupper; background-color: \:tcbcolback; border: 1px solid \:tcbcolframe;}}
+}
+{\HCode{\Hnewline<div class="tcolorbox-title">}\par}
+{\ifvmode\IgnorePar\fi\EndP\HCode{</div>\Hnewline<div class="tcolorbox-content">}}
+{\ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline</div>\Hnewline</div>}\par}
+
+\Css{.tcolorbox{margin-top:0.5em;margin-bottom: 0.5em;}}
+
+\Configure{tcolorlowerbox}{\ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline<div class="lowerbox">}
+  \Css{\#\:tcbcolid\space .lowerbox{border-top: 1px dashed \:tcbcolframe;}}
+}
+{\ifvmode\IgnorePar\fi\EndP\HCode{\Hnewline</div>}}
+
+% there is rule p + div elsewhere in TeX4ht. we want to nullify it.
+\Css{.tcolorbox .lowerbox{margin-top:0pt;}}
+>>>
+
 %%%%%%%%%%%%%%%%
 \section{verse}
 %%%%%%%%%%%%%%%%%



More information about the tex4ht-commits mailing list.