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

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Tue Jul 28 15:15:30 CEST 2020


Author: michal_h21
Date: 2020-07-28 16:15:30 +0300 (Tue, 28 Jul 2020)
New Revision: 782

Modified:
   trunk/lit/ChangeLog
   trunk/lit/Makefile
   trunk/lit/tex4ht-4ht.tex
   trunk/lit/tex4ht-sty.tex
Log:
Prepare for new LaTeX hook management in \begin{document}

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2020-07-27 11:20:53 UTC (rev 781)
+++ trunk/lit/ChangeLog	2020-07-28 13:15:30 UTC (rev 782)
@@ -1,3 +1,11 @@
+2020-07-28  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-sty.tex (tex4ht.sty),
+	* tex4ht-4ht.tex (latex.4ht),
+	* Makefile: use new LaTeX hook system for patching \begin{document}
+	when possible.
+	https://puszcza.gnu.org.ua/bugs/?477#postcomment
+	
 2020-07-27  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-sty.tex (tex4ht.sty): don't patch \shipout command.

Modified: trunk/lit/Makefile
===================================================================
--- trunk/lit/Makefile	2020-07-27 11:20:53 UTC (rev 781)
+++ trunk/lit/Makefile	2020-07-28 13:15:30 UTC (rev 782)
@@ -55,7 +55,7 @@
 tex_1opt = "$(tex_opts)" # must be quoted, passing to shell script
 dev_null = </dev/null    # when we don't call tex directly.
 
-HTTEX = ht "tex $(tex_opts)"  # set tex options for plain tex
+HTTEX = ht "etex $(tex_opts)"  # set tex options for plain tex
 
 # Although many of the source files say to use xhlatex, we always use
 # htlatex instead. xhlatex generates XHTML from the literate source and
@@ -359,18 +359,18 @@
 	texlua checklog.lua *.log
 
 $(tex4ht_4ht_derived): tex4ht-4ht.tex cond4ht.4ht $(common)
-	tex $(tex_opts) $<
+	etex $(tex_opts) $<
 
 $(tex4ht_bibtex2_derived): tex4ht-bibtex2.tex $(common)
 	latex $(tex_opts) $<
 
 $(tex4ht_c_derived): tex4ht-c.tex $(common)
-	tex $(tex_opts) $<
+	etex $(tex_opts) $<
 
 $(tex4ht_cond4ht_derived): tex4ht-cond4ht.tex mktex4ht-cnf.tex \
                            $(common_no_cond_sty)
-	tex $(tex_opts) $<
-	tex $(tex_opts) cond4ht.4ht
+	etex $(tex_opts) $<
+	etex $(tex_opts) cond4ht.4ht
 
 $(tex4ht_docbook_derived): tex4ht-docbook.tex $(common)
 	htlatex $< "html,3" "" "" $(tex_1opt)

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2020-07-27 11:20:53 UTC (rev 781)
+++ trunk/lit/tex4ht-4ht.tex	2020-07-28 13:15:30 UTC (rev 782)
@@ -5366,12 +5366,26 @@
 \let\end|=\o:end
 \let\o:end|=\:UnDef
 \let\o:enddocumenthook|=\@enddocumenthook
-\def\@enddocumenthook{\HtmlEnv
+\def\:enddocumenthook{\HtmlEnv
    \Configure{newpage}{}%
    \o:enddocumenthook
    \at:docend  \csname export:hook\endcsname  }
 >>>
 
+LaTeX in 2020 introduced new hoooks in the development version, so we need to
+adapt for it. The following code uses either the old code, or the new hooks. We
+should remove the legacy code once the hooks are introduced in the stable LaTeX
+core
+
+\<html latex hook on end\><<<
+\ifdefined\AddToHook%
+ \AddToHook{enddocument} {\HtmlEnv\Configure{newpage}{}\at:docend  \csname export:hook\endcsname}
+\else%
+  \let\@enddocumenthook\:enddocumenthook
+\fi
+>>>
+
+
 \<html latex start\><<<
 \def\:startdoc{%
    \pageno=1

Modified: trunk/lit/tex4ht-sty.tex
===================================================================
--- trunk/lit/tex4ht-sty.tex	2020-07-27 11:20:53 UTC (rev 781)
+++ trunk/lit/tex4ht-sty.tex	2020-07-28 13:15:30 UTC (rev 782)
@@ -853,10 +853,15 @@
 \let\o:document|=\document
 \def\document{%
    |<check irregularities|>%
-   \expandafter\let\csname enddocument\endcsname|=\empty
-   \end{document}%
+   %\expandafter\let\csname enddocument\endcsname|=\empty
+   %\end{document}%
    |<protect AtBeginDocument|>%
-   \let\document|=\o:document
+   %\let\document|=\o:document
+   \ifdefined\AddToHook%
+      \def\document{\endgroup\o:document}%
+   \else%
+      \let\document\o:document%
+   \fi%
    \let\:latex at error|=\@latex at error
    \def\@latex at error##1{\:latex at error{##1 in `\config:file'}}%
    |<load latex /Preample|>%
@@ -3035,6 +3040,7 @@
    \csname export:hook\endcsname  \csname o:end\endcsname}
 >>>
 
+This is not used, enddocument hook for LaTeX is defined in latex.4ht.
 
 \<latex hook on end\><<<
 \let\o:enddocumenthook|=\@enddocumenthook



More information about the tex4ht-commits mailing list.