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

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Thu Oct 8 17:37:28 CEST 2020


Author: michal_h21
Date: 2020-10-08 18:37:27 +0300 (Thu, 08 Oct 2020)
New Revision: 808

Modified:
   trunk/lit/tex4ht-sty.tex
Log:
added new hook mechanism for early package redefinitions

Modified: trunk/lit/tex4ht-sty.tex
===================================================================
--- trunk/lit/tex4ht-sty.tex	2020-10-05 22:24:54 UTC (rev 807)
+++ trunk/lit/tex4ht-sty.tex	2020-10-08 15:37:27 UTC (rev 808)
@@ -606,7 +606,8 @@
    \let\:temp\@reset at ptions
    \def\@reset at ptions{%
       \let\@reset at ptions\:temp
-      |<cats for usepackage|>\a:usepackage
+      |<cats for usepackage|>\a:usepackage%
+      \a:usepackage:lthooks{#1}{#4}
       |<recall usepackage cats|>}%
       \def\:currentoptions{#2}
 \:onefilewithoptions#1[#2][#3]{#4}\package:hooks{#1.#4}}
@@ -623,6 +624,22 @@
 \TivhTcats
 >>>
 
+In October 2020, LaTeX kernel added new hook support. It can be used
+for lot of stuff, including execution of code when a package is loaded.
+It is more efficient and clean than the current TeX4ht system of package
+handling. We can use it to execute code before and after package loading.
+
+Files that contain code that should be executed before the package is loaded
+should be named as packagename-ext-hooks.4ht. 
+For example, catchfile-sty-hooks.4ht.
+
+\<hook at usepackage\><<<
+\def\a:usepackage:lthooks#1#2{%
+  \IfFileExists{#1-#2-hooks.4ht}{\input #1-#2-hooks.4ht}{}%
+} 
+>>>
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%
 \Section{Second Pass}
 %%%%%%%%%%%%%%%%%%%%%%%%%



More information about the tex4ht-commits mailing list.