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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Fri Jun 10 17:03:38 CEST 2022


Author: michal_h21
Date: 2022-06-10 15:03:38 +0000 (Fri, 10 Jun 2022)
New Revision: 1146

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-jats.tex
Log:
Added basic formatting support for JATS

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-06-09 10:45:16 UTC (rev 1145)
+++ trunk/lit/ChangeLog	2022-06-10 15:03:38 UTC (rev 1146)
@@ -1,3 +1,9 @@
+2022-06-10  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-jats.tex (jats.4ht): added basic formatting support for
+	JATS.
+	https://tex.stackexchange.com/q/647208/2891
+
 2022-06-09  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-4ht.tex (latex.4ht): don't update \@currentlabel for

Modified: trunk/lit/tex4ht-jats.tex
===================================================================
--- trunk/lit/tex4ht-jats.tex	2022-06-09 10:45:16 UTC (rev 1145)
+++ trunk/lit/tex4ht-jats.tex	2022-06-10 15:03:38 UTC (rev 1146)
@@ -45,17 +45,55 @@
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\chapter{Start Here}
+\chapter{Package configurations}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\section{Basic system}
 
 \<configure jats tex4ht\><<<
 \special{t4ht.xml}
+|<xml structure|>
+|<document structure|>
+|<basic hyperlinks|>
+|<basic fonts|>
+|<basic jats mathml|>
+>>>
+
+\<configure jats latex\><<<
+|<latex fonts|>
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Classes}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<configure jats article\><<<
+|<latex sections|>
+>>>
+
+\<configure jats book\><<<
+|<latex chapters|>
+|<latex sections|>
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Packages}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<configure jats url\><<<
+|<url links|>
+>>>
+
+\<configure jats hyperref\><<<
+|<hyperref links|>
+>>>
+
+\<xml structure\><<<
 \Configure{VERSION}{\HCode{<?xml version="1.0" encoding="UTF-8"?>\Hnewline}}
 
 % select JATS version
 \NewConfigure{DtdVersion}{1}
