summaryrefslogtreecommitdiff
path: root/support/TeX4ht
diff options
context:
space:
mode:
Diffstat (limited to 'support/TeX4ht')
-rw-r--r--support/TeX4ht/source/ChangeLog8
-rw-r--r--support/TeX4ht/source/tex4ht-jats.tex382
2 files changed, 362 insertions, 28 deletions
diff --git a/support/TeX4ht/source/ChangeLog b/support/TeX4ht/source/ChangeLog
index f3741e4ff5..956704a020 100644
--- a/support/TeX4ht/source/ChangeLog
+++ b/support/TeX4ht/source/ChangeLog
@@ -1,3 +1,11 @@
+2022-06-15 Michal Hoftich <michal.h21@gmail.com>
+
+ * tex4ht-jats.tex (jats.4ht): added support for Koma, AMS and Memoir
+ classes, figures, tables and footnotes.
+
+ * tex4ht-jats.tex (jats.4ht): added xml:lang support for the article
+ element.
+
2022-06-14 Michal Hoftich <michal.h21@gmail.com>
* tex4ht-4ht-tex (usepackage.4ht, ctexart-hooks.4ht, ctexart.4ht):
diff --git a/support/TeX4ht/source/tex4ht-jats.tex b/support/TeX4ht/source/tex4ht-jats.tex
index 61a087788f..68aed941f9 100644
--- a/support/TeX4ht/source/tex4ht-jats.tex
+++ b/support/TeX4ht/source/tex4ht-jats.tex
@@ -54,6 +54,7 @@ file.
\special{t4ht.xml}
|<xml structure|>
|<document structure|>
+|<xml:lang declarations|>
|<basic hyperlinks|>
|<basic fonts|>
|<basic jats mathml|>
@@ -67,27 +68,131 @@ file.
\section{Classes}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
\<configure jats article\><<<
-|<latex sections|>
+|<article,report,book|>
+|<article,report|>
>>>
\<configure jats book\><<<
-|<latex chapters|>
-|<latex sections|>
+|<article,report,book|>
+|<book,report|>
>>>
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\section{Packages}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\<configure jats report\><<<
+|<article,report,book|>
+|<article,report|>
+|<book,report|>
+>>>
-\<configure jats url\><<<
-|<url links|>
+Shared configurations for base LaTeX classes.
+
+\<article,report,book\><<<
+|<shared latex classes|>
>>>
-\<configure jats hyperref\><<<
-|<hyperref links|>
+Configurations that are shared only for article and report
+
+\<article,report\><<<
+|<shared article,report|>
+>>>
+
+\<book,report\><<<
+|<shared book,report|>
+>>>
+
+\section{Configurations for Koma Script}
+
+\<configure jats scrartcl\><<<
+|<scr article,report,book|>
+|<scr article,report|>
>>>
+\<configure jats scrbook\><<<
+|<scr article,report,book|>
+|<scr report,book|>
+>>>
+
+\<configure jats scrreprt\><<<
+|<scr article,report,book|>
+|<scr article,report|>
+|<scr report,book|>
+>>>
+
+\<scr article,report,book\><<<
+|<shared latex classes|>
+>>>
+
+\<scr article,report\><<<
+|<shared article,report|>
+>>>
+
+\<scr report,book\><<<
+|<shared book,report|>
+>>>
+
+\section{Configurations for AMS classes}
+
+\<configure jats amsart\><<<
+|<ams art,proc,book|>
+|<ams art,proc|>
+>>>
+
+\<configure jats amsproc\><<<
+|<ams art,proc,book|>
+|<ams proc,book|>
+|<ams art,proc|>
+>>>
+
+\<configure jats amsbook\><<<
+|<ams art,proc,book|>
+|<ams proc,book|>
+>>>
+
+|<ams art,proc|><<<
+>>>
+
+\<ams proc,book\><<<
+|<latex numbered chapters|>
+>>>
+
+\<ams art,proc,book\><<<
+|<latex numbered sections|>
+|<latex floats|>
+|<abstract|>
+|<latex tables|>
+|<latex footnotes|>
+>>>
+
+\section{Configurations for Memoir}
+
+\<configure jats memoir\><<<
+|<shared latex classes|>
+|<shared article,report|>
+|<shared book,report|>
+>>>
+
+\section{Shared class configurations}
+\<shared latex classes\><<<
+|<latex sections|>
+|<latex floats|>
+|<latex tables|>
+|<latex footnotes|>
+>>>
+
+\<shared article,report\><<<
+|<abstract|>
+>>>
+
+\<shared book,report\><<<
+|<latex chapters|>
+>>>
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Basic system configurations}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
\<xml structure\><<<
\Configure{VERSION}{\HCode{<?xml version="1.0" encoding="UTF-8"?>\Hnewline}}
@@ -103,7 +208,7 @@ file.
\Configure{xmlns}{xlink}{http://www.w3.org/1999/xlink}
\Configure{xmlns}{mml}{http://www.w3.org/1998/Math/MathML}
-\Configure{HTML}{\HCode{<article dtd-version="\a:DtdVersion" \html:xmlns>\Hnewline}}{\HCode{\Hnewline</article>}}
+\Configure{HTML}{\HCode{<article dtd-version="\a:DtdVersion" \html:xmlns xml:lang="\Get:Language">\Hnewline}}{\HCode{\Hnewline</article>}}
\Configure{@HEAD}{}
\Configure{HEAD}{\HCode{<front>}}{\HCode{</front>}}
% Add header structure
@@ -132,6 +237,111 @@ file.
\Configure{@HEAD}{\a:ArticleMeta}
>>>
+
+\<xml:lang declarations\><<<
+\def\Declare:Language#1#2{%
+\expandafter\gdef\csname rfclang#1\endcsname{#2}%
+}
+\def\Get:Language{%
+\ifx\bbl@main@language\@undefined en-US%
+\else%
+\expandafter\ifdefined\csname rfclang\bbl@main@language\endcsname \csname rfclang\bbl@main@language\endcsname\fi%
+\fi%
+}
+
+\Declare:Language{UKenglish}{en}
+\Declare:Language{USenglish}{en}
+\Declare:Language{latex}{en}
+\Declare:Language{acadian}{fr}
+\Declare:Language{albanian}{sq}
+\Declare:Language{american}{en}
+\Declare:Language{amharic}{am}
+\Declare:Language{arabic}{ar}
+\Declare:Language{armenian}{hy}
+\Declare:Language{australian}{en}
+\Declare:Language{austrian}{de}
+\Declare:Language{basque}{eu}
+\Declare:Language{bengali}{bn}
+\Declare:Language{brazilian}{pt}
+\Declare:Language{brazil}{pt}
+\Declare:Language{breton}{br}
+\Declare:Language{british}{en}
+\Declare:Language{bulgarian}{bg}
+\Declare:Language{canadian}{en}
+\Declare:Language{canadien}{fr}
+\Declare:Language{catalan}{ca}
+\Declare:Language{croatian}{hr}
+\Declare:Language{czech}{cs}
+\Declare:Language{danish}{da}
+\Declare:Language{divehi}{dv}
+\Declare:Language{dutch}{nl}
+\Declare:Language{english}{en}
+\Declare:Language{esperanto}{eo}
+\Declare:Language{estonian}{et}
+\Declare:Language{finnish}{f\/i}
+\Declare:Language{francais}{fr}
+\Declare:Language{french}{fr}
+\Declare:Language{galician}{gl}
+\Declare:Language{germanb}{de}
+\Declare:Language{german}{de}
+\Declare:Language{greek}{el}
+\Declare:Language{hebrew}{he}
+\Declare:Language{hindi}{hi}
+\Declare:Language{hungarian}{hu}
+\Declare:Language{icelandic}{is}
+\Declare:Language{interlingua}{ia}
+\Declare:Language{irish}{ga}
+\Declare:Language{italian}{it}
+\Declare:Language{kannada}{kn}
+\Declare:Language{khmer}{km}
+\Declare:Language{korean}{ko}
+\Declare:Language{lao}{lo}
+\Declare:Language{latin}{la}
+\Declare:Language{latvian}{lv}
+\Declare:Language{lithuanian}{lt}
+\Declare:Language{lowersorbian}{dsb}
+\Declare:Language{magyar}{hu}
+\Declare:Language{malayalam}{ml}
+\Declare:Language{marathi}{mr}
+\Declare:Language{naustrian}{de}
+\Declare:Language{newzealand}{en}
+\Declare:Language{ngerman}{de}
+\Declare:Language{norsk}{no}
+\Declare:Language{norwegiannynorsk}{nn}
+\Declare:Language{nynorsk}{no}
+\Declare:Language{occitan}{oc}
+\Declare:Language{oldchurchslavonic}{cu}
+\Declare:Language{persian}{fa}
+\Declare:Language{polish}{pl}
+\Declare:Language{polutonikogreek}{el}
+\Declare:Language{portuges}{pt}
+\Declare:Language{portuguese}{pt}
+\Declare:Language{romanian}{ro}
+\Declare:Language{romansh}{rm}
+\Declare:Language{russian}{ru}
+\Declare:Language{samin}{se}
+\Declare:Language{sanskrit}{sa}
+\Declare:Language{scottish}{gd}
+\Declare:Language{serbian}{sr}
+\Declare:Language{serbo-croatian}{sh}
+\Declare:Language{slovak}{sk}
+\Declare:Language{slovene}{sl}
+\Declare:Language{slovenian}{sl}
+\Declare:Language{spanish}{es}
+\Declare:Language{swedish}{sv}
+\Declare:Language{tamil}{ta}
+\Declare:Language{telugu}{te}
+\Declare:Language{thai}{th}
+\Declare:Language{tibetan}{bo}
+\Declare:Language{turkish}{tr}
+\Declare:Language{turkmen}{tk}
+\Declare:Language{ukrainian}{uk}
+\Declare:Language{uppersorbian}{hsb}
+\Declare:Language{urdu}{ur}
+\Declare:Language{vietnamese}{vi}
+\Declare:Language{welsh}{cy}
+>>>
+
\<document structure\><<<
\Configure{HtmlPar}
{\EndP\HCode{|<show input line no|><p \csname a:!P\endcsname>}}
@@ -243,8 +453,21 @@ about font name and size is lost.
>>>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Document structure}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Sections}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\<latex chapters\><<<
+|<latex numbered chapters|>
+|<latex unnumbered chapters|>
+>>>
+
+
+\<latex numbered chapters\><<<
\Configure{chapter}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
@@ -255,11 +478,6 @@ about font name and size is lost.
{\if@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}}
@@ -271,8 +489,20 @@ about font name and size is lost.
\appendixname\ \thechapter\HCode{</label>}}
>>>
+\<latex unnumbered chapters\><<<
+\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}
+>>>
+
\<latex sections\><<<
+|<latex numbered sections|>
+|<latex unnumbered sections|>
+>>>
+\<latex numbered sections\><<<
\Configure{section}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{</sec>\Hnewline}}
@@ -285,11 +515,6 @@ about font name and size is lost.
\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}}
@@ -303,11 +528,6 @@ about font name and size is lost.
\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}}
@@ -321,18 +541,33 @@ about font name and size is lost.
\HCode{<label>}\@seccntformat{section}%
\HCode{</label>}\fi }
-\Configure{likesubsubsection}
+
+\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{paragraph}
+>>>
+
+\<latex unnumbered sections\><<<
+\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{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{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{likeparagraph}
{\ifvmode\IgnorePar\fi\EndP\IgnorePar\HCode{<sec>\Hnewline}}
@@ -341,5 +576,96 @@ about font name and size is lost.
{\HCode{</title>}\HtmlParOn \ShowPar\par}
>>>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Abstracts}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<abstract\><<<
+\ConfigureEnv{abstract}
+{\ifvmode\IgnorePar\fi\EndP\HCode{<abstract>\Hnewline}}
+{\ifvmode\IgnorePar\fi\EndP\HCode{</abstract>}\par}{}{}
+
+\Configure{abstracttitle}{\ifvmode\IgnorePar\fi\EndP\HCode{<label>}\HtmlParOff\NoFonts}
+ {\HCode{</label>}\EndNoFonts\HtmlParOn\par}
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Floats}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<latex floats\><<<
+
+\Configure{float}
+ {\ifOption{refcaption}{}{\csname par\endcsname\ShowPar \leavevmode}}
+ {\IgnorePar\EndP\HCode{<fig>}}
+ {\ifvmode \IgnorePar \fi\EndP
+ \HCode{</fig>}\csname par\endcsname\ShowPar}
+
+\ConfigureEnv{figure}
+{\IgnorePar\EndP\HCode{<fig>\Hnewline}%
+ \bgroup \Configure{float}{\ShowPar}{}{}%
+ }
+ {\egroup
+ \IgnorePar\EndP\HCode{</fig>}|<try env inline par|>\par}
+ {}{}
+
+
+\Configure{caption}{\IgnorePar\EndP\HCode{<label>}}
+ {: } {\HCode{</label><caption>}\noindent\ShowPar}
+ {\HCode{</caption>}\HCode{<!--tex4ht:label?:
+ \cur:th\:currentlabel\space-->}%
+}
+>>>
+%%%%%%%%%%%%%%%%%%%
+\section{Tables}
+%%%%%%%%%%%%%%%%%%%
+
+\<latex tables\><<<
+\ConfigureEnv{table}
+ {\ifvmode \IgnorePar\fi \EndP \HCode{<table-wrap position="float">}
+ \Configure{float}{}{}{}{}
+ }
+ {\ifvmode \IgnorePar\fi \EndP \HCode{</table-wrap>}\par\ShowPar}
+ {}{}
+
+\ConfigureEnv{tabular}
+ {\Configure{noalign}%
+{\f:tabular\d:tabular \HCode{<tr><td colspan="\ar:cnt">}}
+{\HCode{</td></tr>}\pend:def\TableNo{0}\c:tabular\e:tabular}%
+%
+\IgnorePar\ifvmode\else\HCode{<!--tex4ht:inline-->}\fi
+\EndP\PushStack\Col:Marg\AllColMargins
+}
+{\PopStack\Col:Marg\AllColMargins\ShowPar
+\Configure{noalign}{}{}%
+%
+\ShowPar
+%
+}{}{}
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%
+\section{Footnotes}
+%%%%%%%%%%%%%%%%%%%%%
+
+\<latex footnotes\><<<
+\Configure{footnotemark}{\bgroup\NoFonts\HCode{<fn symbol="}\Configure{textsuperscript}{}{}}{\HCode{">}\EndNoFonts\egroup}
+% suppress footnote number in footnotext, it was already used in footnotemark
+\Configure{footnotetext}{\NoFonts\ShowPar\setbox0=\vbox\bgroup}
+{\egroup\EndNoFonts\SaveEndP\par\ShowPar\normalsize}% force new paragraph and normal font size
+{\EndP\RecallEndP\HCode{</fn>}}%
+>>>
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Packages}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<configure jats url\><<<
+|<url links|>
+>>>
+
+\<configure jats hyperref\><<<
+|<hyperref links|>
+>>>
\endinput