34 lines
783 B
Lua
34 lines
783 B
Lua
------------------------------------ PANDOC -----------------------------------
|
|
|
|
local function is_chosen(block)
|
|
chosen, content = true, block.content
|
|
if content == nil or pandoc.utils.type(content) ~= "Inlines" then
|
|
chosen = false
|
|
end
|
|
return chosen
|
|
end
|
|
|
|
local function sanitize(inlines)
|
|
for i, inline in ipairs(inlines) do
|
|
if inline.tag == "Code" then
|
|
inlines:remove(i)
|
|
elseif inline.tag == "Quoted" then
|
|
str = pandoc.utils.stringify(inline.content):gsub('"', '\\"')
|
|
inlines[i] = '"' .. str .. '"'
|
|
end
|
|
end
|
|
return pandoc.utils.stringify(inlines)
|
|
end
|
|
|
|
return {
|
|
{
|
|
Block = function (block)
|
|
if is_chosen(block) then
|
|
raw = sanitize(block.content)
|
|
doc = lit.parse(raw)
|
|
print(doc)
|
|
end
|
|
end,
|
|
}
|
|
}
|