-\Configure{DtdVersion}{1.2}
+\Configure{DtdVersion}{1.3}
 
 \Configure{DOCTYPE}{\HCode{<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v\a:DtdVersion\space 20130915//EN" "http://jats.nlm.nih.gov/archiving/\a:DtdVersion/JATS-archivearticle1-mathml3.dtd">\Hnewline}}
 
@@ -87,25 +125,221 @@
 % enable to configure contributors
 \def\JATS:Contributors{}
 \NewConfigure{Contributor}[1]{\concat:config\JATS:Contributors{#1}}
-\NewConfigure{TitleGroup}
+\NewConfigure{TitleGroup}{1}
 
 % insert metas into document header
 \Configure{@HEAD}{\a:JournalMeta}
 \Configure{@HEAD}{\a:ArticleMeta}
+>>>
 
+\<document structure\><<<
+\Configure{HtmlPar}
+  {\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
+  {\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
+  {\Tg</p>}%
+  {\Tg</p>}%
+>>>
 
+\<show input line no\><<<
+<!--l. \the\inputlineno-->%
+>>>
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Hyperlinks}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<basic hyperlinks\><<<
+\Configure{Link}{xref}{rid=}{id=}{\empty}   
+\LinkCommand\ExternalLink{ext-link,xlink:href,id}
 >>>
 
 
+\<url links\><<<
+\Configure{url}%
+     {\tmp:toks{#1}\ExternalLink[\noexpand\the\tmp:toks]{}{}{\let\UrlBigBreaks\empty
+                         \let\UrlBreaks\empty #1}\EndExternalLink}
+>>>
 
+\<hyperref links\><<<
+>>>
 
-\<configure jats tex4ht\><<<
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Math}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+MathML in JATS must use the mml: prefix
+
+\<basic jats mathml\><<<
+\Configure{mathml}{mml:}
 >>>
 
-\<configure jats latex\><<<
+Inline and display math should use different elements for their
+inclusion. We need to keep stack of the opened elements, as 
+math can be nested.
+
+For some reason, this configuration is called too early, resulting
+in compilation error. We thus use AtBeginDocument to postpone it.
+
+\<basic jats mathml\><<<
+\edef\math:type:inline{display="inline" }
+
+\ifdefined\AtBeginDocument
+\AtBeginDocument{
+  \Configure{DviMathML}{%
+    \ifx\a:@math\math:type:inline%
+    \PushStack\math:types{inline-formula}%
+    \HCode{<inline-formula>}%
+    \else%
+    \HCode{<disp-formula>}%
+    \PushStack\math:types{disp-formula}%
+    \fi%
+  }{\PopStack\math:types\:temp\HCode{</\:temp>}}%
+}%
+\fi
+
 >>>
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Fonts}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+JATS doesn't support any attributes for fonts, so the information
+about font name and size is lost.
 
+\<basic fonts\><<<
+\Configure{htf}{0}{+}{<italic}{}{}{}{}{>}{</italic>}
+\Configure{htf}{4}{+}{<sc}{}{}{}{}{>}{</sc>}
+\Configure{htf}{6}{+}{<underline}{}{}{}{}{>}{</underline>}
+>>>
+
+\<latex fonts\><<<
+\Configure{textit}{\Protect\HCode{<italic>}\NoFonts}{\EndNoFonts\Protect\Tg</italic>}
+\Configure{textbf}{\Protect\HCode{<bold>}\NoFonts}{\EndNoFonts\Protect\Tg</bold>}
+\Configure{textsc}{\Protect\HCode{<sc>}\NoFonts}{\EndNoFonts\Protect\Tg</sc>}
+\Configure{textrm}{\Protect\HCode{<roman>}\NoFonts}
+                    {\EndNoFonts\Protect\HCode{</roman>}}
+\Configure{textup}{\Protect\HCode{<span class="textup">}\NoFonts}
+                    {\EndNoFonts\Protect\HCode{</span>}}  
+\Configure{textsf}{\Protect\HCode{<sans-serif>}\NoFonts}
+                    {\EndNoFonts\Protect\HCode{</sans-serif>}}  
+\Configure{textsl}{\Protect\HCode{<italic>}\NoFonts}
+                    {\EndNoFonts\Protect\HCode{</italic>}}
+\Configure{texttt}{\Protect\HCode{<monospace>}\NoFonts}
+                    {\EndNoFonts\Protect\HCode{</monospace>}}
+\Configure{emph}{\Protect\HCode{<italic>}\NoFonts}
+                    {\EndNoFonts\Protect\HCode{</italic>}}
+
+\Configure{underline}
+   {\HCode{<underline>}\:gobble}
+   {\HCode{</underline>}}
+
+\Configure{textsuperscript}
+  {\HCode{<sup>}}
+  {\HCode{</sup>}}
+
+\Configure{textsubscript}
+  {\HCode{<sub>}}
+  {\HCode{</sub>}}
+>>>
+
+
+
+\<latex chapters\><<<
+\Configure{chapter}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\TitleMark\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\ConfigureMark{chapter}
+   {\if at mainmatter
+       \HCode{<label>}\chaptername\ \thechapter\HCode{</label>}\fi}
+
+\Configure{likechapter}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\Configure{appendix}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\TitleMark\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\ConfigureMark{appendix}{\HCode{<label>}%
+   \appendixname\ \thechapter\HCode{</label>}}
+>>>
+
+\<latex sections\><<<
+
+\Configure{section}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\TitleMark\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\ConfigureMark{section}
+   {\ifnum \c:secnumdepth>\c at secnumdepth \expandafter\:gobble
+    \else
+       \HCode{<label>}\@seccntformat{section}%
+       \HCode{</label>}\fi }
+
+\Configure{likesection}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\Configure{subsection}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\TitleMark\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\ConfigureMark{subsection}
+   {\ifnum \c:secnumdepth>\c at secnumdepth \expandafter\:gobble
+    \else
+       \HCode{<label>}\@seccntformat{section}%
+       \HCode{</label>}\fi }
+
+\Configure{likesubsection}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\Configure{subsubsection}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\TitleMark\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\ConfigureMark{subsubsection}
+   {\ifnum \c:secnumdepth>\c at secnumdepth \expandafter\:gobble
+    \else
+       \HCode{<label>}\@seccntformat{section}%
+       \HCode{</label>}\fi }
+
+\Configure{likesubsubsection}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+\Configure{paragraph}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+
+
+\Configure{likeparagraph}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
+   {\HCode{<title>}\space\HtmlParOff}
+   {\HCode{</title>}\HtmlParOn \ShowPar\par}
+>>>
+
+
 \endinput



More information about the tex4ht-commits mailing list.