diff options
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/filters/make4ht-fix-links.lua')
-rw-r--r-- | Master/texmf-dist/scripts/make4ht/filters/make4ht-fix-links.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/filters/make4ht-fix-links.lua b/Master/texmf-dist/scripts/make4ht/filters/make4ht-fix-links.lua new file mode 100644 index 00000000000..4dbc26824f3 --- /dev/null +++ b/Master/texmf-dist/scripts/make4ht/filters/make4ht-fix-links.lua @@ -0,0 +1,19 @@ +-- replace colons in `id` or `href` attributes for local links with underscores +-- + +local function fix_href_colons(s) + return s:gsub('(href=".-")', function(a) + if a:match("[a-z]%://") then return a end + return a:gsub(":","_") + end) +end + +local function fix_id_colons(s) + return s:gsub('(id=".-")', function(a) + return a:gsub(":", "_") + end) +end + +return function(s) + return fix_id_colons(fix_href_colons(s)) +end |