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

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Fri Oct 16 22:19:03 CEST 2020


Author: michal_h21
Date: 2020-10-16 23:19:03 +0300 (Fri, 16 Oct 2020)
New Revision: 812

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-sty.tex
Log:
changed early package hooks mechanism to speed up things

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2020-10-16 18:39:11 UTC (rev 811)
+++ trunk/lit/ChangeLog	2020-10-16 20:19:03 UTC (rev 812)
@@ -4,7 +4,10 @@
 	html4.4ht, mktex4ht.4ht, ooffice.4ht, ooimpress.4ht, tei.4ht): strip leading
 	quotes from files that we try to find .4ht files for.
 	https://puszcza.gnu.org.ua/bugs/?486#postcomment
-	* tex4ht-4ht.tex (catchfile-sty-hooks.4ht): removed unnecessary file
+	* tex4ht-4ht.tex (catchfile-sty-hooks.4ht): removed unnecessary file.
+	* tex4ht-sty.tex (tex4ht.sty): changed the early package hook mechanism to
+	speed up things.
+	https://puszcza.gnu.org.ua/bugs/?486#postcomment
 
 2020-10-08  Michal Hoftich  <michal.h21 at gmail.com>
 

Modified: trunk/lit/tex4ht-sty.tex
===================================================================
--- trunk/lit/tex4ht-sty.tex	2020-10-16 18:39:11 UTC (rev 811)
+++ trunk/lit/tex4ht-sty.tex	2020-10-16 20:19:03 UTC (rev 812)
@@ -630,13 +630,33 @@
 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.
+can be requested using PackageHooks configuration. It needs to be included
+in the "add to usepackage" placeholder that is available in tex4ht-4ht.tex.
 
+Example:
+
+\Verbatim
+\<add to usepackage\><<<
+\Configure{PackageHooks}{packagename.sty}{packagename-hooks.4ht}
+>>>
+
+\<packagename-hooks.4ht\><<<
+% Some stuff executed before the package is loaded
+\:AtEndOfPackage{
+  % stuff executed after package is loaded
+  % macro redefinitions and so on
+}
+>>> \AddFile{9}{packagename-hooks}
+
+\EndVerbatim
+
 \<hook at usepackage\><<<
+\NewConfigure{PackageHooks}[2]{\expandafter\def\csname package:hooks:#1\endcsname{\input #2}}
 \def\a:usepackage:lthooks#1#2{%
-  \IfFileExists{#1-#2-hooks.4ht}{\input #1-#2-hooks.4ht}{}%
-} 
+  \expandafter\ifcsname package:hooks:#1.#2\endcsname
+  \csname package:hooks:#1.#2\endcsname
+  \fi
+}
 >>>
 
 



More information about the tex4ht-commits mailing list.