Add ICJ108 table style and RTL Typst helpers.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
15
filters/ltr-spans.lua
Normal file
15
filters/ltr-spans.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
-- 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
|
||||
20
filters/typst-linebreaks.lua
Normal file
20
filters/typst-linebreaks.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Turn HTML <br> / LineBreak into Typst #linebreak() so two-line table
|
||||
-- headers work in PDF as well as HTML.
|
||||
local function typst_break()
|
||||
return pandoc.RawInline("typst", "#linebreak()")
|
||||
end
|
||||
|
||||
function RawInline(el)
|
||||
if not quarto.doc.is_format("typst") then
|
||||
return nil
|
||||
end
|
||||
if el.format == "html" and el.text:match("^<br%s*/?>$") then
|
||||
return typst_break()
|
||||
end
|
||||
end
|
||||
|
||||
function LineBreak()
|
||||
if quarto.doc.is_format("typst") then
|
||||
return typst_break()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user