16 lines
484 B
Lua
16 lines
484 B
Lua
-- Preserve [text]{dir="ltr"} in Typst PDF (Pandoc HTML keeps the attribute;
|
|
-- Typst needs an explicit text(dir: ltr) wrapper).
|
|
function Span(el)
|
|
if not el.attributes or el.attributes.dir ~= "ltr" then
|
|
return nil
|
|
end
|
|
if not quarto.doc.is_format("typst") then
|
|
return nil
|
|
end
|
|
local text = pandoc.utils.stringify(el.content)
|
|
:gsub("\\", "\\\\")
|
|
:gsub("%]", "\\]")
|
|
:gsub("@", "\\@")
|
|
return pandoc.RawInline("typst", "#text(dir: ltr)[" .. text .. "]")
|
|
end
|