diff options
Diffstat (limited to 'support/make4ht/domfilters/make4ht-sectionid.lua')
-rw-r--r-- | support/make4ht/domfilters/make4ht-sectionid.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/support/make4ht/domfilters/make4ht-sectionid.lua b/support/make4ht/domfilters/make4ht-sectionid.lua index c1629181bb..4a1f522e6e 100644 --- a/support/make4ht/domfilters/make4ht-sectionid.lua +++ b/support/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 |