Skip to content

Commit 9503b01

Browse files
committed
Improve asciidoc encoding
1 parent 40f7d6f commit 9503b01

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/resources/filters/layout/asciidoc.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ function asciidocFigure(image)
2424
-- alt text (ok to use HTML entities since alt is expressly for HTML output)
2525
local altText = image.attr.attributes["alt"] or image.attr.attributes[kFigAlt] or ""
2626
altText = altText:gsub("\"", """)
27+
altText = altText:gsub("<", "&lt;")
28+
altText = altText:gsub(">", "&gt;")
29+
altText = altText:gsub("&", "&amp;")
2730

2831
-- the figure itself
2932
figure:extend({"image::" .. image.src .. "[\"" .. altText .. "\"]"})

src/resources/filters/quarto-post/render-asciidoc.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function renderAsciidoc()
2727
local identifier = span.identifier
2828
if refType(identifier) == "sec" then
2929
-- this is a chapter title, tear out the id and make it ourselves
30-
local titleContents = pandoc.write(pandoc.Pandoc(span.content), "asciidoc")
30+
local titleContents = pandoc.write(pandoc.Pandoc({span.content}), "asciidoc")
3131
meta['title'] = pandoc.RawInline("asciidoc", titleContents)
3232
meta['title-prefix'] = pandoc.RawInline("asciidoc", "[[" .. identifier .. "]]")
3333
end

0 commit comments

Comments
 (0)