Skip to content

Commit 8aecde1

Browse files
committed
fix: normalise attributes string to ensure proper parsing by Pandoc
1 parent 4691866 commit 8aecde1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/resources/filters/crossref/equations.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ function parseRefAttr(text)
239239
end)
240240
text = text:gsub(placeholder, "'")
241241

242+
-- Normalise spaces around = in attributes (alt = "value" -> alt="value")
243+
text = text:gsub("(%w+)%s*=%s*(['\"])", "%1=%2")
244+
242245
local parsed = pandoc.read("## " .. text, "markdown")
243246
if parsed and parsed.blocks[1] and parsed.blocks[1].attr then
244247
local attr = parsed.blocks[1].attr

0 commit comments

Comments
 (0)