[tex4ht-commits] [SCM] tex4ht updated: r1654 - trunk/lit
Michal Hoftich
INVALID.NOREPLY at gnu.org.ua
Fri Feb 28 17:01:39 CET 2025
Author: michal_h21
Date: 2025-02-28 16:01:39 +0000 (Fri, 28 Feb 2025)
New Revision: 1654
Modified:
trunk/lit/ChangeLog
trunk/lit/tex4ht-ooffice.tex
Log:
Added support for writing to automatic styles from the document
Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog 2025-02-27 14:02:06 UTC (rev 1653)
+++ trunk/lit/ChangeLog 2025-02-28 16:01:39 UTC (rev 1654)
@@ -1,3 +1,9 @@
+2025-02-28 Michal Hoftich <michal.h21 at gmail.com>
+
+ * tex4ht-oofice.tex (ooffice.4ht): support addition of automatic
+ styles later in the document.
+ https://github.com/michal-h21/make4ht/issues/165
+
2025-02-27 Michal Hoftich <michal.h21 at gmail.com>
* tex4ht-4ht.tex (listings.4ht): use correct destinations for links
Modified: trunk/lit/tex4ht-ooffice.tex
===================================================================
--- trunk/lit/tex4ht-ooffice.tex 2025-02-27 14:02:06 UTC (rev 1653)
+++ trunk/lit/tex4ht-ooffice.tex 2025-02-28 16:01:39 UTC (rev 1654)
@@ -178,22 +178,48 @@
\expandafter\ifx\csname a:automatic-styles\endcsname\relax \else
\csname a:automatic-styles\endcsname
\fi \Hnewline
- </office:automatic-styles>
+ }
+ % include temp file with styles declared by commands in the document
+ \InputIfFileExists{|<automatic styles file|>}{}{}%
+ |<oo declare automatic styles file|>%
+ \HCode{</office:automatic-styles>
}}
{\EndP\HCode{</office:document-content>}\Configure{newpage}{}}
\NewConfigure{automatic-styles}[1]{%
\expandafter\concat:config\csname a:automatic-styles\endcsname{#1}}
\expandafter\let\csname a:automatic-styles\endcsname\relax
+|<oo automatic styles file|>
|<oo2 automatic styles|>
>>>
+We need a mechanism for writting to the automatic styles contained in content.xml.
+Styles that should be placed here are styles used for particular elements, for example
+colors of particular tables rows.
+Automatic styles are written before the document contents is processed, so my solution is to
+open a temp file, where commands can write style changes. This file will be then included in
+the next pass at the correct place in the XML file.
+\<automatic styles file\><<<
+\jobname.4as>>>
+\<oo declare automatic styles file\><<<
+\newwrite\:automaticstylesfile
+\immediate\openout\:automaticstylesfile=|<automatic styles file|>
+>>>
+We can declare some helper commands for writing to the automatic styles file.
+\<oo automatic styles file\><<<
+% write arbitrary code to the automatic styles file
+\def\OOautomaticstyles#1{\immediate\write\:automaticstylesfile{#1}}
+% write XML code
+\def\OOautomaticstylesxml#1{\OOautomaticstyles{\string\HCode{#1\Hnewline}}}
+>>>
+
+
\<configure ooffice tex4ht\><<<
\Configure{HEAD}{}{}
>>>
More information about the tex4ht-commits
mailing list.