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

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Thu Feb 27 15:02:07 CET 2025


Author: michal_h21
Date: 2025-02-27 14:02:06 +0000 (Thu, 27 Feb 2025)
New Revision: 1653

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-4ht.tex
Log:
make correct destinations for list of listings

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2025-02-27 12:28:37 UTC (rev 1652)
+++ trunk/lit/ChangeLog	2025-02-27 14:02:06 UTC (rev 1653)
@@ -1,5 +1,9 @@
 2025-02-27  Michal Hoftich  <michal.h21 at gmail.com>
 
+	* tex4ht-4ht.tex (listings.4ht): use correct destinations for links
+	in list of listings.
+	https://tug.org/pipermail/tex4ht/2025q1/003697.html
+
 	* tex4ht-sty.tex (tex4ht.sty): don't add page breaks in
 	\Configure{MathClass}. It prevents writing to the aux file for the
 	Acronym package. 

Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex	2025-02-27 12:28:37 UTC (rev 1652)
+++ trunk/lit/tex4ht-4ht.tex	2025-02-27 14:02:06 UTC (rev 1653)
@@ -34175,14 +34175,23 @@
 of \Verb|\addcontentsline| which can then be used to write the correct TOC
 information to the .4tc file.
 
+The contents line will point to the listings environment. We expect that the environment
+will have id in the form of listing-<number>, where <number> is the number of the listing.
+The \Verb|\listingN| counter is updated after the contents line is written, so we need 
+to increase it locally. 
+
+\<next listings id\><<<
+listing-\the\numexpr\listingN+1\relax>>>
+
 \<listings list of\><<<
 \def\lst:newaddcontentsline#1#2#3{\gHAdvance\TitleCount by 1
   {\protect:wrtoc%
+  \Tag{)Q|<next listings id|>}{\FileNumber}% write listings id to the xref file, so it can be used in links
   \protected at edef\:temp{#3}%
    \protected at edef\:temp{\the\:tokwrite{\string\doTocEntry%
    \string\toclol% identify this entry as list of listings
    {\thetable}{\string\csname\space a:TocLink\string\endcsname%
-     {\FileNumber}{\cur:th \:currentlabel}{}{\ifx\:temp\empty\else \ignorespaces #3\fi}}%
+     {\FileNumber}{|<next listings id|>}{}{\ifx\:temp\empty\else \ignorespaces #3\fi}}%
        {}\relax}}\:temp%
 }}%
 >>>
@@ -34195,8 +34204,6 @@
   \let\addcontentsline\lst:newaddcontentsline%
 }
 \append:defI\lst at MakeCaption{%
-  % insert destination ID for the list of listings
-  \Link{}{\cur:th\:currentlabel}\EndLink
   \let\addcontentsline\lst:addcontentsline
 }
 >>>



More information about the tex4ht-commits mailing list.