summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-09-30 20:13:53 +0000
committerKarl Berry <karl@freefriends.org>2021-09-30 20:13:53 +0000
commite145e1504f6609805f20556912bcbbfab32655f2 (patch)
treef3bf85338234900a4740a93c996188b8e900ac6e /Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua
parent7922f119be5a0399890a6a2cb688574cc119f78e (diff)
make4ht (30sep21)
git-svn-id: svn://tug.org/texlive/trunk@60662 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua')
-rw-r--r--Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua b/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua
index c1629181bb0..4a1f522e6e8 100644
--- a/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua
+++ b/Master/texmf-dist/scripts/make4ht/domfilters/make4ht-sectionid.lua
@@ -44,6 +44,9 @@ end
local escape_name = function(name)
local result = {}
+ -- remove LaTeX commands
+ name = name:gsub("\\[%a]+", "")
+ name = name:gsub("^%s+", ""):gsub("%s+$", "")
for _,char in utf8.codes(name) do
local info = chardata[char] or {}
if is_space(info) then
@@ -62,7 +65,7 @@ local function parse_toc_line(line)
-- the section ids and titles are saved in the following format:
-- \csname a:TocLink\endcsname{1}{x1-20001}{QQ2-1-2}{Nazdar světe}
-- ............................... id ................. title ...
- local id, name = line:match("a:TocLink.-{.-}{(.-)}{.-}{(.-)}")
+ local id, name = line:match("a:TocLink.-{.-}{(.-)}{.-}(%b{})")
if id then
return id, escape_name(name)
end