texlive[75061] Master/texmf-dist: section numbers in fulltoc, tex4ht
commits+karl at tug.org
commits+karl at tug.org
Tue Apr 29 23:29:19 CEST 2025
Revision: 75061
https://tug.org/svn/texlive?view=revision&revision=75061
Author: karl
Date: 2025-04-29 23:29:19 +0200 (Tue, 29 Apr 2025)
Log Message:
-----------
section numbers in fulltoc, tex4ht r1668
Revision Links:
--------------
https://tug.org/svn/texlive?view=revision&revision=1668
Modified Paths:
--------------
trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex
trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht
Modified: trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog 2025-04-29 19:50:41 UTC (rev 75060)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/ChangeLog 2025-04-29 21:29:19 UTC (rev 75061)
@@ -1,3 +1,8 @@
+2025-04-29 Michal Hoftich <michal.h21 at gmail.com>
+
+ * tex4ht-html4.tex (html4.4ht): include section numbers in the TOC
+ generated by the "fulltoc" option.
+
2025-04-25 Michal Hoftich <michal.h21 at gmail.com>
* tex4ht-html4.tex (html4.4ht): added the "fulltoc" option. It will
Modified: trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex
===================================================================
--- trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex 2025-04-29 19:50:41 UTC (rev 75060)
+++ trunk/Master/texmf-dist/source/generic/tex4ht/tex4ht-html4.tex 2025-04-29 21:29:19 UTC (rev 75061)
@@ -1,4 +1,4 @@
-% $Id: tex4ht-html4.tex 1667 2025-04-25 14:39:28Z michal_h21 $
+% $Id: tex4ht-html4.tex 1668 2025-04-29 14:59:53Z michal_h21 $
% Compile 4 times: latex tex4ht-html4
% Copy html4.4ht into the work directory before all but the last compilation.
%
@@ -1977,7 +1977,9 @@
\Configure{crosslinks+}{%
\bgroup
% container for the page toc
- \Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC">}\IgnorePar}
+ \Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC">}\IgnorePar%
+ % force section numbers to be included in TOC links
+ \:tocsectionnumberlinks}%
{\HCode{\Hnewline}}{\IgnorePar\HCode{</nav>\Hnewline}\ShowPar}{}{}%
\expandafter\TableOfContents\expandafter[\a:fulltocsections]% Print table of contents before crosslinks
\egroup
@@ -1987,15 +1989,34 @@
{\ifvmode\IgnorePar\fi\EndP%
\HCode{<nav class="crosslinks-bottom">}}{\HCode{</nav>}}{}{}
-% configuration for TOC on the main page, which is not configured by the previous command
-\Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC">}\IgnorePar}
+% configuration for TOC on the main page, it is not configured by the previous command
+% we added also the bookTOC class, so that we can style it differently than minitocs on subpages
+\Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC bookTOC">}\IgnorePar}
{}{\IgnorePar\HCode{</nav>\Hnewline<main class="main-content">\Hnewline}\ShowPar}{}{}%
% close the <main> element started in \Configure{crosslinks+} and \Configure{tableofcontents}
\Configure{@/BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{</main>}}
-
\Css{nav.TOC > span{display:block;}}
+\def\:declaresectionnumberlink#1{%
+% these configurations are inspired by this post: https://tex.stackexchange.com/a/523739/2891
+\expandafter\def\csname toc#1\endcsname##1##2##3{%
+ % configure the toclink so that the number is within the link
+ \Configure{TocLink}{\Link{####2}{####3}##1 ####4\EndLink}%
+ \HCode{<span class="#1Toc">}##2\HCode{</span>}}%
+\expandafter\def\csname toclike#1\endcsname##1##2##3{%
+ % configure the toclink so that the number is within the link
+ \Configure{TocLink}{\Link{####2}{####3}##1 ####4\EndLink}%
+ \HCode{<span class="#1Toc">}##2\HCode{</span>}}%
+}
+\def\:tocsectionnumberlinks{%
+ \:declaresectionnumberlink{part}%
+ \:declaresectionnumberlink{chapter}%
+ \:declaresectionnumberlink{section}%
+ \:declaresectionnumberlink{subsection}%
+ \:declaresectionnumberlink{subsubsection}%
+}
+
\else
\Log:Note{For full TOC on each page compatible with the collapsetoc DOM filter,
use the `fulltoc' command line option.}
Modified: trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht
===================================================================
--- trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht 2025-04-29 19:50:41 UTC (rev 75060)
+++ trunk/Master/texmf-dist/tex/generic/tex4ht/html4.4ht 2025-04-29 21:29:19 UTC (rev 75061)
@@ -1,4 +1,4 @@
-% html4.4ht (2025-04-25-14:24), generated from tex4ht-html4.tex
+% html4.4ht (2025-04-29-13:09), generated from tex4ht-html4.tex
% Copyright 2009-2025 TeX Users Group
% Copyright 1997-2009 Eitan M. Gurari
%
@@ -17,7 +17,7 @@
%
% If you modify this program, changing the
% version identification would be appreciated.
-\immediate\write-1{version 2025-04-25-14:24}
+\immediate\write-1{version 2025-04-29-13:09}
\exit:ifnot{8859-6,%
CJK,%
@@ -1526,7 +1526,9 @@
\Configure{crosslinks+}{%
\bgroup
% container for the page toc
- \Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC">}\IgnorePar}
+ \Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC">}\IgnorePar%
+ % force section numbers to be included in TOC links
+ \:tocsectionnumberlinks}%
{\HCode{\Hnewline}}{\IgnorePar\HCode{</nav>\Hnewline}\ShowPar}{}{}%
\expandafter\TableOfContents\expandafter[\a:fulltocsections]% Print table of contents before crosslinks
\egroup
@@ -1536,15 +1538,34 @@
{\ifvmode\IgnorePar\fi\EndP%
\HCode{<nav class="crosslinks-bottom">}}{\HCode{</nav>}}{}{}
-% configuration for TOC on the main page, which is not configured by the previous command
-\Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC">}\IgnorePar}
+% configuration for TOC on the main page, it is not configured by the previous command
+% we added also the bookTOC class, so that we can style it differently than minitocs on subpages
+\Configure{tableofcontents}{\IgnorePar\EndP\HCode{<nav class="TOC bookTOC">}\IgnorePar}
{}{\IgnorePar\HCode{</nav>\Hnewline<main class="main-content">\Hnewline}\ShowPar}{}{}%
% close the <main> element started in \Configure{crosslinks+} and \Configure{tableofcontents}
\Configure{@/BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{</main>}}
-
\Css{nav.TOC > span{display:block;}}
+\def\:declaresectionnumberlink#1{%
+% these configurations are inspired by this post: https://tex.stackexchange.com/a/523739/2891
+\expandafter\def\csname toc#1\endcsname##1##2##3{%
+ % configure the toclink so that the number is within the link
+ \Configure{TocLink}{\Link{####2}{####3}##1 ####4\EndLink}%
+ \HCode{<span class="#1Toc">}##2\HCode{</span>}}%
+\expandafter\def\csname toclike#1\endcsname##1##2##3{%
+ % configure the toclink so that the number is within the link
+ \Configure{TocLink}{\Link{####2}{####3}##1 ####4\EndLink}%
+ \HCode{<span class="#1Toc">}##2\HCode{</span>}}%
+}
+\def\:tocsectionnumberlinks{%
+ \:declaresectionnumberlink{part}%
+ \:declaresectionnumberlink{chapter}%
+ \:declaresectionnumberlink{section}%
+ \:declaresectionnumberlink{subsection}%
+ \:declaresectionnumberlink{subsubsection}%
+}
+
\else
\Log:Note{For full TOC on each page compatible with the collapsetoc DOM filter,
use the `fulltoc' command line option.}
More information about the tex-live-commits
mailing list.