Skip to content

lua,rawblock - recognize and process pandoc-reader:LANG blocks #13155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/resources/filters/normalize/extractquartodom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ function parse_md_in_html_rawblocks()
end,
RawBlock = function(raw)
local result
if raw.format == "pandoc-native" then
if raw.format:sub(1, 14) == "pandoc-reader-" then
-- this is a pandoc reader format, so we can read it directly
result = pandoc.read(raw.text, raw.format:sub(15)).blocks
elseif raw.format == "pandoc-native" then
result = pandoc.read(raw.text, "native").blocks
elseif raw.format == "pandoc-json" then
result = pandoc.read(raw.text, "json").blocks
Expand All @@ -39,7 +42,10 @@ function parse_md_in_html_rawblocks()
end,
RawInline = function(raw)
local result
if raw.format == "pandoc-native" then
if raw.format:sub(1, 14) == "pandoc-reader-" then
-- this is a pandoc reader format, so we can read it directly
result = quarto.utils.as_inlines(pandoc.read(raw.text, raw.format:sub(15)).blocks)
elseif raw.format == "pandoc-native" then
result = quarto.utils.as_inlines(pandoc.read(raw.text, "native").blocks)
elseif raw.format == "pandoc-json" then
-- let's try to be minimally smart here, and handle lists differently from a single top-level element
Expand Down
Loading