Span = function(el) color = el.attributes['c'] if color ~= nil then el.attributes['c'] = nil if FORMAT:match 'html' then el.attributes['style'] = 'color: ' .. color .. ';' elseif FORMAT:match 'latex' then table.insert(el.content, 1, pandoc.RawInline('latex', '\\textcolor{'..color..'}{')) table.insert(el.content, pandoc.RawInline('latex', '}')) end end background_color = el.attributes['bc'] if background_color ~= nil then el.attributes['bc'] = nil if FORMAT:match 'html' then el.attributes['style'] = 'background-color: ' .. background_color .. ';' elseif FORMAT:match 'latex' then table.insert(el.content, 1, pandoc.RawInline('latex', '\\colorbox{'..background_color..'}{')) table.insert(el.content, pandoc.RawInline('latex', '}')) end end return el end Link = function(el) if FORMAT:match 'plain' then -- Converting from Markdown to Plain Text loses any link URLs -- https://github.com/jgm/pandoc/issues/2399 return table.insert(el.content, {pandoc.Space(), " <", pandoc.Str(el.target), pandoc.Str ">"}) else background_color = el.attributes['bc'] if background_color ~= nil then el.attributes['bc'] = nil if FORMAT:match 'html' then el.attributes['style'] = 'background-color: ' .. background_color .. ';' elseif FORMAT:match 'latex' then table.insert(el.content, 1, pandoc.RawInline('latex', '\\colorbox{'..background_color..'}{')) table.insert(el.content, pandoc.RawInline('latex', '}')) end end return el end end Div = function(el) local admonitions = { important = "Important" , attention = "Attention" , information = "Information" , problem = "Problème" , solution = "Solution" } if admonitions[el.classes[1]] ~= nil then if FORMAT:match 'html' then ad_type = pandoc.Div(admonitions[el.classes[1]], { class = 'admonition-type' }) ad_content = pandoc.Div(el.content, { class = 'admonition-content' }) el.content = { ad_type, ad_content } table.insert(el.classes, 1, 'admonition') elseif FORMAT:match 'latex' then table.insert(el.content, 1, pandoc.RawBlock("latex", "\\begin{quote_" .. el.classes[1] .. "}")) table.insert(el.content, pandoc.RawBlock("latex", "\\end{quote_" .. el.classes[1] .. "}")) end end return el end