3

This seems to have happened after I updated TL 2020 on my Linux last night.

Now when building the same Latex file, with url{} in them, to HTML, using tex4ht, all the URL's are messed up and clicking on any gives page not found error.

No problem in the PDF compiled using lualatex.

What happens is that a URL such as

   https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=234780 

now shows, inside the generated HTML, as

<a class='url' 
  href='https://mathematica.stackexchange.com/landing/r/digest cta=question&amp;id;=234780'>
<span class='rm-lmtt-12'>

Notice the difference near the end.

Here is a MWE and the command to generate the HTML

\documentclass[12pt]{book}
\usepackage{hyperref}
\begin{document}

\url{https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=234780}

\end{document}

Compiled using

make4ht -ulm default -a debug foo4.tex "mathjax,htm"

There was no such problem before this TL update. I looked at HTML page compiled before OCT update, and the URL's there are correct. Here random one copied from the HTML page source compiled before this update

 https://mathematica.stackexchange.com/landing/r/digest?cta=question&#x0026;id=234240

Any one else sees this problem? Is there a workaround for it?

file list:

 *File List*
    book.cls    2020/04/10 v1.4m Standard LaTeX document class
    bk12.clo    2020/04/10 v1.4m Standard LaTeX file (size option)
hyperref.sty    2020-05-15 v7.00e Hypertext links for LaTeX
 ltxcmds.sty    2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
   iftex.sty    2020/03/06 v1.0d TeX engine tests
pdftexcmds.sty    2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
kvsetkeys.sty    2019/12/15 v1.18 Key value parser (HO)
kvdefinekeys.sty    2019-12-19 v1.6 Define keys (HO)
pdfescape.sty    2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
 hycolor.sty    2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
letltxmacro.sty    2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
 auxhook.sty    2019-12-17 v1.6 Hooks for auxiliary files (HO)
kvoptions.sty    2020-10-07 v3.14 Key value format for package options (HO)
  pd1enc.def    2020-05-15 v7.00e Hyperref: PDFDocEncoding definition (HO)
 intcalc.sty    2019/12/15 v1.3 Expandable calculations with integers (HO)
etexcmds.sty    2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  bitset.sty    2019/12/09 v1.3 Handle bit-vector datatype (HO)
bigintcalc.sty    2019/12/15 v1.5 Expandable calculations on big integers (HO)
atbegshi.sty    2020/08/17 v1.0a Emulation of the original atbegshi package
with kernel methods
 hluatex.def    2020-05-15 v7.00e Hyperref driver for luaTeX
   puenc.def    2020-05-15 v7.00e Hyperref: PDF Unicode definition (HO)
stringenc.sty    2019/11/29 v1.12 Convert strings between diff. encodings (HO)
atveryend.sty    2020/08/19 v1.0a Emulation of the original atvery package
with kernel methods
rerunfilecheck.sty    2019/12/05 v1.9 Rerun checks for auxiliary files (HO)
uniquecounter.sty    2019/12/15 v1.4 Provide unlimited unique counter (HO)
l3backend-luatex.def    2020-09-24 L3 backend support: PDF output (LuaTeX)
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
 nameref.sty    2019/09/16 v2.46 Cross-referencing by name of section
refcount.sty    2019/12/15 v3.6 Data extraction from label references (HO)
gettitlestring.sty    2019/12/15 v1.6 Cleanup title references (HO)
2
  • 1
    I can confirm the problem. The command htlatex foo4 "xhtml, mathjax, htm, charset=utf-8" " -cmozhtf -utf8" (a space after , in the second argument for htlatex is necessary only on Windows) seems to generate a correct result, so I suspect that the problem is in make4ht utility. Nov 22, 2020 at 6:50
  • @AkiraKakuto Yes, htlatex does not have this problem. Actually just the command htlatex foo4 "xhtml, mathjax, htm" will produce the correct page. So only difference is htlatex vs, make4ht in the front, yes.
    – Nasser
    Nov 22, 2020 at 7:18

1 Answer 1

4

You already found that it happens only with make4ht. It uses the LuaXML library to clean up the generated HTML code. There seems to be a bug in the way how it parses the XML entities. It tries to convert named entities to Unicode characters. It mistaken &id as a named entity. Because it cannot find the mapping between id and any Unicode character, it returns the original entity. But here comes the issue, it appends the semicolon. So your url comes from:

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=234780 

to

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id;=234780

The & becomes &amp; later in the processing, but the spurious semicolon remains. The actual error is that &id is parsed as HTML entity. Only text between & and ; should be parsed as entity. It is fixed in the development version of LuaXML, which should be uploaded to CTAN soon. In the meantime, you can place the updated file luaxml-entities.lua to the directory with your document.

It should produce the correct result:

<a class='url' href='https://mathematica.stackexchange.com/landing/r/digest?cta=question&amp;id=234780'><span class='cmtt-12'>https://mathematica.stackexchange.com/landing/r/digest?cta=question&amp;id=234780</span></a>
1
  • Thanks for the fast fix. I verified it fixes the URL problem in the generated HTML.
    – Nasser
    Nov 22, 2020 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .