pandoc 2.17.1 → 2.17.1.1
raw patch · 6 files changed
+100/−91 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +10/−0
- data/sample.lua +54/−54
- man/pandoc.1 +2/−2
- pandoc.cabal +1/−1
- src/Text/Pandoc/App/Opt.hs +3/−4
- test/writer.custom +30/−30
changelog.md view
@@ -1,5 +1,15 @@ # Revision history for pandoc +## pandoc 2.17.1.1 (2022-01-31)++ * Fix regression in 2.17.1 which caused problems finding+ default files in the default user data directory. (Reverts+ the item "logic bug in `fullDefaultsPath`", which was+ misguided.)++ * Sample custom writer: use single quotes for strings (#7487,+ Albert Krewinkel).+ ## pandoc 2.17.1 (2022-01-30) * Support `pagedjs-cli` as pdf engine (#7838, Albert Krewinkel).
data/sample.lua view
@@ -14,7 +14,7 @@ -- syntax errors. local pipe = pandoc.pipe-local stringify = (require "pandoc.utils").stringify+local stringify = (require 'pandoc.utils').stringify -- The global variable PANDOC_DOCUMENT contains the full AST of -- the document which is going to be written. It can be used to@@ -25,19 +25,19 @@ -- `image_format` meta value. local image_format = meta.image_format and stringify(meta.image_format)- or "png"+ or 'png' local image_mime_type = ({- jpeg = "image/jpeg",- jpg = "image/jpeg",- gif = "image/gif",- png = "image/png",- svg = "image/svg+xml",+ jpeg = 'image/jpeg',+ jpg = 'image/jpeg',+ gif = 'image/gif',+ png = 'image/png',+ svg = 'image/svg+xml', })[image_format]- or error("unsupported image format `" .. image_format .. "`")+ or error('unsupported image format `' .. image_format .. '`') -- Character escaping local function escape(s, in_attribute)- return s:gsub("[<>&\"']",+ return s:gsub('[<>&"\']', function(x) if x == '<' then return '<'@@ -60,7 +60,7 @@ local function attributes(attr) local attr_table = {} for x,y in pairs(attr) do- if y and y ~= "" then+ if y and y ~= '' then table.insert(attr_table, ' ' .. x .. '="' .. escape(y,true) .. '"') end end@@ -72,7 +72,7 @@ -- Blocksep is used to separate block elements. function Blocksep()- return "\n\n"+ return '\n\n' end -- This function is called once for the whole document. Parameters:@@ -106,31 +106,31 @@ end function Space()- return " "+ return ' ' end function SoftBreak()- return "\n"+ return '\n' end function LineBreak()- return "<br/>"+ return '<br/>' end function Emph(s)- return "<em>" .. s .. "</em>"+ return '<em>' .. s .. '</em>' end function Strong(s)- return "<strong>" .. s .. "</strong>"+ return '<strong>' .. s .. '</strong>' end function Subscript(s)- return "<sub>" .. s .. "</sub>"+ return '<sub>' .. s .. '</sub>' end function Superscript(s)- return "<sup>" .. s .. "</sup>"+ return '<sup>' .. s .. '</sup>' end function SmallCaps(s)@@ -142,33 +142,33 @@ end function Link(s, tgt, tit, attr)- return "<a href='" .. escape(tgt,true) .. "' title='" ..- escape(tit,true) .. "'" .. attributes(attr) .. ">" .. s .. "</a>"+ return '<a href="' .. escape(tgt,true) .. '" title="' ..+ escape(tit,true) .. '"' .. attributes(attr) .. '>' .. s .. '</a>' end function Image(s, src, tit, attr)- return "<img src='" .. escape(src,true) .. "' title='" ..- escape(tit,true) .. "'/>"+ return '<img src="' .. escape(src,true) .. '" title="' ..+ escape(tit,true) .. '"/>' end function Code(s, attr)- return "<code" .. attributes(attr) .. ">" .. escape(s) .. "</code>"+ return '<code' .. attributes(attr) .. '>' .. escape(s) .. '</code>' end function InlineMath(s)- return "\\(" .. escape(s) .. "\\)"+ return '\\(' .. escape(s) .. '\\)' end function DisplayMath(s)- return "\\[" .. escape(s) .. "\\]"+ return '\\[' .. escape(s) .. '\\]' end function SingleQuoted(s)- return "‘" .. s .. "’"+ return '‘' .. s .. '’' end function DoubleQuoted(s)- return "“" .. s .. "”"+ return '“' .. s .. '”' end function Note(s)@@ -184,11 +184,11 @@ end function Span(s, attr)- return "<span" .. attributes(attr) .. ">" .. s .. "</span>"+ return '<span' .. attributes(attr) .. '>' .. s .. '</span>' end function RawInline(format, str)- if format == "html" then+ if format == 'html' then return str else return ''@@ -200,8 +200,8 @@ for _,cit in ipairs(cs) do table.insert(ids, cit.citationId) end- return "<span class=\"cite\" data-citation-ids=\"" .. table.concat(ids, ",") ..- "\">" .. s .. "</span>"+ return '<span class="cite" data-citation-ids="' .. table.concat(ids, ',') ..+ '">' .. s .. '</span>' end function Plain(s)@@ -209,16 +209,16 @@ end function Para(s)- return "<p>" .. s .. "</p>"+ return '<p>' .. s .. '</p>' end -- lev is an integer, the header level. function Header(lev, s, attr)- return "<h" .. lev .. attributes(attr) .. ">" .. s .. "</h" .. lev .. ">"+ return '<h' .. lev .. attributes(attr) .. '>' .. s .. '</h' .. lev .. '>' end function BlockQuote(s)- return "<blockquote>\n" .. s .. "\n</blockquote>"+ return '<blockquote>\n' .. s .. '\n</blockquote>' end function HorizontalRule()@@ -234,39 +234,39 @@ -- If code block has class 'dot', pipe the contents through dot -- and base64, and include the base64-encoded png as a data: URL. if attr.class and string.match(' ' .. attr.class .. ' ',' dot ') then- local img = pipe("base64", {}, pipe("dot", {"-T" .. image_format}, s))+ local img = pipe('base64', {}, pipe('dot', {'-T' .. image_format}, s)) return '<img src="data:' .. image_mime_type .. ';base64,' .. img .. '"/>' -- otherwise treat as code (one could pipe through a highlighter) else- return "<pre><code" .. attributes(attr) .. ">" .. escape(s) ..- "</code></pre>"+ return '<pre><code' .. attributes(attr) .. '>' .. escape(s) ..+ '</code></pre>' end end function BulletList(items) local buffer = {} for _, item in pairs(items) do- table.insert(buffer, "<li>" .. item .. "</li>")+ table.insert(buffer, '<li>' .. item .. '</li>') end- return "<ul>\n" .. table.concat(buffer, "\n") .. "\n</ul>"+ return '<ul>\n' .. table.concat(buffer, '\n') .. '\n</ul>' end function OrderedList(items) local buffer = {} for _, item in pairs(items) do- table.insert(buffer, "<li>" .. item .. "</li>")+ table.insert(buffer, '<li>' .. item .. '</li>') end- return "<ol>\n" .. table.concat(buffer, "\n") .. "\n</ol>"+ return '<ol>\n' .. table.concat(buffer, '\n') .. '\n</ol>' end function DefinitionList(items) local buffer = {} for _,item in pairs(items) do local k, v = next(item)- table.insert(buffer, "<dt>" .. k .. "</dt>\n<dd>" ..- table.concat(v, "</dd>\n<dd>") .. "</dd>")+ table.insert(buffer, '<dt>' .. k .. '</dt>\n<dd>' ..+ table.concat(v, '</dd>\n<dd>') .. '</dd>') end- return "<dl>\n" .. table.concat(buffer, "\n") .. "\n</dl>"+ return '<dl>\n' .. table.concat(buffer, '\n') .. '\n</dl>' end -- Convert pandoc alignment to something HTML can use.@@ -303,13 +303,13 @@ local function add(s) table.insert(buffer, s) end- add("<table>")- if caption ~= "" then- add("<caption>" .. escape(caption) .. "</caption>")+ add('<table>')+ if caption ~= '' then+ add('<caption>' .. escape(caption) .. '</caption>') end if widths and widths[1] ~= 0 then for _, w in pairs(widths) do- add('<col width="' .. string.format("%.0f%%", w * 100) .. '" />')+ add('<col width="' .. string.format('%.0f%%', w * 100) .. '" />') end end local header_row = {}@@ -317,7 +317,7 @@ for i, h in pairs(headers) do local align = html_align(aligns[i]) table.insert(header_row,'<th align="' .. align .. '">' .. h .. '</th>')- empty_header = empty_header and h == ""+ empty_header = empty_header and h == '' end if not empty_header then add('<tr class="header">')@@ -326,9 +326,9 @@ end add('</tr>') end- local class = "even"+ local class = 'even' for _, row in pairs(rows) do- class = (class == "even" and "odd") or "even"+ class = (class == 'even' and 'odd') or 'even' add('<tr class="' .. class .. '">') for i,c in pairs(row) do add('<td align="' .. html_align(aligns[i]) .. '">' .. c .. '</td>')@@ -340,7 +340,7 @@ end function RawBlock(format, str)- if format == "html" then+ if format == 'html' then return str else return ''@@ -348,7 +348,7 @@ end function Div(s, attr)- return "<div" .. attributes(attr) .. ">\n" .. s .. "</div>"+ return '<div' .. attributes(attr) .. '>\n' .. s .. '</div>' end -- The following code will produce runtime warnings when you haven't defined@@ -358,6 +358,6 @@ meta.__index = function(_, key) io.stderr:write(string.format("WARNING: Undefined function '%s'\n",key))- return function() return "" end+ return function() return '' end end setmetatable(_G, meta)
man/pandoc.1 view
@@ -1,5 +1,5 @@ '\" t-.\" Automatically generated by Pandoc 2.17.0.1+.\" Automatically generated by Pandoc 2.17.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font.@@ -15,7 +15,7 @@ . ftr VB CB . ftr VBI CBI .\}-.TH "Pandoc User\[cq]s Guide" "" "January 30, 2022" "pandoc 2.17.1" ""+.TH "Pandoc User\[cq]s Guide" "" "January 30, 2022" "pandoc 2.17.1.1" "" .hy .SH NAME pandoc - general markup converter
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-version: 2.17.1+version: 2.17.1.1 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md
src/Text/Pandoc/App/Opt.hs view
@@ -707,10 +707,9 @@ let fp = if null (takeExtension file) then addExtension file "yaml" else file- let searchpath = fp : case dataDir of- Nothing -> []- Just d -> [d </> "defaults" </> fp]- fromMaybe fp <$> findM fileExists searchpath+ defaultDataDir <- liftIO defaultUserDataDir+ let defaultFp = fromMaybe defaultDataDir dataDir </> "defaults" </> fp+ fromMaybe fp <$> findM fileExists [fp, defaultFp] -- | In a list of lists, append another list in front of every list which -- starts with specific element.
test/writer.custom view
@@ -5,7 +5,7 @@ <h1 id="headers">Headers</h1> -<h2 id="level-2-with-an-embedded-link">Level 2 with an <a href='/url' title=''>embedded link</a></h2>+<h2 id="level-2-with-an-embedded-link">Level 2 with an <a href="/url" title="">embedded link</a></h2> <h3 id="level-3-with-emphasis">Level 3 with <em>emphasis</em></h3> @@ -525,7 +525,7 @@ <p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p> -<p>An <em><a href='/url' title=''>emphasized link</a></em>.</p>+<p>An <em><a href="/url" title="">emphasized link</a></em>.</p> <p><strong><em>This is strong and em.</em></strong></p> @@ -560,7 +560,7 @@ <p>‘He said, “I want to go.”’ Were you alive in the 70’s?</p> -<p>Here is some quoted ‘<code>code</code>’ and a “<a href='http://example.com/?foo=1&bar=2' title=''>quoted link</a>”.</p>+<p>Here is some quoted ‘<code>code</code>’ and a “<a href="http://example.com/?foo=1&bar=2" title="">quoted link</a>”.</p> <p>Some dashes: one—two — three—four — five.</p> @@ -660,70 +660,70 @@ <h2 id="explicit">Explicit</h2> -<p>Just a <a href='/url/' title=''>URL</a>.</p>+<p>Just a <a href="/url/" title="">URL</a>.</p> -<p><a href='/url/' title='title'>URL and title</a>.</p>+<p><a href="/url/" title="title">URL and title</a>.</p> -<p><a href='/url/' title='title preceded by two spaces'>URL and title</a>.</p>+<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p> -<p><a href='/url/' title='title preceded by a tab'>URL and title</a>.</p>+<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p> -<p><a href='/url/' title='title with "quotes" in it'>URL and title</a></p>+<p><a href="/url/" title="title with "quotes" in it">URL and title</a></p> -<p><a href='/url/' title='title with single quotes'>URL and title</a></p>+<p><a href="/url/" title="title with single quotes">URL and title</a></p> -<p><a href='/url/with_underscore' title=''>with_underscore</a></p>+<p><a href="/url/with_underscore" title="">with_underscore</a></p> -<p><a href='mailto:nobody@nowhere.net' title=''>Email link</a></p>+<p><a href="mailto:nobody@nowhere.net" title="">Email link</a></p> -<p><a href='' title=''>Empty</a>.</p>+<p><a href="" title="">Empty</a>.</p> <h2 id="reference">Reference</h2> -<p>Foo <a href='/url/' title=''>bar</a>.</p>+<p>Foo <a href="/url/" title="">bar</a>.</p> -<p>With <a href='/url/' title=''>embedded [brackets]</a>.</p>+<p>With <a href="/url/" title="">embedded [brackets]</a>.</p> -<p><a href='/url/' title=''>b</a> by itself should be a link.</p>+<p><a href="/url/" title="">b</a> by itself should be a link.</p> -<p>Indented <a href='/url' title=''>once</a>.</p>+<p>Indented <a href="/url" title="">once</a>.</p> -<p>Indented <a href='/url' title=''>twice</a>.</p>+<p>Indented <a href="/url" title="">twice</a>.</p> -<p>Indented <a href='/url' title=''>thrice</a>.</p>+<p>Indented <a href="/url" title="">thrice</a>.</p> <p>This should [not][] be a link.</p> <pre><code>[not]: /url</code></pre> -<p>Foo <a href='/url/' title='Title with "quotes" inside'>bar</a>.</p>+<p>Foo <a href="/url/" title="Title with "quotes" inside">bar</a>.</p> -<p>Foo <a href='/url/' title='Title with "quote" inside'>biz</a>.</p>+<p>Foo <a href="/url/" title="Title with "quote" inside">biz</a>.</p> <h2 id="with-ampersands">With ampersands</h2> -<p>Here’s a <a href='http://example.com/?foo=1&bar=2' title=''>link with an ampersand in the URL</a>.</p>+<p>Here’s a <a href="http://example.com/?foo=1&bar=2" title="">link with an ampersand in the URL</a>.</p> -<p>Here’s a link with an amersand in the link text: <a href='http://att.com/' title='AT&T'>AT&T</a>.</p>+<p>Here’s a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p> -<p>Here’s an <a href='/script?foo=1&bar=2' title=''>inline link</a>.</p>+<p>Here’s an <a href="/script?foo=1&bar=2" title="">inline link</a>.</p> -<p>Here’s an <a href='/script?foo=1&bar=2' title=''>inline link in pointy braces</a>.</p>+<p>Here’s an <a href="/script?foo=1&bar=2" title="">inline link in pointy braces</a>.</p> <h2 id="autolinks">Autolinks</h2> -<p>With an ampersand: <a href='http://example.com/?foo=1&bar=2' title='' class="uri">http://example.com/?foo=1&bar=2</a></p>+<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2" title="" class="uri">http://example.com/?foo=1&bar=2</a></p> <ul> <li>In a list?</li>-<li><a href='http://example.com/' title='' class="uri">http://example.com/</a></li>+<li><a href="http://example.com/" title="" class="uri">http://example.com/</a></li> <li>It should.</li> </ul> -<p>An e-mail address: <a href='mailto:nobody@nowhere.net' title='' class="email">nobody@nowhere.net</a></p>+<p>An e-mail address: <a href="mailto:nobody@nowhere.net" title="" class="email">nobody@nowhere.net</a></p> <blockquote>-<p>Blockquoted: <a href='http://example.com/' title='' class="uri">http://example.com/</a></p>+<p>Blockquoted: <a href="http://example.com/" title="" class="uri">http://example.com/</a></p> </blockquote> <p>Auto-links should not occur here: <code><http://example.com/></code></p>@@ -740,7 +740,7 @@ <img src="lalune.jpg" id="" alt="lalune"/><figcaption>lalune</figcaption> </figure> -<p>Here is a movie <img src='movie.jpg' title=''/> icon.</p>+<p>Here is a movie <img src="movie.jpg" title=""/> icon.</p> <hr/> @@ -774,7 +774,7 @@ lazy and just indent the first line of each block. <a href="#fnref2">↩</a></p></li> <li id="fn3"><p>This is <em>easier</em> to type. Inline notes may contain-<a href='http://google.com' title=''>links</a> and <code>]</code> verbatim characters,+<a href="http://google.com" title="">links</a> and <code>]</code> verbatim characters, as well as [bracketed text]. <a href="#fnref3">↩</a></p></li> <li id="fn4"><p>In quote. <a href="#fnref4">↩</a></p></li> <li id="fn5"><p>In list. <a href="#fnref5">↩</a></p></li>