git.iko.soy/typeable/pandoc
on 46dffbd help sign in
801 files changed+16132−27993
since splitsnapshots
unifiedsplit
.circleci/config.yml+122−64 .editorconfig−8 .github/ISSUE_TEMPLATE+11 .github/ISSUE_TEMPLATE/bug_report.md−25 .github/ISSUE_TEMPLATE/config.yml−9 .github/ISSUE_TEMPLATE/feature_request.md−21 .github/workflows/ci.yml+12−98 .github/workflows/format-validation.yml−88 .github/workflows/lint.yml−33 .github/workflows/nightly.yml+3−10 .github/workflows/release-candidate.yml+1 .gitignore−7 .hlint.yaml+53−79 .travis.yml+54 AUTHORS.md−40 CONTRIBUTING.md+24−123 COPYING.md+1−1 COPYRIGHT+26−17 INSTALL.md+38−27 MANUAL.txt+253−607 Makefile+19−47 README.md+19−23 README.template+6−6 RELEASE-CHECKLIST+1−3 SECURITY.md−12 benchmark/benchmark-pandoc.hs+84−65 benchmark/weigh-pandoc.hs+50 cabal.project+7−9 changelog.md+22−2510 data/default.csl+2−12 data/docx/word/settings.xml+16−6 data/docx/word/styles.xml−15 data/jats.csl+203 data/make-reference-files.hs+27 data/odt/styles.xml+1−1 data/sample.lua+8−7 data/templates/.github/ISSUE_TEMPLATE.md+3 data/templates/.github/PULL_REQUEST_TEMPLATE.md+4 data/templates/README.markdown+49 data/templates/affiliations.jats−38 data/templates/article.jats_publishing+7−23 data/templates/default.biblatex−10 data/templates/default.bibtex−10 data/templates/default.context+8−10 data/templates/default.dzslides+1−1 data/templates/default.epub2+1−1 data/templates/default.epub3+1−1 data/templates/default.html4−3 data/templates/default.html5−3 data/templates/default.jats_articleauthoring+4−7 data/templates/default.latex+44−78 data/templates/default.man+1−1 data/templates/default.org+3−3 data/templates/default.revealjs+122−84 data/templates/default.s5−3 data/templates/default.slideous−7 data/templates/default.slidy−5 data/templates/styles.html+18−51 data/translations/zh-Hans.yaml−22 data/translations/zh-Hant.yaml−22 data/vimwiki.css+82 default.nix−13 doc/epub.md+2−9 doc/faqs.md−128 doc/filters.md+6−91 doc/jats.md−414 doc/libraries.md−63 doc/lua-filters.md+16−265 doc/org.md+5−22 doc/using-the-pandoc-api.md+15−28 linux/make_artifacts.sh+7−19 man/pandoc.1+650−1144 man/pandoc.1.after+1−1 pandoc.cabal+181−134 app/pandoc.hs → pandoc.hs+3−1 release.nix−4 shell.nix−106 src/Text/Pandoc.hs+1−1 src/Text/Pandoc/App.hs+58−85 src/Text/Pandoc/App/CommandLineOptions.hs+57−88 src/Text/Pandoc/App/FormatHeuristics.hs+8−19 src/Text/Pandoc/App/Opt.hs+48−269 src/Text/Pandoc/App/OutputSettings.hs+3−3 src/Text/Pandoc/Asciify.hs+391−14 src/Text/Pandoc/BCP47.hs+112 src/Text/Pandoc/CSS.hs+25−24 src/Text/Pandoc/CSV.hs+3−2 src/Text/Pandoc/Citeproc.hs+140−292 src/Text/Pandoc/Citeproc/BibTeX.hs+73−314 src/Text/Pandoc/Citeproc/Data.hs+6−7 src/Text/Pandoc/Citeproc/Locator.hs+4−20 src/Text/Pandoc/Citeproc/MetaValue.hs+6−9 src/Text/Pandoc/Class/CommonState.hs+1−1 src/Text/Pandoc/Class/IO.hs+24−24 src/Text/Pandoc/Class/PandocMonad.hs+38−45 src/Text/Pandoc/Data.hs+1−1 src/Text/Pandoc/Error.hs+51−107 src/Text/Pandoc/Extensions.hs+7−36 src/Text/Pandoc/Filter.hs+4−6 src/Text/Pandoc/Filter/JSON.hs+1−1 src/Text/Pandoc/Filter/Lua.hs+1−1 src/Text/Pandoc/Filter/Path.hs+1−1 src/Text/Pandoc/Highlighting.hs+6−6 src/Text/Pandoc/Image.hs+1−1 src/Text/Pandoc/ImageSize.hs+341−61 src/Text/Pandoc/Logging.hs+56−82 src/Text/Pandoc/Lua.hs+1−1 src/Text/Pandoc/Lua/ErrorConversion.hs+1−1 src/Text/Pandoc/Lua/Filter.hs+4−7 src/Text/Pandoc/Lua/Global.hs+1−1 src/Text/Pandoc/Lua/Init.hs+5−15 src/Text/Pandoc/Lua/Marshaling.hs+2−2 src/Text/Pandoc/Lua/Marshaling/AST.hs+81−79 src/Text/Pandoc/Lua/Marshaling/AnyValue.hs+1−1 src/Text/Pandoc/Lua/Marshaling/CommonState.hs+2−2 src/Text/Pandoc/Lua/Marshaling/Context.hs+2−3 src/Text/Pandoc/Lua/Marshaling/List.hs+2−2 src/Text/Pandoc/Lua/Marshaling/MediaBag.hs+3−3 src/Text/Pandoc/Lua/Marshaling/PandocError.hs+1−1 src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs+2−2 src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs+1−1 src/Text/Pandoc/Lua/Marshaling/Version.hs+1−1 src/Text/Pandoc/Lua/Module/MediaBag.hs+17−18 src/Text/Pandoc/Lua/Module/Pandoc.hs+23−29 src/Text/Pandoc/Lua/Module/System.hs+1−1 src/Text/Pandoc/Lua/Module/Types.hs+1−1 src/Text/Pandoc/Lua/Module/Utils.hs+2−2 src/Text/Pandoc/Lua/Packages.hs+27−10 src/Text/Pandoc/Lua/PandocLua.hs+13−20 src/Text/Pandoc/Lua/Util.hs+2−2 src/Text/Pandoc/Lua/Walk.hs+2−2 src/Text/Pandoc/MIME.hs+3−26 src/Text/Pandoc/MediaBag.hs+15−46 src/Text/Pandoc/Options.hs+19−22 src/Text/Pandoc/PDF.hs+17−38 src/Text/Pandoc/Parsing.hs+266−414 src/Text/Pandoc/Process.hs+1−1 src/Text/Pandoc/Readers.hs+49−56 src/Text/Pandoc/Readers/BibTeX.hs+11−18 src/Text/Pandoc/Readers/CSV.hs+9−9 src/Text/Pandoc/Readers/CommonMark.hs+28−81 src/Text/Pandoc/Readers/Creole.hs+7−6 src/Text/Pandoc/Readers/CslJson.hs+5−6 src/Text/Pandoc/Readers/DocBook.hs+104−134 src/Text/Pandoc/Readers/Docx.hs+51−71 src/Text/Pandoc/Readers/Docx/Combine.hs+7−7 src/Text/Pandoc/Readers/Docx/Parse.hs+124−218 src/Text/Pandoc/Readers/Docx/Parse/Styles.hs+25−32 src/Text/Pandoc/Readers/Docx/Util.hs+26−28 src/Text/Pandoc/Readers/DokuWiki.hs+9−10 src/Text/Pandoc/Readers/EPUB.hs+39−46 src/Text/Pandoc/Readers/FB2.hs+51−57 src/Text/Pandoc/Readers/HTML.hs+561−264 src/Text/Pandoc/Readers/HTML/Parsing.hs−225 src/Text/Pandoc/Readers/HTML/Table.hs−283 src/Text/Pandoc/Readers/HTML/TagCategories.hs−78 src/Text/Pandoc/Readers/HTML/Types.hs−97 src/Text/Pandoc/Readers/Haddock.hs+7−11 src/Text/Pandoc/Readers/Ipynb.hs+4−6 src/Text/Pandoc/Readers/JATS.hs+63−49 src/Text/Pandoc/Readers/Jira.hs+10−14 src/Text/Pandoc/Readers/LaTeX.hs+1434−274 src/Text/Pandoc/Readers/LaTeX/Citation.hs−210 src/Text/Pandoc/Readers/LaTeX/Inline.hs−397 src/Text/Pandoc/Readers/LaTeX/Lang.hs+121−200 src/Text/Pandoc/Readers/LaTeX/Macro.hs−184 src/Text/Pandoc/Readers/LaTeX/Math.hs−221 src/Text/Pandoc/Readers/LaTeX/Parsing.hs+56−214 src/Text/Pandoc/Readers/LaTeX/SIunitx.hs+70−153 src/Text/Pandoc/Readers/LaTeX/Table.hs−378 src/Text/Pandoc/Readers/LaTeX/Types.hs+2−15 src/Text/Pandoc/Readers/Man.hs+17−38 src/Text/Pandoc/Readers/Markdown.hs+260−362 src/Text/Pandoc/Readers/MediaWiki.hs+14−21 src/Text/Pandoc/Readers/Metadata.hs+34−115 src/Text/Pandoc/Readers/Muse.hs+9−10 src/Text/Pandoc/Readers/Native.hs+6−8 src/Text/Pandoc/Readers/OPML.hs+36−22 src/Text/Pandoc/Readers/Odt.hs+25−28 src/Text/Pandoc/Readers/Odt/Arrows/State.hs+2−2 src/Text/Pandoc/Readers/Odt/ContentReader.hs+15−22 src/Text/Pandoc/Readers/Odt/Generic/Namespaces.hs+1−2 src/Text/Pandoc/Readers/Odt/Generic/Utils.hs+26−10 src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs+14−13 src/Text/Pandoc/Readers/Odt/Namespaces.hs+5−6 src/Text/Pandoc/Readers/Odt/StyleReader.hs+17−21 src/Text/Pandoc/Readers/Org.hs+8−5 src/Text/Pandoc/Readers/Org/BlockStarts.hs+1−1 src/Text/Pandoc/Readers/Org/Blocks.hs+33−71 src/Text/Pandoc/Readers/Org/DocumentTree.hs+1−1 src/Text/Pandoc/Readers/Org/ExportSettings.hs+1−1 src/Text/Pandoc/Readers/Org/Inlines.hs+13−13 src/Text/Pandoc/Readers/Org/Meta.hs+5−13 src/Text/Pandoc/Readers/Org/ParserState.hs+1−1 src/Text/Pandoc/Readers/Org/Parsing.hs+6−6 src/Text/Pandoc/Readers/Org/Shared.hs+1−1 src/Text/Pandoc/Readers/RST.hs+116−85 src/Text/Pandoc/Readers/Roff.hs+18−16 src/Text/Pandoc/Readers/TWiki.hs+27−7 src/Text/Pandoc/Readers/Textile.hs+90−96 src/Text/Pandoc/Readers/TikiWiki.hs+6−6 src/Text/Pandoc/Readers/Txt2Tags.hs+23−49 src/Text/Pandoc/Readers/Vimwiki.hs+7−12 src/Text/Pandoc/RoffChar.hs+1−1 src/Text/Pandoc/SelfContained.hs+12−16 src/Text/Pandoc/Shared.hs+101−52 src/Text/Pandoc/Slides.hs+1−1 src/Text/Pandoc/Sources.hs−195 src/Text/Pandoc/Templates.hs+1−5 src/Text/Pandoc/Translations.hs+1−1 src/Text/Pandoc/UTF8.hs+24−21 src/Text/Pandoc/UUID.hs+1−1 src/Text/Pandoc/Writers.hs+4−9 src/Text/Pandoc/Writers/AnnotatedTable.hs−23 src/Text/Pandoc/Writers/AsciiDoc.hs+12−43 src/Text/Pandoc/Writers/BibTeX.hs−61 src/Text/Pandoc/Writers/CommonMark.hs+1−1 src/Text/Pandoc/Writers/ConTeXt.hs+39−45 src/Text/Pandoc/Writers/CslJson.hs+10−14 src/Text/Pandoc/Writers/Custom.hs+1−1 src/Text/Pandoc/Writers/Docbook.hs+33−114 src/Text/Pandoc/Writers/Docx.hs+405−254 src/Text/Pandoc/Writers/Docx/StyleMap.hs+1−1 src/Text/Pandoc/Writers/Docx/Table.hs−227 src/Text/Pandoc/Writers/Docx/Types.hs−185 src/Text/Pandoc/Writers/DokuWiki.hs+16−29 src/Text/Pandoc/Writers/EPUB.hs+212−269 src/Text/Pandoc/Writers/FB2.hs+78−62 src/Text/Pandoc/Writers/GridTable.hs−157 src/Text/Pandoc/Writers/HTML.hs+64−144 src/Text/Pandoc/Writers/Haddock.hs+2−13 src/Text/Pandoc/Writers/ICML.hs+1−6 src/Text/Pandoc/Writers/Ipynb.hs+1−1 src/Text/Pandoc/Writers/JATS.hs+120−113 src/Text/Pandoc/Writers/JATS/References.hs−164 src/Text/Pandoc/Writers/JATS/Table.hs−268 src/Text/Pandoc/Writers/JATS/Types.hs−57 src/Text/Pandoc/Writers/Jira.hs+18−43 src/Text/Pandoc/Writers/LaTeX.hs+815−100 src/Text/Pandoc/Writers/LaTeX/Caption.hs−47 src/Text/Pandoc/Writers/LaTeX/Citation.hs−181 src/Text/Pandoc/Writers/LaTeX/Lang.hs−192 src/Text/Pandoc/Writers/LaTeX/Notes.hs−34 src/Text/Pandoc/Writers/LaTeX/Table.hs−307 src/Text/Pandoc/Writers/LaTeX/Types.hs−83 src/Text/Pandoc/Writers/LaTeX/Util.hs−275 src/Text/Pandoc/Writers/Man.hs+3−3 src/Text/Pandoc/Writers/Markdown.hs+661−102 src/Text/Pandoc/Writers/Markdown/Inline.hs−616 src/Text/Pandoc/Writers/Markdown/Types.hs−81 src/Text/Pandoc/Writers/MediaWiki.hs+3−10 src/Text/Pandoc/Writers/Ms.hs+12−30 src/Text/Pandoc/Writers/Muse.hs+3−6 src/Text/Pandoc/Writers/Native.hs+1−1 src/Text/Pandoc/Writers/ODT.hs+22−28 src/Text/Pandoc/Writers/OOXML.hs+22−22 src/Text/Pandoc/Writers/OPML.hs+1−1 src/Text/Pandoc/Writers/OpenDocument.hs+88−183 src/Text/Pandoc/Writers/Org.hs+42−66 src/Text/Pandoc/Writers/Powerpoint.hs+1−1 src/Text/Pandoc/Writers/Powerpoint/Output.hs+148−172 src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+3−2 src/Text/Pandoc/Writers/RST.hs+22−38 src/Text/Pandoc/Writers/RTF.hs+11−17 src/Text/Pandoc/Writers/Roff.hs+2−2 src/Text/Pandoc/Writers/Shared.hs+6−20 src/Text/Pandoc/Writers/TEI.hs+4−5 src/Text/Pandoc/Writers/Texinfo.hs+16−23 src/Text/Pandoc/Writers/Textile.hs+1−1 src/Text/Pandoc/Writers/ZimWiki.hs+3−5 src/Text/Pandoc/XML.hs+20−42 src/Text/Pandoc/XML/Light.hs−89 src/Text/Pandoc/XML/Light/Output.hs−234 src/Text/Pandoc/XML/Light/Proc.hs−139 src/Text/Pandoc/XML/Light/Types.hs−193 stack.yaml+21−10 test/Tests/Command.hs+47−74 test/Tests/Helpers.hs+36−25 test/Tests/Lua.hs+4−2 test/Tests/Lua/Module.hs+1−3 test/Tests/Old.hs+30−18 test/Tests/Readers/Creole.hs+3−1 test/Tests/Readers/Docx.hs+7−29 test/Tests/Readers/DokuWiki.hs+2 test/Tests/Readers/EPUB.hs+4−2 test/Tests/Readers/FB2.hs+2 test/Tests/Readers/HTML.hs+19−24 test/Tests/Readers/JATS.hs+2−1 test/Tests/Readers/Jira.hs+2−22 test/Tests/Readers/LaTeX.hs+21−2 test/Tests/Readers/Man.hs+2−1 test/Tests/Readers/Markdown.hs+6−4 test/Tests/Readers/Muse.hs+2 test/Tests/Readers/Odt.hs+3−2 test/Tests/Readers/Org.hs+1−1 test/Tests/Readers/Org/Block.hs+24−22 test/Tests/Readers/Org/Block/CodeBlock.hs+38−36 test/Tests/Readers/Org/Block/Figure.hs+11−9 test/Tests/Readers/Org/Block/Header.hs+6−4 test/Tests/Readers/Org/Block/List.hs+3−14 test/Tests/Readers/Org/Block/Table.hs+5−3 test/Tests/Readers/Org/Directive.hs+3−1 test/Tests/Readers/Org/Inline.hs+7−5 test/Tests/Readers/Org/Inline/Citation.hs+3−41 test/Tests/Readers/Org/Inline/Note.hs+3−1 test/Tests/Readers/Org/Inline/Smart.hs+3−1 test/Tests/Readers/Org/Meta.hs+30−44 test/Tests/Readers/Org/Shared.hs+3−1 test/Tests/Readers/RST.hs+3−1 test/Tests/Readers/Txt2Tags.hs+3−1 test/Tests/Shared.hs+3−1 test/Tests/Writers/AnnotatedTable.hs+1 test/Tests/Writers/AsciiDoc.hs+2 test/Tests/Writers/ConTeXt.hs+115−122 test/Tests/Writers/Docbook.hs+2−103 test/Tests/Writers/Docx.hs+2−25 test/Tests/Writers/FB2.hs+2 test/Tests/Writers/HTML.hs+54−57 test/Tests/Writers/JATS.hs+93−135 test/Tests/Writers/Jira.hs+1−60 test/Tests/Writers/LaTeX.hs+2 test/Tests/Writers/Markdown.hs+3−3 test/Tests/Writers/Ms.hs+2 test/Tests/Writers/Muse.hs+1 test/Tests/Writers/Native.hs+2 test/Tests/Writers/OOXML.hs+4−5 test/Tests/Writers/Org.hs+13−46 test/Tests/Writers/Plain.hs+2 test/Tests/Writers/Powerpoint.hs+2 test/Tests/Writers/RST.hs+2 test/Tests/Writers/TEI.hs+2 test/command/1279.md+1−1 test/command/1608.md+1−1 test/command/1881.md+13−13 test/command/2103.md−8 test/command/2378.md+3−3 test/command/2874.md+2−2 test/command/3516.md+5−1 test/command/3674.md+1−1 test/command/3706.md+8−8 test/command/3736.md+6−3 test/command/3752.md−60 test/command/3792.md+1−1 test/command/3824.md−1 test/command/4038.md+1−1 test/command/4063.md−29 test/command/4164.md+9−5 test/command/4186.md+8−8 test/command/4420.md+11 test/command/4442.md+1−1 test/command/4465.md−15 test/command/4742.md+2−2 test/command/5121.md+2−1 test/command/5178.md+10−10 test/command/5304.md+1−1 test/command/5321.md+2−2 test/command/5367.md+10−9 test/command/5519.md+1−1 test/command/5541-nesting.md−1 test/command/5686.md+1−1 test/command/5708.md+5−1 test/command/5986.md+2−3 test/command/6026.md−19 test/command/6324.md−17 test/command/6388.md−16 test/command/6541.md−27 test/command/6620.md−3 test/command/6658.md−75 test/command/6709.md−11 test/command/6719.md−18 test/command/6723.md−32 test/command/6739.md−21 test/command/6740.md−7 test/command/6741.md−145 test/command/6752.md−36 test/command/6755.md−11 test/command/6765.md−31 test/command/6768.md−21 test/command/6774.md−63 test/command/6783.md−26 test/command/6791.md−32 test/command/6792.md−66 test/command/6796.md−16 test/command/6802.md−9 test/command/6836.md−17 test/command/6837.md−29 test/command/6844.md−27 test/command/6855.md−12 test/command/6858.md−52 test/command/6869.md−6 test/command/6873.md−7 test/command/6890.md−36 test/command/6925.md−34 test/command/6948.md−31 test/command/6951.md−18 test/command/6958.md−10 test/command/6993.md−21 test/command/7003.md−37 test/command/7006.md−20 test/command/7009.md−8 test/command/7016.md−48 test/command/7041.md−23 test/command/7042.md−146 test/command/7058.md−6 test/command/7064.md−32 test/command/7067.md−90 test/command/7080.md−8 test/command/7092.md−8 test/command/7099.md−18 test/command/7112.md−15 test/command/7129.md−27 test/command/7132.md−10 test/command/7134.md−16 test/command/7145.md−12 test/command/7155.md−15 test/command/7173.md−137 test/command/7208.md−6 test/command/7214.md−28 test/command/7216.md−19 test/command/7266.md−10 test/command/7272.md−27 test/command/7278.md−38 test/command/7282.md−7 test/command/7288.md−40 test/command/7299.md−23 test/command/7321.md−24 test/command/7323.md−29 test/command/7324.md−25 test/command/7339.md−11 test/command/7340.md−6 test/command/7376.md−16 test/command/7394.md−85 test/command/7397.md−14 test/command/7400.md−9 test/command/7416.md−19 test/command/averroes.bib−95 test/command/biblatex-266.md+2−2 test/command/biblatex-aksin.md+5−5 test/command/biblatex-almendro.md+5−5 test/command/biblatex-angenendt.md+9−9 test/command/biblatex-aristotle-anima.md+3−3 test/command/biblatex-aristotle-physics.md+3−3 test/command/biblatex-aristotle-poetics.md+3−3 test/command/biblatex-aristotle-rhetoric.md+5−5 test/command/biblatex-article.md+15−15 test/command/biblatex-augustine.md+2−2 test/command/biblatex-averroes-bland.md+5−5 test/command/biblatex-averroes-hannes.md+7−7 test/command/biblatex-averroes-hercz.md+5−5 test/command/biblatex-baez-article.md+10−10 test/command/biblatex-baez-online.md+7−7 test/command/biblatex-basic.md+3−5 test/command/biblatex-bertram.md+4−4 test/command/biblatex-bibstring-resolution.md+3−3 test/command/biblatex-book-averroes.md+13−14 test/command/biblatex-book-coleridge.md+4−4 test/command/biblatex-book-title-maintitle-series.md+4−4 test/command/biblatex-book-vazques-de-parga.md+6−6 test/command/biblatex-brandt.md+7−7 test/command/biblatex-britannica.md+6−6 test/command/biblatex-chiu.md+3−3 test/command/biblatex-cicero.md+6−6 test/command/biblatex-cms.md+9−9 test/command/biblatex-coleridge.md+4−4 test/command/biblatex-companion.md+6−6 test/command/biblatex-cotton.md+5−5 test/command/biblatex-crossref-inbook-mvbook.md+7−7 test/command/biblatex-crossref-nested.md+16−16 test/command/biblatex-ctan.md+11−11 test/command/biblatex-dates.md+44−44 test/command/biblatex-doody.md+8−8 test/command/biblatex-edtf-date.md+37−36 test/command/biblatex-escapedquotes.md+5−5 test/command/biblatex-examples.bib+1674 test/command/biblatex-formatting.md+4−4 test/command/biblatex-gaonkar-in.md+4−4 test/command/biblatex-gaonkar.md+3−3 test/command/biblatex-geer.md+5−5 test/command/biblatex-gerhardt.md+4−4 test/command/biblatex-gillies.md+6−5 test/command/biblatex-glashow.md+3−3 test/command/biblatex-gonzalez.md+6−6 test/command/biblatex-hammond.md+2−2 test/command/biblatex-herrmann.md+5−5 test/command/biblatex-hyman.md+8−8 test/command/biblatex-iliad.md+5−5 test/command/biblatex-inbook-title-booktitle-maintitle-series-2.md+5−5 test/command/biblatex-inbook-title-booktitle-maintitle-series.md+5−5 test/command/biblatex-inbook.md+25−25 test/command/biblatex-incollection-2.md+18−18 test/command/biblatex-incollection.md+19−19 test/command/biblatex-inproceedings.md+16−16 test/command/biblatex-issue288.md+6−6 test/command/biblatex-itzhaki.md+8−7 test/command/biblatex-jaffe.md+3−3 test/command/biblatex-jcg.md+3−3 test/command/biblatex-kant-kpv.md+6−6 test/command/biblatex-kant-ku.md+6−6 test/command/biblatex-kastenholz.md+11−11 test/command/biblatex-knuth-ct-a.md+12−12 test/command/biblatex-knuth-ct-b.md+9−9 test/command/biblatex-knuth-ct-c.md+8−8 test/command/biblatex-knuth-ct-d.md+9−9 test/command/biblatex-knuth-ct-e.md+8−8 test/command/biblatex-knuth-ct-related.md+8−8 test/command/biblatex-knuth-ct.md+8−8 test/command/biblatex-kowalik.md+9−9 test/command/biblatex-kullback-related.md+3−3 test/command/biblatex-kullback-reprint.md+4−4 test/command/biblatex-kullback.md+3−3 test/command/biblatex-laufenberg.md+9−9 test/command/biblatex-loh.md+5−5 test/command/biblatex-malinowski.md+4−4 test/command/biblatex-manual.md+9−9 test/command/biblatex-markey.md+8−8 test/command/biblatex-maron.md+4−4 test/command/biblatex-massa.md+2−2 test/command/biblatex-moore-related.md+7−7 test/command/biblatex-moore.md+4−4 test/command/biblatex-moraux.md+9−9 test/command/biblatex-murray.md+9−10 test/command/biblatex-nietzsche-historie.md+15−15 test/command/biblatex-nietzsche-ksa.md+7−7 test/command/biblatex-nietzsche-ksa1.md+9−9 test/command/biblatex-nussbaum.md+63 test/command/biblatex-online.md+18−18 test/command/biblatex-options-url-false-doi-false.md+5−5 test/command/biblatex-padhye.md+6−6 test/command/biblatex-patent.md+27−27 test/command/biblatex-periodical.md+4−5 test/command/biblatex-piccato.md+3−3 test/command/biblatex-pines.md+6−6 test/command/biblatex-quotes.md+3−3 test/command/biblatex-reese.md+7−7 test/command/biblatex-report.md+8−8 test/command/biblatex-salam.md+8−8 test/command/biblatex-sarfraz.md+6−6 test/command/biblatex-shore.md+9−9 test/command/biblatex-sigfridsson.md+9−9 test/command/biblatex-sorace.md+7−7 test/command/biblatex-spiegelberg.md+6−6 test/command/biblatex-springer.md+4−4 test/command/biblatex-strings.md+6−6 test/command/biblatex-test-case-conversion.md+5−5 test/command/biblatex-textnormal.md+2−2 test/command/biblatex-thesis.md+10−10 test/command/biblatex-title-and-shorttitle.md+11−11 test/command/biblatex-vangennep-related.md+3−3 test/command/biblatex-vangennep-trans.md+5−5 test/command/biblatex-vangennep.md+2−2 test/command/biblatex-vazques-de-parga-mvbook.md+6−6 test/command/biblatex-vazques-de-parga.md+6−6 test/command/biblatex-video.md+1−1 test/command/biblatex-vizedom-related.md+3−3 test/command/biblatex-wassenberg.md+10−10 test/command/biblatex-weinberg.md+3−3 test/command/biblatex-westfahl-frontier.md+5−5 test/command/biblatex-westfahl-space.md+15−15 test/command/biblatex-wilde.md+4−4 test/command/biblatex-worman.md+3−3 test/command/biblatex-yoon.md+5−5 test/command/bibtex-basic.md+3−3 test/command/chap1/spider.png test/command/chap1/text.md−17 test/command/chap2/spider.png test/command/chap2/text.md−5 test/command/chicago-fullnote-bibliography.csl+108−356 test/command/citeproc-17.md−17 test/command/citeproc-20.md−25 test/command/citeproc-7a.md+1−1 test/command/citeproc-author-in-text-suffix.md−6 test/command/custom-attributes.html+16 test/command/defaults-inheritance-1.md−6 test/command/defaults-inheritance-2.md−5 test/command/defaults-inheritance-3.md−6 test/command/defaults3.yaml−4 test/command/defaults4.yaml−3 test/command/defaults5.yaml−2 test/command/defaults6.yaml−2 test/command/defaults7.yaml−2 test/command/defaults8.yaml−2 test/command/defaults9.yaml−1 test/command/docbook-bibliography.md−20 test/command/duplicate_attributes.md−7 test/command/empty-inline-code.txt+6 test/command/latex-center.md−13 test/command/mmd-metadata.md−20 test/command/nested-table-to-asciidoc-6942.md−82 test/command/newif.md−55 test/command/pandoc-citeproc-119.md+3−2 test/command/pandoc-citeproc-14.md+2−1 test/command/pandoc-citeproc-152.md+4−2 test/command/pandoc-citeproc-160.md+4−2 test/command/pandoc-citeproc-175.md+4−2 test/command/pandoc-citeproc-213.md+2−1 test/command/pandoc-citeproc-25.md+2−1 test/command/pandoc-citeproc-27.md+2−1 test/command/pandoc-citeproc-320a.md+3−3 test/command/pandoc-citeproc-322.md+1−1 test/command/pandoc-citeproc-356.md+7−2 test/command/pandoc-citeproc-360.md+4−4 test/command/pandoc-citeproc-371.md+2−1 test/command/pandoc-citeproc-416.md+2−1 test/command/pandoc-citeproc-47.md+2−1 test/command/pandoc-citeproc-53.md+2−4 test/command/pandoc-citeproc-57.md+2−1 test/command/pandoc-citeproc-58.md+2−1 test/command/pandoc-citeproc-61.md+4−2 test/command/pandoc-citeproc-65.md+1−1 test/command/pandoc-citeproc-68.md+2−2 test/command/pandoc-citeproc-70.md+2−2 test/command/pandoc-citeproc-77.md+4−4 test/command/pandoc-citeproc-82.md+4−3 test/command/pandoc-citeproc-87.md+2−1 test/command/pandoc-citeproc-chicago-author-date.md+13−11 test/command/pandoc-citeproc-chicago-fullnote-bibliography.md+30−26 test/command/pandoc-citeproc-ieee.md+4−2 test/command/pandoc-citeproc-locators-integrated.md+2−2 test/command/pandoc-citeproc-move-period-inside-quote.md+3−2 test/command/pandoc-citeproc-page-range.md+3−3 test/command/svg.md+15−17 test/command/toc.md+20−11 test/command/unicode-collation.md−130 test/command/yaml-metadata-blocks.md+3−3 test/docbook-reader.docbook+2−9 test/docx/0_level_headers.native+2−2 test/docx/golden/block_quotes.docx test/docx/golden/codeblock.docx test/docx/golden/comments.docx test/docx/golden/custom_style_no_reference.docx test/docx/golden/custom_style_preserve.docx test/docx/golden/custom_style_reference.docx test/docx/golden/definition_list.docx test/docx/golden/document-properties-short-desc.docx test/docx/golden/document-properties.docx test/docx/golden/headers.docx test/docx/golden/image.docx test/docx/golden/inline_code.docx test/docx/golden/inline_formatting.docx test/docx/golden/inline_images.docx test/docx/golden/link_in_notes.docx test/docx/golden/links.docx test/docx/golden/lists.docx test/docx/golden/lists_continuing.docx test/docx/golden/lists_multiple_initial.docx test/docx/golden/lists_restarting.docx test/docx/golden/nested_anchors_in_header.docx test/docx/golden/notes.docx test/docx/golden/raw-blocks.docx test/docx/golden/raw-bookmarks.docx test/docx/golden/table_one_row.docx test/docx/golden/table_with_list_cell.docx test/docx/golden/tables-default-widths.docx test/docx/golden/tables.docx test/docx/golden/track_changes_deletion.docx test/docx/golden/track_changes_insertion.docx test/docx/golden/track_changes_move.docx test/docx/golden/track_changes_scrubbed_metadata.docx test/docx/golden/unicode.docx test/docx/golden/verbatim_subsuper.docx test/docx/image_vml_as_object.docx test/docx/image_vml_as_object.native−2 test/docx/lists_multiple_initial.native−8 test/docx/raw-blocks.native−6 test/docx/raw-bookmarks.native−3 test/docx/sdt_elements.native+10−9 test/docx/table_captions_no_field.docx test/docx/table_captions_no_field.native−34 test/docx/table_captions_with_field.docx test/docx/table_captions_with_field.native−54 test/docx/table_header_rowspan.docx test/docx/table_header_rowspan.native−189 test/docx/table_one_header_row.docx test/docx/table_one_header_row.native−18 test/docx/table_one_row.docx test/docx/table_one_row.native+4−4 test/docx/table_variable_width.native+17−12 test/docx/table_with_list_cell.native+3−3 test/docx/tables-default-widths.native−92 test/docx/tables.native+9−9 test/docx/track_changes_scrubbed_metadata.docx test/docx/track_changes_scrubbed_metadata.native−9 test/epub/features.epub test/epub/features.native+3−3 test/epub/wasteland.epub test/epub/wasteland.native+4−4 test/fb2/images.fb2+1−1 test/fb2/test.jpg test/grofftest.sh+26 test/html-reader.html−76 test/html-reader.native+37−148 test/jats-reader.native+1−1 test/jats-reader.xml−1 test/jira-reader.native+1−1 test/latex-reader.native+13−26 test/lhs-test.html+19−45 test/lhs-test.html+lhs+19−45 test/lhs-test.latex+4−4 test/lhs-test.latex+lhs+4−4 test/lua/module/pandoc-path.lua−44 test/markdown-reader-more.native+34−6 test/odt/native/tab.native−1 test/odt/odt/tab.odt test/org-select-tags.org+2−2 test/pipe-tables.native+10−2 test/pptx/code-custom.pptx test/pptx/code-custom_templated.pptx test/pptx/code.pptx test/pptx/code_templated.pptx test/pptx/document-properties-short-desc.pptx test/pptx/document-properties-short-desc_templated.pptx test/pptx/document-properties.pptx test/pptx/document-properties_templated.pptx test/pptx/endnotes.pptx test/pptx/endnotes_templated.pptx test/pptx/endnotes_toc.pptx test/pptx/endnotes_toc_templated.pptx test/pptx/images.pptx test/pptx/images_templated.pptx test/pptx/inline_formatting.pptx test/pptx/inline_formatting_templated.pptx test/pptx/lists.pptx test/pptx/lists_templated.pptx test/pptx/raw_ooxml.native+1−1 test/pptx/raw_ooxml.pptx test/pptx/raw_ooxml_templated.pptx test/pptx/reference_depth.pptx test/pptx/remove_empty_slides.pptx test/pptx/remove_empty_slides_templated.pptx test/pptx/slide_breaks.pptx test/pptx/slide_breaks_slide_level_1.pptx test/pptx/slide_breaks_slide_level_1_templated.pptx test/pptx/slide_breaks_templated.pptx test/pptx/slide_breaks_toc.pptx test/pptx/slide_breaks_toc_templated.pptx test/pptx/speaker_notes.pptx test/pptx/speaker_notes_after_metadata.pptx test/pptx/speaker_notes_after_metadata_templated.pptx test/pptx/speaker_notes_afterheader.pptx test/pptx/speaker_notes_afterheader_templated.pptx test/pptx/speaker_notes_afterseps.pptx test/pptx/speaker_notes_afterseps_templated.pptx test/pptx/speaker_notes_templated.pptx test/pptx/start_numbering_at.pptx test/pptx/start_numbering_at_templated.pptx test/pptx/tables.pptx test/pptx/tables_templated.pptx test/pptx/two_column.pptx test/pptx/two_column_templated.pptx test/rst-reader.native+21−3 test/s5-fancy.html+1−1 test/tables-rstsubset.native+9−1 test/tables.jats_archiving+156−156 test/tables.jats_articleauthoring+156−156 test/tables.jats_publishing+156−156 test/tables.latex+101−65 test/tables.ms−44 test/tables.org+3−3 test/tables/nordics.html4+6−6 test/tables/nordics.html5+6−6 test/tables/nordics.jats_archiving−58 test/tables/nordics.latex−42 test/tables/nordics.native+33−60 test/tables/planets.html4+1−1 test/tables/planets.html5+1−1 test/tables/planets.jats_archiving−128 test/tables/planets.latex−30 test/tables/planets.native+112−215 test/tables/students.jats_archiving−56 test/tables/students.latex−31 test/tables/students.native+32−49 test/test-pandoc.hs+8−18 test/textile-reader.native+1−1 test/textile-reader.textile+1−1 test/txt2tags.native+1−1 test/txt2tags.t2t+1−1 test/writer.context+43−45 test/writer.custom+2−2 test/writer.dokuwiki−11 test/writer.html4+19−44 test/writer.html5+19−44 test/writer.icml−2 test/writer.jats_archiving+8−12 test/writer.jats_articleauthoring+1−1 test/writer.jats_publishing+8−12 test/writer.jira+35−23 test/writer.latex+4−4 test/writer.markdown+55−28 test/writer.ms+1−1 test/writer.opml+1−1 test/writer.org+91−91 test/writer.zimwiki+3−3 test/writers-lang-and-dir.context+5−7 test/writers-lang-and-dir.latex+8−11 tools/build-arm.sh−110 tools/changelog-helper.sh+4−11 tools/parseTimings.pl−33 trypandoc/index.html+1−1 trypandoc/trypandoc.hs+8−3 windows/Makefile+1−1 windows/pandoc.wxs+2−2
.circleci/config.yml+122−64
@@ -1,72 +1,130 @@
11version: "2.1"
2−jobs:
3− build:
4− macos:
5− xcode: 11.1.0
2+
3+env: &env
64 environment:
7− HOMEBREW_NO_AUTO_UPDATE: 1
5+ LC_ALL: "C.UTF-8"
6+ docker:
7+ - image: fpco/stack-build:lts-13
8+
9+#-----------------------------------------------------------------------------
10+# Common utility stuff, not to be modified usually
11+#-----------------------------------------------------------------------------
12+
13+preinstall: &preinstall
14+ run: |
15+ echo 'export PATH=/opt/cabal/bin:/opt/ghc/bin:$PATH' >> $BASH_ENV
16+ source $BASH_ENV
17+ apt-get update
18+
19+restore: &restore
20+ # Needs to happen after installing ca-certificates
21+ restore_cache:
22+ key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
23+
24+save: &save
25+ save_cache:
26+ key: v1-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
27+ paths:
28+ - ~/.cabal
29+ - ~/.ghc
30+ - ~/.local
31+ - ~/.stack
32+
33+commands:
34+ cabal_build:
35+ parameters:
36+ ghcversion:
37+ type: string
838 steps:
9− - checkout
10− - restore_cache:
11− # See https://circleci.com/docs/2.0/caching/
12− name: Restore Cached Dependencies
13− keys:
14− - stack-dependencies-{{ checksum "stack.yaml" }}
15− - run:
16− name: Install stack
17− command: stack --version || (curl -sSL https://get.haskellstack.org/ | sh -s - -f)
18− - run:
19− name: Resolve/Update Dependencies
20− command: stack --no-terminal setup
21− - run:
22− name: Run tests
23− command: stack --no-terminal test
24− - run:
25− name: Install executable
26− command: stack --no-terminal install
27− - run:
28− name: Create artifacts
29− command: |
30− export VERSION=$(grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}')
31− export ARTIFACTS=macos-release-candidate
32− export RESOURCES=${ARTIFACTS}/Resources
33− export ROOT=${ARTIFACTS}/pandoc
34− export DEST=${ROOT}/usr/local
35− export ME=$(whoami)
36− export BASE=pandoc-$VERSION
37− mkdir -p ${ARTIFACTS}
38− mkdir -p ${RESOURCES}
39− mkdir -p ${DEST}/bin
40− mkdir -p ${DEST}/share/man/man1
41− cp ~/.local/bin/pandoc ${DEST}/bin/
42− strip ${DEST}/bin/pandoc
43− cp man/pandoc.1 ${DEST}/share/man/man1/pandoc.1
44− ~/.local/bin/pandoc -s COPYING.md -Vpagetitle=License -o ${RESOURCES}/license.html
45− chown -R $ME:staff ${ROOT}
46− sed -e "s/PANDOCVERSION/${VERSION}/" macos/distribution.xml.in > ${ARTIFACTS}/distribution.xml
47− cp macos/Makefile ${ARTIFACTS}/
48− echo ${VERSION} > ${ARTIFACTS}/version.txt
49− zip -r macos-release-candidate.zip ${ARTIFACTS}
39+ - checkout
40+ - *preinstall
41+ - *restore
42+ - run:
43+ name: install cabal
44+ command: apt-get install -y cabal-install-2.4
45+ - run:
46+ name: install ghc
47+ command: |
48+ apt-get install -y ghc-<< parameters.ghcversion >>
49+ - run:
50+ name: build and test project
51+ command: |
52+ set -e
53+ cabal v2-update
54+ TMPDIR=`mktemp -d -t circleci.XXXXXXX`
55+ cabal v2-sdist --output-dir=${TMPDIR}
56+ cd ${TMPDIR}
57+ tar xvzf *.tar.gz
58+ cd *
59+ cabal v2-build -w ghc-<< parameters.ghcversion >> -j2 --disable-optimization --dependencies-only --enable-tests --enable-benchmarks
60+ cabal v2-build -w ghc-<< parameters.ghcversion >> -j2 --disable-optimization --enable-tests --enable-benchmarks 2>build.log
61+ cat build.log
62+ # fail if we had warnings in local build
63+ # this is to work around the fact that cabal v2 doesn't allow
64+ # us to use -Werror for just local build:
65+ # https://github.com/haskell/cabal/issues/4247
66+ ! grep -q "[Ww]arning:" build.log
67+ cabal v2-test -w ghc-<< parameters.ghcversion >> -j2 --disable-optimization --enable-tests
68+ cabal v2-haddock -w ghc-<< parameters.ghcversion >>
69+ cabal check
70+ - *save
5071
51− - save_cache:
52− name: Cache Dependencies
53− key: stack-dependencies-{{ checksum "stack.yaml" }}
54− paths:
55− - "/root/.stack"
56− - ".stack-work"
57− - "/usr/local/bin/stack"
72+#-----------------------------------------------------------------------------
73+# Build matrix
74+#-----------------------------------------------------------------------------
5875
59− - store_artifacts:
60− # https://circleci.com/docs/2.0/artifacts/
61− path: macos-release-candidate.zip
62− destination: macos-release-candidate.zip
76+jobs:
77+ cabal-ghc-8_8_1:
78+ <<: *env
79+ steps:
80+ - cabal_build:
81+ ghcversion: 8.8.1
82+
83+ cabal-ghc-8_6_5:
84+ <<: *env
85+ steps:
86+ - cabal_build:
87+ ghcversion: 8.6.5
88+
89+ cabal-ghc-8_4_4:
90+ <<: *env
91+ steps:
92+ - cabal_build:
93+ ghcversion: 8.4.4
94+
95+ cabal-ghc-8_2_2:
96+ <<: *env
97+ steps:
98+ - cabal_build:
99+ ghcversion: 8.2.2
100+
101+ cabal-ghc-8_0_2:
102+ <<: *env
103+ steps:
104+ - cabal_build:
105+ ghcversion: 8.0.2
106+
107+ stack-ghc-8_6:
108+ <<: *env
109+ steps:
110+ - checkout
111+ - *preinstall
112+ - *restore
113+ - run: |
114+ set -e
115+ apt-get install -y ghc-8.6.5
116+ stack update
117+ stack test --system-ghc --fast --ghc-options="-Werror" .
118+ - *save
63119
64120workflows:
65− version: 2
66− release:
121+ version: "2.1"
122+ build:
67123 jobs:
68− - build:
69− filters:
70− branches:
71− only:
72− - /rc\/.*/
124+ - cabal-ghc-8_6_5
125+ - cabal-ghc-8_4_4
126+ - cabal-ghc-8_2_2
127+ - cabal-ghc-8_0_2
128+ - stack-ghc-8_6
129+ # - cabal-ghc-8_8_1
130+
.editorconfig−8
@@ -8,14 +8,6 @@ indent_size = 2
88insert_final_newline = true
99trim_trailing_whitespace = true
1010
11−[*.{zip,docx}]
12−charset =
13−end_of_line =
14−indent_style =
15−indent_size =
16−insert_final_newline =
17−trim_trailing_whitespace =
18−
1911[*.{markdown,md}]
2012trim_trailing_whitespace = false
2113
.github/ISSUE_TEMPLATEnew file+11
@@ -0,0 +1,11 @@
1+Asking a question?
2+Please use the pandoc-discuss mailing list instead:
3+https://groups.google.com/forum/#!forum/pandoc-discuss
4+This tracker is for bug reports and enhancement requests.
5+
6+Reporting a bug?
7+Please include your pandoc version and an example that allows us
8+to reproduce the problem (complete input, exact command line
9+used, expected and actual output). The smaller the example, the
10+better.
11+
.github/ISSUE_TEMPLATE/bug_report.mddeleted−25
@@ -1,25 +0,0 @@
1−---
2−name: Bug report
3−about: Create a report to help us improve
4−title: ''
5−labels: 'bug'
6−assignees: ''
7−
8−---
9−
10−<!--
11−Thank you for reporting an issue! Before you continue, please make sure that you have
12−
13−- searched the issue tracker for similar issues (including closed issues): https://github.com/jgm/pandoc/issues
14−- searched the pandoc-discuss mailing list for solutions: https://groups.google.com/forum/#!forum/pandoc-discuss
15−- reproduced your issue on the latest release of pandoc, or on https://pandoc.org/try
16−
17−Note that this bug tracker is for reporting bugs, not asking questions. For questions, use the pandoc-discuss mailing list.
18−-->
19−
20−**Explain the problem.**
21−Include the exact command line you used and all inputs necessary to reproduce the issue. Please create as minimal an example as possible, to help the maintainers isolate the problem. Explain the output you received and how it differs from what you expected.
22−
23−**Pandoc version?**
24−What version of pandoc are you using, on what OS?
25−
.github/ISSUE_TEMPLATE/config.ymldeleted−9
@@ -1,9 +0,0 @@
1−blank_issues_enabled: false
2−contact_links:
3− - name: Ask a question
4− url: https://groups.google.com/forum/#!forum/pandoc-discuss
5− about: "Discussion forum for pandoc (may be used as an email list)"
6− - name: Contributing Guidelines
7− url: https://pandoc.org/CONTRIBUTING.html
8− about: "Guidelines for submitting bug reports and code improvements"
9−
.github/ISSUE_TEMPLATE/feature_request.mddeleted−21
@@ -1,21 +0,0 @@
1−---
2−name: Feature request
3−about: Suggest an idea for this project
4−title: ''
5−labels: 'enhancement'
6−assignees: ''
7−
8−---
9−
10−<!--
11−Thank you for suggesting a feature! Before you continue, please make sure that you have
12−
13−- read the contributing guidelines: https://pandoc.org/CONTRIBUTING.html
14−- searched the issue tracker for similar issues (including closed issues): https://github.com/jgm/pandoc/issues
15−- searched the pandoc-discuss mailing list for relevant discussions: https://groups.google.com/forum/#!forum/pandoc-discuss
16−-->
17−
18−**Describe your proposed improvement and the problem it solves.**
19−
20−**Describe alternatives you've considered.**
21−
.github/workflows/ci.yml+12−98
@@ -45,50 +45,23 @@ jobs:
4545 versions:
4646 - ghc: '8.0.2'
4747 cabal: '2.4'
48− prefix: 'v2-'
49− cabalopts: ''
50− testopts: ''
5148 - ghc: '8.2.2'
5249 cabal: '2.4'
53− prefix: 'v2-'
54− cabalopts: ''
55− testopts: ''
5650 - ghc: '8.4.4'
5751 cabal: '2.4'
58− prefix: 'v2-'
59− cabalopts: '-f-embed_data_files'
60− testopts: ''
6152 - ghc: '8.6.5'
6253 cabal: '3.2'
63− prefix: ''
64− cabalopts: ''
65− testopts: '--test-option=--hide-successes'
6654 - ghc: '8.8.4'
6755 cabal: '3.2'
68− prefix: ''
69− cabalopts: ''
70− testopts: '--test-option=--hide-successes'
71− - ghc: '8.10.4'
56+ - ghc: '8.10.2'
7257 cabal: '3.2'
73− prefix: ''
74− cabalopts: '-ftrypandoc'
75− testopts: '--test-option=--hide-successes'
76− - ghc: '9.0.1'
77− cabal: '3.4'
78− prefix: ''
79− cabalopts: ''
80− testopts: '--test-option=--hide-successes'
8158 steps:
8259 - uses: actions/checkout@v2
8360
84− # needed by memory
85− - name: Install numa
86− run: sudo apt-get install libnuma-dev
87−
8861 # need to install older cabal/ghc versions from ppa repository
8962
9063 - name: Install recent cabal/ghc
91− uses: haskell/actions/setup@v1
64+ uses: actions/setup-haskell@v1.1
9265 with:
9366 ghc-version: ${{ matrix.versions.ghc }}
9467 cabal-version: ${{ matrix.versions.cabal }}
@@ -115,15 +88,14 @@ jobs:
11588
11689 - name: Install dependencies
11790 run: |
118− cabal ${{ matrix.versions.prefix }}update
119− cabal ${{ matrix.versions.prefix }}build ${{ matrix.versions.cabalopts }} --dependencies-only --enable-tests --disable-optimization
120−
91+ cabal v2-update
92+ cabal v2-build --dependencies-only --enable-tests --disable-optimization
12193 - name: Build and test
12294 run: |
123− cabal ${{ matrix.versions.prefix }}build ${{ matrix.versions.cabalopts }} --enable-tests --disable-optimization 2>&1 | tee build.log
95+ cabal v2-build --enable-tests --disable-optimization 2>&1 | tee build.log
12496 # fail if warnings in local build
12597 ! grep -q ": *[Ww]arning:" build.log || exit 1
126− cabal ${{ matrix.versions.prefix }}test ${{ matrix.versions.cabalopts }} --disable-optimization ${{ matrix.versions.testopts }}
98+ cabal v2-test --disable-optimization
12799
128100 windows:
129101
@@ -132,11 +104,10 @@ jobs:
132104 steps:
133105 - uses: actions/checkout@v2
134106
135− # We should have ghc 8.10, cabal, stack pre-installed
136− # - uses: haskell/actions/setup@v1
137− # with:
138− # enable-stack: true
139− # stack-version: 'latest'
107+ - uses: actions/setup-haskell@v1.1
108+ with:
109+ enable-stack: true
110+ stack-version: 'latest'
140111
141112 # declare/restore cached things
142113 # caching doesn't work for scheduled runs yet
@@ -161,7 +132,6 @@ jobs:
161132 - name: Install dependencies
162133 run: |
163134 stack update
164− stack install happy
165135 stack test --dependencies-only --fast
166136 - name: Build and test
167137 shell: cmd
@@ -175,14 +145,14 @@ jobs:
175145 fail-fast: true
176146 matrix:
177147 versions:
178− - ghc: '8.8.4'
148+ - ghc: '8.10.2'
179149 cabal: '3.2'
180150
181151 steps:
182152 - uses: actions/checkout@v2
183153
184154 - name: Install recent cabal/ghc
185− uses: haskell/actions/setup@v1
155+ uses: actions/setup-haskell@v1.1
186156 with:
187157 ghc-version: ${{ matrix.versions.ghc }}
188158 cabal-version: ${{ matrix.versions.cabal }}
@@ -217,59 +187,3 @@ jobs:
217187 # fail if warnings in local build
218188 ! grep -q ": *[Ww]arning:" build.log || exit 1
219189 cabal v2-test --disable-optimization
220−
221− benchmark:
222−
223− runs-on: ubuntu-18.04
224− strategy:
225− fail-fast: true
226− matrix:
227− versions:
228− - ghc: '8.8.4'
229− cabal: '3.2'
230− - ghc: '8.10.2'
231− cabal: '3.2'
232− steps:
233− - uses: actions/checkout@v2
234−
235− # need to install older cabal/ghc versions from ppa repository
236−
237− - name: Install recent cabal/ghc
238− uses: haskell/actions/setup@v1
239− with:
240− ghc-version: ${{ matrix.versions.ghc }}
241− cabal-version: ${{ matrix.versions.cabal }}
242−
243− # declare/restore cached things
244− # caching doesn't work for scheduled runs yet
245− # https://github.com/actions/cache/issues/63
246−
247− - name: Cache cabal global package db
248− id: cabal-global
249− uses: actions/cache@v2
250− with:
251− path: |
252− ~/.cabal
253− key: benchmark-${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-global-${{ hashFiles('cabal.project') }}
254−
255− - name: Cache cabal work
256− id: cabal-local
257− uses: actions/cache@v2
258− with:
259− path: |
260− dist-newstyle
261− key: benchmark-${{ runner.os }}-${{ matrix.versions.ghc }}-${{ matrix.versions.cabal }}-cabal-local
262−
263− - name: Install dependencies
264− run: |
265− v2=$([ "${{ matrix.versions.cabal }}" = "2.2" ] && printf 'new' || printf 'v2')
266− cabal $v2-update
267− cabal $v2-build --dependencies-only --enable-optimization=1 --enable-benchmarks --disable-tests
268−
269− - name: Build and test
270− run: |
271− v2=$([ "${{ matrix.versions.cabal }}" = "2.2" ] && printf 'new' || printf 'v2')
272− cabal $v2-build --enable-optimization=1 --enable-benchmarks --disable-tests 2>&1 | tee build.log
273− # fail if warnings in local build
274− ! grep -q ": *[Ww]arning:" build.log || exit 1
275− cabal $v2-bench --enable-optimization=1 --benchmark-options='--timeout=6 +RTS -T -RTS'
.github/workflows/format-validation.ymldeleted−88
@@ -1,88 +0,0 @@
1−name: Format validation
2−
3−on:
4− push:
5− branches:
6− - '*'
7− - '!rc/*'
8− paths:
9− - 'test/writer.jats_articleauthoring'
10− - 'test/writer.jats_publishing'
11− - 'test/writer.jats_archiving'
12− - 'test/tables.jats_archiving'
13− - 'test/tables/nordics.jats_archiving'
14− - 'test/tables/planets.jats_archiving'
15− - 'test/tables/students.jats_archiving'
16− pull_request:
17− branches:
18− - '*'
19− - '!rc/*'
20− paths:
21− - 'test/writer.jats_articleauthoring'
22− - 'test/writer.jats_publishing'
23− - 'test/writer.jats_archiving'
24− - 'test/tables.jats_archiving'
25− - 'test/tables/nordics.jats_archiving'
26− - 'test/tables/planets.jats_archiving'
27− - 'test/tables/students.jats_archiving'
28−
29−jobs:
30− jats:
31− name: JATS
32− runs-on: ubuntu-latest
33− env:
34− VALIDATOR_URL: "https://jats-validator.hubmed.org/dtd/"
35− strategy:
36− fail-fast: false
37− matrix:
38− tagset:
39− - articleauthoring
40− - publishing
41− - archiving
42− steps:
43− - name: Checkout
44− uses: actions/checkout@v2
45−
46− - name: Validate writer output
47− run: |
48− filename=test/writer.jats_${{ matrix.tagset }}
49− printf "Validating file %s\n" "$filename"
50− json="$(curl --form "xml=@${filename}" --silent "$VALIDATOR_URL")"
51− err_count="$(printf '%s' "$json" | jq '.errors | length')"
52− if [ "$err_count" -eq 0 ]; then
53− printf "File was validated successfully.\n"
54− exit 0
55− else
56− printf "Validator report:\n%s" "$json"
57− exit 1
58− fi
59−
60− - name: Validate tables
61− # Archiving has the simplest template, so we only check with that.
62− if: matrix.tagset == 'archiving'
63− run: |
64− tmpl="$(cat <<EOF
65− <?xml version="1.0" encoding="utf-8" ?>
66− <!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
67− "JATS-archivearticle1.dtd">
68− <article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
69− <front><article-meta></article-meta></front>
70− <body>%s</body></article>
71− EOF
72− )"
73− jats_file="$(mktemp jats-tables.XXXXX)"
74− exit_code=0
75− for f in tables tables/nordics tables/planets tables/students; do
76− filename=test/$f.jats_archiving
77− printf "Validating %s...\n" "$filename"
78− printf "$tmpl" "$(cat $filename)" > "$jats_file"
79− json="$(curl --form "xml=@${jats_file}" --silent "$VALIDATOR_URL")"
80− err_count="$(printf "%s" "$json" | jq '.errors | length')"
81− if [ "$err_count" -eq 0 ]; then
82− printf "Table output is valid when used as body content.\n"
83− else
84− printf "Validator report:\n%s" "$json"
85− exit_code=1
86− fi
87− done
88− exit "$exit_code"
.github/workflows/lint.ymldeleted−33
@@ -1,33 +0,0 @@
1−name: Lint
2−
3−# Trigger the workflow on push or pull request, but only for the
4−# master branch
5−on:
6− pull_request:
7− branch: [master]
8− push:
9− branch: [master]
10− paths-ignore:
11− - LICENSE
12− - README.md
13− - CHANGELOG.md
14− - stack.yaml
15− - .travis.yml
16−
17−jobs:
18− lint:
19− name: Lint
20− runs-on: ubuntu-latest
21− env:
22− hlint_script: https://raw.github.com/ndmitchell/hlint/master/misc/run.sh
23−
24− steps:
25− - name: Checkout
26− uses: actions/checkout@v2
27−
28− - name: Check cabal file for missing test files
29− run: make check-cabal
30−
31− - name: Download and run hlint
32− run: |
33− curl -sSL "${hlint_script}" | sh -s .
.github/workflows/nightly.yml+3−10
@@ -2,7 +2,7 @@ name: Nightly
22
33on:
44 schedule:
5− - cron: '53 7 * * *'
5+ - cron: '53 6 * * *'
66
77jobs:
88 linux:
@@ -10,22 +10,15 @@ jobs:
1010 runs-on: ubuntu-18.04
1111 steps:
1212 - uses: actions/checkout@v2
13−
14− - name: Install recent cabal/ghc
15− uses: haskell/actions/setup@v1
16− with:
17− ghc-version: '8.10.3'
18− cabal-version: '3.2'
19−
2013 - name: Install dependencies
2114 run: |
2215 ghc --version
2316 cabal --version
2417 cabal v2-update
25− cabal v2-build --dependencies-only
18+ cabal v2-build --dependencies-only all
2619 - name: Build
2720 run: |
28− cabal v2-install
21+ cabal v2-install all
2922 strip $HOME/.cabal/bin/pandoc
3023 - name: Install artifact
3124 run: |
.github/workflows/release-candidate.yml+1
@@ -32,6 +32,7 @@ jobs:
3232 - osarch: "windows-x86_64"
3333 arch: "x64"
3434 stack_opts: "-j1"
35+
3536 steps:
3637 - uses: actions/checkout@v1
3738 - name: Install dependencies
.gitignore−7
@@ -1,6 +1,4 @@
11*~
2−.DS_Store
3−*.orig
42deb/.vagrant
53dist/*
64MANUAL.*
@@ -16,10 +14,6 @@ man/man?/*.html
1614*.o
1715*.hi
1816*.pyc
19−.hie/
20−.policeman-evidence/
21−.projectile/
22−.vscode/
2317/COPYING.rtf
2418/COPYRIGHT.txt
2519/cabal-dev/
@@ -32,4 +26,3 @@ data/reference.odt
3226/stack.yaml.lock
3327cabal.project.local
3428/dist-newstyle/
35−pandoc-2*/
.hlint.yaml+53−79
@@ -2,111 +2,85 @@
22# https://github.com/ndmitchell/hlint
33##########################
44
5+# This file contains a template configuration file, which is typically
6+# placed as .hlint.yaml in the root of your project
7+
8+
59# Specify additional command line arguments
610#
7−- arguments: [--color=auto, --cpp-ansi]
11+- arguments: [--color, --cpp-ansi]
812
9−# Ignore some builtin hints
13+
14+# Control which extensions/flags/modules/functions can be used
15+#
16+# - extensions:
17+# - default: false # all extension are banned by default
18+# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
19+# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
20+#
21+# - flags:
22+# - {name: -w, within: []} # -w is allowed nowhere
23+#
24+# - modules:
25+# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
26+# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
27+#
28+# - functions:
29+# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
30+
31+
32+# Add custom hints for this project
33+#
34+# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
35+# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
36+
37+
38+# Turn on hints that are off by default
39+#
40+# Ban "module X(module X) where", to require a real export list
41+# - warn: {name: Use explicit module export list}
1042#
43+# Replace a $ b $ c with a . b $ c
44+# - group: {name: dollar, enabled: true}
45+#
46+# Generalise map to fmap, ++ to <>
47+# - group: {name: generalise, enabled: true}
48+
49+
50+# Ignore some builtin hints
51+# - ignore: {name: Use let}
52+# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
53+# - ignore: {name: "Use section"}
54+# - ignore: {name: "Use camelCase"}
55+# - ignore: {name: "Use list comprehension"}
56+# - ignore: {name: "Redundant if"}
1157- ignore: {name: "Avoid lambda"}
12−- ignore: {name: "Use bimap"}
1358- ignore: {name: "Eta reduce"}
1459- ignore: {name: "Evaluate"}
15−- ignore: {name: "Reduce duplication"} # TODO: could be more fine-grained
60+- ignore: {name: "Monad law, left identity", module: "Text.Pandoc.App.OutputSettings"}
61+- ignore: {name: "Reduce duplication", module: "Text.Pandoc.Readers.Markdown"}
1662- ignore: {name: "Use &&&"}
1763- ignore: {name: "Use String"}
18−- ignore: {name: "Use camelCase"}
1964- ignore: {name: "Use fmap"} # specific for GHC 7.8 compat
65+- ignore: {name: "Use forM_", module: "Text.Pandoc.Readers.DocBook"}
2066- ignore: {name: "Use isDigit"}
21−
22−- ignore:
23− name: "Monad law, left identity"
24− within: Text.Pandoc.App.OutputSettings
25−
26−- ignore:
27− name: "Move brackets to avoid $"
28− within: Text.Pandoc.Writers.CslJson
29−
30−- ignore:
31− name: "Redundant <$>"
32− within:
33− - Text.Pandoc.Readers.Docx.Parse
34− - Text.Pandoc.Writers.MediaWiki
35− - Text.Pandoc.Writers.OpenDocument
36− - Text.Pandoc.Writers.Powerpoint.Output
37− - Text.Pandoc.Writers.Powerpoint.Presentation
38−
39−- ignore:
40− name: "Redundant return"
41− within: Text.Pandoc.Citeproc.BibTeX
42−
43−# With recent hlint this rule has given false positives on TH
44−- ignore:
45− name: "Redundant bracket"
46−
47−
67+- ignore: {name: "Use tuple-section", module: "Text.Pandoc.Readers.EPUB"}
68+- ignore: {name: "Use uncurry", module: "Text.Pandoc.Readers.Docx.Combine"}
4869- ignore:
4970 name: "Use <$>"
5071 within:
5172 - Text.Pandoc.Readers.LaTeX
5273 - Text.Pandoc.Readers.Markdown
53−
5474- ignore:
5575 name: "Use camelCase"
5676 within:
5777 - Tests.Writers.Docbook
5878 - Tests.Writers.Native
59− - Text.Pandoc.Citeproc
6079 - Text.Pandoc.Extensions
6180 - Text.Pandoc.Lua.Marshaling.Version
62− - Text.Pandoc.Lua.Module.Pandoc
6381 - Text.Pandoc.Lua.Module.Utils
6482 - Text.Pandoc.Readers.Odt.ContentReader
6583 - Text.Pandoc.Readers.Odt.Namespaces
6684
67−- ignore:
68− name: "Use forM_"
69− within:
70− - Text.Pandoc.Readers.DocBook
71−
72−- ignore:
73− name: "Use Just"
74− within:
75− - Text.Pandoc.Citeproc.MetaValue
76− - Text.Pandoc.Readers.Odt.ContentReader
77− - Text.Pandoc.Writers.Roff
78−
79−- ignore:
80− name: "Use list comprehension"
81− within: Text.Pandoc.Citeproc.BibTeX
82−
83−- ignore:
84− name: "Use list literal pattern"
85− within: Text.Pandoc.Citeproc.MetaValue
86−
87−# TODO: check
88−- ignore:
89− name: "Use second"
90− within:
91− - Text.Pandoc.Citeproc.BibTeX
92− - Text.Pandoc.Citeproc.Locator
93−
94−# TODO: check
95−- ignore:
96− name: "Use sortOn"
97− within: Text.Pandoc.Writers.OpenDocument
98−
99−- ignore:
100− name: "Use tuple-section"
101− within:
102− - Text.Pandoc.Readers.EPUB
103− - Text.Pandoc.ImageSize
104− - Text.Pandoc.Readers.Markdown
105− - Text.Pandoc.Readers.RST
106−
107−# fromRight is only in base >= 4.10
108−- ignore:
109− name: "Use fromRight"
110−
11185# Define some custom infix operators
11286# - fixity: infixr 3 ~^#^~
.travis.ymlnew file+54
@@ -0,0 +1,54 @@
1+os: osx
2+language: generic
3+cache:
4+ timeout: 1000
5+ directories:
6+ - "$HOME/.stack/"
7+ - ".stack-work/"
8+branches:
9+ only:
10+ - /rc\/.*/
11+install:
12+- set -e
13+- ulimit -n 4096
14+- brew install haskell-stack
15+- which stack
16+- stack --version
17+- stack setup
18+- stack exec -- ghc --version
19+- |
20+ export VERSION=$(grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}')
21+ export BASEDIR=$(pwd)
22+ export ARTIFACTS=${BASEDIR}/macos-release-candidate
23+ export RESOURCES=${ARTIFACTS}/Resources
24+ export ROOT=${ARTIFACTS}/pandoc
25+ export DEST=${ROOT}/usr/local
26+ export ME=$(whoami)
27+ export BASE=pandoc-$VERSION
28+ mkdir -p ${ARTIFACTS}
29+ mkdir -p ${RESOURCES}
30+ mkdir -p ${DEST}/bin
31+ mkdir -p ${DEST}/share/man/man1
32+ stack build --dependencies-only pandoc
33+ stack build pandoc
34+ for f in $(find .stack-work/install -name 'pandoc*' -perm +001 -type f); do cp $f ${DEST}/bin/; done
35+ strip ${DEST}/bin/pandoc
36+ cp man/pandoc.1 ${DEST}/share/man/man1/pandoc.1
37+ ${DEST}/bin/pandoc -t html5 -s COPYING.md -Vpagetitle=License \
38+ -o ${RESOURCES}/license.html
39+ chown -R $ME:staff ${ROOT}
40+ sed -e "s/PANDOCVERSION/${VERSION}/" macos/distribution.xml.in > ${ARTIFACTS}/distribution.xml
41+ cp macos/Makefile ${ARTIFACTS}/
42+ echo ${VERSION} > ${ARTIFACTS}/version.txt
43+deploy:
44+ on:
45+ all_branches: true
46+ provider: s3
47+ bucket: travis-jgm-pandoc
48+ region: us-west-1
49+ edge: true
50+ local_dir: macos-release-candidate
51+ access_key_id:
52+ secure: ohEst8EP8Z3r/bPMlYgPATo3B/ye48Z0aGp4W1pEhDZjqufLUVTFBIoicvPApCkTrbKMNTdG+KmasrO/leHpju0uFKYQHDtJmHZe3avIOIdbGnOqn97+mmLZBN5skiJWNtrxnN/TuAM+wlePz1dQpohPt6J3S70ct8DsOdZOaGI=
53+ secret_access_key:
54+ secure: qZ2RN4Bx4WRcVz9H8ae4S6a3AA85kcca0RdMimIREdGSx4ewMYa8lSdcKDvRbPwXRy8H3SeviqL2tTZw3+ej1jccAHowMj8Zvde5EJwX0+qO4Sr0zdWjnsvMeUmx9pO1oL3L/09KTWiMTT+d4XNpE8eqiY08qN8oMj0EPeR/AS4=
AUTHORS.md−40
@@ -1,13 +1,11 @@
11# Contributors
22
33- Anabra
4−- Aner Lucero
54- Arata Mizuki
65- Arfon Smith
76- Aaron Wolen
87- Albert Krewinkel
98- Alex Ivkin
10−- Alex Toldaiev
119- Alex Vong
1210- Alexander Kondratskiy
1311- Alexander Krotov
@@ -19,8 +17,6 @@
1917- Anders Waldenborg
2018- Andreas Lööw
2119- Andrew Dunning
22−- Andy Morris
23−- Anti-Distinctlyminty
2420- Antoine Latter
2521- Antonio Terceiro
2622- Arata Mizuki
@@ -35,8 +31,6 @@
3531- Beni Cherniavsky-Paskin
3632- Benoit Schweblin
3733- Bjorn Buckwalter
38−- Blake Eryx
39−- Bodigrim
4034- Bradley Kuhn
4135- Brent Yorgey
4236- Brian Leung
@@ -47,7 +41,6 @@
4741- Carlos Sosa
4842- Cécile Chemin
4943- Cédric Couralet
50−- Charanjit Singh
5144- Chris Black
5245- Christian Conkle
5346- Christian Despres
@@ -65,23 +58,17 @@
6558- Daniele D'Orazio
6659- David A Roberts
6760- David Lazar
68−- David Martschenko
6961- David Röthlisberger
7062- Denis Laxalde
7163- Denis Maier
7264- Derek Chen-Becker
73−- Diego Balseiro
74−- Dimitri Sabadie
7565- Dmitry Pogodin
76−- Dmitry Volodin
7766- Douglas Calvert
7867- Eigil Rischel
7968- Emanuel Evans
8069- Emerson Harkin
81−- Emily Bourke
8270- Emily Eisenberg
8371- Eric Kow
84−- Erik Rask
8572- Eric Seidel
8673- Eric Schrijver
8774- Ethan Riley
@@ -91,7 +78,6 @@
9178- Florian Beeres
9279- Florian Eitel
9380- Florian Klink
94−- Florian Kohrt
9581- Francesco Occhipinti
9682- François Gannaz
9783- Frederik Elwert
@@ -114,7 +100,6 @@
114100- Hubert Plociniczak
115101- Ian Max Andolina
116102- Igor Khorlo
117−- Igor Pashev
118103- Ilya V. Portnov
119104- Ivan Trubach
120105- Ivo Clarysse
@@ -128,7 +113,6 @@
128113- Jamie F. Olson
129114- Jan Larres
130115- Jan Schulz
131−- Jan Tojnar
132116- Jan-Otto Kröpke
133117- Jason Ronallo
134118- Jeff Arnold
@@ -136,7 +120,6 @@
136120- Jens Getreu
137121- Jens Petersen
138122- Jeroen de Haas
139−- Jerry Sky
140123- Jesse Rosenthal
141124- Joe Hermaszewski
142125- Joe Hillenbrand
@@ -152,7 +135,6 @@
152135- Josef Svenningsson
153136- Joseph C. Sible
154137- Julien Cretel
155−- Julien Dutant
156138- Juliette Fourcot
157139- Juliusz Gonera
158140- Justin Bogner
@@ -168,10 +150,7 @@
168150- Lars-Dominik Braun
169151- Laurent P. René de Cotret
170152- Leif Metcalf
171−- Leonard Rosenthol
172153- Lila
173−- Loïc Grobol
174−- Lorenzo
175154- Lucas Escot
176155- Luke Plant
177156- Marc Schreiber
@@ -194,7 +173,6 @@
194173- Merijn Verstraaten
195174- Michael Beaumont
196175- Michael Chladek
197−- Michael Hoffmann
198176- Michael Peyton Jones
199177- Michael Reed
200178- Michael Snoyman
@@ -205,12 +183,10 @@
205183- Nathan Gass
206184- Neil Mayhew
207185- Nick Bart
208−- Nick Berendsen
209186- Nick Fleisher
210187- Nicolas Kaiser
211188- Nikolay Yakimov
212189- Nils Carlson
213−- Nixon Enraght-Moony
214190- Nokome Bentley
215191- Ole Martin Ruud
216192- Oliver Matthews
@@ -235,7 +211,6 @@
235211- Raymond Ehlers
236212- Recai Oktaş
237213- Roland Hieber
238−- Roman Beránek
239214- RyanGlScott
240215- Salim B
241216- Sascha Wilde
@@ -246,14 +221,12 @@
246221- Shahbaz Youssefi
247222- Shaun Attfield
248223- Shim Myeongseob
249−- Shin Sang-jae
250224- Sidarth Kapur
251225- Sidharth Kapur
252226- Simon Hengel
253227- Stefan Dresselhaus
254228- Sumit Sahrawat
255229- Tarik Graba
256−- Tatiana Porras
257230- Thenaesh Elango
258231- Thomas Hodgson
259232- Thomas Weißschuh
@@ -284,15 +257,11 @@
284257- Yoan Blanc
285258- Yuchen Pei
286259- Zihang Chen
287−- a-vrma
288260- andrebauer
289−- argent0
290−- badumont
291261- blmage
292262- bucklereed
293263- bumper314
294264- chinapedia
295−- cholonam
296265- csforste
297266- dbecher-ito
298267- d-dorazio
@@ -303,11 +272,8 @@
303272- kaizshang91
304273- lux-lth
305274- lwolfsonkin
306−- mbrackeantidot
307275- nkalvi
308276- niszet
309−- nuew
310−- obcat
311277- oltolm
312278- oquechy
313279- quasicomputational
@@ -318,13 +284,7 @@
318284- rski
319285- shreevatsa.public
320286- takahashim
321−- taotieren
322−- tecosaur
323−- TEC
324287- tgkokk
325−- the-solipsist
326−- timo-a
327288- thsutton
328289- vijayphoenix
329290- wiefling
330−- wuffi
CONTRIBUTING.md+24−123
@@ -1,64 +1,6 @@
11Contributing to pandoc
22======================
33
4−Welcome to pandoc! Very soon after its beginnings in 2006, pandoc
5−has been influenced, improved, and modified, by users, devs, and
6−newcomers alike. The project thrives on its active community. It is
7−great to have you here.
8−
9−How can I help?
10−---------------
11−
12−There are many ways in which you can support pandoc. Here are a few
13−ideas:
14−
15− * Participate in online discussions. The [pandoc-discuss] mailing
16− list is a good place for this. This gives valuable input and
17− makes it easier to improve the program.
18−
19− * Help with questions. Every request that is answered by the wider
20− community frees time for programming contributors. This will
21− speed up development of new features and issue fixes. Don't
22− underestimate your knowledge, please share it!
23−
24− Good places to help are the [pandoc-discuss] mailing list, Q/A
25− sites like StackOverflow, community forums (e.g.
26− [RStudio][RStudio Community], [Zettlr][Zettlr Forum]), and, for
27− technical questions, the GitHub [issue tracker].
28−
29− * Write or improve documentation. If you ran into a problem which
30− took more time to figure out than expected, please consider to
31− save other users from the same experience. People writing the
32− documentation tend to lack an outside view, so please help
33− provide one. Good documentation is both difficult and extremely
34− important.
35−
36− The official docs are not the only place for documentation.
37− Pandoc also has a [Wiki][pandoc wiki]. Private blogs can serve
38− as documentation just as the official manual can.
39−
40− * Contribute code. No matter whether it's a small fix in a format
41− template or a huge lump of Haskell code: help is welcome. It's
42− usually a good idea to talk about the plans early, as this can
43− prevent unnecessary work. See below for more information.
44−
45− * Last but not least: consider funding the development and
46− maintenance of pandoc financially. You can find sponsor buttons
47− on the [pandoc website] and the [GitHub repository][GitHub
48− repo].
49−
50−A rich ecosystem of libraries, editors, filters, and templates has
51−developed around pandoc; conversely, pandoc builds and depends on a
52−large number of libraries. Contributing to any of these projects is
53−another way that can help to ensure stability, and to keep pushing
54−the boundaries of what is possible with pandoc.
55−
56−[RStudio Community]: https://community.rstudio.com/
57−[Zettlr Forum]: https://forum.zettlr.com/
58−[pandoc wiki]: https://github.com/jgm/pandoc/wiki
59−[pandoc website]: https://pandoc.org
60−[GitHub repo]: https://github.com/jgm/pandoc
61−
624Have a question?
635----------------
646
@@ -163,12 +105,7 @@ Explain the rationale for the feature you're requesting. Why would this
163105feature be useful? Consider also any possible drawbacks, including backwards
164106compatibility, new library dependencies, and performance issues.
165107
166−Features are very rarely "implement and forget", as all code must be
167−maintained. This is especially relevant for large or complex
168−contributions. It is helpful to be sympathetic to that fact, and to
169−communicate future plans and availability clearly.
170−
171−Any potential new feature is best discussed on [pandoc-discuss]
108+It is best to discuss a potential new feature on [pandoc-discuss]
172109before opening an issue.
173110
174111Patches and pull requests
@@ -244,16 +181,9 @@ Or with stack:
244181
245182 stack test --test-arguments='-p markdown'
246183
247−It is often helpful to add `-j4` (run tests in parallel) and
248−`--hide-successes` (don't clutter output with successes) to the test
249−arguments as well. Collecting all options in a `cabal.project.local`
250−file in the project's root directory can help to keep `cabal`
251−commands short. E.g.:
252−
253− flags: +embed_data_files
254− tests: True
255− test-show-details: direct
256− test-options: -j4 --hide-successes
184+It is often helpful to add `-j4` (run tests in parallel)
185+and `--hide-successes` (don't clutter output with successes)
186+to the test arguments as well.
257187
258188If you add a new feature to pandoc, please add tests as well, following
259189the pattern of the existing tests. The test suite code is in
@@ -276,35 +206,6 @@ or Powerpoint to ensure that they weren't corrupted and that
276206they had the expected result, and mention the Word/Powerpoint
277207version and OS in your commit comment.
278208
279−Code style
280−----------
281−
282−Pandoc uses [hlint] to identify opportunities for code improvements
283−like redundant brackets or unnecessary `Language` extensions.
284−However, sometimes there are cases where there are good reasons to
285−use code different from what hlint proposes. In these cases, the
286−respective warning should be disabled in the file `.hlint.yaml`.
287−
288−There should be no errors when running `hlint .`; this is checked by
289−the continuous integration (CI) setup. It is recommended that
290−contributors check their code with a local hlint installation, but
291−relying on the CI is fine, too.
292−
293−A good way to ensure no new warnings are introduced is to use a Git
294−[pre-commit hook] which runs hlint on all updated Haskell files
295−before creating a commit:
296−
297− #!/bin/sh
298− git diff --diff-filter=MA --cached --name-only | grep '\.hs$' | \
299− xargs hlint --hint .hlint.yaml
300−
301−(If you are using GNU `xargs`, add the `-r` option immediately
302−after `xargs`.)
303−
304−Saving this to `.git/hooks/pre-commit`, and making the script
305−executable, will prevent accidental introduction of potentially
306−problematic code.
307−
308209Benchmarks
309210----------
310211
@@ -318,6 +219,9 @@ With stack:
318219
319220 stack bench
320221
222+You can also build `weigh-pandoc` (`stack build pandoc:weigh-pandoc`)
223+to get some statistics on memory usage. (Eventually this should
224+be incorporated into the benchmark suite.)
321225
322226Using the REPL
323227--------------
@@ -329,10 +233,10 @@ a ghci REPL for working with pandoc. With [stack], use
329233We recommend using the following `.ghci` file (which can be
330234placed in the source directory):
331235
332− :set -fobject-code
333− :set -XTypeSynonymInstances
334− :set -XScopedTypeVariables
335− :set -XOverloadedStrings
236+ :set -fobject-code
237+ :set -XTypeSynonymInstances
238+ :set -XScopedTypeVariables
239+ :set -XOverloadedStrings
336240
337241Profiling
338242---------
@@ -376,7 +280,7 @@ The code
376280--------
377281
378282Pandoc has a publicly accessible git repository on
379−GitHub: <https://github.com/jgm/pandoc>. To get a local copy of the source:
283+GitHub: <http://github.com/jgm/pandoc>. To get a local copy of the source:
380284
381285 git clone https://github.com/jgm/pandoc.git
382286
@@ -386,7 +290,7 @@ the pandoc library is in `src/`, the source for the tests is in
386290
387291The modules `Text.Pandoc.Definition`, `Text.Pandoc.Builder`, and
388292`Text.Pandoc.Generic` are in a separate library `pandoc-types`. The code can
389−be found in <https://github.com/jgm/pandoc-types>.
293+be found in <http://github.com/jgm/pandoc-types>.
390294
391295To build pandoc, you will need a working installation of the
392296[Haskell platform].
@@ -406,11 +310,11 @@ The library is structured as follows:
406310 tree automatically.
407311 - `Text.Pandoc.Readers.*` are the readers, and `Text.Pandoc.Writers.*`
408312 are the writers.
409− - `Text.Pandoc.Citeproc.*` contain the code for citation handling,
410− including an interface to the [citeproc] library.
313+ - `Text.Pandoc.Biblio` is a utility module for formatting citations
314+ using citeproc-hs.
411315 - `Text.Pandoc.Data` is used to embed data files when the `embed_data_files`
412− cabal flag is used.
413− - `Text.Pandoc.Emoji` is a thin wrapper around [emojis].
316+ cabal flag is used. It is generated from `src/Text/Pandoc/Data.hsb` using
317+ the preprocessor [hsb2hs].
414318 - `Text.Pandoc.Highlighting` contains the interface to the
415319 skylighting library, which is used for code syntax highlighting.
416320 - `Text.Pandoc.ImageSize` is a utility module containing functions for
@@ -421,6 +325,7 @@ The library is structured as follows:
421325 - `Text.Pandoc.PDF` contains functions for producing a PDF from a
422326 LaTeX source.
423327 - `Text.Pandoc.Parsing` contains parsing functions used in multiple readers.
328+ - `Text.Pandoc.Pretty` is a pretty-printing library specialized to
424329 the needs of pandoc.
425330 - `Text.Pandoc.SelfContained` contains functions for making an HTML
426331 file "self-contained," by importing remotely linked images, CSS,
@@ -448,17 +353,13 @@ you may want to consider submitting a pull request to the
448353[closed issues]: https://github.com/jgm/pandoc/issues?q=is%3Aissue+is%3Aclosed
449354[latest released version]: https://github.com/jgm/pandoc/releases/latest
450355[Nightly builds]: https://github.com/jgm/pandoc/actions?query=workflow%3ANightly
451−[pandoc-discuss]: https://groups.google.com/group/pandoc-discuss
356+[pandoc-discuss]: http://groups.google.com/group/pandoc-discuss
452357[issue tracker]: https://github.com/jgm/pandoc/issues
453−[User's Guide]: https://pandoc.org/MANUAL.html
454−[FAQs]: https://pandoc.org/faqs.html
455−[EditorConfig]: https://editorconfig.org/
456−[Haskell platform]: https://www.haskell.org/platform/
457−[hlint]: https://hackage.haskell.org/package/hlint
458−[citeproc]: https://hackage.haskell.org/package/citeproc
459−[emojis]: https://hackage.haskell.org/package/emojis
460−[hsb2hs]: https://hackage.haskell.org/package/hsb2hs
461−[pre-commit hook]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
358+[User's Guide]: http://pandoc.org/MANUAL.html
359+[FAQs]: http://pandoc.org/faqs.html
360+[EditorConfig]: http://editorconfig.org/
361+[Haskell platform]: http://www.haskell.org/platform/
362+[hsb2hs]: http://hackage.haskell.org/package/hsb2hs
462363[GitHub labels]: https://github.com/jgm/pandoc/labels
463364[good first issue]:https://github.com/jgm/pandoc/labels/good%20first%20issue
464365[enhancement]: https://github.com/jgm/pandoc/labels/enhancement
COPYING.md+1−1
@@ -357,5 +357,5 @@ into proprietary programs. If your program is a subroutine library,
357357you may consider it more useful to permit linking proprietary
358358applications with the library. If this is what you want to do, use the
359359[GNU Lesser General Public
360−License](https://www.gnu.org/licenses/lgpl.html) instead of this
360+License](http://www.gnu.org/licenses/lgpl.html) instead of this
361361License.
COPYRIGHT+26−17
@@ -1,5 +1,5 @@
11Pandoc
2−Copyright (C) 2006-2021 John MacFarlane <jgm at berkeley dot edu>
2+Copyright (C) 2006-2020 John MacFarlane <jgm at berkeley dot edu>
33
44With the exceptions noted below, this code is released under the [GPL],
55version 2 or later:
@@ -22,11 +22,11 @@ The GNU General Public License is available in the file COPYING.md in
2222the source distribution. On Debian systems, the complete text of the
2323GPL can be found in `/usr/share/common-licenses/GPL`.
2424
25−[GPL]: https://www.gnu.org/copyleft/gpl.html
25+[GPL]: http://www.gnu.org/copyleft/gpl.html
2626
2727Pandoc's complete source code is available from the [Pandoc home page].
2828
29−[Pandoc home page]: https://pandoc.org
29+[Pandoc home page]: http://pandoc.org
3030
3131Pandoc includes some code with different copyrights, or subject to different
3232licenses. The copyright and license statements for these sources are included
@@ -37,7 +37,7 @@ The modules in the `pandoc-types` repository (Text.Pandoc.Definition,
3737Text.Pandoc.Builder, Text.Pandoc.Generics, Text.Pandoc.JSON,
3838Text.Pandoc.Walk) are licensed under the BSD 3-clause license:
3939
40−Copyright (c) 2006-2021, John MacFarlane
40+Copyright (c) 2006-2020, John MacFarlane
4141
4242All rights reserved.
4343
@@ -73,7 +73,7 @@ Pandoc's templates (in `data/templates`) are dual-licensed as either
7373GPL (v2 or higher, same as pandoc) or (at your option) the BSD
74743-clause license.
7575
76−Copyright (c) 2014--2021, John MacFarlane
76+Copyright (c) 2014--2020, John MacFarlane
7777
7878----------------------------------------------------------------------
7979src/Text/Pandoc/Writers/Muse.hs
@@ -83,19 +83,19 @@ Released under the GNU General Public License version 2 or later.
8383
8484----------------------------------------------------------------------
8585src/Text/Pandoc/Writers/Texinfo.hs
86−Copyright (C) 2008-2021 John MacFarlane and Peter Wang
86+Copyright (C) 2008-2020 John MacFarlane and Peter Wang
8787
8888Released under the GNU General Public License version 2 or later.
8989
9090----------------------------------------------------------------------
9191src/Text/Pandoc/Writers/OpenDocument.hs
92−Copyright (C) 2008-2021 Andrea Rossato and John MacFarlane
92+Copyright (C) 2008-2020 Andrea Rossato and John MacFarlane
9393
9494Released under the GNU General Public License version 2 or later.
9595
9696----------------------------------------------------------------------
9797src/Text/Pandoc/Writers/Org.hs
98−Copyright (C) 2010-2021 Puneeth Chaganti, John MacFarlane, and
98+Copyright (C) 2010-2020 Puneeth Chaganti, John MacFarlane, and
9999 Albert Krewinkel
100100
101101Released under the GNU General Public License version 2 or later.
@@ -115,7 +115,7 @@ Released under the GNU General Public License version 2 or later.
115115
116116----------------------------------------------------------------------
117117src/Text/Pandoc/Readers/Textile.hs
118−Copyright (C) 2010-2021 Paul Rivier and John MacFarlane
118+Copyright (C) 2010-2020 Paul Rivier and John MacFarlane
119119
120120Released under the GNU General Public License version 2 or later.
121121
@@ -133,7 +133,7 @@ Released under the GNU General Public License version 2 or later.
133133
134134----------------------------------------------------------------------
135135src/Text/Pandoc/Readers/EPUB.hs
136−Copyright (C) 2014-2021 Matthew Pickering and John MacFarlane
136+Copyright (C) 2014-2020 Matthew Pickering and John MacFarlane
137137
138138Released under the GNU General Public License version 2 or later.
139139
@@ -141,7 +141,7 @@ Released under the GNU General Public License version 2 or later.
141141src/Text/Pandoc/Readers/Org.hs
142142src/Text/Pandoc/Readers/Org/*
143143test/Tests/Readers/Org/*
144−Copyright (C) 2014-2021 Albert Krewinkel
144+Copyright (C) 2014-2020 Albert Krewinkel
145145
146146Released under the GNU General Public License version 2 or later.
147147
@@ -149,7 +149,7 @@ Released under the GNU General Public License version 2 or later.
149149src/Text/Pandoc/Lua.hs
150150src/Text/Pandoc/Lua/*
151151test/lua/*
152−Copyright (C) 2017--2021 Albert Krewinkel and John MacFarlane
152+Copyright (C) 2017--2020 Albert Krewinkel and John MacFarlane
153153
154154Released under the GNU General Public License version 2 or later.
155155
@@ -157,7 +157,7 @@ Released under the GNU General Public License version 2 or later.
157157src/Text/Pandoc/Readers/Jira.hs
158158src/Text/Pandoc/Writers/Jira.hs
159159test/Tests/Readers/Jira.hs
160−Copyright (C) 2019--2021 Albert Krewinkel
160+Copyright (C) 2019--2020 Albert Krewinkel
161161
162162Released under the GNU General Public License version 2 or later.
163163
@@ -169,21 +169,21 @@ Released under the GNU General Public License version 2 or later.
169169
170170----------------------------------------------------------------------
171171data/pandoc.lua
172−Copyright (C) 2017-2021 Albert Krewinkel
172+Copyright (C) 2017-2020 Albert Krewinkel
173173
174174Released under the GNU General Public License version 2 or later.
175175
176176----------------------------------------------------------------------
177177The dzslides template contains JavaScript and CSS from Paul Rouget's
178178dzslides template.
179−https://github.com/paulrouget/dzslides
179+http://github.com/paulrouget/dzslides
180180
181181Released under the Do What the Fuck You Want To Public License.
182182
183183------------------------------------------------------------------------
184−Pandoc embeds a Lua interpreter (via hslua).
184+Pandoc embeds a lua interpreter (via hslua).
185185
186−Copyright © 1994–2020 Lua.org, PUC-Rio.
186+Copyright © 1994–2019 Lua.org, PUC-Rio.
187187
188188Permission is hereby granted, free of charge, to any person obtaining
189189a copy of this software and associated documentation files (the
@@ -203,3 +203,12 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
203203LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
204204OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
205205WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
206+
207+------------------------------------------------------------------------
208+The template pandoc.jats is Copyright 2013--2015 Martin Fenner,
209+released under GPL version 2 or later.
210+
211+The file data/jats.csl is derived from a csl file by Martin Fenner,
212+revised by Martin Paul Eve and then John MacFarlane.
213+"This work is licensed under a Creative Commons Attribution-ShareAlike 3.0
214+License. Originally by Martin Fenner."
INSTALL.md+38−27
@@ -34,10 +34,6 @@ without SVG support), [Python] (to use Pandoc filters), and
3434
3535 choco install rsvg-convert python miktex
3636
37−Using multiple installation methods can result in two separate
38−installations of pandoc; it is recommended to properly uninstall
39−pandoc before switching to an alternative installation method.
40−
4137By default, Pandoc creates PDFs using LaTeX.
4238We recommend installing it via [MiKTeX].
4339
@@ -49,10 +45,14 @@ by downloading [this script][uninstaller]
4945and running it with `perl uninstall-pandoc.pl`.
5046
5147Alternatively, you can install pandoc using
52−[Homebrew](https://brew.sh):
48+[Homebrew](http://brew.sh):
5349
5450 brew install pandoc
5551
52+To include pandoc's citation parser:
53+
54+ brew install pandoc-citeproc
55+
5656Homebrew can also install other software that integrates with Pandoc.
5757For example, to install [librsvg] (its `rsvg-convert` covers formats
5858without SVG support), [Python] (to use Pandoc filters), and
@@ -86,8 +86,9 @@ not outdated. Pandoc is in the [Debian], [Ubuntu], [Slackware],
8686To get the latest release, we provide a binary package for amd64
8787architecture on the **[download page]**.
8888
89−The executable is statically linked and
90−has no dynamic dependencies or dependencies on external
89+This provides both `pandoc` and `pandoc-citeproc`.
90+The executables are statically linked and
91+have no dynamic dependencies or dependencies on external
9192data files. Note: because of the static
9293linking, the pandoc binary from this package cannot use lua
9394filters that require external lua modules written in C.
@@ -97,7 +98,8 @@ Both a tarball and a deb installer are provided. To install the deb:
9798 sudo dpkg -i $DEB
9899
99100where `$DEB` is the path to the downloaded deb. This will
100−install the `pandoc` executable and man page.
101+install the `pandoc` and `pandoc-citeproc` executables and
102+man pages.
101103
102104If you use an RPM-based distro, you may be able to install
103105the deb from our download page using `alien`.
@@ -120,7 +122,7 @@ package repositories. For example, on Debian/Ubuntu,
120122you can install it with `apt-get install haskell-platform`.
121123
122124For PDF output, you'll need LaTeX. We recommend installing
123−[TeX Live](https://www.tug.org/texlive/) via your package
125+[TeX Live](http://www.tug.org/texlive/) via your package
124126manager. (On Debian/Ubuntu, `apt-get install texlive`.)
125127
126128## Chrome OS
@@ -147,7 +149,7 @@ The official Docker images for pandoc can be found at
147149[dockerhub](https://hub.docker.com/).
148150
149151The [pandoc/core](https://hub.docker.com/r/pandoc/core)
150−image contains `pandoc`.
152+image contains `pandoc` and `pandoc-citeproc`.
151153
152154The [pandoc/latex](https://hub.docker.com/r/pandoc/latex)
153155image also contains the minimal LaTeX installation needed
@@ -242,22 +244,28 @@ The easiest way to build pandoc from source is to use [stack][stack]:
242244
243245 pandoc --help
244246
245− [Not sure where `$CABALDIR` is?](https://wiki.haskell.org/Cabal-Install#The_cabal-install_configuration_file)
247+ [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
246248
247−5. By default `pandoc` uses the "i;unicode-casemap" method
249+5. If you want to process citations with pandoc, you will also need to
250+ install a separate package, `pandoc-citeproc`. This can be installed
251+ using cabal:
252+
253+ cabal install pandoc-citeproc
254+
255+ By default `pandoc-citeproc` uses the "i;unicode-casemap" method
248256 to sort bibliography entries (RFC 5051). If you would like to
249257 use the locale-sensitive unicode collation algorithm instead,
250− specify the `icu` flag (which affects the dependency `citeproc`):
258+ specify the `unicode_collation` flag:
251259
252− cabal install pandoc -ficu
260+ cabal install pandoc-citeproc -funicode_collation
253261
254262 Note that this requires the `text-icu` library, which in turn
255263 depends on the C library `icu4c`. Installation directions
256264 vary by platform. Here is how it might work on macOS with Homebrew:
257265
258266 brew install icu4c
259− stack install pandoc \
260− --flag "citeproc:icu" \
267+ stack install pandoc-citeproc \
268+ --flag "pandoc-citeproc:unicode_collation" \
261269 --extra-lib-dirs=/usr/local/opt/icu4c/lib \
262270 --extra-include-dirs=/usr/local/opt/icu4c/include
263271
@@ -266,6 +274,8 @@ The easiest way to build pandoc from source is to use [stack][stack]:
266274 accordingly. If `MANUAL.txt` has been modified, the man page can be
267275 rebuilt: `make man/pandoc.1`.
268276
277+ The `pandoc-citeproc.1` man page will also be installed automatically.
278+
269279
270280### Custom cabal method
271281
@@ -387,29 +397,30 @@ To run just the markdown benchmarks:
387397
388398
389399[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
390−[Cabal User's Guide]: https://cabal.readthedocs.io/
400+[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
391401[Debian]: https://packages.debian.org/pandoc
392402[Fedora]: https://apps.fedoraproject.org/packages/pandoc
393−[FreeBSD ports]: https://www.freshports.org/textproc/hs-pandoc/
394−[GHC]: https://www.haskell.org/ghc/
395−[Haskell platform]: https://hackage.haskell.org/platform/
396−[MacPorts]: https://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
403+[FreeBSD ports]: http://www.freshports.org/textproc/hs-pandoc/
404+[GHC]: http://www.haskell.org/ghc/
405+[GPL]: http://www.gnu.org/copyleft/gpl.html
406+[Haskell platform]: http://hackage.haskell.org/platform/
407+[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
397408[MacTeX]: https://tug.org/mactex/
398−[BasicTeX]: https://www.tug.org/mactex/morepackages.html
409+[BasicTeX]: http://www.tug.org/mactex/morepackages.html
399410[LaTeX]: https://www.latex-project.org
400−[MiKTeX]: https://miktex.org/
411+[MiKTeX]: http://miktex.org/
401412[librsvg]: https://wiki.gnome.org/Projects/LibRsvg
402413[Python]: https://www.python.org
403−[NetBSD]: https://pkgsrc.se/wip/pandoc
414+[NetBSD]: http://pkgsrc.se/wip/pandoc
404415[NixOS]: https://nixos.org/nixos/packages.html
405416[Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv=
406417[Ubuntu]: https://packages.ubuntu.com/pandoc
407418[download page]: https://github.com/jgm/pandoc/releases/latest
408−[gentoo]: https://packages.gentoo.org/package/app-text/pandoc
419+[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
409420[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
410421[openSUSE]: https://software.opensuse.org/package/pandoc
411−[source tarball]: https://hackage.haskell.org/package/pandoc
422+[source tarball]: http://hackage.haskell.org/package/pandoc
412423[stack]: https://docs.haskellstack.org/en/stable/install_and_upgrade.html
413−[cabal-install]: https://hackage.haskell.org/package/cabal-install
424+[cabal-install]: http://hackage.haskell.org/package/cabal-install
414425[Void]: https://voidlinux.org/
415426[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl
MANUAL.txt+253−607
@@ -1,7 +1,7 @@
11---
22title: Pandoc User's Guide
33author: John MacFarlane
4−date: June 20, 2021
4+date: July 23, 2020
55---
66
77# Synopsis
@@ -136,22 +136,22 @@ to output the generated LaTeX. You can then test it with `pdflatex test.tex`.
136136When using LaTeX, the following packages need to be available
137137(they are included with all recent versions of [TeX Live]):
138138[`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
139−[`iftex`], [`listings`] (if the
139+[`ifxetex`], [`ifluatex`], [`listings`] (if the
140140`--listings` option is used), [`fancyvrb`], [`longtable`],
141141[`booktabs`], [`graphicx`] (if the document
142142contains images), [`hyperref`], [`xcolor`],
143143[`ulem`], [`geometry`] (with the `geometry` variable set),
144144[`setspace`] (with `linestretch`), and
145145[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
146−the PDF engine requires [`fontspec`]. `lualatex` uses
147−[`selnolig`]. `xelatex` uses [`polyglossia`] (with `lang`),
148−[`xecjk`], and [`bidi`] (with the `dir` variable set). If the
149−`mathspec` variable is set, `xelatex` will use [`mathspec`]
150−instead of [`unicode-math`]. The [`upquote`] and [`microtype`]
151−packages are used if available, and [`csquotes`] will be used
152−for [typography] if the `csquotes` variable or metadata field is
153−set to a true value. The [`natbib`], [`biblatex`], [`bibtex`],
154−and [`biber`] packages can optionally be used for [citation
146+the PDF engine requires [`fontspec`]. `xelatex` uses
147+[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
148+`dir` variable set). If the `mathspec` variable is set,
149+`xelatex` will use [`mathspec`] instead of [`unicode-math`].
150+The [`upquote`] and [`microtype`] packages are used if
151+available, and [`csquotes`] will be used for [typography]
152+if the `csquotes` variable or metadata field is set to a
153+true value. The [`natbib`], [`biblatex`], [`bibtex`], and
154+[`biber`] packages can optionally be used for [citation
155155rendering]. The following packages will be used to improve
156156output quality if present, but pandoc does not require them to
157157be present: [`upquote`] (for straight quotes in verbatim
@@ -180,7 +180,8 @@ footnotes in tables).
180180[`graphicx`]: https://ctan.org/pkg/graphicx
181181[`grffile`]: https://ctan.org/pkg/grffile
182182[`hyperref`]: https://ctan.org/pkg/hyperref
183−[`iftex`]: https://ctan.org/pkg/iftex
183+[`ifluatex`]: https://ctan.org/pkg/ifluatex
184+[`ifxetex`]: https://ctan.org/pkg/ifxetex
184185[`listings`]: https://ctan.org/pkg/listings
185186[`lm`]: https://ctan.org/pkg/lm
186187[`longtable`]: https://ctan.org/pkg/longtable
@@ -199,7 +200,6 @@ footnotes in tables).
199200[`xcolor`]: https://ctan.org/pkg/xcolor
200201[`xecjk`]: https://ctan.org/pkg/xecjk
201202[`xurl`]: https://ctan.org/pkg/xurl
202−[`selnolig`]: https://ctan.org/pkg/selnolig
203203
204204
205205
@@ -280,8 +280,6 @@ header when requesting a document from a URL:
280280 ::: {#output-formats}
281281 - `asciidoc` ([AsciiDoc]) or `asciidoctor` ([AsciiDoctor])
282282 - `beamer` ([LaTeX beamer][`beamer`] slide show)
283− - `bibtex` ([BibTeX] bibliography)
284− - `biblatex` ([BibLaTeX] bibliography)
285283 - `commonmark` ([CommonMark] Markdown)
286284 - `commonmark_x` ([CommonMark] Markdown with extensions)
287285 - `context` ([ConTeXt])
@@ -361,15 +359,15 @@ header when requesting a document from a URL:
361359 will be used. On \*nix and macOS systems this will be the `pandoc`
362360 subdirectory of the XDG data directory (by default,
363361 `$HOME/.local/share`, overridable by setting the `XDG_DATA_HOME`
364− environment variable). If that directory does not exist and
365− `$HOME/.pandoc` exists, it will be used (for backwards compatibility).
366− On Windows the default user data directory is
362+ environment variable). If that directory does not exist,
363+ `$HOME/.pandoc` will be used (for backwards compatibility).
364+ In Windows the default user data directory is
367365 `C:\Users\USERNAME\AppData\Roaming\pandoc`.
368366 You can find the default user data directory on your system by
369367 looking at the output of `pandoc --version`.
370− Data files placed in this directory (for example, `reference.odt`,
371− `reference.docx`, `epub.css`, `templates`) will override
372− pandoc's normal defaults.
368+ A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
369+ `slidy`, `slideous`, or `s5` directory
370+ placed in this directory will override pandoc's normal defaults.
373371
374372`-d` *FILE*, `--defaults=`*FILE*
375373
@@ -486,7 +484,7 @@ header when requesting a document from a URL:
486484[Emacs Org mode]: https://orgmode.org
487485[AsciiDoc]: https://www.methods.co.nz/asciidoc/
488486[AsciiDoctor]: https://asciidoctor.org/
489−[DZSlides]: https://paulrouget.com/dzslides/
487+[DZSlides]: http://paulrouget.com/dzslides/
490488[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
491489[PDF]: https://www.adobe.com/pdf/
492490[reveal.js]: https://revealjs.com/
@@ -589,13 +587,13 @@ header when requesting a document from a URL:
589587
590588 3. `$PATH` (executable only)
591589
592− Filters, Lua-filters, and citeproc processing are applied in
593− the order specified on the command line.
590+ Filters and Lua-filters are applied in the order specified
591+ on the command line.
594592
595593`-L` *SCRIPT*, `--lua-filter=`*SCRIPT*
596594
597595: Transform the document in a similar fashion as JSON filters (see
598− `--filter`), but use pandoc's built-in Lua filtering system. The given
596+ `--filter`), but use pandoc's build-in Lua filtering system. The given
599597 Lua script is expected to return a list of Lua filters which will be
600598 applied in order. Each Lua filter must contain element-transforming
601599 functions indexed by the name of the AST element on which the filter
@@ -604,17 +602,26 @@ header when requesting a document from a URL:
604602 The `pandoc` Lua module provides helper functions for element
605603 creation. It is always loaded into the script's Lua environment.
606604
607− See the [Lua filters documentation] for further details.
605+ The following is an example Lua script for macro-expansion:
608606
609− In order of preference, pandoc will look for Lua filters in
607+ function expand_hello_world(inline)
608+ if inline.c == '{{helloworld}}' then
609+ return pandoc.Emph{ pandoc.Str "Hello, World" }
610+ else
611+ return inline
612+ end
613+ end
610614
611− 1. a specified full or relative path
615+ return {{Str = expand_hello_world}}
612616
613− 2. `$DATADIR/filters` where `$DATADIR` is the user data
614− directory (see `--data-dir`, above).
617+ In order of preference, pandoc will look for Lua filters in
615618
616− Filters, Lua filters, and citeproc processing are applied in
617− the order specified on the command line.
619+ 1. a specified full or relative path (executable or
620+ non-executable)
621+
622+ 2. `$DATADIR/filters` (executable or non-executable)
623+ where `$DATADIR` is the user data directory (see
624+ `--data-dir`, above).
618625
619626`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
620627
@@ -657,30 +664,30 @@ header when requesting a document from a URL:
657664
658665: Specifies what to do with insertions, deletions, and comments
659666 produced by the MS Word "Track Changes" feature. `accept` (the
660− default) processes all the insertions and deletions.
661− `reject` ignores them. Both `accept` and `reject` ignore comments.
662− `all` includes all insertions, deletions, and comments, wrapped
663− in spans with `insertion`, `deletion`, `comment-start`, and
664− `comment-end` classes, respectively. The author and time of
665− change is included. `all` is useful for scripting: only
666− accepting changes from a certain reviewer, say, or before a
667− certain date. If a paragraph is inserted or deleted,
668− `track-changes=all` produces a span with the class
669− `paragraph-insertion`/`paragraph-deletion` before the
670− affected paragraph break. This option only affects the docx
671− reader.
667+ default), inserts all insertions, and ignores all
668+ deletions. `reject` inserts all deletions and ignores
669+ insertions. Both `accept` and `reject` ignore comments. `all` puts
670+ in insertions, deletions, and comments, wrapped in spans with
671+ `insertion`, `deletion`, `comment-start`, and `comment-end`
672+ classes, respectively. The author and time of change is
673+ included. `all` is useful for scripting: only accepting changes
674+ from a certain reviewer, say, or before a certain date. If a
675+ paragraph is inserted or deleted, `track-changes=all` produces a
676+ span with the class `paragraph-insertion`/`paragraph-deletion`
677+ before the affected paragraph break. This option only affects the
678+ docx reader.
672679
673680`--extract-media=`*DIR*
674681
675682: Extract images and other media contained in or linked from
676683 the source document to the path *DIR*, creating it if
677684 necessary, and adjust the images references in the document
678− so they point to the extracted files. Media are downloaded,
679− read from the file system, or extracted from a binary
680− container (e.g. docx), as needed. The original file paths
681− are used if they are relative paths not containing `..`.
682− Otherwise filenames are constructed from the SHA1 hash of
683− the contents.
685+ so they point to the extracted files. If the source format is
686+ a binary container (docx, epub, or odt), the media is
687+ extracted from the container and the original
688+ filenames are used. Otherwise the media is read from the
689+ file system or downloaded, and new filenames are constructed
690+ based on SHA1 hashes of the contents.
684691
685692`--abbreviations=`*FILE*
686693
@@ -691,15 +698,14 @@ header when requesting a document from a URL:
691698 system default, use
692699 `pandoc --print-default-data-file=abbreviations`. The only
693700 use pandoc makes of this list is in the Markdown reader.
694− Strings found in this list will be followed by a nonbreaking
695− space, and the period will not produce sentence-ending space
696− in formats like LaTeX. The strings may not contain spaces.
701+ Strings ending in a period that are found in this list will
702+ be followed by a nonbreaking space, so that the period will
703+ not produce sentence-ending space in formats like LaTeX.
697704
698705[`pandocfilters`]: https://github.com/jgm/pandocfilters
699706[PHP]: https://github.com/vinai/pandocfilters-php
700707[perl]: https://metacpan.org/pod/Pandoc::Filter
701708[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
702−[Lua filters documentation]: https://pandoc.org/lua-filters.html
703709
704710## General writer options {.options}
705711
@@ -891,11 +897,11 @@ header when requesting a document from a URL:
891897 will not be searched. For example:
892898 `--resource-path=.:test` will search the working directory
893899 and the `test` subdirectory, in that order.
894− This option can be used repeatedly. Search path components
895− that come later on the command line will be searched before
896− those that come earlier, so
897− `--resource-path foo:bar --resource-path baz:bim` is
898− equivalent to `--resource-path baz:bim:foo:bar`.
900+
901+ `--resource-path` only has an effect if (a) the output
902+ format embeds images (for example, `docx`, `pdf`, or `html`
903+ with `--self-contained`) or (b) it is used together with
904+ `--extract-media`.
899905
900906`--request-header=`*NAME*`:`*VAL*
901907
@@ -907,7 +913,7 @@ header when requesting a document from a URL:
907913
908914`--no-check-certificate`
909915
910−: Disable the certificate verification to allow access to
916+: Disable the certificate verification to allow access to
911917 unsecure HTTP resources (for example when the certificate
912918 is no longer valid or self signed).
913919
@@ -936,9 +942,7 @@ header when requesting a document from a URL:
936942
937943`--html-q-tags`
938944
939−: Use `<q>` tags for quotes in HTML. (This option only has an
940− effect if the `smart` extension is enabled for the input
941− format used.)
945+: Use `<q>` tags for quotes in HTML.
942946
943947`--ascii`
944948
@@ -956,45 +960,37 @@ header when requesting a document from a URL:
956960 placement of link references is affected by the
957961 `--reference-location` option.
958962
959−`--reference-location=block`|`section`|`document`
963+`--reference-location = block`|`section`|`document`
960964
961965: Specify whether footnotes (and references, if `reference-links` is
962966 set) are placed at the end of the current (top-level) block, the
963967 current section, or the document. The default is
964968 `document`. Currently only affects the markdown writer.
965969
966−`--markdown-headings=setext`|`atx`
967−
968−: Specify whether to use ATX-style (`#`-prefixed) or
969− Setext-style (underlined) headings for level 1 and 2
970− headings in Markdown output. (The default is `atx`.)
971− ATX-style headings are always used for levels 3+.
972− This option also affects Markdown cells in `ipynb` output.
973−
974970`--atx-headers`
975971
976−: *Deprecated synonym for `--markdown-headings=atx`.*
972+: Use ATX-style headings in Markdown output. The default is
973+ to use setext-style headings for levels 1 to 2, and then ATX headings.
974+ (Note: for `gfm` output, ATX headings are always used.)
975+ This option also affects markdown cells in `ipynb` output.
977976
978−`--top-level-division=default`|`section`|`chapter`|`part`
977+`--top-level-division=[default|section|chapter|part]`
979978
980−: Treat top-level headings as the given division type in
981− LaTeX, ConTeXt, DocBook, and TEI output. The hierarchy
982− order is part, chapter, then section; all headings are
983− shifted such that the top-level heading becomes the
984− specified type. The default behavior is to determine the
985− best division type via heuristics: unless other conditions
986− apply, `section` is chosen. When the `documentclass`
987− variable is set to `report`, `book`, or `memoir` (unless the
988− `article` option is specified), `chapter` is implied as the
989− setting for this option. If `beamer` is the output format,
990− specifying either `chapter` or `part` will cause top-level
991− headings to become `\part{..}`, while second-level headings
992− remain as their default type.
979+: Treat top-level headings as the given division type in LaTeX, ConTeXt,
980+ DocBook, and TEI output. The hierarchy order is part, chapter, then section;
981+ all headings are shifted such that the top-level heading becomes the specified
982+ type. The default behavior is to determine the best division type via
983+ heuristics: unless other conditions apply, `section` is chosen. When the
984+ `documentclass` variable is set to `report`, `book`, or `memoir` (unless the
985+ `article` option is specified), `chapter` is implied as the setting for this
986+ option. If `beamer` is the output format, specifying either `chapter` or
987+ `part` will cause top-level headings to become `\part{..}`, while
988+ second-level headings remain as their default type.
993989
994990`-N`, `--number-sections`
995991
996−: Number section headings in LaTeX, ConTeXt, HTML, Docx, ms, or EPUB
997− output. By default, sections are not numbered. Sections with class
992+: Number section headings in LaTeX, ConTeXt, HTML, Docx, or EPUB output.
993+ By default, sections are not numbered. Sections with class
998994 `unnumbered` will never be numbered, even if `--number-sections`
999995 is specified.
1000996
@@ -1327,10 +1323,7 @@ header when requesting a document from a URL:
13271323: Set the `bibliography` field in the document's metadata to *FILE*,
13281324 overriding any value set in the metadata. If you supply
13291325 this argument multiple times, each *FILE* will be added to
1330− bibliography. If *FILE* is a URL, it will be fetched
1331− via HTTP. If *FILE* is not found relative to the
1332− working directory, it will be sought in the resource path
1333− (see `--resource-path`).
1326+ bibliography.
13341327
13351328`--csl=`*FILE*
13361329
@@ -1339,8 +1332,8 @@ header when requesting a document from a URL:
13391332 `--metadata csl=FILE`.) If *FILE* is a URL, it will be
13401333 fetched via HTTP. If *FILE* is not found relative to the
13411334 working directory, it will be sought in the resource path
1342− (see `--resource-path`) and finally in the `csl`
1343− subdirectory of the pandoc user data directory.
1335+ and finally in the `csl` subdirectory of the
1336+ pandoc user data directory.
13441337
13451338`--citation-abbreviations=`*FILE*
13461339
@@ -1349,31 +1342,28 @@ header when requesting a document from a URL:
13491342 `--metadata citation-abbreviations=FILE`.)
13501343 If *FILE* is a URL, it will be fetched via HTTP. If *FILE* is not
13511344 found relative to the working directory, it will be sought
1352− in the resource path (see `--resource-path`) and finally in
1353− the `csl` subdirectory of the pandoc user data directory.
1345+ in the resource path and finally in the `csl` subdirectory
1346+ of the pandoc user data directory.
13541347
13551348`--natbib`
13561349
1357−: Use [`natbib`] for citations in LaTeX output. This option
1358− is not for use with the `--citeproc` option or with PDF
1359− output. It is intended for use in producing a LaTeX file
1360− that can be processed with [`bibtex`].
1350+: Use [`natbib`] for citations in LaTeX output. This option is not for use
1351+ with the `--citeproc` option or with PDF output. It is intended for
1352+ use in producing a LaTeX file that can be processed with [`bibtex`].
13611353
13621354`--biblatex`
13631355
1364−: Use [`biblatex`] for citations in LaTeX output. This option
1365− is not for use with the `--citeproc` option or with PDF
1366− output. It is intended for use in producing a LaTeX file
1367− that can be processed with [`bibtex`] or [`biber`].
1356+: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1357+ with the `--citeproc` option or with PDF output. It is intended for
1358+ use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
13681359
13691360## Math rendering in HTML {.options}
13701361
1371−The default is to render TeX math as far as possible using
1372−Unicode characters. Formulas are put inside a `span` with
1373−`class="math"`, so that they may be styled differently from the
1374−surrounding text if needed. However, this gives acceptable
1375−results only for basic math, usually you will want to use
1376−`--mathjax` or another of the following options.
1362+The default is to render TeX math as far as possible using Unicode characters.
1363+Formulas are put inside a `span` with `class="math"`, so that they may be styled
1364+differently from the surrounding text if needed. However, this gives acceptable
1365+results only for basic math, usually you will want to use `--mathjax` or another
1366+of the following options.
13771367
13781368`--mathjax`[`=`*URL*]
13791369
@@ -1387,11 +1377,10 @@ results only for basic math, usually you will want to use
13871377
13881378`--mathml`
13891379
1390−: Convert TeX math to [MathML] (in `epub3`, `docbook4`,
1391− `docbook5`, `jats`, `html4` and `html5`). This is the
1392− default in `odt` output. Note that currently only Firefox
1393− and Safari (and select e-book readers) natively support
1394− MathML.
1380+: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1381+ `html4` and `html5`). This is the default in `odt` output. Note that
1382+ currently only Firefox and Safari (and select e-book readers) natively
1383+ support MathML.
13951384
13961385`--webtex`[`=`*URL*]
13971386
@@ -1415,12 +1404,13 @@ results only for basic math, usually you will want to use
14151404`--gladtex`
14161405
14171406: Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1418− can then be processed by [GladTeX] to produce SVG images of the typeset
1419− formulas and an HTML file with these images embedded.
1407+ can then be processed by [GladTeX] to produce images of the typeset
1408+ formulas and an HTML file with links to these images.
1409+ So, the procedure is:
14201410
14211411 pandoc -s --gladtex input.md -o myfile.htex
1422− gladtex -d image_dir myfile.htex
1423− # produces myfile.html and images in image_dir
1412+ gladtex -d myfile-images myfile.htex
1413+ # produces myfile.html and images in myfile-images
14241414
14251415[MathML]: https://www.w3.org/Math/
14261416[MathJax]: https://www.mathjax.org
@@ -1468,7 +1458,6 @@ Nonzero exit codes have the following meanings:
14681458 24 PandocCiteprocError
14691459 31 PandocEpubSubdirectoryError
14701460 43 PandocPDFError
1471− 44 PandocXMLError
14721461 47 PandocPDFProgramNotFoundError
14731462 61 PandocHttpError
14741463 62 PandocShouldNeverHappenError
@@ -1481,7 +1470,6 @@ Nonzero exit codes have the following meanings:
14811470 91 PandocMacroLoop
14821471 92 PandocUTF8DecodingError
14831472 93 PandocIpynbDecodingError
1484− 94 PandocUnsupportedCharsetError
14851473 97 PandocCouldNotFindDataFileError
14861474 99 PandocResourceNotFound
14871475----- ------------------------------------
@@ -1506,16 +1494,6 @@ input-files:
15061494- content.md
15071495# or you may use input-file: with a single value
15081496
1509−# Include options from the specified defaults files.
1510−# The files will be searched for first in the working directory
1511−# and then in the defaults subdirectory of the user data directory.
1512−# The files are included in the same order in which they appear in
1513−# the list. Options specified in this defaults file always have
1514−# priority over the included ones.
1515−defaults:
1516−- defsA
1517−- defsB
1518−
15191497template: letter
15201498standalone: true
15211499self-contained: false
@@ -1543,23 +1521,9 @@ include-after-body: []
15431521include-in-header: []
15441522resource-path: ["."]
15451523
1546−# turn on built-in citation processing. Note that if you need
1547−# control over when the citeproc processing is done relative
1548−# to other filters, you should instead use `citeproc` in the
1549−# list of `filters` (see below).
1550−citeproc: true
1551−csl: ieee
1552−bibliography:
1553−- foobar.bib
1554−- barbaz.json
1555−citation-abbreviations: abbrevs.json
1556−
1557−# Filters will be assumed to be Lua filters if they have
1524+# filters will be assumed to be Lua filters if they have
15581525# the .lua extension, and json filters otherwise. But
1559−# the filter type can also be specified explicitly, as shown.
1560−# Filters are run in the order specified.
1561−# To include the built-in citeproc filter, use either `citeproc`
1562−# or `{type: citeproc}`.
1526+# the filter type can also be specified explicitly, as shown:
15631527filters:
15641528- wordcount.lua
15651529- type: json
@@ -1573,11 +1537,8 @@ data-dir:
15731537verbosity: INFO
15741538log-file: log.json
15751539
1576−# citeproc, natbib, or biblatex. This only affects LaTeX
1577−# output. If you want to use citeproc to format citations,
1578−# you should also set 'citeproc: true' (see above).
1540+# citeproc, natbib, or biblatex
15791541cite-method: citeproc
1580−
15811542# part, chapter, section, or default:
15821543top-level-division: chapter
15831544abbreviations:
@@ -1646,7 +1607,7 @@ epub-cover-image: cover.jpg
16461607reference-links: true
16471608# block, section, or document
16481609reference-location: block
1649−markdown-headings: setext
1610+atx-headers: false
16501611
16511612# accept, reject, or all
16521613track-changes: accept
@@ -1676,34 +1637,6 @@ one line:
16761637verbosity: INFO
16771638```
16781639
1679−In fields that expect a file path (or list of file paths), the
1680−following syntax may be used to interpolate environment variables:
1681−
1682−``` yaml
1683−csl: ${HOME}/mycsldir/special.csl
1684−```
1685−
1686−`${USERDATA}` may also be used; this will always resolve to the
1687−user data directory that is current when the defaults file is
1688−parsed, regardless of the setting of the environment
1689−variable `USERDATA`.
1690−
1691−`${.}` will resolve to the directory containing the default
1692−file itself. This allows you to refer to resources contained
1693−in that directory:
1694−
1695−``` yaml
1696−epub-cover-image: ${.}/cover.jpg
1697−epub-metadata: ${.}/meta.xml
1698−resource-path:
1699−- . # the working directory from which pandoc is run
1700−- ${.}/images # the images subdirectory of the directory
1701− # containing this defaults file
1702−```
1703−
1704−This environment variable interpolation syntax *only* works in
1705−fields that expect file paths.
1706−
17071640Default files can be placed in the `defaults` subdirectory of
17081641the user data directory and used from any directory. For
17091642example, one could create a file specifying defaults for writing
@@ -1931,8 +1864,7 @@ ${ styles.html() }
19311864```
19321865
19331866(If a partial is not found in the directory of the
1934−template and the template path is given as a relative
1935−path, it will also be sought in the `templates`
1867+template, it will also be sought in the `templates`
19361868subdirectory of the user data directory.)
19371869
19381870Partials may optionally be applied to variables using
@@ -2150,8 +2082,7 @@ Currently the following pipes are predefined:
21502082 including a title block in the document itself, you can
21512083 set the `title-meta`, `author-meta`, and `date-meta`
21522084 variables. (By default these are set automatically, based
2153− on `title`, `author`, and `date`.) The page title in HTML
2154− is set by `pagetitle`, which is equal to `title` by default.
2085+ on `title`, `author`, and `date`.)
21552086
21562087`subtitle`
21572088: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and docx
@@ -2225,16 +2156,15 @@ ODT or pptx.
22252156: the base script direction, either `rtl` (right-to-left)
22262157 or `ltr` (left-to-right).
22272158
2228− For bidirectional documents, native pandoc `span`s and
2229− `div`s with the `dir` attribute (value `rtl` or `ltr`) can
2230− be used to override the base direction in some output
2231− formats. This may not always be necessary if the final
2232− renderer (e.g. the browser, when generating HTML) supports
2233− the [Unicode Bidirectional Algorithm].
2159+ For bidirectional documents, native pandoc `span`s and `div`s
2160+ with the `dir` attribute (value `rtl` or `ltr`) can be used to
2161+ override the base direction in some output formats.
2162+ This may not always be necessary if the final renderer
2163+ (e.g. the browser, when generating HTML) supports the
2164+ [Unicode Bidirectional Algorithm].
22342165
2235− When using LaTeX for bidirectional documents, only the
2236− `xelatex` engine is fully supported (use
2237− `--pdf-engine=xelatex`).
2166+ When using LaTeX for bidirectional documents, only the `xelatex` engine
2167+ is fully supported (use `--pdf-engine=xelatex`).
22382168
22392169[BCP 47]: https://tools.ietf.org/html/bcp47
22402170[Unicode Bidirectional Algorithm]: https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
@@ -2243,7 +2173,7 @@ ODT or pptx.
22432173### Variables for HTML
22442174
22452175`document-css`
2246−: Enables inclusion of most of the [CSS] in the `styles.html`
2176+: Enables inclusion of most of the CSS in the `styles.html`
22472177 [partial](#partials) (have a look with
22482178 `pandoc --print-default-data-file=templates/styles.html`).
22492179 Unless you use [`--css`](#option--css), this variable
@@ -2267,10 +2197,6 @@ ODT or pptx.
22672197`monofont`
22682198: sets the CSS `font-family` property on `code` elements.
22692199
2270−`monobackgroundcolor`
2271−: sets the CSS `background-color` property on `code` elements
2272− and adds extra padding.
2273−
22742200`linestretch`
22752201: sets the CSS `line-height` property on the `html` element,
22762202 which is preferred to be unitless.
@@ -2281,41 +2207,18 @@ ODT or pptx.
22812207`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
22822208: sets the corresponding CSS `padding` properties on the `body` element.
22832209
2284−To override or extend some [CSS] for just one document, include for example:
2285−
2286− ---
2287− header-includes: |
2288− <style>
2289− blockquote {
2290− font-style: italic;
2291− }
2292− tr.even {
2293− background-color: #f0f0f0;
2294− }
2295− td, th {
2296− padding: 0.5em 2em 0.5em 0.5em;
2297− }
2298− tbody {
2299− border-bottom: none;
2300− }
2301− </style>
2302− ---
2303−
2304−[CSS]: https://developer.mozilla.org/en-US/docs/Learn/CSS
2305−
23062210### Variables for HTML math
23072211
23082212`classoption`
2309−: when using [KaTeX](#option--katex), you can render display
2310−math equations flush left using [YAML metadata](#layout) or with
2311−`-M classoption=fleqn`.
2213+: when using [KaTeX](#option--katex), you can render display math equations
2214+ flush left using [YAML metadata](#layout) or with `-M classoption=fleqn`.
23122215
23132216### Variables for HTML slides
23142217
23152218These affect HTML output when [producing slide shows with pandoc].
23162219
2317−`institute`
2318−: author affiliations: can be a list when there are multiple authors
2220+All [reveal.js configuration options] are available as variables.
2221+To turn off boolean flags that default to true in reveal.js, use `0`.
23192222
23202223`revealjs-url`
23212224: base URL for reveal.js documents (defaults to
@@ -2335,9 +2238,6 @@ These affect HTML output when [producing slide shows with pandoc].
23352238: additional attributes for the title slide of reveal.js slide shows.
23362239 See [background in reveal.js and beamer] for an example.
23372240
2338−All [reveal.js configuration options] are available as variables.
2339−To turn off boolean flags that default to true in reveal.js, use `0`.
2340−
23412241[reveal.js configuration options]: https://revealjs.com/config/
23422242
23432243### Variables for Beamer slides
@@ -2423,10 +2323,9 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
24232323 ...
24242324
24252325`documentclass`
2426−: document class: usually one of the standard classes,
2427− [`article`], [`book`], and [`report`]; the [KOMA-Script]
2428− equivalents, `scrartcl`, `scrbook`, and `scrreprt`, which
2429− default to smaller margins; or [`memoir`]
2326+: document class: usually one of the standard classes, [`article`], [`book`],
2327+ and [`report`]; the [KOMA-Script] equivalents, `scrartcl`, `scrbook`,
2328+ and `scrreprt`, which default to smaller margins; or [`memoir`]
24302329
24312330`geometry`
24322331: option for [`geometry`] package, e.g. `margin=1in`;
@@ -2451,9 +2350,8 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
24512350 ...
24522351
24532352`indent`
2454−: if true, pandoc will use document class settings for
2455− indentation (the default LaTeX template otherwise removes
2456− indentation and adds space between paragraphs)
2353+: uses document class settings for indentation (the default LaTeX template
2354+ otherwise removes indentation and adds space between paragraphs)
24572355
24582356`linestretch`
24592357: adjusts line spacing using the [`setspace`]
@@ -2478,8 +2376,8 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
24782376#### Fonts
24792377
24802378`fontenc`
2481−: allows font encoding to be specified through `fontenc` package (with
2482− `pdflatex`); default is `T1` (see [LaTeX font encodings guide])
2379+: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
2380+ default is `T1` (see [LaTeX font encodings guide])
24832381
24842382`fontfamily`
24852383: font package for use with `pdflatex`:
@@ -2549,8 +2447,7 @@ Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
25492447: contents of acknowledgments footnote after document title
25502448
25512449`toc`
2552−: include table of contents (can also be set using
2553− `--toc/--table-of-contents`)
2450+: include table of contents (can also be set using `--toc/--table-of-contents`)
25542451
25552452`toc-depth`
25562453: level of section to include in table of contents
@@ -2592,12 +2489,12 @@ Pandoc uses these variables when [creating a PDF] with ConTeXt.
25922489: font size for body text (e.g. `10pt`, `12pt`)
25932490
25942491`headertext`, `footertext`
2595−: text to be placed in running header or footer (see [ConTeXt Headers and
2596− Footers]); repeat up to four times for different placement
2492+: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
2493+ repeat up to four times for different placement
25972494
25982495`indenting`
2599−: controls indentation of paragraphs, e.g. `yes,small,next` (see
2600− [ConTeXt Indentation]); repeat for multiple options
2496+: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
2497+ repeat for multiple options
26012498
26022499`interlinespace`
26032500: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
@@ -2608,19 +2505,16 @@ Pandoc uses these variables when [creating a PDF] with ConTeXt.
26082505 repeat for multiple options
26092506
26102507`linkcolor`, `contrastcolor`
2611−: color for links outside and inside a page, e.g. `red`, `blue` (see
2612− [ConTeXt Color])
2508+: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
26132509
26142510`linkstyle`
2615−: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`,
2616− `type`, `cap`, `small`
2511+: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
26172512
26182513`lof`, `lot`
26192514: include list of figures, list of tables
26202515
26212516`mainfont`, `sansfont`, `monofont`, `mathfont`
2622−: font families: take the name of any system font (see
2623− [ConTeXt Font Switching])
2517+: font families: take the name of any system font (see [ConTeXt Font Switching])
26242518
26252519`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
26262520: sets margins, if `layout` is not used (otherwise `layout`
@@ -2635,18 +2529,16 @@ Pandoc uses these variables when [creating a PDF] with ConTeXt.
26352529 repeat for multiple options
26362530
26372531`pdfa`
2638−: adds to the preamble the setup necessary to generate PDF/A
2639− of the type specified, e.g. `1a:2005`, `2a`. If no type is
2640− specified (i.e. the value is set to True, by e.g.
2641− `--metadata=pdfa` or `pdfa: true` in a YAML metadata block),
2642− `1b:2005` will be used as default, for reasons of backwards
2643− compatibility. Using `--variable=pdfa` without specified value
2644− is not supported. To successfully generate PDF/A the required
2645− ICC color profiles have to be available and the content and all
2646− included files (such as images) have to be standard conforming.
2647− The ICC profiles and output intent may be specified using the
2648− variables `pdfaiccprofile` and `pdfaintent`. See also [ConTeXt
2649− PDFA] for more details.
2532+: adds to the preamble the setup necessary to generate PDF/A of the type
2533+ specified, e.g. `1a:2005`, `2a`. If no type is specified (i.e. the value
2534+ is set to True, by e.g. `--metadata=pdfa` or `pdfa: true` in a YAML metadata
2535+ block), `1b:2005` will be used as default, for reasons of backwards
2536+ compatibility. Using `--variable=pdfa` without specified value is not supported.
2537+ To successfully generate PDF/A the required ICC color profiles have to
2538+ be available and the content and all included files (such as images)
2539+ have to be standard conforming. The ICC profiles and output intent
2540+ may be specified using the variables `pdfaiccprofile` and `pdfaintent`.
2541+ See also [ConTeXt PDFA] for more details.
26502542
26512543`pdfaiccprofile`
26522544: when used in conjunction with `pdfa`, specifies the ICC profile to use
@@ -2661,12 +2553,10 @@ Pandoc uses these variables when [creating a PDF] with ConTeXt.
26612553 If left unspecified, `sRGB IEC61966-2.1` is used as default.
26622554
26632555`toc`
2664−: include table of contents (can also be set using
2665− `--toc/--table-of-contents`)
2556+: include table of contents (can also be set using `--toc/--table-of-contents`)
26662557
26672558`whitespace`
2668−: spacing between paragraphs, e.g. `none`, `small` (using
2669− [`setupwhitespace`])
2559+: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
26702560
26712561`includesource`
26722562: include all source documents as file attachments in the PDF file
@@ -2957,7 +2847,7 @@ their respective sections of [Pandoc's Markdown]:
29572847 for the following formats (in addition to `markdown`):
29582848
29592849 input formats
2960− : `latex`, `textile`, `html` (environments, `\ref`, and
2850+ : `latex`, `org`, `textile`, `html` (environments, `\ref`, and
29612851 `\eqref` only), `ipynb`
29622852
29632853 output formats
@@ -3069,43 +2959,6 @@ This extension can be enabled/disabled for the following formats:
30692959output formats
30702960: `odt`, `opendocument`
30712961
3072−#### Extension: `xrefs_name` ####
3073−
3074−Links to headings, figures and tables inside the document are
3075−substituted with cross-references that will use the name or caption
3076−of the referenced item. The original link text is replaced once
3077−the generated document is refreshed. This extension can be combined
3078−with `xrefs_number` in which case numbers will appear before the
3079−name.
3080−
3081−Text in cross-references is only made consistent with the referenced
3082−item once the document has been refreshed.
3083−
3084−This extension can be enabled/disabled for the following formats:
3085−
3086−output formats
3087−: `odt`, `opendocument`
3088−
3089−#### Extension: `xrefs_number` ####
3090−
3091−Links to headings, figures and tables inside the document are
3092−substituted with cross-references that will use the number
3093−of the referenced item. The original link text is discarded.
3094−This extension can be combined with `xrefs_name` in which case
3095−the name or caption numbers will appear after the number.
3096−
3097−For the `xrefs_number` to be useful heading numbers must be enabled
3098−in the generated document, also table and figure captions must be enabled
3099−using for example the `native_numbering` extension.
3100−
3101−Numbers in cross-references are only visible in the final document once
3102−it has been refreshed.
3103−
3104−This extension can be enabled/disabled for the following formats:
3105−
3106−output formats
3107−: `odt`, `opendocument`
3108−
31092962#### Extension: `styles` #### {#ext-styles}
31102963
31112964When converting from docx, read all docx styles as divs (for
@@ -3127,20 +2980,13 @@ extensions to Emacs Muse markup.
31272980In the `ipynb` input format, this causes Markdown cells
31282981to be included as raw Markdown blocks (allowing lossless
31292982round-tripping) rather than being parsed. Use this only
3130−when you are targeting `ipynb` or a markdown-based
2983+when you are targetting `ipynb` or a markdown-based
31312984output format.
31322985
31332986#### Extension: `citations` {#org-citations}
31342987
3135−Some aspects of [Pandoc's Markdown citation syntax](#citations)
3136−are also accepted in `org` input.
3137−
3138−#### Extension: `element_citations` ####
3139−
3140−In the `jats` output formats, this causes reference items to
3141−be replaced with `<element-citation>` elements. These
3142−elements are not influenced by CSL styles, but all information
3143−on the item is included in tags.
2988+Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted
2989+in `org` input.
31442990
31452991#### Extension: `ntb` ####
31462992
@@ -3248,8 +3094,7 @@ pandoc does require the space.
32483094
32493095### Heading identifiers ###
32503096
3251−See also the [`auto_identifiers`
3252−extension](#extension-auto_identifiers) above.
3097+See also the [`auto_identifiers` extension](#extension-auto_identifiers) above.
32533098
32543099#### Extension: `header_attributes` ####
32553100
@@ -3371,12 +3216,11 @@ block in a block quote, you need five spaces after the `>`:
33713216
33723217#### Extension: `blank_before_blockquote` ####
33733218
3374−Standard Markdown syntax does not require a blank line before a
3375−block quote. Pandoc does require this (except, of course, at
3376−the beginning of the document). The reason for the requirement
3377−is that it is all too easy for a `>` to end up at the beginning
3378−of a line by accident (perhaps through line wrapping). So,
3379−unless the `markdown_strict` format is used, the following does
3219+Standard Markdown syntax does not require a blank line before a block
3220+quote. Pandoc does require this (except, of course, at the beginning of the
3221+document). The reason for the requirement is that it is all too easy for a
3222+`>` to end up at the beginning of a line by accident (perhaps through line
3223+wrapping). So, unless the `markdown_strict` format is used, the following does
33803224not produce a nested block quote in pandoc:
33813225
33823226 > This is a block quote.
@@ -3445,16 +3289,14 @@ this syntax:
34453289 qsort (filter (>= x) xs)
34463290 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34473291
3448−Here `mycode` is an identifier, `haskell` and `numberLines` are
3449−classes, and `startFrom` is an attribute with value `100`. Some
3450−output formats can use this information to do syntax
3451−highlighting. Currently, the only output formats that uses this
3452−information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
3453−highlighting is supported for your output format and language,
3454−then the code block above will appear highlighted, with numbered
3455−lines. (To see which languages are supported, type `pandoc
3456−--list-highlight-languages`.) Otherwise, the code block above
3457−will appear as follows:
3292+Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
3293+`startFrom` is an attribute with value `100`. Some output formats can use this
3294+information to do syntax highlighting. Currently, the only output formats
3295+that uses this information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
3296+highlighting is supported for your output format and language, then the code
3297+block above will appear highlighted, with numbered lines. (To see which
3298+languages are supported, type `pandoc --list-highlight-languages`.) Otherwise,
3299+the code block above will appear as follows:
34583300
34593301 <pre id="mycode" class="haskell numberLines" startFrom="100">
34603302 <code>
@@ -3517,9 +3359,6 @@ line must begin with a space.
35173359 | 200 Main St.
35183360 | Berkeley, CA 94718
35193361
3520−Inline formatting (such as emphasis) is allowed in the content,
3521−but not block-level formatting (such as block quotes or lists).
3522−
35233362This syntax is borrowed from [reStructuredText].
35243363
35253364## Lists
@@ -3723,12 +3562,11 @@ a blank line, and must be followed by one or more definitions.
37233562A definition begins with a colon or tilde, which may be indented one
37243563or two spaces.
37253564
3726−A term may have multiple definitions, and each definition may
3727−consist of one or more block elements (paragraph, code block,
3728−list, etc.), each indented four spaces or one tab stop. The
3729−body of the definition (including the first line, aside from the
3730−colon or tilde) should be indented four spaces. However, as with
3731−other Markdown lists, you can "lazily" omit indentation except
3565+A term may have multiple definitions, and each definition may consist of one or
3566+more block elements (paragraph, code block, list, etc.), each indented four
3567+spaces or one tab stop. The body of the definition (including the first line,
3568+aside from the colon or tilde) should be indented four spaces. However,
3569+as with other Markdown lists, you can "lazily" omit indentation except
37323570at the beginning of a paragraph or other block element:
37333571
37343572 Term 1
@@ -3754,10 +3592,9 @@ definition:
37543592Note that space between items in a definition list is required.
37553593(A variant that loosens this requirement, but disallows "lazy"
37563594hard wrapping, can be activated with `compact_definition_lists`: see
3757−[Non-default extensions], below.)
3595+[Non-pandoc extensions], below.)
37583596
3759−[^3]: I have been influenced by the suggestions of [David
3760− Wheeler](https://justatheory.com/2009/02/modest-markdown-proposal/).
3597+[^3]: I have been influenced by the suggestions of [David Wheeler](https://justatheory.com/2009/02/modest-markdown-proposal/).
37613598
37623599### Numbered example lists ###
37633600
@@ -4179,12 +4016,10 @@ option is used. All of the metadata will appear in a single block
41794016at the beginning of the document.
41804017
41814018Note that [YAML] escaping rules must be followed. Thus, for example,
4182−if a title contains a colon, it must be quoted, and if it contains a
4183−backslash escape, then it must be ensured that it is not treated as a
4184−[YAML escape sequence]. The pipe character (`|`) can be used to begin
4185−an indented block that will be interpreted literally, without need for
4186−escaping. This form is necessary when the field contains blank lines
4187−or block-level formatting:
4019+if a title contains a colon, it must be quoted. The pipe character
4020+(`|`) can be used to begin an indented block that will be interpreted
4021+literally, without need for escaping. This form is necessary
4022+when the field contains blank lines or block-level formatting:
41884023
41894024 ---
41904025 title: 'This is the title: it contains a colon'
@@ -4198,12 +4033,6 @@ or block-level formatting:
41984033 It consists of two paragraphs.
41994034 ...
42004035
4201−The literal block after the `|` must be indented relative to the
4202−line containing the `|`. If it is not, the YAML will be invalid
4203−and pandoc will not interpret it as metadata. For an overview
4204−of the complex rules governing YAML, see the [Wikipedia entry on
4205−YAML syntax].
4206−
42074036Template variables will be set automatically from the metadata. Thus, for
42084037example, in writing HTML, the variable `abstract` will be set to the HTML
42094038equivalent of the Markdown in the `abstract` field:
@@ -4250,24 +4079,6 @@ will be interpreted as markdown. For example:
42504079 \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
42514080 ```
42524081
4253−Note: the `yaml_metadata_block` extension works with
4254−`commonmark` as well as `markdown` (and it is enabled by default
4255−in `gfm` and `commonmark_x`). However, in these formats the
4256−following restrictions apply:
4257−
4258−- The YAML metadata block must occur at the beginning of the
4259− document (and there can be only one). If multiple files are
4260− given as arguments to pandoc, only the first can be a YAML
4261− metadata block.
4262−
4263−- The leaf nodes of the YAML structure are parsed in isolation from
4264− each other and from the rest of the document. So, for
4265− example, you can't use a reference link in these contexts
4266− if the link definition is somewhere else in the document.
4267−
4268−[YAML escape sequence]: https://yaml.org/spec/1.2/spec.html#id2776092
4269−[Wikipedia entry on YAML syntax]: https://en.m.wikipedia.org/wiki/YAML#Syntax
4270−
42714082## Backslash escapes
42724083
42734084#### Extension: `all_symbols_escapable` ####
@@ -4425,8 +4236,7 @@ you need to enclose text in literal `$` characters, backslash-escape
44254236them and they won't be treated as math delimiters.
44264237
44274238For display math, use `$$` delimiters. (In this case, the delimiters
4428−may be separated from the formula by whitespace. However, there can be
4429−no blank lines betwen the opening and closing `$$` delimiters.)
4239+may be separated from the formula by whitespace.)
44304240
44314241TeX math will be printed in all output formats. How it is rendered
44324242depends on the output format:
@@ -4544,8 +4354,8 @@ into
45444354
45454355whereas `Markdown.pl` will preserve it as is.
45464356
4547−There is one exception to this rule: text between `<script>`,
4548−`<style>`, and `<textarea>` tags is not interpreted as Markdown.
4357+There is one exception to this rule: text between `<script>` and
4358+`<style>` tags is not interpreted as Markdown.
45494359
45504360This departure from standard Markdown should make it easier to mix
45514361Markdown with HTML block elements. For example, one can surround
@@ -4960,68 +4770,37 @@ Inline and regular footnotes may be mixed freely.
49604770
49614771#### Extension: `citations` ####
49624772
4963−To cite a bibliographic item with an identifier foo, use the
4964−syntax `@foo`. Normal citations should be included in square
4965−brackets, with semicolons separating distinct items:
4966−
4967− Blah blah [@doe99; @smith2000; @smith2004].
4968−
4969−How this is rendered depends on the citation style. In an
4970−author-date style, it might render as
4971−
4972− Blah blah (Doe 1999, Smith 2000, 2004).
4973−
4974−In a footnote style, it might render as
4975−
4976− Blah blah.[^1]
4977−
4978− [^1]: John Doe, "Frogs," *Journal of Amphibians* 44 (1999);
4979− Susan Smith, "Flies," *Journal of Insects* (2000);
4980− Susan Smith, "Bees," *Journal of Insects* (2004).
4981−
4982−See the [CSL user documentation] for more information about CSL
4983−styles and how they affect rendering.
4984−
4985−Unless a citation key start with a letter, digit, or `_`,
4986−and contains only alphanumerics and internal punctuation
4987−characters (`:.#$%&-+?<>~/`), it must be surrounded
4988−by curly braces, which are not considered part of the key.
4989−In `@Foo_bar.baz.`, the key is `Foo_bar.baz`. The final
4990−period is not *internal* punctuation, so it is not included in
4991−the key. In `@{Foo_bar.baz.}`, the key is `Foo_bar.baz.`, including
4992−the final period. The curly braces are recommended if you use URLs as
4993−keys: `[@{https://example.com/bib?name=foobar&date=2000}, p. 33]`.
4994−
4995−Citation items may optionally include a prefix, a locator, and
4996−a suffix. In
4997−
4998− Blah blah [see @doe99, pp. 33-35 and *passim*; @smith04, chap. 1].
4999−
5000−The first item (`doe99`) has prefix `see `, locator `pp. 33-35`,
5001−and suffix `and *passim*`. The second item (`smith04`) has
5002−locator `chap. 1` and no prefix or suffix.
5003−
5004−Pandoc uses some heuristics to separate the locator from the
5005−rest of the subject. It is sensitive to the locator terms
5006−defined in the [CSL locale files]. Either abbreviated or
5007−unabbreviated forms are accepted. In the `en-US` locale, locator
5008−terms can be written in either singular or plural forms, as
5009−`book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
5010−`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`,
5011−`fol.`/`fols.`; `number`, `no.`/`nos.`; `line`, `l.`/`ll.`;
5012−`note`, `n.`/`nn.`; `opus`, `op.`/`opp.`; `page`, `p.`/`pp.`;
5013−`paragraph`, `para.`/`paras.`; `part`, `pt.`/`pts.`; `section`,
5014−`sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`; `verse`,
5015−`v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
4773+Markdown citations go inside square brackets and are separated
4774+by semicolons. Each citation must have a key, composed of '@' +
4775+the citation identifier from the database, and may optionally
4776+have a prefix, a locator, and a suffix. The citation key must
4777+begin with a letter, digit, or `_`, and may contain
4778+alphanumerics, `_`, and internal punctuation characters
4779+(`:.#$%&-+?<>~/`). Here are some examples:
4780+
4781+ Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
4782+
4783+ Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
4784+
4785+ Blah blah [@smith04; @doe99].
4786+
4787+`pandoc` detects locator terms in the [CSL locale files].
4788+Either abbreviated or unabbreviated forms are accepted. In the `en-US`
4789+locale, locator terms can be written in either singular or plural forms,
4790+as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
4791+`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
4792+`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
4793+`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
4794+`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
4795+`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
50164796locator term is used, "page" is assumed.
50174797
5018−In complex cases, you can force something to be treated as
5019−a locator by enclosing it in curly braces or prevent parsing
5020−the suffix as locator by prepending curly braces:
4798+`pandoc` will use heuristics to distinguish the locator
4799+from the suffix. In complex cases, the locator can be enclosed
4800+in curly braces:
50214801
50224802 [@smith{ii, A, D-Z}, with a suffix]
50234803 [@smith, {pp. iv, vi-xi, (xv)-(xvii)} with suffix here]
5024− [@smith{}, 99 years later]
50254804
50264805A minus sign (`-`) before the `@` will suppress mention of
50274806the author in the citation. This can be useful when the
@@ -5029,26 +4808,13 @@ author is already mentioned in the text:
50294808
50304809 Smith says blah [-@smith04].
50314810
5032−You can also write an author-in-text citation, by omitting the
5033−square brackets:
4811+You can also write an in-text citation, as follows:
50344812
50354813 @smith04 says blah.
50364814
50374815 @smith04 [p. 33] says blah.
50384816
5039−This will cause the author's name to be rendered, followed by
5040−the bibliographical details. Use this form when you want to
5041−make the citation the subject of a sentence.
5042−
5043−When you are using a note style, it is usually better to let
5044−citeproc create the footnotes from citations rather than writing
5045−an explicit note. If you do write an explicit note that
5046−contains a citation, note that normal citations will be put in
5047−parentheses, while author-in-text citations will not. For
5048−this reason, it is sometimes preferable to use the
5049−author-in-text style inside notes when using a note style.
50504817
5051−[CSL user documentation]: https://citationstyles.org/authors/
50524818[CSL]: https://docs.citationstyles.org/en/stable/specification.html
50534819[CSL markup specs]: https://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
50544820[Chicago Manual of Style]: https://chicagomanualofstyle.org
@@ -5057,44 +4823,13 @@ author-in-text style inside notes when using a note style.
50574823[finding and editing styles]: https://citationstyles.org/authors/
50584824[CSL locale files]: https://github.com/citation-style-language/locales
50594825
5060−## Non-default extensions
4826+## Non-pandoc extensions
50614827
50624828The following Markdown syntax extensions are not enabled by default
50634829in pandoc, but may be enabled by adding `+EXTENSION` to the format
50644830name, where `EXTENSION` is the name of the extension. Thus, for
50654831example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
50664832
5067−#### Extension: `rebase_relative_paths` ####
5068−
5069−Rewrite relative paths for Markdown links and images, depending
5070−on the path of the file containing the link or image link. For
5071−each link or image, pandoc will compute the directory of the
5072−containing file, relative to the working directory, and prepend
5073−the resulting path to the link or image path.
5074−
5075−The use of this extension is best understood by example.
5076−Suppose you have a a subdirectory for each chapter of a book,
5077−`chap1`, `chap2`, `chap3`. Each contains a file `text.md` and a
5078−number of images used in the chapter. You would like to have
5079−`![image](spider.jpg)` in `chap1/text.md` refer to
5080−`chap1/spider.jpg` and `![image](spider.jpg)` in `chap2/text.md`
5081−refer to `chap2/spider.jpg`. To do this, use
5082−
5083− pandoc chap*/*.md -f markdown+rebase_relative_paths
5084−
5085−Without this extension, you would have to use
5086−`![image](chap1/spider.jpg)` in `chap1/text.md` and
5087−`![image](chap2/spider.jpg)` in `chap2/text.md`. Links with
5088−relative paths will be rewritten in the same way as images.
5089−
5090−Absolute paths and URLs are not changed. Neither are empty
5091−paths or paths consisting entirely of a fragment, e.g., `#foo`.
5092−
5093−Note that relative paths in reference links and images will
5094−be rewritten relative to the file containing the link
5095−reference definition, not the file containing the reference link
5096−or image itself, if these differ.
5097−
50984833#### Extension: `attributes` ####
50994834
51004835Allows attributes to be attached to any inline or block-level
@@ -5281,13 +5016,6 @@ for regular emphasis, add extra blank space around headings.
52815016
52825017 [Project Gutenberg]: https://www.gutenberg.org
52835018
5284−#### Extension: `sourcepos` ####
5285−
5286−Include source position attributes when parsing `commonmark`.
5287−For elements that accept attributes, a `data-pos` attribute
5288−is added; other elements are placed in a surrounding
5289−Div or Span elemnet with a `data-pos` attribute.
5290−
52915019## Markdown variants
52925020
52935021In addition to pandoc's extended Markdown, the following Markdown
@@ -5402,28 +5130,12 @@ array of YAML-encoded references, for example:
54025130 language: en-GB
54035131 ...
54045132
5405−If both an external bibliography and inline (YAML metadata)
5406−references are provided, both will be used. In case of
5407−conflicting `id`s, the inline references will take precedence.
5408−
54095133Note that `pandoc` can be used to produce such a YAML metadata
54105134section from a BibTeX, BibLaTeX, or CSL JSON bibliography:
54115135
5412− pandoc chem.bib -s -f biblatex -t markdown
5413− pandoc chem.json -s -f csljson -t markdown
5414−
5415−Indeed, `pandoc` can convert between any of these
5416−citation formats:
5136+ pandoc chem.bib -s -t markdown
5137+ pandoc chem.json -s -t markdown
54175138
5418− pandoc chem.bib -s -f biblatex -t csljson
5419− pandoc chem.yaml -s -f markdown -t biblatex
5420−
5421−Running pandoc on a bibliography file with the `--citeproc`
5422−option will create a formatted bibliography in the format
5423−of your choice:
5424−
5425− pandoc chem.bib -s --citeproc -o chem.html
5426− pandoc chem.bib -s --citeproc -o chem.pdf
54275139
54285140### Capitalization in titles
54295141
@@ -5499,11 +5211,11 @@ The CSL project provides further information on [finding and
54995211editing styles].
55005212
55015213The `--citation-abbreviations` option (or the
5502−`citation-abbreviations` metadata field) may be used to specify
5503−a JSON file containing abbreviations of journals that should be
5504−used in formatted bibliographies when `form="short"` is
5505−specified. The format of the file can be illustrated with an
5506−example:
5214+`citation-abbreviations` metadata field) may be used to
5215+specify a JSON file containing abbreviations of journals
5216+that should be used in formatted bibliographies when
5217+`form="short"` is specified. The format of the file
5218+can be illustrated with an example:
55075219
55085220
55095221 { "default": {
@@ -5515,34 +5227,6 @@ example:
55155227 }
55165228 }
55175229
5518−
5519−## Citations in note styles
5520−
5521−Pandoc's citation processing is designed to allow you to
5522−move between author-date, numerical, and note styles without
5523−modifying the markdown source. When you're using a note
5524−style, avoid inserting footnotes manually. Instead, insert
5525−citations just as you would in an author-date style---for
5526−example,
5527−
5528− Blah blah [@foo, p. 33].
5529−
5530−The footnote will be created automatically. Pandoc will take
5531−care of removing the space and moving the note before or
5532−after the period, depending on the setting of
5533−`notes-after-punctuation`, as described below in [Other relevant
5534−metadata fields].
5535−
5536−In some cases you may need to put a citation inside a regular
5537−footnote. Normal citations in footnotes (such as `[@foo, p.
5538−33]`) will be rendered in parentheses. In-text citations (such
5539−as `@foo [p. 33]`) will be rendered without parentheses. (A
5540−comma will be added if appropriate.) Thus:
5541−
5542− [^1]: Some studies [@foo; @bar, p. 33] show that
5543− frubulicious zoosnaps are quantical. For a survey
5544− of the literature, see @baz [chap. 1].
5545−
55465230## Raw content in a style
55475231
55485232To include raw content in a prefix, suffix, delimiter, or term,
@@ -5555,7 +5239,7 @@ and escaped in the output, rather than being passed through raw.
55555239
55565240This feature allows stylesheets to be customized to give
55575241different output for different output formats. However,
5558−stylesheets customized in this way will not be usable
5242+stylesheets customized in this way will not be useable
55595243by other CSL implementations.
55605244
55615245
@@ -5621,30 +5305,17 @@ or BibLaTeX (for `--biblatex`) format.
56215305
56225306A few other metadata fields affect bibliography formatting:
56235307
5624−`link-citations`
5308+`link-citation`
56255309: If true, citations will be
56265310 hyperlinked to the corresponding bibliography entries
56275311 (for author-date and numerical styles only).
56285312
56295313`lang`
56305314: The `lang` field will affect how the style is localized,
5631− for example in the translation of labels, the use
5632− of quotation marks, and the way items are sorted.
5633− (For backwards compatibility, `locale` may be used instead
5634− of `lang`, but this use is deprecated.)
5635−
5636− A BCP 47 language tag is expected: for example, `en`,
5637− `de`, `en-US`, `fr-CA`, `ug-Cyrl`. The unicode extension
5638− syntax (after `-u-`) may be used to specify options for
5639− collation (sorting) more precisely. Here are some examples:
5640−
5641− - `zh-u-co-pinyin` -- Chinese with the Pinyin collation.
5642− - `es-u-co-trad` -- Spanish with the traditional collation
5643− (with `Ch` sorting after `C`).
5644− - `fr-u-kb` -- French with "backwards" accent sorting
5645− (with `coté` sorting after `côte`).
5646− - `en-US-u-kf-upper` -- English with uppercase letters sorting
5647− before lower (default is lower before upper).
5315+ for example in the translation of labels and the use
5316+ of quotation marks. (For backwards compatibility,
5317+ `locale` may be used instead of `lang`, but this use
5318+ is deprecated.)
56485319
56495320`notes-after-punctuation`
56505321: If true (the default), pandoc will put footnote citations
@@ -5656,6 +5327,12 @@ A few other metadata fields affect bibliography formatting:
56565327 punctuation.
56575328
56585329
5330+
5331+
5332+
5333+
5334+
5335+
56595336# Slide shows
56605337
56615338You can use pandoc to produce an HTML + JavaScript slide presentation
@@ -5704,21 +5381,18 @@ To produce an HTML/JavaScript slide show, simply type
57045381
57055382where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
57065383
5707−For Slidy, Slideous, reveal.js, and S5, the file produced by
5708−pandoc with the `-s/--standalone` option embeds a link to
5709−JavaScript and CSS files, which are assumed to be available at
5710−the relative path `s5/default` (for S5), `slideous` (for
5711−Slideous), `reveal.js` (for reveal.js), or at the Slidy website
5712−at `w3.org` (for Slidy). (These paths can be changed by setting
5713−the `slidy-url`, `slideous-url`, `revealjs-url`, or `s5-url`
5714−variables; see [Variables for HTML slides], above.) For
5715−DZSlides, the (relatively short) JavaScript and CSS are included
5716−in the file by default.
5717−
5718−With all HTML slide formats, the `--self-contained` option can
5719−be used to produce a single file that contains all of the data
5720−necessary to display the slide show, including linked scripts,
5721−stylesheets, images, and videos.
5384+For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
5385+`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
5386+assumed to be available at the relative path `s5/default` (for S5), `slideous`
5387+(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
5388+`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
5389+`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for HTML slides],
5390+above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
5391+the file by default.
5392+
5393+With all HTML slide formats, the `--self-contained` option can be used to
5394+produce a single file that contains all of the data necessary to display the
5395+slide show, including linked scripts, stylesheets, images, and videos.
57225396
57235397To produce a PDF slide show using beamer, type
57245398
@@ -5748,11 +5422,7 @@ rules:
57485422 * A heading at the slide level always starts a new slide.
57495423
57505424 * Headings *below* the slide level in the hierarchy create
5751− headings *within* a slide. (In beamer, a "block" will be
5752− created. If the heading has the class `example`, an
5753− `exampleblock` environment will be used; if it has the class
5754− `alert`, an `alertblock` will be used; otherwise a regular
5755− `block` will be used.)
5425+ headings *within* a slide.
57565426
57575427 * Headings *above* the slide level in the hierarchy create
57585428 "title slides," which just contain the section title
@@ -6085,15 +5755,6 @@ The following fields are recognized:
60855755
60865756`rights`
60875757 ~ A string value.
6088−
6089−`belongs-to-collection`
6090− ~ A string value. identifies the name of a collection to which
6091− the EPUB Publication belongs.
6092−
6093−`group-position`
6094− ~ The `group-position` field indicates the numeric position in which
6095− the EPUB Publication belongs relative to other works belonging to
6096− the same `belongs-to-collection` field.
60975758
60985759`cover-image`
60995760 ~ A string value (path to cover image).
@@ -6330,7 +5991,7 @@ Then edit `my.theme` and use it like this:
63305991If you are not satisfied with the built-in highlighting, or you
63315992want highlight a language that isn't supported, you can use the
63325993`--syntax-definition` option to load a [KDE-style XML syntax definition
6333−file](https://docs.kde.org/stable5/en/kate/katepart/highlight.html).
5994+file](https://docs.kde.org/stable5/en/applications/katepart/highlight.html).
63345995Before writing your own, have a look at KDE's [repository of syntax
63355996definitions](https://github.com/KDE/syntax-highlighting/tree/master/data/syntax).
63365997
@@ -6461,21 +6122,6 @@ subdirectory of your user data directory (see [Templates]).
64616122
64626123[Lua]: https://www.lua.org
64636124
6464−# Reproducible builds
6465−
6466−Some of the document formats pandoc targets (such as EPUB,
6467−docx, and ODT) include build timestamps in the generated document.
6468−That means that the files generated on successive builds will
6469−differ, even if the source does not. To avoid this, set the
6470−`SOURCE_DATE_EPOCH` environment variable, and the timestamp will
6471−be taken from it instead of the current time.
6472−`SOURCE_DATE_EPOCH` should contain an integer unix timestamp
6473−(specifying the number of second since midnight UTC January 1, 1970).
6474−
6475−Some document formats also include a unique identifier. For
6476−EPUB, this can be set explicitly by setting the `identifier`
6477−metadata field (see [EPUB Metadata], above).
6478−
64796125# A note on security
64806126
64816127If you use pandoc to convert user-contributed content in a web
@@ -6504,13 +6150,13 @@ application, here are some things to keep in mind:
650461504. The HTML generated by pandoc is not guaranteed to be safe.
65056151 If `raw_html` is enabled for the Markdown input, users can
65066152 inject arbitrary HTML. Even if `raw_html` is disabled,
6507− users can include dangerous content in URLs and attributes.
6508− To be safe, you should run all the generated HTML through
6509− an HTML sanitizer.
6153+ users can include dangerous content in attributes for
6154+ headings, spans, and code blocks. To be safe, you should
6155+ run all the generated HTML through an HTML sanitizer.
65106156
65116157# Authors
65126158
6513−Copyright 2006--2021 John MacFarlane (jgm@berkeley.edu). Released
6159+Copyright 2006--2020 John MacFarlane (jgm@berkeley.edu). Released
65146160under the [GPL], version 2 or greater. This software carries no
65156161warranty of any kind. (See COPYRIGHT for full copyright and
65166162warranty notices.) For a full list of contributors, see the file
Makefile+19−47
@@ -2,31 +2,17 @@ version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}')
22pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1)
33SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$")
44BRANCH?=master
5−ARCH=$(shell uname -m)
6−DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4
7−COMMIT=$(shell git rev-parse --short HEAD)
8−TIMESTAMP=$(shell date "+%Y%m%d_%H%M")
9−LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv 2>/dev/null))
10−BASELINE?=$(LATESTBENCH)
11−ifeq ($(BASELINE),)
12−BASELINECMD=
13−else
14−BASELINECMD=--baseline $(BASELINE)
15−endif
16−GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A8m -RTS
5+RESOLVER?=lts-13
6+GHCOPTS=-fdiagnostics-color=always
177WEBSITE=../../web/pandoc.org
188REVISION?=1
19−# For gauge:
20−# BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN)
21−# For tasty-bench:
22−BENCHARGS?=--csv bench_$(TIMESTAMP).csv $(BASELINECMD) --timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",)
239
2410quick:
25− stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)'
11+ stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j +RTS -A64m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)'
2612
2713quick-cabal:
2814 cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests
29− cabal new-build -j4 . --disable-optimization
15+ cabal new-build . --disable-optimization
3016 cabal new-run test-pandoc --disable-optimization -- --hide-successes $(TESTARGS)
3117
3218full-cabal:
@@ -35,7 +21,7 @@ full-cabal:
3521 cabal new-run test-pandoc --disable-optimization -- --hide-successes $(TESTARGS)
3622
3723full:
38− stack install --flag 'pandoc:embed_data_files' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 $(GHCOPTS)'
24+ stack install --flag 'pandoc:embed_data_files' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 -j4 $(GHCOPTS)'
3925
4026ghci:
4127 stack ghci --flag 'pandoc:embed_data_files'
@@ -51,14 +37,11 @@ test:
5137ghcid:
5238 ghcid -c "stack repl --flag 'pandoc:embed_data_files'"
5339
54−ghcid-test:
55− ghcid -c "stack repl --ghc-options=-XNoImplicitPrelude --flag 'pandoc:embed_data_files' --ghci-options=-fobject-code pandoc:lib pandoc:test-pandoc"
56−
5740bench:
58− stack bench \
59− --ghc-options '$(GHCOPTS)' \
60− --benchmark-arguments='$(BENCHARGS)' 2>&1 | \
61− tee "bench_latest.txt"
41+ stack bench --benchmark-arguments='$(BENCHARGS)' --ghc-options '$(GHCOPTS)'
42+
43+weigh:
44+ stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc
6245
6346reformat:
6447 for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done
@@ -82,22 +65,21 @@ dist: man/pandoc.1
8265 cd pandoc-${version}
8366 stack setup && stack test && cd .. && rm -rf "pandoc-${version}"
8467
85−check: checkdocs check-cabal
86−
87−checkdocs:
88− ! grep -q -n -e "\t" MANUAL.txt changelog.md
68+checkdocs: README.md
69+ ! grep -n -e "\t" MANUAL.txt changelog
8970
9071debpkg: man/pandoc.1
9172 docker run -v `pwd`:/mnt \
9273 -v `pwd`/linux/artifacts:/artifacts \
93− --user $(id -u):$(id -g) \
9474 -e REVISION=$(REVISION) \
9575 -w /mnt \
96− --memory=0 \
97− --rm \
98− $(DOCKERIMAGE) \
99− bash \
100− /mnt/linux/make_artifacts.sh 2>&1 > docker.log
76+ utdemir/ghc-musl:v12-libgmp-ghc8101 bash \
77+ /mnt/linux/make_artifacts.sh
78+
79+macospkg:
80+ rm -rf macos-release-candidate
81+ aws s3 sync s3://travis-jgm-pandoc macos-release-candidate
82+ make -C macos-release-candidate
10183
10284man/pandoc.1: MANUAL.txt man/pandoc.1.before man/pandoc.1.after
10385 pandoc $< -f markdown -t man -s \
@@ -135,14 +117,4 @@ update-website:
135117clean:
136118 stack clean
137119
138−check-cabal: git-files.txt sdist-files.txt
139− echo "Checking to see if all committed test/data files are in sdist."
140− diff -u $^
141−
142−sdist-files.txt: .FORCE
143− cabal sdist --list-only | sed 's/\.\///' | grep '^\(test\|data\)\/' | sort > $@
144−
145−git-files.txt: .FORCE
146− git ls-tree -r --name-only HEAD | grep '^\(test\|data\)\/' | sort > $@
147−
148−.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal
120+.PHONY: deps quick full haddock install clean test bench changes_github macospkg dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg macospkg checkdocs ghcid ghci fix_spacing hlint
README.md+19−23
@@ -3,38 +3,35 @@ README.template and MANUAL.txt via the command:
33pandoc --lua-filter tools/update-readme.lua README.template -o README.md
44-->
55
6−# Pandoc
6+Pandoc
7+======
78
89[![github
910release](https://img.shields.io/github/release/jgm/pandoc.svg?label=current+release)](https://github.com/jgm/pandoc/releases)
1011[![hackage
11−release](https://img.shields.io/hackage/v/pandoc.svg?label=hackage)](https://hackage.haskell.org/package/pandoc)
12−[![homebrew](https://img.shields.io/homebrew/v/pandoc.svg)](https://formulae.brew.sh/formula/pandoc)
12+release](https://img.shields.io/hackage/v/pandoc.svg?label=hackage)](http://hackage.haskell.org/package/pandoc)
13+[![homebrew](https://img.shields.io/homebrew/v/pandoc.svg)](http://brewformulas.org/Pandoc)
1314[![stackage LTS
14−package](https://stackage.org/package/pandoc/badge/lts)](https://www.stackage.org/lts/package/pandoc-types)
15+package](http://stackage.org/package/pandoc/badge/lts)](http://stackage.org/lts/package/pandoc)
1516[![CI
1617tests](https://github.com/jgm/pandoc/workflows/CI%20tests/badge.svg)](https://github.com/jgm/pandoc/actions)
1718[![license](https://img.shields.io/badge/license-GPLv2+-lightgray.svg)](https://www.gnu.org/licenses/gpl.html)
1819[![pandoc-discuss on google
1920groups](https://img.shields.io/badge/pandoc-discuss-red.svg?style=social)](https://groups.google.com/forum/#!forum/pandoc-discuss)
2021
21−## The universal markup converter
22+The universal markup converter
23+------------------------------
2224
23−Pandoc is a [Haskell](https://haskell.org) library for converting from
25+Pandoc is a [Haskell](http://haskell.org) library for converting from
2426one markup format to another, and a command-line tool that uses this
2527library. It can convert *from*
2628
2729<div id="input-formats">
2830
29−- `bibtex` ([BibTeX](https://ctan.org/pkg/bibtex) bibliography)
30−- `biblatex` ([BibLaTeX](https://ctan.org/pkg/biblatex) bibliography)
3131- `commonmark` ([CommonMark](https://commonmark.org) Markdown)
3232- `commonmark_x` ([CommonMark](https://commonmark.org) Markdown with
3333 extensions)
3434- `creole` ([Creole 1.0](http://www.wikicreole.org/wiki/Creole1.0))
35−- `csljson` ([CSL
36− JSON](https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html)
37− bibliography)
3835- `csv` ([CSV](https://tools.ietf.org/html/rfc4180) table)
3936- `docbook` ([DocBook](https://docbook.org))
4037- `docx` ([Word docx](https://en.wikipedia.org/wiki/Office_Open_XML))
@@ -95,15 +92,10 @@ It can convert *to*
9592- `asciidoc` ([AsciiDoc](https://www.methods.co.nz/asciidoc/)) or
9693 `asciidoctor` ([AsciiDoctor](https://asciidoctor.org/))
9794- `beamer` ([LaTeX beamer](https://ctan.org/pkg/beamer) slide show)
98−- `bibtex` ([BibTeX](https://ctan.org/pkg/bibtex) bibliography)
99−- `biblatex` ([BibLaTeX](https://ctan.org/pkg/biblatex) bibliography)
10095- `commonmark` ([CommonMark](https://commonmark.org) Markdown)
10196- `commonmark_x` ([CommonMark](https://commonmark.org) Markdown with
10297 extensions)
10398- `context` ([ConTeXt](https://www.contextgarden.net/))
104−- `csljson` ([CSL
105− JSON](https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html)
106− bibliography)
10799- `docbook` or `docbook4` ([DocBook](https://docbook.org) 4)
108100- `docbook5` (DocBook 5)
109101- `docx` ([Word docx](https://en.wikipedia.org/wiki/Office_Open_XML))
@@ -175,7 +167,7 @@ It can convert *to*
175167 and JavaScript slide show)
176168- `slidy` ([Slidy](https://www.w3.org/Talks/Tools/Slidy2/) HTML and
177169 JavaScript slide show)
178−- `dzslides` ([DZSlides](https://paulrouget.com/dzslides/) HTML5 +
170+- `dzslides` ([DZSlides](http://paulrouget.com/dzslides/) HTML5 +
179171 JavaScript slide show),
180172- `revealjs` ([reveal.js](https://revealjs.com/) HTML5 + JavaScript
181173 slide show)
@@ -217,11 +209,13 @@ While conversions from pandoc’s Markdown to all formats aspire to be
217209perfect, conversions from formats more expressive than pandoc’s Markdown
218210can be expected to be lossy.
219211
220−## Installing
212+Installing
213+----------
221214
222215Here’s [how to install pandoc](INSTALL.md).
223216
224−## Documentation
217+Documentation
218+-------------
225219
226220Pandoc’s website contains a full [User’s
227221Guide](https://pandoc.org/MANUAL.html). It is also available
@@ -230,15 +224,17 @@ contains some [examples of the use of
230224pandoc](https://pandoc.org/demos.html) and a limited [online
231225demo](https://pandoc.org/try).
232226
233−## Contributing
227+Contributing
228+------------
234229
235230Pull requests, bug reports, and feature requests are welcome. Please
236231make sure to read [the contributor guidelines](CONTRIBUTING.md) before
237232opening a new issue.
238233
239−## License
234+License
235+-------
240236
241−© 2006-2021 John MacFarlane (jgm@berkeley.edu). Released under the
242−[GPL](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html "GNU General Public License"),
237+© 2006-2020 John MacFarlane (jgm@berkeley.edu). Released under the
238+[GPL](http://www.gnu.org/copyleft/gpl.html "GNU General Public License"),
243239version 2 or greater. This software carries no warranty of any kind.
244240(See COPYRIGHT for full copyright and warranty notices.)
README.template+6−6
@@ -7,9 +7,9 @@ Pandoc
77======
88
99[![github release](https://img.shields.io/github/release/jgm/pandoc.svg?label=current+release)](https://github.com/jgm/pandoc/releases)
10−[![hackage release](https://img.shields.io/hackage/v/pandoc.svg?label=hackage)](https://hackage.haskell.org/package/pandoc)
11−[![homebrew](https://img.shields.io/homebrew/v/pandoc.svg)](https://formulae.brew.sh/formula/pandoc)
12−[![stackage LTS package](https://stackage.org/package/pandoc/badge/lts)](https://www.stackage.org/lts/package/pandoc-types)
10+[![hackage release](https://img.shields.io/hackage/v/pandoc.svg?label=hackage)](http://hackage.haskell.org/package/pandoc)
11+[![homebrew](https://img.shields.io/homebrew/v/pandoc.svg)](http://brewformulas.org/Pandoc)
12+[![stackage LTS package](http://stackage.org/package/pandoc/badge/lts)](http://stackage.org/lts/package/pandoc)
1313[![CI tests](https://github.com/jgm/pandoc/workflows/CI%20tests/badge.svg)](https://github.com/jgm/pandoc/actions)
1414[![license](https://img.shields.io/badge/license-GPLv2+-lightgray.svg)](https://www.gnu.org/licenses/gpl.html)
1515[![pandoc-discuss on google groups](https://img.shields.io/badge/pandoc-discuss-red.svg?style=social)](https://groups.google.com/forum/#!forum/pandoc-discuss)
@@ -81,9 +81,9 @@ new issue.
8181License
8282-------
8383
84−© 2006-2021 John MacFarlane (jgm@berkeley.edu). Released under the
84+© 2006-2020 John MacFarlane (jgm@berkeley.edu). Released under the
8585[GPL], version 2 or greater. This software carries no warranty of
8686any kind. (See COPYRIGHT for full copyright and warranty notices.)
8787
88−[GPL]: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html "GNU General Public License"
89−[Haskell]: https://haskell.org
88+[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
89+[Haskell]: http://haskell.org
RELEASE-CHECKLIST+1−3
@@ -1,11 +1,9 @@
1−[ ] use 'policeman' to check API changes and version update
21[ ] make README.md and commit if needed
32[ ] make man/pandoc.1 and commit if needed
43[ ] Finalize changelog
4+ tools/changelog-helper.sh
55[ ] push release candidate branch rc/VERSION and (if it builds
66 successfully) download artifacts
7−[ ] run tools/build-arm.sh to create and download arm64 linux package
8−[ ] download macos artifacts from CircleCI
97[ ] Use 'make' in macos and windows artifacts to sign code
108[ ] make update-website
119[ ] make trypandoc
SECURITY.mddeleted−12
@@ -1,12 +0,0 @@
1−# Security Policy
2−
3−## Supported Versions
4−
5−Only the most recent version of pandoc is supported with security updates.
6−
7−## Reporting a Vulnerability
8−
9−To report a vulnerability, email the maintainer, jgm@berkeley.edu.
10−But first please read the section of the manual entitled
11−[A note on security](https://pandoc.org/MANUAL.html#a-note-on-security),
12−which describes some security guarantees pandoc does NOT make.
benchmark/benchmark-pandoc.hs+84−65
@@ -1,6 +1,7 @@
1+{-# LANGUAGE NoImplicitPrelude #-}
12{-# LANGUAGE OverloadedStrings #-}
23{-
3−Copyright (C) 2012-2021 John MacFarlane <jgm@berkeley.edu>
4+Copyright (C) 2012-2019 John MacFarlane <jgm@berkeley.edu>
45
56This program is free software; you can redistribute it and/or modify
67it under the terms of the GNU General Public License as published by
@@ -16,88 +17,106 @@ You should have received a copy of the GNU General Public License
1617along with this program; if not, write to the Free Software
1718Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1819-}
20+import Prelude
1921import Text.Pandoc
2022import Text.Pandoc.MIME
21−import Control.DeepSeq (force)
22−import Control.Monad.Except (throwError)
23+import Control.Monad.Except (throwError, liftIO)
2324import qualified Text.Pandoc.UTF8 as UTF8
2425import qualified Data.ByteString as B
2526import qualified Data.Text as T
26−import Test.Tasty.Bench
27−-- import Gauge
27+import Criterion.Main
28+import Criterion.Types (Config(..))
29+import Data.List (intersect)
30+import Data.Maybe (mapMaybe, catMaybes)
31+import System.Environment (getArgs)
2832import qualified Data.ByteString.Lazy as BL
29−import Data.Maybe (mapMaybe)
30−import Data.List (sortOn)
33+
34+data Input = InputText {unInputText :: T.Text}
35+ | InputBS {unInputBS :: BL.ByteString}
3136
3237readerBench :: Pandoc
3338 -> T.Text
34− -> Maybe Benchmark
35−readerBench _ name
36− | name `elem` ["bibtex", "biblatex", "csljson"] = Nothing
37−readerBench doc name = either (const Nothing) Just $
38− runPure $ do
39− (rdr, rexts) <- getReader name
40− (wtr, wexts) <- getWriter name
41− case (rdr, wtr) of
42− (TextReader r, TextWriter w) -> do
43− inp <- w def{ writerWrapText = WrapAuto
44− , writerExtensions = wexts } doc
45− return $ bench (T.unpack name) $
46− nf (either (error . show) id . runPure . r def) inp
47− (ByteStringReader r, ByteStringWriter w) -> do
48− tmpl <- Just <$> compileDefaultTemplate name
49− inp <- w def{ writerWrapText = WrapAuto
50− , writerExtensions = wexts
51− , writerTemplate = tmpl } doc
52− return $ bench (T.unpack name) $
53− nf (either (error . show) id .
54− runPure . r def{readerExtensions = rexts}) inp
55− _ -> throwError $ PandocSomeError $ "text/bytestring format mismatch: "
56− <> name
39+ -> IO (Maybe Benchmark)
40+readerBench doc name = do
41+ let (rdr, rexts) = either (error . show) id . runPure $ getReader name
42+ res <- runIO $ do
43+ (wtr, wexts) <- getWriter name
44+ case (rdr, wtr) of
45+ (TextReader r, TextWriter w) -> do
46+ setResourcePath ["./test"]
47+ inp <- w def{ writerWrapText = WrapAuto
48+ , writerExtensions = wexts } doc
49+ return (r def{ readerExtensions = rexts } . unInputText, InputText inp)
50+ (ByteStringReader r, ByteStringWriter w) -> do
51+ setResourcePath ["./test"]
52+ tmpl <- Just <$> compileDefaultTemplate name
53+ inp <- w def{ writerWrapText = WrapAuto
54+ , writerExtensions = wexts
55+ , writerTemplate = tmpl } doc
56+ liftIO $ BL.writeFile "/tmp/test.odt" inp
57+ return (r def{ readerExtensions = rexts } . unInputBS, InputBS inp)
58+ _ -> throwError $ PandocSomeError $ "text/bytestring format mismatch: "
59+ <> name
60+ return $ case res of
61+ Right (readerFun, inp) ->
62+ Just $ bench (T.unpack $ name <> " reader")
63+ $ nf (\i -> either (error . show) id $ runPure (readerFun i))
64+ inp
65+ Left _ -> Nothing
5766
5867getImages :: IO [(FilePath, MimeType, BL.ByteString)]
5968getImages = do
60− ll <- B.readFile "test/lalune.jpg"
61− mv <- B.readFile "test/movie.jpg"
62− return [("lalune.jpg", "image/jpg", BL.fromStrict ll)
63− ,("movie.jpg", "image/jpg", BL.fromStrict mv)]
69+ ll <- BL.readFile "test/lalune.jpg"
70+ mv <- BL.readFile "test/movie.jpg"
71+ return [("lalune.jpg", "image/jpg", ll)
72+ ,("movie.jpg", "image/jpg", mv)]
6473
65−writerBench :: [(FilePath, MimeType, BL.ByteString)]
66− -> Pandoc
74+writerBench :: Pandoc
6775 -> T.Text
6876 -> Maybe Benchmark
69−writerBench _ _ name
70− | name `elem` ["bibtex", "biblatex", "csljson"] = Nothing
71−writerBench imgs doc name = either (const Nothing) Just $
72− runPure $ do
73− (wtr, wexts) <- getWriter name
74− case wtr of
75− TextWriter writerFun ->
76− return $ bench (T.unpack name)
77− $ nf (\d -> either (error . show) id $
78− runPure $ do
79− mapM_ (\(fp,mt,bs) -> insertMedia fp (Just mt) bs) imgs
80− writerFun def{ writerExtensions = wexts} d)
81− doc
82− ByteStringWriter writerFun ->
83− return $ bench (T.unpack name)
77+writerBench doc name =
78+ case res of
79+ Right writerFun ->
80+ Just $ env getImages $ \imgs ->
81+ bench (T.unpack $ name <> " writer")
8482 $ nf (\d -> either (error . show) id $
85− runPure $ do
86− mapM_ (\(fp,mt,bs) -> insertMedia fp (Just mt) bs) imgs
87− writerFun def{ writerExtensions = wexts} d)
88− doc
83+ runPure (do mapM_
84+ (\(fp, mt, bs) ->
85+ insertMedia fp (Just mt) bs)
86+ imgs
87+ writerFun d)) doc
88+ Left _ -> Nothing
89+ where res = runPure $ do
90+ (wtr, wexts) <- getWriter name
91+ case wtr of
92+ TextWriter w ->
93+ return $ w def{ writerExtensions = wexts }
94+ _ -> throwError $ PandocSomeError
95+ $ "could not get text writer for " <> name
8996
9097main :: IO ()
9198main = do
99+ args <- filter (\x -> T.take 1 x /= "-") . fmap T.pack <$> getArgs
100+ print args
101+ let matchReader (n, _) =
102+ null args || ("reader" `elem` args && n `elem` args)
103+ matchWriter (n, TextWriter _) =
104+ null args || ("writer" `elem` args && n `elem` args)
105+ matchWriter _ = False
106+ allWriters = map fst (writers :: [(T.Text, Writer PandocPure)])
107+ matchedReaders = map fst (filter matchReader readers
108+ :: [(T.Text, Reader PandocPure)])
109+ matchedWriters = map fst (filter matchWriter writers
110+ :: [(T.Text, Writer PandocPure)])
92111 inp <- UTF8.toText <$> B.readFile "test/testsuite.txt"
93112 let opts = def
94− let doc = either (error . show) force $ runPure $ readMarkdown opts inp
95− defaultMain
96− [ env getImages $ \imgs ->
97− bgroup "writers" $ mapMaybe (writerBench imgs doc . fst)
98− (sortOn fst
99− writers :: [(T.Text, Writer PandocPure)])
100− , bgroup "readers" $ mapMaybe (readerBench doc . fst)
101− (sortOn fst
102− readers :: [(T.Text, Reader PandocPure)])
103− ]
113+ let doc = either (error . show) id $ runPure $ readMarkdown opts inp
114+ readerBs <- fmap catMaybes
115+ $ mapM (readerBench doc)
116+ $ filter (/="haddock")
117+ (matchedReaders `intersect` allWriters)
118+ -- we need the corresponding writer to generate
119+ -- input for the reader
120+ let writerBs = mapMaybe (writerBench doc) matchedWriters
121+ defaultMainWith defaultConfig{ timeLimit = 6.0 }
122+ (writerBs ++ readerBs)
benchmark/weigh-pandoc.hsnew file+50
@@ -0,0 +1,50 @@
1+{-# LANGUAGE NoImplicitPrelude #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{- |
4+ Module : Main
5+ Copyright : © 2016-2019 John MacFarlane <jgm@berkeley.edu>
6+ License : GNU GPL, version 2 or above
7+
8+ Maintainer : John MacFarlane <jgm@berkeley.edu>
9+ Stability : alpha
10+ Portability : portable
11+
12+Benchmarks to determine resource use of readers and writers.
13+-}
14+import Prelude
15+import Weigh
16+import Text.Pandoc
17+import Data.Text (Text, unpack)
18+
19+main :: IO ()
20+main = do
21+ doc <- read <$> readFile "test/testsuite.native"
22+ mainWith $ do
23+ func "Pandoc document" id doc
24+ mapM_
25+ (\(n,r) -> weighReader doc n (either (error . show) id . runPure . r def{readerExtensions = pandocExtensions}))
26+ [("markdown", readMarkdown)
27+ ,("html", readHtml)
28+ ,("docbook", readDocBook)
29+ ,("latex", readLaTeX)
30+ ,("commonmark", readCommonMark)
31+ ]
32+ mapM_
33+ (\(n,w) -> weighWriter doc n (either (error . show) id . runPure . w def))
34+ [("markdown", writeMarkdown)
35+ ,("html", writeHtml5String)
36+ ,("docbook", writeDocbook5)
37+ ,("latex", writeLaTeX)
38+ ,("commonmark", writeCommonMark)
39+ ]
40+
41+weighWriter :: Pandoc -> String -> (Pandoc -> Text) -> Weigh ()
42+weighWriter doc name writer = func (name ++ " writer") writer doc
43+
44+weighReader :: Pandoc -> Text -> (Text -> Pandoc) -> Weigh ()
45+weighReader doc name reader =
46+ case lookup name writers of
47+ Just (TextWriter writer) ->
48+ let inp = either (error . show) id $ runPure $ writer def{ writerWrapText = WrapAuto} doc
49+ in func (unpack $ name <> " reader") reader inp
50+ _ -> return () -- no writer for reader
cabal.project+7−9
@@ -1,13 +1,11 @@
11packages: pandoc.cabal
2−tests: True
3−flags: +embed_data_files
42
5−source-repository-package
6− type: git
7− location: https://github.com/jgm/doctemplates
8− tag: 428c26d5303cf7a2b1051fe1ffd9aafe9ba71c81
3+package pandoc
4+ flags: +embed_data_files -trypandoc
5+ ghc-options: -j +RTS -A64m -RTS
96
107source-repository-package
11− type: git
12− location: https://github.com/jgm/citeproc
13− tag: 4ce0501cd6f9c86eee087afcf878c256e49b9615
8+ type: git
9+ location: https://github.com/jgm/citeproc
10+ tag: 1412868a711ad12c2cb5cfc0d6bbba11c7612ce6
11+constraints: base16-bytestring < 1
changelog.md+22−2510
@@ -1,2493 +1,5 @@
11# Revision history for pandoc
22
3−## pandoc 2.14.0.3 (2021-06-22)
4−
5− * Text.Pandoc.MediaBag `insertMediaBag`: ensure we get a sane mediaPath
6− for URLs (#7391). In earlier 2.14.x versions, we'd get
7− incorrect paths for resources downloaded from URLs when the
8− media are extracted (including in PDF production).
9− * Text.Pandoc.Parsing: improve `emailAddress` (#7398).
10− Previously the parser would accept characters in domains
11− that are illegal in domains, and this sometimes caused it
12− to gobble bits of the following text.
13− * txt2tags reader: modify the email address parser so
14− it still includes form parameters, even after the change to
15− `emailAddress` in Text.Pandoc.Parsing.
16− * Text.Pandoc.Readers.Metadata: Fix regression with comment-only YAML
17− metadata blocks (#7400).
18− * reveal.js writer and template: better handling of options. Previously
19− it was impossible to specify false values for options that default to
20− true (e.g. `center`); setting the option to false just caused the portion
21− of the template setting the option to be omitted. Now we prepopulate
22− all the variables with their default values, including them all
23− unconditionally and allowing them to be overridden.
24− * Markdown writer: Fix regression in code blocks with attributes (#7397).
25− Code blocks with a single class but nonempty attributes
26− were having attributes drop as a result of #7242.
27− * LaTeX writer:
28− + Add strut at end of minipage if it contains line breaks.
29− Without them, the last line is not as tall as it should be in
30− some cases.
31− + Always use a minipage for cells with line breaks, when
32− width information is available (#7393). Otherwise the way we treat them
33− can lead to content that overflows a cell.
34− + Use `\strut` instead of `~` before `\\` in empty line.
35− * Use lts-18.0 stack resolver.
36− * Require skylighting 0.10.5.2 (adding support for Swift).
37− * Require commonmark 0.2.1.
38− * Rephrase section on unsafe HTML in manual.
39− * Create SECURITY.md
40−
41−## pandoc 2.14.0.2 (2021-06-13)
42−
43− * Fix MediaBag regressions (#7345). iIn the 2.14 release `--extract-media`
44− stopped working as before; there could be mismatches between the
45− paths in the rendered document and the extracted media.
46− This patch makes several changes that restore the earlier behavior
47− (while keeping the same API). The `mediaPath` in 2.14 was always
48− constructed from the SHA1 hash of the media contents. Now, we
49− preserve the original path unless it's an absolute path or contains
50− `..` segments (in that case we use a path based on the SHA1 hash of
51− the contents).
52−
53− In Text.Pandoc.MediaBag, `mediaDirectory` and `mediaItems` now use the
54− `mediaPath`, rather than the mediabag key, for the first component of the
55− tuple. This makes more sense, I think, and fits with the documentation of
56− these functions; eventually, though, we should rework the API so that
57− `mediaItems` returns both the keys and the MediaItems.
58−
59− In Text.Pandoc.Class.IO, rewriting of source paths in `extractMedia` has
60− been fixed.
61−
62− In Text.Pandoc.Class.PandocMonad, `fillMediaBag` has been modified so that
63− it doesn't modify image paths (that was part of the problem in #7345).
64−
65− We now do path normalization (e.g. `\` separators on Windows) in
66− writing the media.
67−
68− * Text.Pandoc.PDF:
69−
70− + Text.Pandoc.PDF: Fix regression in 2.14 for generation of PDFs with
71− SVGs (#7344).
72− + Only print relevant part of environment on `--verbose`. Since
73− `--verbose` output might be put in an issue, we want to avoid
74− spilling out secrets in environment variables.
75−
76− * Markdown reader: fix pipe table regression in 2.11.4 (#7343).
77− Previously pipe tables with empty headers (that is, a header
78− line with all empty cells) would be rendered as headerless
79− tables. This broke in 2.11.4. The fix here is to produce an
80− AST with an empty table head when a pipe table has all empty
81− header cells.
82−
83− * LaTeX reader: don't allow optional `*` on symbol control sequences
84− (#7340). Generally we allow optional starred variants of LaTeX commands
85− (since many allow them, and if we don't accept these explicitly,
86− ignoring the star usually gives acceptable results). But we
87− don't want to do this for `\(*\)` and similar cases.
88−
89− * Docx reader: handle absolute URIs in Relationship Target (#7374).
90−
91− * Docx writer: fix handling of empty table headers (Albert Krewinkel,
92− #7369). A table header which does not contain any cells is now treated as
93− an empty header.
94−
95− * LaTeX writer: Fix regression in table header position (#7347).
96− In recent versions the table headers were no longer bottom-aligned
97− (if more than one line). This patch fixes that by using minipages
98− for table headers in non-simple tables.
99−
100− * CommonMark writer:
101−
102− + Do not use simple class for fenced-divs (Jan Tojnar, amends #7242.)
103− + Do not throw away attributes when `Ext_attributes` is enabled.
104− `Ext_attributes` covers at least the following:
105− `Ext_fenced_code_attributes`, `Ext_header_attributes`,
106− `Ext_inline_code_attributes`, `Ext_link_attributes`.
107−
108− * Markdown writer:
109−
110− + Allow `pipe_tables` to be disabled for commonmark formats
111− (`commonmark_x`, `gfm`) (#7375).
112− + Re-use functions from Text.Pandoc.Markdown.Inline (Jan Tojnar).
113−
114− * DocBook writer: Remove non-existent admonitions (Jan Tojnar).
115− `attention`, `error` and `hint` are reStructuredText specific.
116−
117− * HTML writer: Don't omit width attribute on div (#7342).
118−
119− * Text.Pandoc.MIME, `extensionFromMimeType`: add a few special cases.
120− When we do a reverse lookup in the MIME table, we just get the
121− last match, so when the same mime type is associated with several
122− different extensions, we sometimes got weird results, e.g. `.vs`
123− for `text/plain`. These special cases help us get the most standard
124− extensions for mime types like `text/plain`.
125−
126− * Lua utils: fix handling of table headers in `from_simple_table` (Albert
127− Krewinkel, #7369). Passing an empty list of header cells now results
128− in an empty table header.
129−
130− * Text.Pandoc.Citeproc:
131−
132− + Avoid duplicate classes and attributes on references div.
133− + Fix regression in citeproc processing (#7376). If inline
134− references are used (in the metadata `references` field), we
135− should still only include in the bibliography items that are
136− actually cited (unless `nocite` is used).
137−
138− * Require citeproc 0.4.0.1. This fixes a bug which led to doubled
139− "et al." in some (rare) circumstances.
140−
141− * MANUAL.txt:
142−
143− + Mention GladTeX for EPUB export (Sebastian Humenda).
144− This updates the manual and the web site about the GladTeX usage.
145− + More details and a useful link for YAML syntax.
146−
147− * CONTRIBUTING.md: update modules overview (Albert Krewinkel).
148−
149− * using-the-pandoc-api.md: switch from String to Text (Albert Krewinkel).
150−
151−
152−## pandoc 2.14.0.1 (2021-06-01)
153−
154− * Commonmark reader: Fix regression in 2.14 with YAML metdata block parsing,
155− which could cause the document body to be omitted after metadata (#7339).
156−
157− * HTML reader: fix column width regression in 2.14 (#7334).
158− Column widths specified with a style attribute were off by a factor of 100.
159−
160− * Markdown reader: in `rebasePaths`, check for both Windows and Posix
161− absolute paths. Previously Windows pandoc was treating
162− `/foo/bar.jpg` as non-absolute.
163−
164− * Text.Pandoc.Logging: In rendering `LoadedResource`, use relative paths.
165−
166− * Docx writer: fix regression on captions (#7328). The "Table Caption"
167− style was no longer getting applied. (It was overwritten by "Compact.")
168−
169− * Use commonmark-extensions 0.2.1.2
170−
171−## pandoc 2.14 (2021-05-28)
172−
173− * Change reader types, allowing better tracking of source positions
174− [API change]. Previously, when multiple file arguments were provided,
175− pandoc simply concatenated them and passed the contents to the readers,
176− which took a Text argument. As a result, the readers had no way of knowing
177− which file was the source of any particular bit of text. This meant that
178− we couldn't report accurate source positions on errors or include accurate
179− source positions as attributes in the AST. More seriously, it meant that
180− we couldn't resolve resource paths relative to the files containing them
181− (see e.g. #5501, #6632, #6384, #3752).
182−
183− * Add `rebase_relative_paths` extension (#3752). When enabled, this
184− extension rewrites relative image and link paths by prepending
185− the (relative) directory of the containing file. This
186− behavior is useful when your input sources are split
187− into multiple files, across several directories, with files
188− referring to images stored in the same directory. The
189− extension can be enabled for all markdown and commonmark-based formats.
190−
191− * Add Text.Pandoc.Sources (exported module), with a `Sources` type and a
192− `ToSources` class. A `Sources` wraps a list of `(SourcePos, Text)` pairs
193− [API change]. A parsec `Stream` instance is provided for `Sources`. The
194− module also exports versions of parsec's `satisfy` and other Char parsers
195− that track source positions accurately from a `Sources` stream (or any
196− instance of the new `UpdateSourcePos` class).
197−
198− * Text.Pandoc.Parsing
199−
200− + Export the modified Char parsers defined in Text.Pandoc.Sources
201− instead of the ones parsec provides. Modified parsers to use a
202− `Sources` as stream [API change].
203− + Improve include file functions [API change]. Remove old
204− `insertIncludedFileF`. Give `insertIncludedFile` a more general type,
205− allowing it to be used where `insertIncludedFileF` was.
206− + Add parameter to the `citeKey` parser from
207− Text.Pandoc.Parsing, which controls whether the `@{..}`
208− syntax is allowed [API change].
209−
210− * Text.Pandoc.Error: Modified the constructor `PandocParsecError` to take a
211− `Sources` rather than a `Text` as first argument, so parse error locations
212− can be accurately reported.
213−
214− * Fix source position reporting for YAML bibliographies (#7273).
215−
216− * Issue error message when reader or writer format is malformed
217− (#7231). Previously we exited with an error status but (due to a bug)
218− no message.
219−
220− * Smarter smart quotes (#7216, #2103). Treat a leading `"` with no
221− closing `"` as a left curly quote. This supports the practice, in
222− fiction, of continuing paragraphs quoting the same speaker without an
223− end quote. It also helps with quotes that break over lines in line blocks.
224−
225− * Markdown reader:
226−
227− + Use MetaInlines not MetaBlocks for multimarkdown metadata fields.
228− This gives better results in converting to e.g. pandoc markdown.
229− + Implement curly-brace syntax for Markdown citation keys (#6026).
230− The change provides a way to use citation keys that contain
231− special characters not usable with the standard citation key syntax.
232− Example: `@{foo_bar{x}'}` for the key `foo_bar{x}`. It also allows
233− separating citation keys from immediately following text, e.g. `@{foo}A`.
234−
235− * RST reader:
236−
237− + Seek include files in the directory of the file
238− containing the include directive, as RST requires (#6632).
239− + Use `insertIncludedFile` from Text.Pandoc.Parsing
240− instead of reproducing much of its code.
241−
242− * Org reader: Resolve org includes relative to the directory containing the
243− file containing the INCLUDE directive (#5501).
244−
245− * ODT reader: Treat tabs as spaces (#7185, niszet).
246−
247− * Docx reader:
248−
249− + Add handling of vml image objects (#7257, mbrackeantidot).
250− + Support new table features (Emily Bourke, #6316): column
251− spans, row spans, multiple header rows, table description
252− (parsed as a simple caption), captions, column widths.
253−
254− * LaTeX reader:
255−
256− + Improved siunitx support (#6658, #6620).
257− + Better support for `\xspace` (#7299).
258− + Improve parsing of `\def` macros. We previously set "verbatim mode"
259− even for parsing the initial `\def`; this caused problems
260− for `\def` nested inside another `\def`.
261− + Implement `\newif`.
262−
263− * ConTeXt writer: improve ordered lists (#5016, Denis Maier).
264− Change ordered list from itemize to enumerate. Add new
265− itemgroup for ordered lists. Remove manual insertion of
266− width attributes. Use tabular figures in ordered list
267− enumerators.
268−
269− * HTML reader:
270−
271− + Don't fail on unmatched closing "script" tag (Albert Krenkel, #7282).
272− + Keep h1 tags as normal headers (#2293, Albert Krewinkel).
273− The tags `<title>` and `<h1 class="title">` often contain the same
274− information, so the latter was dropped from the document. However, as
275− this can lead to loss of information, the heading is now always
276− retained. Use `--shift-heading-level-by=-1` to turn the `<h1>`
277− into the document title, or a filter to restore the previous behavior.
278− + Handle relative lengths (e.g. `2*`) in HTML column widths (#4063).
279− See <https://www.w3.org/TR/html4/types.html#h-6.6>.
280−
281− * DocBook/JATS readers:
282−
283− + Fix mathml regression caused by the switch in XML libraries (#7173).
284− + Fix "phrase" in DocBook: take classes from "role" not "class" (#7195).
285−
286− * DocBook reader: ensure that first and last names are separated (#6541).
287−
288− * Jira reader (Albert Krewinkel, #7218):
289−
290− + Support "smart" links: `[alias|https://example.com|smart-card]` syntax.
291− + Allow spaces and most unicode characters in attachment links.
292− + No longer require a newline character after `{noformat}`.
293− + Only allow URI path segment characters in bare links.
294− + The `file:` schema is no longer allowed in bare links; these
295− rarely make sense.
296−
297− * Plain writer: handle superscript unicode minus (#7276).
298−
299− * LaTeX writer:
300−
301− + Better handling of line breaks in simple tables (#7272).
302− Now we also handle the case where they're embedded in other elements,
303− e.g. spans.
304− + For beamer output, support `exampleblock` and `alertblock` (#7278).
305− A block will be rendered as an `exampleblock` if the heading
306− has class `example` and an `alertblock` if it has class `alert`.
307− + Separate successive quote chars with thin space (#6958,
308− Albert Krewinkel). Successive quote characters are separated with
309− a thin space to improve readability and to prevent unwanted ligatures.
310− Detection of these quotes sometimes had failed if the second quote
311− was nested in a span element.
312− + Separate successive quote chars with thin space (#6958, Albert
313− Krewinkel).
314−
315− * EPUB Writer: Fix belongs-to-collection XML id choice (#7267, nuew).
316− The epub writer previously used the same XML id for both the book
317− identifier and the epub collection. This causes an error on epubcheck.
318−
319− * BibTeX/BibLaTeX writer: Handle `annote` field (#7266).
320−
321− * ZimWiki writer: allow links and emphasis in headers (#6605,
322− Albert Krewinkel).
323−
324− * ConTeXt writer:
325−
326− + Support blank lines in line blocks (#6564, Albert Krewinkel,
327− thanks to @denismaier).
328− + Use span identifiers as reference anchors (#7246, Albert Krewinkel).
329−
330− * HTML writer:
331−
332− + Keep attributes from code nested below `pre` tag (#7221,
333− Albert Krewinkel). If a code block is defined with `<pre><code
334− class="language-x">…</code></pre>`, where the `<pre>` element has no
335− attributes, then the attributes from the `<code>` element are used
336− instead. Any leading `language-` prefix is dropped in the code's
337− `class` attribute are dropped to improve syntax highlighting.
338− + Ensure headings only have valid attribs in HTML4 (#5944, Albert
339− Krewinkel).
340− + Parse `<header>` as a Div (Albert Krewinkel).
341−
342− * Org writer:
343−
344− + Inline latex envs need newlines (#7252, tecosaur).
345− As specified in https://orgmode.org/manual/LaTeX-fragments.html, an
346− inline \begin{}...\end{} LaTeX block must start on a new line.
347− + Use LaTeX style maths deliminators (#7196, tecosaur).
348−
349− * JATS writer (Albert Krewinkel):
350−
351− + Use either styled-content or named-content for spans (#7211).
352− If the element has a content-type attribute, or at least one class,
353− then that value is used as `content-type` and the span is put inside
354− a `<named-content>` element. Otherwise a `<styled-content>` element
355− is used instead.
356− + Reduce unnecessary use of `<p>` elements for wrapping (#7227).
357− The `<p>` element is used for wrapping in cases were the contents
358− would otherwise not be allowed in a certain context. Unnecessary
359− wrapping is avoided, especially around quotes (`<disp-quote>` elements).
360− + Convert spans to `<named-content>` elements (#7211). Spans with
361− attributes are converted to `<named-content>` elements instead of
362− being wrapped with `<milestone-start/>` and `<milestone-end>`
363− elements. Milestone elements are not allowed in documents using the
364− articleauthoring tag set, so this change ensures the creation of valid
365− documents.
366− + Add footnote number as label in backmatter (#7210). Footnotes in the
367− backmatter are given the footnote's number as a label. The
368− articleauthoring output is unaffected from this change, as footnotes
369− are placed inline there.
370− + Escape disallows chars in identifiers. XML identifiers must start
371− with an underscore or letter, and can contain only a limited set
372− of punctuation characters. Any IDs not adhering to these rules are
373− rewritten by writing the offending characters as `Uxxxx`,
374− where `xxxx` is the character's hex code.
375−
376− * Jira writer: use `{color}` when span has a color attribute
377− (Albert Krewinkel, tarleb/jira-wiki-markup#10).
378−
379− * Docx writer:
380−
381− + Autoset table width if no column has an explicit width (Albert
382− Krewinkel).
383− + Extract Table handling into separate module (Albert Krewinkel).
384− + Support colspans and rowspans in tables (Albert Krewinkel, #6315).
385− + Support multirow table headers (Albert Krewinkel).
386− + Improve integration of settings from reference.docx (#1209).
387− This change allows users to create a reference.docx that
388− sets `w:proofState` for spelling or grammar to `dirty`,
389− so that spell/grammar checking will be triggered on the
390− generated docx.
391− + Copy over more settings from reference.docx (#7240). From settings.xml
392− in the reference-doc, we now include: `zoom`, `embedSystemFonts`,
393− `doNotTrackMoves`, `defaultTabStop`, `drawingGridHorizontalSpacing`,
394− `drawingGridVerticalSpacing`, `displayHorizontalDrawingGridEvery`,
395− `displayVerticalDrawingGridEvery`, `characterSpacingControl`,
396− `savePreviewPicture`, `mathPr`, `themeFontLang`, `decimalSymbol`,
397− `listSeparator`, `autoHyphenation`, `compat`.
398− + Set zoom to 100% by default in settings.xml.
399− + Align math options more with current Word defaults (e.g. Cambria Math
400− font).
401− + Remove `rsid`s from default settings.xml. Word will add these
402− when revisions are made.
403−
404− * Ms writer: Handle tables with multiple paragraphs (#7288).
405− Previously they overflowed the table cell width. We now set line lengths
406− per-cell and restore them after the table has been written.
407−
408− * Markdown writer:
409−
410− + Use cleaner braceless syntax for code blocks with a
411− single class (#7242, Jan Tojnar).
412− + Add quotes properly in markdown YAML metadata fields (#7245).
413− This fixes a bug, which caused the writer to look at the *last*
414− rather than the *first* character in determining whether quotes
415− were needed. So we got spurious quotes in some cases and
416− didn't get necessary quotes in others.
417− + Use `@{..}` syntax for citations when needed.
418− + Use fewer unneeded escapes for `#` (see #6259).
419− + Improve escaping of `@`. We need to escape literal `@` before
420− `{` because of the new citation syntax.
421−
422− * Commonmark writer: Use backslash escapes for `<` and `|`...
423− instead of entities (#7208).
424−
425− * Powerpoint writer: allow `monofont` to be specified in metadata
426− (#7187).
427−
428− * LaTeX template:
429−
430− + Use non-starred names for xcolor color names (#6109).
431− This should make svgnames and x11names work properly.
432− + Fix bad vertical spacing after bibliography (#7234, badumont).
433− + List of figures before list of tables (#7235, Julien Dutant).
434− + Move CSL macro definitions before header-includes so they can be
435− overridden (#7286).
436− + Improve treatment of CSL `entry-spacing` (#7296).
437− Previously with the default template settings (`indent` variable
438− not set), we would get interparagraph spaces separating bib
439− entries even with `entry-spacing="0"`. On the other hand,
440− setting `entry-spacing="2"` gave ridiculously large spacing.
441− This change makes the spacing caused by `entry-spacing` a multiple
442− of `\parskip` by default, which gives aesthetically reasonable
443− output. Those who want a larger or smaller unit (e.g. because
444− they use `indent` which sets `\parskip` to 0) may
445− `\setlength{\cslentryspacingunit}{10pt}` in header-includes
446− to override the defaults.
447− + Move title, author, date up to top of preamble (#7295).
448− This allows header-includes to use them, and puts them
449− in a position where you can see them immediately.
450− + Define commands for zero width non-joiner character
451− (#6639, Albert Krewinkel). The zero-width non-joiner character
452− is used to avoid ligatures (e.g. in German).
453−
454− * ConTeXt template:
455−
456− + Define `enumerate` itemgroup (#5016, Denis Maier).
457− + List of figures before list of tables (#7235, Julien Dutant).
458−
459− * reveal.js template:
460−
461− + Support `toc-title` (#7171, Florian Kohrt).
462− + Use `hash: true` by default rather than `history: true` (#6968).
463−
464− * HTML-based slide shows: add support for `institute` (#7289, Thomas
465− Hodgson).
466−
467− * Text.Pandoc.Extensions: Add constructor `Ext_rebase_relative_paths` to
468− `Extensions` [API change].
469−
470− * Text.Pandoc.XML.Light: add Eq, Ord instances for Content,
471− Element, Attr, CDataKind [API change].
472−
473− * Text.Pandoc.MediaBag:
474−
475− + Change type to use a `Text` key instead of `[FilePath]`.
476− We normalize the path and use `/` separators for consistency.
477− + Export `MediaItem` type [API change].
478− + Change `MediaBag` type to a map from Text to MediaItem [API change].
479− + `lookupMedia` now returns a `MediaItem` [API change].
480− + Change `insertMedia` so it sets the `mediaPath` to a filename based on
481− the SHA1 hash of the contents. This will be used when contents
482− are extracted.
483−
484− * Text.Pandoc.Class.PandocMonad:
485−
486− + Remove `fetchMediaResource` [API change]. Use `fetchItem` to get
487− resources in `fillMediaBag`.
488− + Add informational message in `downloadOrRead` indicating what path
489− local resources have been loaded from.
490−
491− * Text.Pandoc.Logging:
492−
493− + Remove single quotes around paths in messages.
494− + Add LoadedResource constructor to LogMessage [API change].
495− This is for INFO-level messages telling where image data has been
496− loaded from. (This can vary because of the resource path.)
497−
498− * Text.Pandoc.Asciify: simplify code and export `toAsciiText` [API change].
499− Instead of encoding a giant (and incomplete) map, we now
500− just use unicode-transforms to normalize the text to
501− a canonical decomposition, and manipulate the result.
502−
503− * App: allow tabs expansion even if file-scope is used (Albert Krewinkel,
504− #6709). Tabs in plain-text inputs are now handled correctly, even if
505− the `--file-scope` flag is used.
506−
507− * Add new internal module Text.Pandoc.Writers.GridTable (Albert Krewinkel).
508−
509− * Text.Pandoc.Highlighting: Change type of `languagesByExtension`, adding
510− a parameter for a `SyntaxMap` [API change] (Jan Tojnar, #7241).
511− Languages defined using `--syntax-definition` were not recognized by
512− `languagesByExtension`. This patch corrects that, allowing the writers
513− to see all custom definitions. The LaTeX writer still uses the default
514− syntax map, but that's okay in that context, since
515− `--syntax-definition` won't create new listings styles.
516−
517− * Text.Pandoc.Citeproc:
518−
519− + Ensure that CSL-related attributes are passed on to a Div with id
520− 'refs'. Otherwise things like `entry-spacing` won't work when
521− such Divs are used.
522− + Use metadata's `lang` for the lang parameter of citeproc, overriding
523− `localeLanguage`.
524− + Recognize locators spelled with a capital letter (#7323).
525− + Add a comma and a space in front of the suffix if it doesn't start
526− with space or punctuation (#7324).
527− + Don't detect math elements as locators (#7321).
528−
529− * Remove Text.Pandoc.BCP47 module [API change]. Use types and functions
530− from UnicodeCollation.Lang instead. This is a richer implementation
531− of BCP 47.
532−
533− * Text.Pandoc.Shared:
534−
535− + Fix regression in grid tables for wide characters (#7214).
536− In the translation from String to Text, a char-width-sensitive
537− `splitAt'` was dropped. This commit reinstates it and uses it to make
538− `splitTextByInstances` char-width sensitive.
539− + Add `getLang` (formerly in the now-removed BCP47) [API change].
540−
541− * Text.Pandoc.SelfContained: use `application/octet-stream`
542− for unknown mime types instead of halting with an error (#7202).
543−
544− * Lua filters: respect Inlines/Blocks filter functions in `pandoc.walk_*`
545− (Albert Krewinkel).
546−
547− * Add text as build-depend for trypandoc (#7193, Roman Beránek).
548−
549− * Bump upper-bounds for network-uri, time, attoparsec.
550−
551− * Use citeproc 0.4.
552−
553− * Use texmath 0.12.3.
554−
555− * Use jira-wiki-markup 1.3.5 (Albert Krewinkel).
556−
557− * Require latest skylighting (fixes a bug in XML syntax highlighting).
558−
559− * Use latest xml-conduit.
560−
561− * Use latest commonmark, commonmark-extensions, commonmark-pandoc.
562−
563− * Use haddock-library-1.10.0 (Albert Krewinkel).
564−
565− * Allow compilation with base 4.15 (Albert Krewinkel).
566−
567− * MANUAL:
568−
569− + Add information about `lang` and bibliography sorting.
570− + Add info about YAML escape sequences, link to spec (#7152,
571− Albert Krewinkel).
572− + Note that `institute` variable works for HTML-based slides.
573− + Update documentation on citation syntax.
574− + Add citation example for locators and suffixes (Tristan Stenner)
575−
576− * Updated and fixed typos in documentation (Charanjit Singh,
577− Anti-Distinctlyminty, Tatiana Porras, obcat).
578−
579− * Add instructions for installing pandoc-types before compiling filter.
580−
581− * INSTALL: add note that parallel installations should be avoided
582− (#6865).
583−
584− * Remove `biblatex-nussbaum.md` test. It is basically the same
585− as `biblaetx-quotes.md`.
586−
587− * Command tests: fail if a file contains no tests---and fix a
588− test that failed in that way!
589−
590− * Use smaller images in tests, reducing the size of the source tarball by 8 MB.
591−
592−
593−## pandoc 2.13 (2021-03-21)
594−
595− * Support `yaml_metadata_block` extension for `commonmark`, `gfm` (#6537).
596− This supported is a bit more limited than with pandoc's
597− `markdown`. The YAML block must be the first thing in the input,
598− and the leaf notes are parsed in isolation from the rest of
599− the document. So, for example, you can't use reference
600− links if the references are defined later in the document.
601−
602− * Fix fallback to default partials when custom templates are used.
603− If the directory containing a template does not contain the partial,
604− it should be sought in the default templates, but this was not
605− working properly (#7164).
606−
607− * Handle `nocite` better with `--biblatex` and `--natbib` (#4585).
608− Previously the nocite metadata field was ignored with these formats.
609− Now it populates a `nocite-ids` template variable and causes a
610− `\nocite` command to be issued.
611−
612− * Text.Pandoc.Citeproc: apply `fixLinks` correctly (#7130). This is code
613− that incorporates a prefix like `https://doi.org/` into a following link
614− when appropriate.
615−
616− * Text.Pandoc.Shared:
617−
618− + Remove `backslashEscapes`, `escapeStringUsing` [API change]. Replace
619− these inefficient association list lookups with more efficient escaping
620− functions in the writers that used them (for a 10-25% performance boost
621− in org, haddock, rtf, texinfo writers).
622− + Remove `ToString`, `ToText` typeclasses [API change]. These were needed
623− for the transition from String to Text, but they are no longer used and
624− may clash with other things.
625− + Simplify `compactDL`.
626−
627− * Text.Pandoc.Parsing:
628−
629− + Change type of `readWithM` so that it is no longer polymorphic
630− [API change]. The `ToText` class has been removed, and now that we've
631− completed the transition to Text we no longer need this to operate
632− on Strings.
633− + Remove `F` type synonym [API change]. Muse and Org were defining their
634− own `F` anyway.
635−
636− * Text.Pandoc.Readers.Metadata:
637−
638− + Export `yamlMetaBlock` [API change].
639− + Make `yamlBsToMeta`, `yamlBsToRefs` polymorphic on the parser state
640− [API change].
641−
642− * Markdown reader: Fix regression with `tex_math_backslash` (#7155).
643−
644− * MediaWiki reader: Allow block-level content in notes (ref) (#7145).
645−
646− * Jira reader (Albert Krewinkel):
647−
648− + Fixed parsing of autolinks (i.e., of bare URLs in the text).
649− Previously an autolink would take up the rest of a line, as spaces
650− were allowed characters in these items.
651− + Emoji character sequences no longer cause parsing failures. This was
652− due to missing backtracking when emoji parsing fails.
653− + Mark divs created from panels with class "panel".
654−
655− * RST reader: fix logic for ending comments (#7134). Previously comments
656− sometimes got extended too far.
657−
658− * DocBook writer: include Header attributes as XML attributes on
659− section (Erik Rask). Attributes with key names that are not allowed
660− as XML attributes are dropped, as are attributes with invalid values
661− and `xml:id` (DocBook 5) and `id` (DocBook 4).
662−
663− * Docx writer:
664−
665− + Make `nsid` in `abstractNum` deterministic. Previously we assigned
666− a random number, but we don't need random values, so now we just
667− assign a value based on the list marker.
668− + Use integral values for `w:tblW` (#7141).
669−
670− * Jira writer (Albert Krewinkel):
671−
672− + Block quotes are only rendered as `bq.` if they do not contain a
673− linebreak.
674− + Jira writer: improve div/panel handling. Include div attributes in
675− panels, always render divs with class `panel` as panels, and
676− avoid nesting of panels.
677−
678− * HTML writer: Add warnings on duplicate attribute values.
679− This prevents emitting invalid HTML. Ultimately it would be good to
680− prevent this in the types themselves, but this is better for now.
681−
682− * Org writer: Prevent unintended creation of ordered list items (#7132,
683− Albert Krewinkel). Adjust line wrapping if default wrapping would cause
684− a line to be read as an ordered list item.
685−
686− * JATS templates: support 'equal-contrib' attrib for authors (Albert
687− Krewinkel). Authors who contributed equally to a paper may be marked
688− with `equal-contrib`.
689−
690− * reveal.js template: replace JS comment with HTML (#7154, Florian Kohrt).
691−
692− * Text.Pandoc.Logging: Add `DuplicateAttribute` constructor to `LogMessage`.
693− [API change]
694−
695− * Use `-j4` for linux release build. This speeds up the build dramatically
696− on arm.
697−
698− * cabal.project: remove ghcoptions. Move flags to top level, so they can
699− be set differently on the command line.
700−
701− * Require latest texmath, skylighting, citeproc, jira-wiki-markup.
702− (The latest skylighting fixes a bad bug with Haskell syntax highlighting.)
703− Narrow version bounds for texmath, skylighting, and citeproc, since
704− the test output depend on them.
705−
706− * Use doclayout 0.3.0.2. This significantly reduces the time and memory
707− needed to compile pandoc.
708−
709− * Use `foldl'` instead of `foldl` everywhere.
710−
711− * Update bounds for random (#7156, Alexey Kuleshevich).
712−
713− * Remove uses of some partial functions.
714−
715− * Don't bake in a larger stack size for the executable.
716−
717− * Test improvements:
718−
719− + Use `getExecutablePath` from base, avoiding the dependency on
720− `executable-path`.
721− + Factor out `setupEnvironment` in Helpers, to avoid code duplication.
722− + Fix finding of data files by setting teh `pandoc_datadir` environment
723− variable when we shell out to pandoc. This avoids the need to use
724− `--data-dir` for the tests, which caused problems finding `pandoc.lua`
725− when compiling without the `embed_data_files` flag (#7163).
726−
727− * Benchmark improvements:
728−
729− + Build `+RTS -A8m -RTS` into default ghc-options for benchmark.
730− This is necessary to get accurate benchmark results; otherwise we
731− are largely measuring garbage collecting, some not related to the
732− current benchmark.
733− + Allow specifying BASELINE file in 'make bench' for comparison
734− (otherwise the latest benchmark is chosen by default).
735− + Force `readFile` in benchmarks early (Bodigrim).
736−
737− * CONTRIBUTING: suggest using a `cabal.project.local` file (#7153,
738− Albert Krewinkel).
739−
740− * Add ghcid-test to Makefile. This loads the test suite in ghcid.
741−
742−
743−## pandoc 2.12 (2021-03-08)
744−
745− * `--resource-path` now accumulates if specified multiple
746− times (#6152). Resource paths specified later on the command line are
747− prepended to those specified earlier. Thus,
748− `--resource-path foo --resource-path bar:baz` is equivalent to
749− `--resource-path bar:bas:foo`. (The previous behavior was
750− for the last `--resource-path` to replace all the rest.)
751− `resource-path` in defaults files behaves the same way: it
752− will be prepended to the resource path set by earlier
753− command line options or defaults files. This change
754− facilitates the use of multiple defaults files: each can
755− specify a directory containing resources it refers to
756− without clobbering the resource paths set by the others.
757−
758− * Allow defaults files to refer to the home directory, the
759− user data directory, and the directory containing the defaults file
760− itself (#5871, #5982, #5977). In fields that expect file paths
761− (and only in these fields),
762−
763− + `${VARIABLE}` will expand to the value of the environment variable
764− `VARIABLE` (and in particular `${HOME}` will expand to the path
765− of the home directory). A warning will be raised for undefined
766− variables.
767− + `${USERDATA}` will expand to the path of the user data
768− directory in force when the defaults file is being processed.
769− + `${.}` will expand to the directory containing the defaults file.
770− (This allows default files to be placed in a directory containing
771− resources they make use of.)
772−
773− * When downloading content from URL arguments, be sensitive to
774− the character encoding (#5600). We can properly handle UTF-8 and latin1
775− (ISO-8859-1); for others we raise an error. Fall back to latin1 if
776− no charset is given in the mime type and UTF-8 decoding fails.
777−
778− * Allow abbreviations that don't end in a period to be
779− specified using `--abbreviations` (#7124).
780−
781− * Add new unexported module Text.Pandoc.XML.Light, as well
782− as Text.Pandoc.XML.Light.Types, Text.Pantoc.XML.Light.Proc,
783− Text.Pandoc.XML.Light.Output. (Closes #6001, #6565, #7091).
784−
785− This module exports definitions of `Element` and `Content`
786− that are isomorphic to xml-light's, but with Text
787− instead of String. This allows us to keep most of the code in existing
788− readers that use xml-light, but avoid lots of unnecessary allocation.
789−
790− We also add versions of the functions from xml-light's
791− Text.XML.Light.Output and Text.XML.Light.Proc that operate on our
792− modified XML types, and functions that convert xml-light types to our
793− types (since some of our dependencies, like texmath, use xml-light).
794−
795− We export functions that use xml-conduit's parser to produce an
796− `Element` or `[Content]`. This allows existing pandoc code to use
797− a better parser without much modification.
798−
799− The new parser is used in all places where xml-light's parser was
800− previously used. Benchmarks show a significant performance improvement
801− in parsing XML-based formats (with docbook, opml, jats, and docx
802− almost twice as fast, odt and fb2 more than twice as fast).
803−
804− In addition, the new parser gives us better error reporting than
805− xml-light. We report XML errors, when possible, using the new
806− `PandocXMLError` constructor in `PandocError`.
807−
808− These changes revealed the need for some changes in the tests. The
809− docbook-reader.docbook test lacked definitions for the entities it used;
810− these have been added. And the docx golden tests have been updated,
811− because the new parser does not preserve the order of attributes.
812−
813− * DocBook reader:
814−
815− + Avoid expensive tree normalization step, as it is not necessary
816− with the new XML parser.
817− + Support `informalfigure` (#7079) (Nils Carlson).
818−
819− * Docx reader:
820−
821− + Use Map instead of list for Namespaces. This gives a speedup of
822− about 5-10%. With this and the XML parsing changes, the docx reader
823− is now about twice as fast as in the previous release.
824−
825− * HTML reader:
826−
827− + Small performance tweaks.
828− + Also, remove exported class `NamedTag(..)` [API change]. This was just
829− intended to smooth over the transition from String to Text and is no
830− longer needed.
831− + As a result, the functions `isInlineTag` and `isBlockTag`
832− are no longer polymorphic; they apply to a `Tag Text` [API change].
833− + Do a lookahead to find the right parser to use. This takes
834− benchmarks from 34ms to 23ms, with less allocation.
835− + Fix bad handling of empty `src` attribute in `iframe` (#7099).
836− If `src` is empty, we simply skip the `iframe`.
837− If `src` is invalid or cannot be fetched, we issue a warning
838− nd skip instead of failing with an error.
839−
840− * JATS reader:
841−
842− + Avoid tree normalization, which is no longer necessary given the
843− new XML parser.
844−
845− * LaTeX reader:
846−
847− + Don't export `tokenize`, `untokenize` [API change]. These are internal
848− implementation details, which were only exported for testing.
849− They don't belong in the public API.
850− + Improved efficiency of the parser. With these changes the reader
851− is almost twice as fast as in the last release in our benchmarks.
852− + Code cleanup, removing some unnecessary things.
853− + Rewrite `withRaw` so it doesn't rely on fragile assumptions
854− about token positions (which break when macros are expanded)
855− (#7092). This requires the addition of `sEnableWithRaw` and
856− `sRawTokens` in `LaTeXState`, and a new combinator `disablingWithRaw`
857− to disable collecting of raw tokens in certain contexts.
858− Add `parseFromToks` to Text.Pandoc.Readers.LaTeX.Parsing.
859− Fix parsing of single character tokens so it doesn't mess
860− up the new raw token collecting. These changes slightly increase
861− allocations and have a small performance impact.
862− + Handle some bibtex/biblatex-specific commands that used to be
863− dealt with in pandoc-citeproc (#7049).
864− + Optimize `satisfyTok`, avoiding unnecessary macro expansion steps.
865− Benchmarks after this change show 2/3 of the run time and 2/3 of the
866− allocation of the Feb. 10 benchmarks.
867− + Removed `sExpanded` in state. This isn't actually needed and checking
868− it doesn't change anything.
869− + Improve `braced'`. Remove the parameter, have it parse the
870− opening brace, and make it more efficient.
871− + Factor out pieces of the LaTeX reader to make the module smaller.
872− This reduces memory demands when compiling. Created
873− Text.Pandoc.Readers.{LaTeX,Math,Citation,Table,Macro,Inline}.
874− Changed Text.Pandoc.Readers.LaTeX.SIunitx to export a command map
875− instead of individual commands.
876− + Handle table cells containing `&` in `\verb` (#7129).
877−
878− * Make Text.Pandoc.Readers.LaTeX.Types an unexported module [API change].
879−
880− * Markdown reader:
881−
882− + Improved handling of mmd link attributes in references (#7080).
883− Previously they only worked for links that had titles.
884− + Improved efficiency of the parser (benchmarks show a 15% speedup).
885−
886− * OPML reader:
887−
888− + Avoid tree normalization, which is no longer necessary with the
889− new XML parser.
890−
891− * ODT reader:
892−
893− + Finer-grained errors on parse failure (#7091).
894− + Give more information if the zip container can't be unpacked.
895−
896− * Org reader:
897−
898− + Support `task_lists` extension (Albert Krewinkel, #6336).
899− + Fix bug in org-ref citation parsing (Albert Krewinkel, #7101).
900− The org-ref syntax allows to list multiple citations separated by
901− comma. Previously commas were accepted as part of the citation id,
902− so all citation lists were parsed as one single citation.
903−
904− * RST reader:
905−
906− + Use `getTimestamp` instead of `getCurrentTime` to fetch timestamp.
907− Setting `SOURCE_DATE_EPOCH` will allow reproducible builds.
908− + RST reader: fix handling of header in CSV tables (#7064).
909− The interpretation of this line is not affected by the delim option.
910−
911− * Jira reader:
912−
913− + Modified the Doc parser to skip leading blank lines. This fixes
914− parsing of documents which start with multiple blank lines (Albert
915− Krewinkel, #7095).
916− + Prevent URLs within link aliases to be treated as autolinks (Albert
917− Krewinkel, #6944).
918−
919− * Text.Pandoc.Shared
920−
921− + Remove formerly exported functions that are no longer used in the
922− code base: `splitByIndices`, `splitStringByIndicies`, `substitute`,
923− and `underlineSpan` (which had been deprecated in April 2020)
924− [API change].
925− + Export `handleTaskListItem` (Albert Krewinkel) [API change].
926− + Change `defaultUserDataDirs` to `defaultUserDataDir` [API
927− change]. We determine what is the default user data directory
928− by seeing whether the XDG directory and/or legacy
929− directory exist.
930−
931− * BibTeX writer:
932−
933− + BibTeX writer: use doclayout and doctemplate. This change allows
934− bibtex/biblatex output to wrap as other formats do,
935− depending on the settings of `--wrap` and `--columns` (#7068).
936−
937− * CSL JSON writer:
938−
939− + Output `[]` if no references in input, instead of raising a
940− PandocAppError as before.
941−
942− * Docx writer:
943−
944− + Use `getTimestamp` instead of `getCurrentTime` for timestamp.
945− Setting `SOURCE_DATE_EPOCH` will allow reproducible builds.
946−
947− * EPUB writer:
948−
949− + Use `getTimestamp` instead of `getCurrentTime` for timestamp.
950− Setting `SOURCE_DATE_EPOCH` will allow reproducible builds (#7093).
951− This does not suffice to fully enable reproducible in EPUB, since
952− a unique id is still being generated for each build.
953− + Support `belongs-to-collection` metadata (#7063) (Nick Berendsen).
954−
955− * JATS writer:
956−
957− + Escape special chars in reference elements (Albert Krewinkel).
958− Prevents the generation of invalid markup if a citation element
959− contains an ampersand or another character with a special meaning
960− in XML.
961−
962− * Jira writer:
963−
964− + Use Span identifiers as anchors (Albert Krewinkel).
965− + Use `{noformat}` instead of `{code}` for unknown languages (Albert
966− Krewinkel). Code blocks which are not marked as a language supported
967− by Jira are rendered as preformatted text via `{noformat}` blocks.
968−
969− * LaTeX writer:
970−
971− + Adjust hypertargets to beginnings of paragraphs (#7078).
972− Use `\vadjust pre` so that the hypertarget takes you to the beginning
973− of the paragraph rather than one line down.
974− This makes a particular difference for links to citations using
975− `--citeproc` and `link-citations: true`.
976− + Change BCP47 lang tag from `jp` to `ja` (Mauro Bieg, #7047).
977− + Use function instead of map for accent lookup (should be
978− more efficient).
979− + Split the module to make it easier to compile on low-memory
980− systems: added Text.Pandoc.Writers.LaTeX.{Util,Citation,Lang}.
981−
982− * Markdown writer:
983−
984− + Handle math right before digit. We insert an HTML comment to
985− avoid a `$` right before a digit, which pandoc will not recognize
986− as a math delimiter.
987− + Split the module to make it easier to compile on low-memory
988− systems: added Text.Pandoc.Writers.Markdown.{Types,Inline}.
989−
990− * ODT writer:
991−
992− + Use `getTimestamp` instead of `getCurrentTime` for timestamp.
993− Setting `SOURCE_DATE_EPOCH` will allow reproducible builds.
994− + Update default ODT style (Lorenzo). Previously, the "First paragraph"
995− style inherited from "Standard" but not from "Text body." Now
996− it is adjusted to inherit from "Text body", to avoid some ugly
997− spacing issues. It may be necessary to update a custom `reference.odt`
998− in light of this change.
999−
1000− * Org writer:
1001−
1002− + Support `task_lists` extension (Albert Krewinkel, #6336).
1003−
1004− * Pptx writer:
1005−
1006− + Use `getTimestamp` instead of `getCurrentTime` for timestamp.
1007− Setting `SOURCE_DATE_EPOCH` will allow reproducible builds.
1008−
1009− * JATS templates: tag `author.name` as `string-name` (Albert Krewinkel).
1010− The partitioning the components of a name into surname, given names,
1011− etc. is not always possible or not available. Using `author.name`
1012− allows to give the full name as a fallback to be used when
1013− `author.surname` is not available.
1014−
1015− * Add default templates for bibtex and biblatex, so that
1016− the variables `header-include`, `include-before`, `include-after`
1017− (or alternatively the command line options
1018− `--include-in-header`, `--include-before-body`, `--include-after-body`)
1019− may be used.
1020−
1021− * LaTeX template:
1022−
1023− + Update to iftex package (#7073) (Andrew Dunning)
1024− + Wrap url colours in braces (#7121) (Loïc Grobol).
1025−
1026− * revealjs template: Add 'center' option for vertical slide centering.
1027− (maurerle, #7104).
1028−
1029− * Text.Pandoc.XML: Improve efficiency of `fromEntities`.
1030−
1031− * Text.Pandoc.MIME
1032−
1033− + Add exported function `getCharset` [API change].
1034−
1035− * Text.Pandoc.UTF8: change IO functions to return Text, not String
1036− [API change]. This affects `readFile`, `getContents`, `writeFileWith`,
1037− `writeFile`, `putStrWith`, `putStr`, `putStrLnWith`, `putStrLn`.
1038− `hPutStrWith`, `hPutStr`, `hPutStrLnWith`, `hPutStrLn`, `hGetContents`.
1039− This avoids the need to uselessly create a linked list of characters
1040− when emiting output.
1041−
1042− * Text.Pandoc.App
1043−
1044− + Add `parseOptionsFromArgs` [API change, new exported function].
1045− + Add fields for CSL options to `Opt` [API change]:
1046− `optCSL`, `optbibliography`, `optCitationAbbreviations`.
1047−
1048− * Text.Pandoc.Citeproc.BibTeX
1049−
1050− + `Text.Pandoc.Citeproc.writeBibTeXString` now returns
1051− `Doc Text` instead of `Text` (#7068).
1052− + Correctly handle `pages` (= `page` in CSL) (#7067).
1053− + Correctly handle BibLaTeX `langid` (= `language` in CSL, #7067).
1054− + In BibTeX output, protect foreign titles since there's no language
1055− field (#7067).
1056− + Clean up BibTeX parsing (#7049). Previously there was a messy code
1057− path that gave strange results in some cases, not passing through raw
1058− tex but trying to extract a string content. This was an artefact of
1059− trying to handle some special bibtex-specific commands in the BibTeX
1060− reader. Now we just handle these in the LaTeX reader and simplify
1061− parsing in the BibTeX reader. This does mean that more raw tex will
1062− be passed through (and currently this is not sensitive to the
1063− `raw_tex` extension; this should be fixed).
1064−
1065− * Text.Pandoc.Citeproc.MetaValue
1066−
1067− + Correctly parse "raw" date value in markdown references metadata.
1068− (See jgm/citeproc#53.)
1069−
1070− * Text.Pandoc.Citeproc
1071−
1072− + Use https URLs for links (Salim B, #7122).
1073−
1074− * Text.Pandoc.Class
1075−
1076− + Add `getTimestamp` [API change]. This attempts to read the
1077− `SOURCE_DATE_EPOCH` environment variable and parse a UTC time
1078− from it (treating it as a unix date stamp, see
1079− https://reproducible-builds.org/specs/source-date-epoch/). If the
1080− variable is not set or can't be parsed as a unix date stamp, then the
1081− function returns the current date.
1082−
1083− * Text.Pandoc.Error
1084−
1085− + Add `PandocUnsupportedCharsetError` constructor for
1086− `PandocError` [API change].
1087− + Export `renderError` [API change].
1088− + Refactor `handleError` to use `renderError`. This allows us render
1089− error messages without exiting.
1090−
1091− * Text.Pandoc.Extensions
1092−
1093− + `Ext_task_lists` is now supported by org (and turned
1094− on by default) (Albert Krewinkel, #6336).
1095− + Remove `Ext_fenced_code_attributes` from allowed commonmark attributes
1096− (#7097). This attribute was listed as allowed, but it didn't actually
1097− do anything. Use `attributes` for code attributes and more.
1098−
1099− * Lua subsystem:
1100−
1101− + Always load built-in Lua scripts from default data-dir (Albert
1102− Krewinkel). The Lua modules `pandoc` and `pandoc.List` are now always
1103− loaded from the system's default data directory. Loading from a
1104− different directory by overriding the default path, e.g. via
1105− `--data-dir`, is no longer supported to avoid unexpected behavior
1106− and to address security concerns.
1107− + Add module "pandoc.path" (Albert Krewinkel, #6001, #6565).
1108− The module allows to work with file paths in a convenient and
1109− platform-independent manner.
1110− + Use strict evaluation when retrieving AST value from the stack
1111− (Albert Krewinkel, #6674).
1112−
1113− * Text.Pandoc.PDF
1114−
1115− + Disable `smart` extension when building PDF via LaTeX.
1116− This is to prevent accidental creation of ligatures like
1117− `` ?` `` and `` !` `` (especially in languages with quotations like
1118− German), and similar ligature issues. (See jgm/citeproc#54.)
1119−
1120− * Text.Pandoc.CSV:
1121−
1122− + Fix parsing of unquoted values (#7112). Previously we didn't allow
1123− unescaped quotes in unquoted values, but they are allowed
1124− in CSV.
1125−
1126− * Test suite:
1127−
1128− + Use a more robust method for testing the executable. Many
1129− of our tests require running the pandoc executable. This
1130− is problematic for a few different reasons. First,
1131− cabal-install will sometimes run the test suite after
1132− building the library but before building the executable,
1133− which means the executable isn't in place for the tests.
1134− One can work around that by first building, then building
1135− and running the tests, but that's fragile. Second, we
1136− have to find the executable. So far, we've done that using
1137− a function `findPandoc` that attempts to locate it
1138− relative to the test executable (which can be located
1139− using findExecutablePath). But the logic here is delicate
1140− and work with every combination of options. To solve both
1141− problems, we add an `--emulate` option to the
1142− `test-pandoc` executable. When `--emulate` occurs as the
1143− first argument passed to `test-pandoc`, the program simply
1144− emulates the regular pandoc executable, using the rest of
1145− the arguments (after `--emulate`). Thus, `test-pandoc
1146− --emulate -f markdown -t latex` is just like `pandoc -f
1147− markdown -t latex`. Since all the work is done by library
1148− functions, implementing this emulation just takes a couple
1149− lines of code and should be entirely reliable. With this
1150− change, we can test the pandoc executable by running the
1151− test program itself (locatable using `findExecutablePath`)
1152− with the `--emulate` option. This removes the need for the
1153− fragile `findPandoc` step, and it means we can run our
1154− integration tests even when we're just building the
1155− library, not the executable. [Note: part of this change
1156− involved simplifying some complex handling to set
1157− environment variables for dynamic library paths. I have
1158− tested a build with `--enable-dynamic-executable`, and it
1159− works, but further testing may be needed.]
1160− + Print accurate location if a test fails (Albert
1161− Krewinkel). Ensures that tasty-hunit reports the location
1162− of the failing test instead of the location of the helper
1163− `test` function.
1164−
1165− * Documentation: Update URLs and use `https` where possible (#7122,
1166− Salim B).
1167−
1168− * Add `doc/libraries.md`, a description of libraries that support pandoc.
1169−
1170− * MANUAL.txt
1171−
1172− + MANUAL: block-level formatting is not allowed in line blocks (#7107).
1173− + Clarify `tex_math_dollars` extension. Note that no blank lines
1174− are allowed between the delimiters in display math.
1175− + Add MANUAL section on reproducible builds.
1176− + Document no template fallback for absolute path (#7077, Nixon
1177− Enraght-Moony.)
1178− + Improve docs for cite-method.
1179− + Update README and man page.
1180−
1181− * Makefile: in `make bench`, create CSV files for comparison and compare
1182− against previous benchmark run. Add timestamp to CSV filenames.
1183−
1184− * cabal.project: don't explicitly set -trypandoc.
1185− If we do, this can't be overridden on the cabal command line.
1186−
1187− * doc/lua-filters.md: improve documentation for
1188− `pandoc.mediabag.insert`, `pandoc.mediabag.fetch`,
1189− `directory`, `normalize` (Albert Krewinkel).
1190−
1191− * Allow base64-bytestring-1.2.* (Dmitrii Kovanikov)
1192−
1193− * Require jira-wiki-markup 1.3.3 (Albert Krewinkel)
1194−
1195− * Require citeproc 0.3.0.8, which correctly titlecases when titles
1196− contain non-ASCII characters.
1197−
1198− * Use skylighting 0.10.4. This version of skylighting uses xml-conduit
1199− rather than hxt. This speeds up parsing of XML syntax definitions
1200− fourfold, and removes four packages from pandoc's dependency graph:
1201− hxt-charproperties, hxt-unicode, hxt-regex-xmlschema, hxt.
1202−
1203− * Add script `tools/parseTimings.pl` to help pin down which
1204− modules take the most time and memory to compile.
1205−
1206− * Avoid unnecessary use of NoImplicitPrelude pragma (#7089) (Albert
1207− Krewinkel)
1208−
1209− * Benchmarks
1210−
1211− + Use the lighter-weight tasty-bench instead of criterion.
1212− + Run writer benchmarks for binary formats too.
1213− + Alphabetize benchmarks.
1214− + Don't run benchmarks for bibliography formats
1215− (yet; we need a special input for them).
1216− + Show allocation data
1217− + Clean up benchmark code.
1218− + Allow specifying patterns using `-p blah'.
1219−
1220− * trypandoc: add 2 second timeout.
1221−
1222− * Use `-split-sections` in creating linux release binary.
1223− This reduces executable size significantly (by about 30%).
1224−
1225− * Remove `weigh-pandoc`. It's not really useful any more, now that our
1226− regular benchmarks include data on allocation.
1227−
1228− * Improve linux package build process and add script to
1229− automate building an arm64 binary package.
1230−
1231−
1232−## pandoc 2.11.4 (2021-01-22)
1233−
1234− * Add `biblatex`, `bibtex` as output formats (closes #7040).
1235−
1236− * Recognize more extensions as markdown by default (#7034):
1237− `mkdn`, `mkd`, `mdwn`, `mdown`, `Rmd`.
1238−
1239− * Implement defaults file inheritance (#6924, David Martschenko).
1240− Allow defaults files to inherit options from other defaults files by
1241− specifying them with the following syntax:
1242− `defaults: [list of defaults files or single defaults file]`.
1243−
1244− * Fix infinite HTTP requests when writing epubs from URL source (#7013).
1245− Due to a bug in code added to avoid overwriting the cover image
1246− if it had the form `fileX.YYY`, pandoc made an endless sequence
1247− of HTTP requests when writing epub with input from a URL.
1248−
1249− * Org reader:
1250−
1251− + Allow multiple pipe chars in todo sequences (Albert Krewinkel, #7014).
1252− Additional pipe chars, used to separate "action" state from "no further
1253− action" states, are ignored. E.g., for the following sequence, both
1254− `DONE` and `FINISHED` are states with no further action required:
1255− `#+TODO: UNFINISHED | DONE | FINISHED`.
1256− + Restructure output of captioned code blocks (Albert Krewinkel, #6977).
1257− The Div wrapper of code blocks with captions now has the class
1258− "captioned-content". The caption itself is added as a Plain block
1259− inside a Div of class "caption". This makes it easier to write filters
1260− which match on captioned code blocks. Existing filters will need to be
1261− updated.
1262− + Mark verbatim code with class `verbatim` (Dimitri Sabadie, #6998).
1263−
1264− * LaTeX reader:
1265−
1266− + Handle `filecontents` environment (#7003).
1267− + Put contents of unknown environments in a Div when `raw_tex` is not
1268− enabled (#6997). (When `raw_tex` is enabled, the whole environment is
1269− parsed as a raw block.) The class name is the name of the environment.
1270− Previously, we just included the contents without the surrounding Div,
1271− but having a record of the environment's boundaries and name can be
1272− useful.
1273−
1274− * Mediawiki reader:
1275−
1276− + Allow space around storng/emph delimiters (#6993).
1277−
1278− * New module Text.Pandoc.Writers.BibTeX, exporting
1279− writeBibTeX and writeBibLaTeX. [API change]
1280−
1281− * LaTeX writer:
1282−
1283− + Revert table line height increase in 2.11.3 (#6996).
1284− In 2.11.3 we started adding `\addlinespace`, which produced less dense
1285− tables. This wasn't an intentional change; I misunderstood a comment in
1286− the discussion leading up to the change. This commit restores the earlier
1287− default table appearance. Note that if you want a less dense table, you
1288− can use something like `\def\arraystretch{1.5}` in your header.
1289−
1290− * EPUB writer:
1291−
1292− + Adjust internal links to identifiers defined in raw HTML sections
1293− after splitting into chapters (#7000).
1294− + Recognize `Format "html4"`, `Format "html5"` as raw HTML.
1295− + Adjust internal links to images, links, and tables after splitting into
1296− chapters. Previously we only did this for Div and Span and Header
1297− elements (see #7000).
1298−
1299− * Ms writer:
1300−
1301− + Don't justify text inside table cells.
1302−
1303− * JATS writer:
1304−
1305− + Use `<element-citation>` if `element_citations`
1306− extension is enabled (Albert Krewinkel).
1307− + Fix citations (Albert Krewinkel, #7018). By default
1308− we use formatted citations.
1309− + Ensure that `<disp-quote>` is always wrapped in `<p>` (#7041).
1310−
1311− * Markdown writer:
1312−
1313− + Cleaned up raw formats. We now react appropriately
1314− to `gfm`, `commonmark`, and `commonmark_x` as raw formats.
1315−
1316− * RST writer:
1317−
1318− + Fix bug with dropped content from inside spans with a class in
1319− some cases (#7039).
1320−
1321− * Docx writer:
1322−
1323− + Handle table header using styles (#7008). Instead of hard-coding
1324− the border and header cell vertical alignment, we now let this
1325− be determined by the Table style, making use of Word's
1326− "conditional formatting" for the table's first row. For
1327− headerless tables, we use the tblLook element to tell Word
1328− not to apply conditional first-row formatting.
1329−
1330− * Commonmark writer:
1331−
1332− + Implement start number on ordered lists (#7009). Previously they always
1333− started at 1, but according to the spec the start number is respected.
1334−
1335− * HTML writer:
1336−
1337− + Fix implicit_figure at end of footnotes (#7006).
1338−
1339− * ConTeXt template: Remove `\setupthinrules` from default template.
1340− The width parameter this used is not actually supported,
1341− and the command didn't do anything.
1342−
1343− * Text.Pandoc.Extensions:
1344−
1345− + Add `Ext_element_citations` constructor (Albert Krewinkel).
1346−
1347− * Text.Pandoc.Citeproc.BibTeX: New unexported function
1348− `writeBibtexString`.
1349−
1350− * Text.Pandoc.Citeproc:
1351−
1352− + Use finer grained imports (Albert Krewinkel).
1353− + Factor out and export `getStyle` [API change].
1354− + Export `getReferences` [API change, #7106].
1355− + Factor out getLang.
1356−
1357− * Text.Pandoc.Parsing: modify `gridTableWith'` for headerless tables.
1358− If the table lacks a header, the header row should be an empty
1359− list. Previously we got a list of empty cells, which caused
1360− an empty header to be emitted instead of no header. In LaTeX/PDF
1361− output that meant we got a double top line with space between.
1362−
1363− * ImageSize: use `viewBox` for SVG if no length, width attributes (#7045).
1364− This change allows pandoc to extract size information from more SVGs.
1365−
1366− * Add simple default.nix.
1367−
1368− * Use commonmark 0.1.1.3.
1369−
1370− * Use citeproc 0.3.0.5.
1371−
1372− * Update default CSL to use latest chicago-author-date.csl.
1373−
1374− * CONTRIBUTING.md: add note on GNU xargs.
1375−
1376− * MANUAL.txt:
1377−
1378− + Update description of `-L`/`--lua-filter`.
1379− + Document use of citations in note styles (#6828).
1380−
1381−## pandoc 2.11.3.2 (2020-12-29)
1382−
1383− * HTML reader: use renderTags' from Text.Pandoc.Shared (Albert Krewinkel).
1384− A side effect of this change is that empty `<col>` elements are written
1385− as self-closing tags in raw HTML blocks.
1386−
1387− * Asciidoc writer: Add support for writing nested tables (#6972, timo-a).
1388− Asciidoc supports one level of nesting. If deeper tables are to be
1389− written, they are omitted and a warning is issued.
1390−
1391− * Docx writer: fix nested tables with captions (#6983).
1392− Previously we got unreadable content, because docx seems
1393− to want a `<w:p>` element (even an empty one) at the end of
1394− every table cell.
1395−
1396− * Powerpoint writer: allow arbitrary OOXML in raw inline elements
1397− (Albert Krewinkel). The raw text is now included verbatim in the
1398− output. Previously is was parsed into XML elements, which prevented
1399− the inclusion of partial XML snippets.
1400−
1401− * LaTeX writer: support colspans and rowspans in tables (#6950,
1402− Albert Krewinkel). Note that the multirow package is needed for
1403− rowspans. It is included in the latex template under a variable,
1404− so that it won't be used unless needed for a table.
1405−
1406− * HTML writer: don't include p tags in CSL bibliography entries
1407− (#6966). Fixes a regression in 2.11.3.
1408−
1409− * Add `meta-description` variable to HTML templates (#6982). This
1410− is populated by the writer by stringifying the `description`
1411− field of metadata (Jerry Sky). The `description` meta tag will
1412− make the generated HTML documents more complete and SEO-friendly.
1413−
1414− * Citeproc: fix handling of empty URL variables (`DOI`, etc.).
1415− The `linkifyVariables` function was changing these to links
1416− which then got treated as non-empty by citeproc, leading
1417− to wrong results (e.g. ignoring nonempty URL when empty DOI is present).
1418− See jgm/citeproc#41.
1419−
1420− * Use citeproc 0.3.0.3. Fixes an issue in author-only citations when
1421− both an author and translator are present, and an issue with
1422− citation group delimiters.
1423−
1424− * Require texmath 0.12.1. This improves siunitx support in math,
1425− fixes bugs with `\*mod` family operators and arrays, and avoids
1426− italicizing symbols and operator names in docx output.
1427−
1428− * Ensure that the perl interpreter used for filters with `.pl`
1429− extension (wuffi).
1430−
1431− * MANUAL: note that textarea content is never parsed as Markdown
1432− (Albert Krewinkel).
1433−
1434−
1435−## pandoc 2.11.3.1 (2020-12-18)
1436−
1437− * Added some missing files to extra-source-files and data
1438− files, so they are included in the sdist tarball. Closes #6961.
1439− Cleaned up some extraneous data and test files, and added
1440− a CI check to ensure that the test and data files included
1441− in the sdist match what is in the git repository.
1442−
1443− * Use citeproc 0.3.0.1, which avoids removing nonbreaking
1444− space at the end of the `initialize-with` attribute. (Some
1445− journals require nonbreaking space after initials, and this
1446− makes that possible.)
1447−
1448−## pandoc 2.11.3 (2020-12-17)
1449−
1450− * With `--bibliography` (or `bibliography` in metadata), a
1451− URL may now be provided, and pandoc will fetch the resource.
1452− In addition, if a file path is provided and it is not
1453− found relative to the working directory, the resource
1454− path will be searched (#6940).
1455−
1456− * Add `sourcepos` extension for `commonmark`, `gfm`, `commonmark_x`
1457− (#4565). With the `sourcepos` extension set set, `data-pos`
1458− attributes are added to the AST by the commonmark reader. No other
1459− readers are affected. The `data-pos` attributes are put on elements
1460− that accept attributes; for other elements, an enlosing Div or Span
1461− is added to hold the attributes.
1462−
1463− * Change extensions for `commonmark_x`: replace `auto_identifiers`
1464− with `gfm_auto_identifiers` (#6863). `commonmark_x` never actually
1465− supported `auto_identifiers` (it didn't do anything), because the
1466− underlying library implements gfm-style identifiers only. Attempts
1467− to add the `auto_identifiers` extension to `commonmark` will now
1468− fail with an error.
1469−
1470− * HTML reader:
1471−
1472− + Split module into several submodules (Albert Krewinkel). Reducing
1473− module size should reduce memory use during compilation.
1474− + Support advanced table features (Albert Krewinkel):
1475− block level content in captions, row and colspans,
1476− body headers, row head columns, footers, attributes.
1477− + Disable round-trip testing for tables. Information for cell
1478− alignment in a column is not preserved during round-trips (Albert
1479− Krewinkel).
1480− + Allow finer grained options for tag omission (Albert Krewinkel).
1481− + Simplify list attribute handling (Albert Krewinkel).
1482− + Pay attention to `lang` attributes on body element (#6938).
1483− These (as well as `lang` attributes on the html element) should update
1484− lang in metadata.
1485− + Retain attribute prefixes and avoid duplicates (#6938).
1486− Previously we stripped attribute prefixes, reading `xml:lang` as
1487− `lang` for example. This resulted in two duplicate `lang`
1488− attributes when `xml:lang` and `lang` were both used. This commit
1489− causes the prefixes to be retained, and also avoids invald
1490− duplicate attributes.
1491−
1492− * Commonmark reader:
1493−
1494− + Refactor `specFor`.
1495− + Set input name to `""` to avoid clutter in sourcepos output.
1496−
1497− * Org reader:
1498−
1499− + Parse `#+LANGUAGE` into `lang` metadata field (#6845, Albert
1500− Krewinkel).
1501− + Preserve targets of spurious links (#6916, Albert
1502− Krewinkel). Links with (internal) targets that the reader doesn't
1503− know about are converted into emphasized text. Information on the
1504− link target is now preserved by wrapping the text in a Span of class
1505− `spurious-link`, with an attribute `target` set to the link's
1506− original target. This allows to recover and fix broken or unknown
1507− links with filters.
1508−
1509− * DocBook reader:
1510−
1511− + Table text width support (#6791, Nils Carlson).
1512− Table width in relation to text width is not natively supported
1513− by docbook but is by the docbook `fo` stylesheets through an XML
1514− processing instruction, `<?dbfo table-width="50%"?>`.
1515−
1516− * LaTeX reader:
1517−
1518− + Improve parsing of command options (#6869, #6873).
1519− In cases where we run into trouble parsing inlines til the
1520− closing `]`, e.g. quotes, we return a plain string with the
1521− option contents. Previously we mistakenly included the brackets
1522− in this string.
1523− + Preserve center environment (#6852, Igor Pashev).
1524− The contents of the `center` environment are put in a `Div`
1525− with class `center`.
1526− + Don't parse `\rule` with width 0 as horizontal rule. These are
1527− sometimes used as spacers in LaTeX.
1528− + Don't apply theorem default styling to a figure inside (#6925).
1529− If we put an image in italics, then when rendering to Markdown
1530− we no longer get an implicit figure.
1531−
1532− * Dokuwiki reader:
1533−
1534− + Handle unknown interwiki links better (#6932).
1535− DokuWiki lets the user define his own Interwiki links. Previously
1536− pandoc reacted to these by emitting a google search link, which is
1537− not helpful. Instead, we now just emit the full URL including the
1538− wikilink prefix, e.g. `faquk>FAQ-mathml`. This at least gives users
1539− the ability to modify the links using filters.
1540−
1541− * Markdown writer:
1542−
1543− + Properly handle boolean values in writing YAML metadata (#6388).
1544− + Ensure that a new csl-block begins on a new line (#6921).
1545− This just looks better and doesn't affect the semantics.
1546−
1547− * RST writer:
1548−
1549− + Better image handling (#6948). An image alone in its paragraph
1550− (but not a figure) is now rendered as an independent image, with an
1551− `alt` attribute if a description is supplied. An inline image that
1552− is not alone in its paragraph will be rendered, as before, using a
1553− substitution. Such an image cannot have a "center", "left", or
1554− "right" alignment, so the classes `align-center`, `align-left`, or
1555− `align-right` are ignored. However, `align-top`, `align-middle`,
1556− `align-bottom` will generate a corresponding `align` attribute.
1557−
1558− * Docx writer:
1559−
1560− + Keep raw openxml strings verbatim (#6933, Albert Krewinkel).
1561− + Use Content instead of Element. This allows us to inject
1562− raw OpenXML into the document without reparsing it into an
1563− Element, which is necessary if you want to inject an open
1564− tag or close tag.
1565− + Fix bullets/lists indentation, so that the first level is slightly
1566− indented to the right instead of right on the margin (cholonam).
1567− + Support bold and italic in "complex script" (#6911).
1568− Previously bold and italics didn't work properly in LTR
1569− text. This commit causes the w:bCs and w:iCs attributes
1570− to be used, in addition to w:b and w:i, for bold and
1571− italics respectively.
1572−
1573− * ICML writer:
1574−
1575− + Fix image bounding box for custom widths/heighta (Mauro Bieg, #6936).
1576−
1577− * LaTeX writer:
1578−
1579− + Improve table spacing (#6842, #6860).
1580− Remove the `\strut` that was added at the end of minipage
1581− environments in cells. Replace `\tabularnewline` with
1582− `\\ \addlinespace`.
1583− + Improve calculation of column spacing (#6883).
1584− + Extract table handling into separate module (Albert Krewinkel).
1585− + Fix bug with nested `csl-` display Spans (#6921).
1586− + Improve longtable output (#6883). Don't create minipages for
1587− regular paragraphs. Put width and alignment information in the
1588− longtable column descriptors.
1589−
1590− * OpenDocument writer:
1591−
1592− + Support for table width as a percentage of text width
1593− (#6792, Nils Carson).
1594− + Implement Div and Span ident support (#6755, Nils Carson).
1595− Spans and Divs containing an ident in the Attr will become bookmarks
1596− or sections with idents in OpenDocument format.
1597− + Add two extensions, `xrefs_name` and `xrefs_number` (#6774, Nils
1598− Carlson). Links to headings, figures and tables inside the
1599− document are substituted with cross-references that will use the
1600− name or caption of the referenced item for `xrefs_name` or the
1601− number for `xrefs_number`. For the `xrefs_number` to be useful
1602− heading numbers must be enabled in the generated document and
1603− table and figure captions must be enabled using for example the
1604− `native_numbering` extension. In order for numbers and reference
1605− text to be updated the generated document must be refreshed.
1606−
1607− * JATS writer:
1608−
1609− + Support advanced table features (Albert Krewinkel).
1610− + Support author affiliations (#6687, Albert Krewinkel).
1611−
1612− * Docbook writer:
1613−
1614− + Use correct id attribute consistently (Jan Tojnar).
1615− DocBook5 should always use `xml:id` instead of `id`.
1616− + Handle admonition titles better (Jan Tojnar).
1617− Docbook reader produces a `Div` with `title` class for `<title>`
1618− element within an “admonition” element. Markdown writer then turns
1619− this into a fenced div with `title` class attribute. Since fenced
1620− divs are block elements, their content is recognized as a
1621− paragraph by the Markdown reader. This is an issue for Docbook
1622− writer because it would produce an invalid DocBook document from
1623− such AST – the `<title>` element can only contain “inline”
1624− elements. Handle this special case separately by unwrapping
1625− the paragraph before creating the `<title>` element.
1626− + Add XML namespaces to top-level elements (#6923, Jan Tojnar).
1627− Previously, we only added `xmlns` attributes to chapter
1628− elements, even when running with `--top-level-division=section`.
1629− These namespaces are now added to part and section elements too,
1630− when they are the selected top-level divisions.
1631− We do not need to add namespaces to documents produced with
1632− `--standalone` flag, since those will already have xmlns attribute on
1633− the root element in the template.
1634−
1635− * HTML writer:
1636−
1637− + Fix handling of nested `csl-` display spans (#6921).
1638− Previously inner Spans used to represent CSL display attributes were
1639− not rendered as div tags as intended.
1640−
1641− * EPUB writer:
1642−
1643− + Include title page in landmarks (#6919).
1644− Note that the toc is also included if `--toc` is specified.
1645− + Add frontmatter type on body element for nav.xhtml (#6918).
1646−
1647− * EPUB templates: use preserveAspectRatio="xMidYMid" for cover image (#6895,
1648− Shin Sang-jae). This change affects both the epub2 and the epub3
1649− templates. It avoids distortion of the cover image by requiring that the
1650− aspect ratio be preserved.
1651−
1652− * LaTeX template:
1653−
1654− + Include `csquotes` package if `csquotes` variable set.
1655− + Put back `amssymb`. We need it for checkboxes in todo lists,
1656− and maybe for other things. In this location it seems compatible
1657− with the cases that prompted #6469 and PR #6762.
1658− + Disable language-specific shorthands in babel (#6817, #6887).
1659− Babel defines "shorthands" for some languages, and these can
1660− produce unexpected results. For example, in Spanish, `1.22`
1661− gets rendered as `122`, and `et~al.` as `etal`.
1662− One would think that babel's `shorthands=off` option (which
1663− we were using) would disable these, but it doesn't. So we
1664− remove `shorthands=off` and add some code that redefines
1665− the shorthands macro. Eventually this will be fixed in babel,
1666− I hope, and we can revert to something simpler.
1667−
1668− * JATS template: allow array of persistent institute ids in `pid`
1669− (Albert Krewinkel).
1670−
1671− * Text.Pandoc.Parsing: minor code and efficiency improvements.
1672−
1673− * Text.Pandoc.Extension:
1674−
1675− + Add `Ext_sourcepos` constructor for `Extension` [API change].
1676− + Add `Ext_xrefs_name` and `Ext_xrefs_number` constructors for
1677− `Extension` (Nils Carson) [API change].
1678−
1679− * Text.Pandoc.Citeproc:
1680−
1681− + Fix truncation of `[Citation]` list in `Cite` inside footnotes (#6890).
1682− This affected author-in-text citations in footnotes. It didn't cause
1683− problems for the printed output, but for filters that expected the
1684− citation id and other information.
1685− + Allow the use of both inline and external references (#6951),
1686− as with pandoc-citeproc. References defined in the document's
1687− metadata take priority over references with the same id defined in
1688− an external bibliography.
1689− + Use `fetchItem` to get external bibliography (#6940).
1690− + Ensure that BCP47 lang codes can be used. We ignore the variants
1691− and just use the base lang code and country code when passing off
1692− to citeproc.
1693− + Citeproc BibTeX parser: revert change in `getRawField`
1694− which was made (for reasons forgotten) when transferring
1695− this code from pandoc-citeproc. The change led to `--` in
1696− URLs being interpreted as en-dashes, which is unwanted (#6874).
1697−
1698− * Text.Pandoc.ImageSize:
1699−
1700− + Default to DPI 72 if the format specifies DPI of 0 (#6880).
1701− This shouldn't happen, in general, but it can happen with
1702− JPEGs that don't conform to the spec. Having a DPI of 0
1703− will blow up size calculations (division by 0).
1704− + ImageSize: use JuicyPixels to determine size for png, jpeg, and
1705− gif, instead of doing our own binary parsing (#6936). This
1706− gives more reliable results.
1707−
1708− * Text.Pandoc.CSS:
1709−
1710− + Remove `foldOrElse` (internal module) (Albert Krewinkel).
1711−
1712− * Use skylighting 0.10.2 (#6625).
1713−
1714− * Use citeproc 0.3. This fixes issues with references with
1715− duplicate ids (jgm/citeproc#36).
1716−
1717− * Use doctemplates 0.9. This fixes issues with boolean
1718− metadata values in the Markdown writer (#6388)
1719− and in `meta-json` (#6650). It also fixes
1720− issues with nested for loops in templates.
1721−
1722− * Add translations zh-Hans.yaml and zh-Hant.yaml (#6904, #6909,
1723− Kolen Cheung, taotieren).
1724−
1725− * Add tests: True to cabal.project.
1726− This fixes some CI failures for cabal.
1727−
1728− * Normalize test/tables/*.native (#6888, Kolen Cheung).
1729−
1730− * Move executable to `app` directory to avoid problems with cabal repl.
1731−
1732− * CONTRIBUTING: add section "How can I help?" (#6892, Albert Krewinkel).
1733− Also adds a paragraph aimed at highlighting the importance of feature
1734− maintenance.
1735−
1736− * MANUAL: Document that --number-sections works in `ms` (#6935).
1737−
1738−
1739−## pandoc 2.11.2 (2020-11-19)
1740−
1741− * Default to using ATX (`##`-style) headings for Markdown output
1742− (#6662, Aner Lucero). Previously we used Setext (underlined) headings
1743− by default for levels 1--2.
1744−
1745− * Add option `--markdown-headings=atx|setext`, and deprecate
1746− `--atx-headers` (#6662, Aner Lucero).
1747−
1748− * Support `markdown-headings` in defaults files.
1749−
1750− * Fix corner case in YAML metadata parsing (#6823). Previously YAML
1751− metadata would sometimes not get recognized if a field ended with a
1752− newline followed by spaces.
1753−
1754− * `--self-contained`: increase coverage (#6854).
1755− Previously we only self-contained attributes for certain tag names
1756− (`img`, `embed`, `video`, `input`, `audio`, `source`, `track`,
1757− `section`). Now we self-contain any occurrence of `src`,
1758− `data-src`, `poster`, or `data-background-image`, on any tag; and
1759− also `href` on `link` tags.
1760−
1761− * Markdown reader:
1762−
1763− + Fix detection of locators following in-text citations.
1764− Prevously, if we had `@foo [p. 33; @bar]`, the `p. 33` would be
1765− incorrectly parsed as a prefix of `@bar` rather than a suffix of
1766− `@foo`.
1767− + Improve period suppression algorithm for citations in notes
1768− in note citation styles (#6835).
1769− + Don't increment `stateNoteNumber` for example list references.
1770− This helps with #6836 (a bug in which example list references
1771− disturb calculation of citation note number and affect when
1772− `ibid` is triggered).
1773−
1774− * LaTeX reader:
1775−
1776− + Move `getNextNumber` from Readers.LaTeX to Readers.LaTeX.Parsing.
1777− + Fix negative numbers in siunitx commands. A change in pandoc 2.11
1778− broke negative numbers, e.g. `\SI{-33}{\celcius}` or `\num{-3}`.
1779− This fixes the regression.
1780−
1781− * DocBook reader: drop period in formalpara title
1782− and put it in a div with class `formalpara-title`, so that
1783− people can reformat with filters (#6562).
1784−
1785− * Man reader: improve handling of `.IP` (#6858). We now better handle
1786− `.IP` when it is used with non-bullet, non-numbered lists, creating a
1787− definition list. We also skip blank lines like groff itself.
1788−
1789− * Bibtex reader: fall back on `en-US` if locale for LANG not found.
1790− This reproduces earlier pandoc-citeproc behavior (jgm/citeproc#26).
1791−
1792− * JATS writer:
1793−
1794− + Wrap all tables (Albert Krewinkel).
1795− All `<table>` elements are put inside `<table-wrap>` elements, as the
1796− former are not valid as immediate child elements of `<body>`.
1797− + Move Table handling to separate module (Albert Krewinkel).
1798− Adds two new unexported modules:
1799− Text.Pandoc.Writers.JATS.Types, Text.Pandoc.Writers.JATS.Table.
1800−
1801− * Org writer:
1802−
1803− + Replace org #+KEYWORDS with #+keywords (TEC).
1804− As of ~2 years ago, lower case keywords became the standard (though
1805− they are handled case insensitive, as always).
1806− + Update org supported languages and identifiers according to the
1807− current list contained in
1808− <https://orgmode.org/worg/org-contrib/babel/languages/index.html>
1809− (TEC).
1810−
1811− * Only use `filterIpynbOutput` if input format is ipynb (#6841).
1812− Before this change content could go missing from divs with class
1813− `output`, even when non-ipynb was being converted.
1814−
1815− * When checking reader/writer name, check base name now that we permit
1816− extensions on formats other than markdown.
1817−
1818− * Text.Pandoc.PDF: Fix `changePathSeparators` for Windows (#6173).
1819− Previously a path beginning with a drive, like `C:\foo\bar`, was
1820− translated to `C:\/foo/bar`, which caused problems.
1821− With this fix, the backslashes are removed.
1822−
1823− * Text.Pandoc.Logging:
1824−
1825− + Add constructor `ATXHeadingInLHS` to `LogMessage` [API change].
1826− + Add constructor `EnvironmentVariableUndefined` to
1827− `LogMessage` [API change].
1828−
1829− * Fix error that is given when people specify `doc` output (#6834,
1830− gison93).
1831−
1832− * LaTeX template: add a `\break` after parbox in `CSLRightInline`.
1833− This should fix spacing problems between entries with numeric styles.
1834− Also fix number of params on `CSLReferences`.
1835−
1836− * reveal.js template: Put quotes around `controlsLayout`,
1837− `controlsBackArrows`, and `display`, since these require strings.
1838− Add `showSlideNumber`, `hashOneBasedIndex`, `pause`.
1839−
1840− * Use citeproc 0.2. This fixes a bug with title case around parentheses.
1841−
1842− * pandoc.cabal: remove 'static' flag.
1843− This isn't really necessary and can be misleading (e.g. on macOS,
1844− where a fully static build isn't possible). cabal's new option
1845− `--enable-executable-static` does the same. On stack you can add
1846− something like this to the options for your executable in package.yaml:
1847−
1848− ld-options: -static -pthread
1849−
1850− * Remove obsolete bibutils flag setting in `linux/make_artifacts.sh`.
1851−
1852− * Manual:
1853−
1854− + Correct `link-citation` -> `link-citations`.
1855− + Add a sentence about `pagetitle` for HTML (#6843, Alex Toldaiev).
1856−
1857− * INSTALL.md: Remove references to `pandoc-citeproc` (#6857).
1858−
1859− * CONTRIBUTING: describe hlint and how it's used (#6840, Albert
1860− Krewinkel).
1861−
1862−## pandoc 2.11.1.1 (2020-11-07)
1863−
1864− * Citeproc: improve punctuation in in-text note citations (#6813).
1865− Previously in-text note citations inside a footnote would sometimes have
1866− the final period stripped, even if it was needed (e.g. on the end of
1867− 'ibid').
1868−
1869− * Use citeproc 0.1.1.1. This improves the decision about when
1870− to use `ibid` in cases where citations are used inside
1871− a footnote (#6813).
1872−
1873− * Support `nocase` spans for `csljson` output.
1874−
1875− * Require latest commonmark, commonmark-extensions.
1876− This fixes a bug with `autolink_bare_uris` and commonmark.
1877−
1878− * LaTeX reader: better handling of `\\` inside math in table cells (#6811).
1879−
1880− * DokuWiki writer: translate language names for code elements
1881− and improve whitespace (#6807).
1882−
1883− * MediaWiki writer: use `syntaxhighlight` tag instead of deprecated
1884− `source` for highlighted code (#6810). Also support `startFrom`
1885− attribute and `numberLines`.
1886−
1887− * Lint code in PRs and when committing to master (#6790,
1888− Albert Krewinkel).
1889−
1890− * doc/filters.md: describe technical details of filter invocations (#6815,
1891− Albert Krewinkel).
1892−
1893−
1894−## pandoc 2.11.1 (2020-11-03)
1895−
1896− * DocBook Reader: fix duplicate bibliography bug (#6773, Nils Carlson).
1897−
1898− * HTML reader:
1899−
1900− + Parse contents of iframes (#6770).
1901− + Parse inline svg as image unless `raw_html` is set in the reader (in
1902− which case the svg is passed through as raw HTML) (#6770).
1903−
1904− * LaTeX reader:
1905−
1906− + Fix bug parsing macro arguments (#6796). If `\cL` is
1907− defined as `\mathcal{L}`, and `\til` as `\tilde{#1}`, then
1908− `\til\cL` should expand to `\tilde{\mathcal{L}}`, but
1909− pandoc was expanding it to `\tilde\mathcal{L}`. This is
1910− fixed by parsing the arguments in "verbatim mode" when the
1911− macro expands arguments at the point of use.
1912− + Properly support optional (cite) argument for
1913− `\blockquote` from `csquotes` (#6802).
1914−
1915− * LaTeX writer: Improved calculation of table column widths.
1916− We now have LaTeX do the calculation, using `\tabcolsep`.
1917− So we should now have accurate relative column widths no
1918− matter what the text width. The default template has been modified to load
1919− the calc package if tables are used.
1920−
1921− * HTML writer: Fix duplicate "class" attribute for table
1922− rows (Andy Morris).
1923−
1924− * Text.Pandoc.Filter: allow shorter YAML representation of Citeproc
1925− (Albert Krewinkel). The map-based YAML representation of filters expects
1926− `type` and `path` fields. The path field had to be present for all filter
1927− types, but is not used for citeproc filters. The field can now be omitted
1928− when type is "citeproc", as described in the MANUAL.
1929−
1930− * Text.Pandoc.Error: Add `PandocBibliographyError` constructor
1931− for `PandocError` [API change]. This ensures that bibliography parsing
1932− errors generate messages that include the bibliography file name --
1933− otherwise it can be quite mysterious where it is coming from.
1934−
1935− * Citeproc: properly handle `csl` field with `data:` URI (#6783).
1936− This is used with the JATS writer, so this fixes a regression
1937− in pandoc 2.11 with JATS output and citeproc.
1938−
1939− * Allow `citation-abbreviations` in defaults file.
1940−
1941− * JATS templates: ensure `jats_publishing` output is valid
1942− (Albert Krewinkel).
1943−
1944− * LaTeX template: Fix `CSLRightInline`, so that it does not
1945− run over the right margin.
1946−
1947− * HTML template: default CSS tweaks (Mauro Bieg and John
1948− MacFarlane).
1949−
1950− - Fix margin before codeblock
1951− - Add `monobackgroundcolor` variable, making the background color
1952− and padding of code optional.
1953− - Ensure that backgrounds from highlighting styles take precedence over
1954− monobackgroundcolor
1955− - Remove list markers from TOC
1956− - Add margin-bottom where needed
1957− - Remove italics from blockquote styling
1958− - Change borders and spacing in tables to be more consistent with other
1959− output formats
1960− - Style h5, h6
1961− - Set font-size for print media to 12pt.
1962− - Reduce interline space.
1963− - Reduce interparagraph space.
1964− - Reduce line width.
1965− - Remove the special `line-height: 1` for table cells.
1966− - Remove the special line-height for pre.
1967− - Ensure that there is a bit more space before a heading
1968− than after.
1969− - Slightly reduced space after title header.
1970− - Add CSS example to MANUAL
1971−
1972− * man template: Change comment that triggers `tbl` from
1973− `.\"t` to `'\" t`, as specified in groff_man(7) (#6803).
1974−
1975− * Use latest commonmark, commonmark-extensions.
1976− This fixes a bug with nested blocks in footnotes with the
1977− `footnote` extension to `commonmark`. See jgm/commonmark-hs#63.
1978−
1979− * Citeproc: use comma for in-text citations inside footnotes.
1980− When an author-in-text citation like `@foo` occurs in a footnote,
1981− we now render it with: `AUTHOR NAME + COMMA + SPACE + REST`.
1982− Previously we rendered: `AUTHOR NAME + SPACE + "(" + REST + ")"`.
1983− This gives better results. Note that normal citations are still
1984− rendered in parentheses.
1985−
1986− * Use latest citeproc:
1987−
1988− + citeproc no longer capitalizes notes, so we do it
1989− in pandoc when appropriate.
1990− + Closes #6783.
1991−
1992− * Clarify manual on `--track-changes` (#6801).
1993−
1994− * Add `doc/jats.md` to document pandoc's handling of JATS
1995− (#6794, Albert Krewinkel).
1996−
1997− * Fix code example in lua-filters.md (#6795).
1998−
1999−## pandoc 2.11.0.4 (2020-10-21)
2000−
2001− * Commonmark writer: fix regression with fenced divs (#6768).
2002− Starting with 2.10.1, fenced divs no longer render with
2003− HTML div tags in commonmark output. This is a regression
2004− due to our transition from cmark-gfm. This commit fixes it.
2005−
2006− * Use released version of citeproc. (This fixes a mis-step
2007− in the 2.11.0.3 release, which is now deprecated.)
2008−
2009− * Use latest sylighting, with support for `groovy`.
2010−
2011− * Document that --html-q-tags requires the smart extension on the reader
2012− (#6766).
2013−
2014−## pandoc 2.11.0.3 (2020-10-20)
2015−
2016− * Use latest citeproc (closes #6765). This fixes a problem with
2017− author-in-text citations for references including both an author
2018− and an editor. Previously, both were included in the text, but only
2019− the author should be.
2020−
2021− * With `--citeproc`, ensure that the final period is removed when
2022− citations that occur in notes in note-based styles get put in
2023− parentheses. See jgm/citeproc#20.
2024−
2025− * Normalize rewritten image paths with `--extract-media` (#6761).
2026− This change will avoid mixed paths like this one when
2027− `--extract-media` is used with a Word file:
2028− `![](C:\Git\TIJ4\Markdown/media/image30.wmf)`. Instead we'll get
2029− `![](C:\Git\TIJ4\Markdown`media`image30.wmf)`.
2030−
2031− * Modify `--version` output. Use space more efficiently and report the
2032− citeproc and ipynb versions, along with skylighting, texmath, and
2033− pandoc-types. Drop the word "default" before "user data directory."
2034−
2035− * DocBook reader: bibliomisc and anchor support (#6754, Nils Carlson).
2036− Also ensure that bibliodiv without a title no longer results in
2037− an empty Header.
2038−
2039− * ConTeXt template: adds `\setupinterlinespace` to fonts larger
2040− than normal (#6763, Denis Maier).
2041−
2042− * LaTeX template: Do not load amssymb if not needed (#6469, Angelo Peronio).
2043− See <https://tex.stackexchange.com/a/549938>.
2044−
2045− * Relax upper bound on hslua, allow hslua-1.3.* (Albert Krewinkel).
2046−
2047− * MANUAL:
2048−
2049− + Improve explanation of "indent" variable (#6767, Cyrus Yip).
2050− + Remove org from list of input formats supporting raw_tex (#6753,
2051− Nick Fleisher).
2052−
2053−
2054−## pandoc 2.11.0.2 (2020-10-15)
2055−
2056− * Fix handling of `xdata` in bibtex/biblatex bibliographies (#6752).
2057−
2058− * Fix some small typos in the API documentation (#6751, Michael Hoffmann).
2059−
2060− * Require citeproc 0.1.0.2. This fixes a regression from pandoc-citeproc
2061− involving spacing between components of a reference in certain styles
2062− (e.g. `cell.csl`).
2063−
2064− * Fix typos in comments, doc strings, error messages, and tests
2065− (Albert Krewinkel, #6738).
2066−
2067−## pandoc 2.11.0.1 (2020-10-13)
2068−
2069− * LaTeX reader: support more acronym commands (#6746):
2070− `\acl`, `\aclp`, and capitalized versions of already
2071− supported commands.
2072−
2073− * Commonmark reader: add `pipe_table` extension *after* defaults (#6739).
2074− Otherwise we get bad results for non-table, non-paragraph
2075− lines containing pipe characters.
2076−
2077− * Markdown writer: Fix autolinks rendering for gfm (#6740).
2078− Previously, autolinks rendered as raw HTML, due to the
2079− `class="uri"` added by pandoc's markdown reader.
2080−
2081− * LaTeX writer:
2082−
2083− + Escape option values in lstlistings environment (#6742).
2084− + Fix handling of `lang` `pt-BR` (#2953). For polyglossia we now
2085− use `\setmainlanguage[variant=brazilian]{portuguese}` and for babel
2086− `\usepackage[shorthands=off,main=brazilian]{babel}`.
2087−
2088− * Depend on latest citeproc (0.1.0.1).
2089−
2090− + This fixes the citation number issue with ieee.csl and other
2091− styles that do not explicitly sort bibliographies (#6741). (Pandoc
2092− was numbering them by their order in the bibliography file,
2093− rather than the order cited, as required by the CSL spec.)
2094− + Fixes groupin/collapsing with citation items with prefixes.
2095−
2096− * default.latex: fix `CSLReference` macro definition.
2097−
2098− * Fix MANUAL.txt CSL JSON conversion examples.
2099−
2100− * Fix spelling errors in changelog, MANUAL.txt, `doc/org.md` (#6738).
2101−
2102−
2103−## pandoc 2.11 (2020-10-11)
2104−
2105− * Add `--citeproc` (`-C`) option to trigger built-in citation processing.
2106− It is no longer necessary to use the external `pandoc-citeproc`
2107− filter. `--citeproc` behaves like a filter and can be positioned
2108− relative to other filters as they appear on the command line.
2109−
2110− The new built-in citation processing uses the citeproc library,
2111− a reimplementation of CSL citation processing that fixes many
2112− of the shortcomings of pandoc-citeproc. In general, citation
2113− processing should work much the same as it did with pandoc-citeproc,
2114− but with greater fidelity to CSL styles and better performance.
2115− (The tests from the pandoc-citeproc package have been carried
2116− over to pandoc.) The following differences should be noted:
2117−
2118− - At this point, only some of the writers (HTML, ms, LaTeX) properly
2119− interpret CSL display styles. You should get decent output in
2120− all formats (at least as good as with pandoc-citeproc), but
2121− indentation and block-alignment may not be right.
2122−
2123− - pandoc-citeproc searches the `~/.csl` directory for `.csl`
2124− styles. Pandoc instead searches the `csl` subdirectory of
2125− the pandoc user data directory (e.g., `~/.pandoc/csl` or
2126− `~/.local/share/pandoc/csl`). Users who already keep
2127− CSL styles in `~/.csl` may find it convenient to add a
2128− symlink.
2129−
2130− - Some of the bibliography formats supported by pandoc-citeproc (via
2131− hs-bibutils) are no longer supported: Copac, EndNote,
2132− ISI, MEDLINE, MODS, and RIS. If you use one of these formats,
2133− you may use the `bibutils` utility to convert to BibLaTeX.
2134− We now support only BibTeX, BibLaTeX, CSL JSON,
2135− and pandoc's YAML/Markdown analogue of CSL JSON.
2136−
2137− - pandoc-citeproc would always retrieve the independent parent
2138− of a dependent style by doing an HTTP request. pandoc will
2139− now first seek the independent parent locally (in the resource
2140− path or in the `csl` subdirectory of the pandoc user data
2141− directory) before resorting to HTTP. In addition, you may
2142− omit the `.csl` extension, e.g. `--csl zoology`.
2143−
2144− - Using the `--bibliography` option (or including
2145− `bibliography` in YAML metadata) no longer triggers
2146− citation processing implicitly: one must always use the
2147− `--citeproc` option if citation processing is wanted.
2148−
2149− * Add `csljson` as and input and output format. This allows pandoc
2150− to convert between `csljson` and other bibliography formats
2151− (e.g. `-f csljson -t markdown -s` or `-f bibtex -t csljson`),
2152− and to generate formatted versions of CSL JSON bibliographies
2153− (e.g., `pandoc -f csljson --citeproc pl.json -o pl.pdf`).
2154−
2155− * Added `bibtex`, `biblatex` as input formats. This allows pandoc
2156− to convert between BibLaTeX and BibTeX and other bibliography formats,
2157− and to generated formatted versions of BibTeX/BibLaTeX bibliographies
2158− (e.g., `pandoc -f biblatex --citeproc pl.bib -o pl.pdf`).
2159−
2160− * Raise informative errors when YAML metadata parsing fails (#6730).
2161− Previously the command would succeed, returning empty metadata,
2162− with no errors or warnings.
2163−
2164− * Sort languages in `--list-highlight-languages` output (#6718,
2165− Albert Krewinkel). Languages were previously sorted by their
2166− long name, which leads to unexpected results).
2167−
2168− * Add CSS to default HTML template (#6601, Mauro Bieg). This
2169− greatly improves the default typography in pandoc's HTML
2170− output. The CSS is sensitive to a number of variables
2171− (e.g. `mainfont`, `fontsize`, `linestretch`): see the manual for
2172− details. To restore the earlier, more spartan output, you can
2173− disable this with `-M document-css=false`.
2174−
2175− * Support `--toc-depth` option for ODT writer (#6696, niszet).
2176−
2177− * Fix issues with Windows UNC paths with some options (#5127).
2178−
2179− * Remove `fenced_code_blocks` and `backtick_code_blocks` from allowed
2180− `commonmark` and `gfm` extensions. These shouldn't really be counted
2181− as extensions, because they can't be disabled in commonmark.
2182− Adjust markdown writer to check for the commonmark variant in addition
2183− to extensions.
2184−
2185− * Add these extensions to `gfm` and `commonmark`:
2186− `fenced_code_blocks`, `backtick_code_blocks`, `fenced_code_attributes`.
2187− These can't really be disabled in the reader, but they need to be enabled
2188− in the writer or we just get indented code.
2189−
2190− * Make sure proper set of extensions is recognized for `commonmark_x`.
2191−
2192− * Allow `gfm_auto_identifiers`, `ascii_identifiers` extensions for `docx`.
2193−
2194− * Markdown reader:
2195−
2196− + Add `Maybe FilePath` parameter to `yamlToMeta` [API change].
2197− + Export `yamlToRefs` [API change], a version of `yamlToMeta`
2198− specialized to references.
2199− + Set `citationNoteNum` accurately in citations.
2200− + Revise abbreviation support. Don't insert a nonbreaking space after a
2201− potential abbreviation if it comes right before a note or citation.
2202− This causes problems for citeproc's moving of note citations.
2203−
2204− * LaTeX reader:
2205−
2206− + Support missing siunitx commands (#6658).
2207− + Support `squared`, `cubed`, `tothe` in siunitx (#6657).
2208− + Improved uncertainty handling in slunitx.
2209− + Factored out siunitx stuff into separate unexposed module.
2210− + Fix improper empty cell filtering (#6689, Christian Despres).
2211− + Fix parsing of "show name" in `\newtheorem` (#6734).
2212− Previously we were just treating it as a string and
2213− ignoring accents and formatting.
2214− + Prevent wrong nesting of `\multirow` and `\multicolumn` table
2215− cells (#6603, Laurent P. René de Cotret).
2216− + Table cell parser not consuming spaces correctly (#6596,
2217− Laurent P. René de Cotret).
2218− + Change `SIRange` to `SIrange` (#6617, Emerson Harkin).
2219− + Allow blank lines inside `\author` (#6324).
2220−
2221− * DocBook reader:
2222−
2223− + Don't squelch space at end of emphasis and other inline elements;
2224− instead, move it outside the element (#6719).
2225− + Implement table cell alignment (#6698, Nils Carlson).
2226− + Implement column span support for tables (#6492, Nils Carlson).
2227− + Update list of block level tags (#6610).
2228−
2229−
2230− * JATS reader:
2231−
2232− + Don't squelch space at end of emphasis and other inline elements;
2233− instead, move it outside the element (#6719).
2234−
2235− * RST reader:
2236−
2237− + Apply `.. class::` directly to following Header rather than creating
2238− a surrounding Div (#6699).
2239−
2240− * Docx reader:
2241−
2242− + Allow empty dates in comments and tracked changes (#6726, Diego
2243− Balseiro).
2244−
2245− * Markdown writer:
2246−
2247− + Be less aggressive about using quotes for YAML values,
2248− allowing e.g. a quotation mark or bracket as long as it's not at the
2249− beginning of the line.
2250− + Use double quotes for YAML metadata (#6727).
2251− + Sort YAML metadata keys in Markdown output case-insensitive.
2252−
2253−
2254− * Asciidoc writer:
2255−
2256− + Support asciidoctor's block figures (#6538, argent0).
2257−
2258− * LaTeX writer:
2259−
2260− + Fix spacing issue with list in definition list.
2261− When a list occurs at the beginning of a definition list definition,
2262− it can start on the same line as the label, which looks bad.
2263− Fix that by starting such lists with an `\item[]`.
2264−
2265− * HTML writer:
2266−
2267− + Support intermediate table headers (#5314, Albert Krewinkel).
2268− + Support attributes on all table elements (Albert Krewinkel).
2269− + Render table footers if present (#6314, Albert Krewinkel).
2270− + Fix addition of `doc-biblioentry` role.
2271− + Support colspans and rowspans in HTML tables (#6312, Albert Krewinkel).
2272−
2273− * ICML writer:
2274−
2275− + Support internal document links (#5541, Leonard Rosenthol).
2276− + Changed default link state to invisible (#6676, Leonard Rosenthol).
2277−
2278− * Docx writer:
2279−
2280− + Better handle list items whose contents are lists (#5948, Michael
2281− Hoffmann). If the first element of a bulleted or ordered list is
2282− another list, then that first item would previously disappear if the
2283− target format is docx.
2284− + Separate adjacent tables (#4315). Word combines adjacent tables,
2285− so to prevent this we insert an empty paragraph between two
2286− adjacent tables.
2287−
2288− * Org writer:
2289−
2290− + Don't force blank line after headings (#6554).
2291−
2292− * OpenDocument writer:
2293−
2294− + Implement table cell alignment (#6700 Nils Carson, Mauro Bieg).
2295− + New table cell support with row and column spans (#6682, Nils Carson).
2296− + Syntax highlighting for inline code (#6711, niszet).
2297−
2298− * Add Text.Pandoc.Citeproc module, exporting `processCitations`
2299− [API change]. This depends on several other, unexported
2300− modules under Text.Pandoc.Citeproc.
2301−
2302− * Add module Text.Pandoc.Writers.CslJson, exporting `writeCslJson`.
2303− [API change]
2304−
2305− * Add module Text.Pandoc.Readers.CslJson, exporting `readCslJson`.
2306− [API change]
2307−
2308− * Add module Text.Pandoc.Readers.BibTeX, exporting `readBibTeX` and
2309− `readBibLaTeX`. [API change]
2310−
2311− * Text.Pandoc.Filter: Add `CiteprocFilter` constructor to Filter.
2312− [API change] This runs the processCitations transformation.
2313− We need to treat it like a filter so it can be placed
2314− in the sequence of filter runs (after some, before others).
2315− In FromYAML, this is parsed from `citeproc` or `{type: citeproc}`,
2316− so this special filter may be specified either way in a defaults file
2317− (or by `citeproc: true`, though this gives no control of positioning
2318− relative to other filters).
2319−
2320− * Add new exported module Text.Pandoc.Writers.AnnotatedTable [API change]
2321− (#6655, Christian Despres). This module (which should generally
2322− be imported qualified to avoid name conflicts) provides a
2323− `Table` type that mirrors the structure of a pandoc `Table`,
2324− but with added inferred information so that the writers do not have to
2325− lay out tables themselves. The `toTable` and `fromTable` functions convert
2326− between an annotated `Table` and a regular pandoc `Table`. In addition to
2327− producing a `Table` with coherent and well-formed annotations, the
2328− `toTable` function also normalizes its input table like the table
2329− builder does. Tests ensure that `toTable` normalizes tables exactly
2330− like the table builder, and that its annotations are coherent.
2331−
2332− * Text.Pandoc.Logging:
2333−
2334− + Remove unused `CouldNotParseYamlMetadata` constructor for `LogMessage`
2335− [API change].
2336− + Add `CiteprocWarning` constructor to `LogMessage` [API change].
2337−
2338− * Text.Pandoc.Readers.Metadata: export `yamlBsToRefs` [API change].
2339− These allow specifying an id filter so we parse only references
2340− that are used in the document.
2341−
2342− * Text.Pandoc.Parsing:
2343−
2344− + Export ParseError [API change].
2345− + Add `stateInNote` and `stateNoteNumber` to `ParserState`
2346− [API change]. These are used to populate note numbers for citation
2347− processing.
2348−
2349− * Fix apparent typos in sample.lua (#6729, William Lupton).
2350− Also make the writer less aggressive in escaping quotes.
2351−
2352− * Text.Pandoc.Options:
2353−
2354− + `defaultMathJaxURL`: use `tex-chtml-full` instead of `tex-mml-chtml`
2355− (#6599, Kolen Cheung). This drops the MathML support (which we
2356− don't need for HTML math rendering) and includes the full JavaScript,
2357− which makes it possible to use `--self-contained` (though there may
2358− still be issues if the required math fonts aren't available). This
2359− change should also reduce latency in pages with lots of formulas.
2360− + Add `/tex-chtml-full.js` to `defaultMathJaxURL` (#6593) Previously we
2361− added this in processing command line options, but not in processing
2362− defaults files, which was inconsistent.
2363−
2364− * epub.css: Fix cover page selectors and add note explaining their use
2365− (#6649, a-vrma).
2366−
2367− * Add data files needed for Text.Pandoc.Citeproc: these include
2368− `default.csl` in the data directory and a `citeproc` directory that
2369− is only used at compile-time for biblatex localizations. Note that we've
2370− added `file-embed` as a mandatory rather than a conditional
2371− dependency, because of the biblatex localization files.
2372−
2373− * Lua filters:
2374−
2375− + Add SimpleTable for backwards compatibility (#6575, Albert Krewinkel).
2376− A new type `SimpleTable` is made available to Lua filters. It is
2377− similar to the `Table` type in pandoc versions before 2.10;
2378− conversion functions from and to the new Table type are provided.
2379− Old filters using tables now require minimal changes and can use, e.g.,
2380−
2381− if PANDOC_VERSION > {2,10,1} then
2382− pandoc.Table = pandoc.SimpleTable
2383− end
2384−
2385− and
2386−
2387− function Table (tbl)
2388− tbl = pandoc.utils.to_simple_table(tbl)
2389− …
2390− return pandoc.utils.from_simple_table(tbl)
2391− end
2392−
2393− to work with the current pandoc version.
2394−
2395− + Make `attr` argument optional in `Table` constructor (Albert Krewinkel).
2396− This changes the Lua API. It is highly unlikely for this change to affect
2397− existing filters, since the documentation for the new Table constructor
2398− (and type) was incomplete and partly wrong before. The Lua API is now
2399− more consistent, as all constructors for elements with attributes now
2400− take attributes as the last parameter.
2401−
2402− * MANUAL.txt:
2403−
2404− * Add a dedicated Citations section which consolidates the information
2405− the manual used to contain about citation processing, and incorporates
2406− some information formerly found in the pandoc-citeproc man page.
2407− + Add note about lualatex using `selnolig`.
2408− + Remove duplicate `seriespage` (#6568, Blake Eryx).
2409− + Remove lists of support extensions for markdown variants (#6604).
2410− Instead, offer the advice to use `--list-extensions=FORMAT`.
2411− + Fix position of attributes in header (Albert Krewinkel).
2412− + Delete obsolete section on compact and loose lists (#6684).
2413−
2414−
2415− * doc/lua-filters.md:
2416−
2417− + Add info on how to debug Lua filters (#6732, Ian Max Andolina).
2418− + Document Underline type and constructor (Albert Krewinkel).
2419− + Document `body` field (Albert Krewinkel).
2420− + Add missing header attribute
2421− + Add missing Link.title field (Albert Krewinkel).
2422− + Make the setting-the-date example conditional (the-solipsist).
2423− This makes the example a bit more realistic.
2424− + Remove outdated link table example.
2425−
2426− * doc/org.md:
2427−
2428− + Add section on tables (Albert Krewinkel).
2429− + Add section on handling of unknown directives (Albert Krewinkel).
2430−
2431− * CONTRIBUTING.md: fix typo (#6584, Dmitry Volodin).
2432−
2433− * Use golden test framework for command tests. This means that
2434− `--accept` can be used to update expected output.
2435−
2436− * Use the `smart` extension when generating pandoc's man page (#6613).
2437−
2438− * Release-candidate: don't build windows i386.
2439− So far we haven't been able to figure out how to get
2440− stack to use a 32-bit ghc.
2441−
2442− * Use `null` instead of deprecated `Builder.isNull`.
2443−
2444− * Makefile:
2445−
2446− + Fix macospkg target to fetch target from S3 artifacts.
2447− + Fix pandoc-templates target to include all partials.
2448−
2449− * Remove duplicated dependency in pandoc.cabal (#6591, Felix Yan).
2450−
2451− * Sort build depends in pandoc.cabal alphabetically (#6691,
2452− Albert Krewinkel).
2453−
2454− * Add .travis.yml for macos release candidate build (#6622).
2455− We need to build the release candidate on Travis rather
2456− than GitHub actions, because GH has macos 10.15, and
2457− binaries compiled on that OS will not work with 10.13.
2458− This build is only triggered on `rc/*` branches.
2459−
2460− * Remove instructions for building pandoc-citeproc from CI and
2461− release binary build instructions. We will no longer distribute
2462− pandoc-citeproc.
2463−
2464− * Fix math rendering in trypandoc (this broke after
2465− commit d8ad766d17603784b86fc5c2e1b22864125d04d1).
2466−
2467− * Use latest versions of skylighting, commonmark (#6589),
2468− comonmark-extensions, commonmark-pandoc, texmath.
2469−
2470− * Relax version bounds for hslua, hslua-module-text, bytestring.
2471−
2472− * Use released pandoc-types 1.22. This changes the JSON
2473− encoding slightly for the new table types introduced
2474− in 1.21, so they're more consistent with the rest.
2475− Developers of libraries for pandoc filters will want
2476− to take note.
2477−
2478− * Fix hlint suggestions, update hlint.yaml (#6680, Christian Despres).
2479−
2480− * Code cleanup (#6678, Joseph C. Sible).
2481−
2482− * Add haddocks to functions in Text.Pandoc.Writers.Shared (Albert
2483− Krewinkel).
2484−
2485− * Remove duplicate `tshow` definition.
2486−
2487− * Linux release candidate build: use ghc-musl container. This simplifies
2488− our build process (over using a customized alpine container).
2489−
2490−
24913## pandoc 2.10.1 (2020-07-23)
24924
24935 * Add `commonmark_x` output format. This is `commonmark` with a number
@@ -2605,7 +117,7 @@
2605117 * Ms writer:
2606118
2607119 + Fix code highlighting with blank lines. Previously blank lines
2608− were simply omitted from highlighted code.
120+ were simply omitted from highligted code.
2609121 + Escape starting periods in ms writer code blocks (#6505, Michael
2610122 Hoffmann). If a line of ms code block output starts with a period (.),
2611123 it should be prepended by `\&` so that it is not interpreted as a roff
@@ -3068,7 +580,7 @@
3068580 * Make it possible to compile using Stack on NixOS (#6439, Mathieu
3069581 Boespflug).
3070582
3071− * CI action to check for commit message length (Nikolay Yakimov, #6398).
583+ * CI action to check for commit messsage length (Nikolay Yakimov, #6398).
3072584
3073585
3074586## pandoc 2.9.2.1 (2020-03-23)
@@ -3635,7 +1147,7 @@
36351147 The main impact of this change is better reflowing of
36361148 content interpolated into templates. Previously,
36371149 interpolated variables were rendered independently and
3638− interpolated as strings, which could lead to overly long
1150+ intepolated as strings, which could lead to overly long
36391151 lines. Now the templates interpolated as Doc values which
36401152 may include breaking spaces, and reflowing occurs after
36411153 template interpolation rather than before.
@@ -4114,7 +1626,7 @@
41141626 a margin and font size according to their level.
41151627 Furthermore this commit allows changing the font with which code is
41161628 formatted via the `monofont` option.
4117− + Start numbering at appropriate numbers (Jesse Rosenthal, #5709).
1629+ + Start numbering at appopriate numbers (Jesse Rosenthal, #5709).
41181630 Starting numbers for ordered lists were previously ignored. Now
41191631 we specify the number if it is something other than 1.
41201632
@@ -5433,7 +2945,7 @@
54332945 * Man/Ms writers: Don't escape `-` as `\-`. The `\-` gets rendered
54342946 in HTML and PDF as a unicode minus sign.
54352947
5436− * Ms writer: Ensure we have a newline after .EN in display math (#5251).
2948+ * Ms writer: Ensure we have a newline after .EN in disply math (#5251).
54372949
54382950 * RST writer: Don't wrap simple table header lines (#5128).
54392951
@@ -5565,7 +3077,7 @@
55653077 + Set default listings language for lua, assembler (#5227, John
55663078 MacFarlane). Otherwise we get an error when trying to compile code
55673079 with lua or assembler code. To change the default dialect
5568− (currently 5.3 for lua and x86masm for assembler), you can use
3080+ (currenty 5.3 for lua and x86masm for assembler), you can use
55693081 `--include-in-header` to inject something like
55703082 `\lstset{defaultdialect=[5.2]Lua}`.
55713083
@@ -9262,7 +6774,7 @@
92626774
92636775 * Removed `hard_line_breaks` extension from `markdown_github` (#3594).
92646776 GitHub has two Markdown modes, one for long-form documents like READMEs
9265− and one for short things like issue comments. In issue comments, a line
6777+ and one for short things like issue coments. In issue comments, a line
92666778 break is treated as a hard line break. In README, wikis, etc., it is
92676779 treated as a space as in regular Markdown. Since pandoc is more likely to
92686780 be used to convert long-form documents from GitHub Markdown,
@@ -9615,7 +7127,7 @@
96157127 top-level `Text.Pandoc` module.
96167128
96177129 + Changed `StringWriter` -> `TextWriter`.
9618− + `getWriter` now returns a pair of a reader and
7130+ + `getWriter` now retuns a pair of a reader and
96197131 `Extensions`, instead of building the extensions into the
96207132 reader (#3659). The calling code must explicitly set
96217133 `readerExtensions` using the `Extensions` returned. The
@@ -10567,7 +8079,7 @@
105678079 + Use `unicode-math` (Vaclav Haisman). Use `mathspec` with only
105688080 XeLaTeX on request.
105698081 + Don't load `fontspec` before `unicode-math` (over there).
10570− The `unicode-math` package loads `fontspec` so explicit loading of
8082+ The `unicode-math` package loads `fontspec` so explict loading of
105718083 `fontspec` before `unicode-math` is not necessary.
105728084 + Use `unicode-math` by default in default.latex template. mathspec will
105738085 be used in xelatex if the `mathspec` variable is set; otherwise
@@ -11248,7 +8760,7 @@
112488760 is now used in parsing RST and Markdown line blocks, DocBook
112498761 `linegroup`/`line` combinations, and Org-mode `VERSE` blocks.
112508762 Previously `Para` blocks with hard linebreaks were used. `LineBlock`s
11251− are handled specially in the following output formats: AsciiDoc
8763+ are handled specially in the following ouput formats: AsciiDoc
112528764 (as `[verse]` blocks), ConTeXt (`\startlines`/`\endlines`),
112538765 HTML (`div` with a style), Markdown (line blocks if `line_blocks`
112548766 is enabled), Org-mode (`VERSE` blocks), RST (line blocks). In
@@ -11395,7 +8907,7 @@
113958907 comma-separated list.
113968908 + Give precedence to later meta lines. The last meta-line of any given
113978909 type is the significant line. Previously the value of the first line
11398− was kept, even if more lines of the same type were encountered.
8910+ was kept, even if more lines of the same type were encounterd.
113998911 + Read LaTeX_header as header-includes. LaTeX-specific header commands
114008912 can be defined in `#+LaTeX_header` lines. They are parsed as
114018913 format-specific inlines to ensure that they will only show up in LaTeX
@@ -11443,7 +8955,7 @@
114438955 be able to figure out internal links to a header in a docx if the
114448956 anchor span was empty. We change that to read the inlines out of the
114458957 first anchor span in a header.
11446− + Let headers use existing id. Previously we always generated an id for
8958+ + Let headers use exisiting id. Previously we always generated an id for
114478959 headers (since they wouldn't bring one from Docx). Now we let it use an
114488960 existing one if possible. This should allow us to recurs through anchor
114498961 spans.
@@ -12022,7 +9534,7 @@
120229534 character. Empty rows where parsed as alignment rows and dropped from
120239535 the output.
120249536 + Fix spacing after LaTeX-style symbols.
12025− The org-reader was dropping space after unescaped LaTeX-style symbol
9537+ The org-reader was droping space after unescaped LaTeX-style symbol
120269538 commands: `\ForAll \Auml` resulted in `∀Ä` but should give `∀ Ä`
120279539 instead. This seems to be because the LaTeX-reader treats the
120289540 command-terminating space as part of the command. Dropping the trailing
@@ -12357,7 +9869,7 @@
123579869
123589870 * Entity handling fixes: improved handling of entities like
123599871 `&lang;` that require a trailing semicolon. Allow uppercase
12360− `x` in numerical hexadecimal character references, working
9872+ `x` in numerical hexidecimal character references, working
123619873 around a tagsoup bug.
123629874
123639875 * `stack.yaml` - use lts-4.0, but with older aeson to avoid excessive
@@ -13842,7 +11354,7 @@
1384211354 * `Text.Pandoc.Shared`:
1384311355
1384411356 + Make safeRead safe (#1801, Matthew Pickering).
13845− + Added `mapLeft`, `hush` (Matthew Pickering).
11357+ + Addded `mapLeft`, `hush` (Matthew Pickering).
1384611358
1384711359 * `Text.Pandoc.Pretty`:
1384811360
@@ -13910,7 +11422,7 @@
1391011422
1391111423 + Use `text:p` instead of `text:h` for title.
1391211424 Using `text:h` causes problems with numbering. Closes #2059.
13913− Thanks to @nkalvi for diagnosing this.
11425+ Thansk to @nkalvi for diagnosing this.
1391411426
1391511427 * reveal.js template:
1391611428
@@ -14176,7 +11688,7 @@
1417611688 * RST writer:
1417711689
1417811690 + Ensure blank line after figure.
14179− + Avoid excess whitespace after last list item (#1777).
11691+ + Avoid exces whitespace after last list item (#1777).
1418011692 + Wrap line blocks with spaces before continuations (#1656).
1418111693 + Fixed double-rendering of footnotes in RST tables (#1769).
1418211694
@@ -14238,7 +11750,7 @@
1423811750 + Renumber header and footer relationships to avoid collisions (Jesse
1423911751 Rosenthal). We previously took the old relationship names of the
1424011752 headers and footer in secptr. That led to collisions. We now make
14241− a map of available names in the relationships file, and then rename
11753+ a map of availabl names in the relationships file, and then rename
1424211754 in secptr.
1424311755
1424411756 * ConTeXt writer:
@@ -14961,7 +12473,7 @@
1496112473 different versions of the `directory` library.
1496212474
1496312475 + Added `Text.Pandoc.Compat.Except` to allow building against
14964− different versions of `mtl`.
12476+ different verions of `mtl`.
1496512477
1496612478 * Code cleanup in some writers, using Reader monad to avoid
1496712479 passing options parameter around (Matej Kollar).
@@ -16600,7 +14112,7 @@
1660014112 + Include HTML TOC, even in epub2. The TOC is included in `<spine>`,
1660114113 but `linear` is set to `no` unless the `--toc` option is specified.
1660214114 Include `<guide>` element in OPF. This should allow the TOC to
16603− be usable in Kindles when converted with kindlegen. Closes #773.
14115+ be useable in Kindles when converted with kindlegen. Closes #773.
1660414116
1660514117 * `Text.Pandoc.Parsing`: Optimized `oneOfStringsCI`.
1660614118 This dramatically reduces the speed penalty that comes from enabling the
@@ -17196,7 +14708,7 @@
1719614708 be a parenthesized emphasized "hello".
1719714709 The new list is taken from the PHP source of textile 2.4.
1719814710 + Fixed autolinks. Previously the textile reader and writer
17199− incorrectly implemented RST-style autolinks for URLs and email
14711+ incorrectly implented RST-style autolinks for URLs and email
1720014712 addresses. This has been fixed. Now an autolink is done this way:
1720114713 `"$":http://myurl.com`.
1720214714 + Fixed footnotes bug in textile. This affected notes occurring
@@ -18259,7 +15771,7 @@
1825915771 Items are no longer installed as root.
1826015772 Man pages are zipped and given proper permissions.
1826115773
18262− * Modified windows installer generator to use cabal-dev.
15774+ * Modified windows installer generater to use cabal-dev.
1826315775
1826415776 * Setup: Making man pages now works with cabal-dev (at least on OSX). In
1826515777 Setup.hs we now invoke 'runghc' in a way that points it to the correct
data/default.csl+2−12
@@ -27,9 +27,6 @@
2727 <email>matthew.g.roth@yale.edu</email>
2828 <uri> https://orcid.org/0000-0001-7902-6331</uri>
2929 </contributor>
30− <contributor>
31− <name>Brenton M. Wiernik</name>
32− </contributor>
3330 <category citation-format="author-date"/>
3431 <category field="generic-base"/>
3532 <summary>The author-date variant of the Chicago style</summary>
@@ -512,15 +509,8 @@
512509 </choose>
513510 </macro>
514511 <macro name="event">
515− <group delimiter=" ">
516− <choose>
517− <if variable="genre">
518− <text term="presented at"/>
519− </if>
520− <else>
521− <text term="presented at" text-case="capitalize-first"/>
522− </else>
523− </choose>
512+ <group>
513+ <text term="presented at" suffix=" "/>
524514 <text variable="event"/>
525515 </group>
526516 </macro>
data/docx/word/settings.xml+16−6
@@ -1,6 +1,6 @@
11<?xml version="1.0" encoding="UTF-8"?>
22<w:settings xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main">
3− <w:zoom w:percent="100" />
3+ <w:zoom w:percent="90" />
44 <w:embedSystemFonts />
55 <w:proofState w:spelling="clean" w:grammar="clean" />
66 <w:stylePaneFormatFilter w:val="0004" />
@@ -17,21 +17,31 @@
1717 <w:characterSpacingControl w:val="doNotCompress" />
1818 <w:savePreviewPicture />
1919 <w:rsids>
20+ <w:rsidRoot w:val="00590D07" />
21+ <w:rsid w:val="00011C8B" />
22+ <w:rsid w:val="004E29B3" />
23+ <w:rsid w:val="00590D07" />
24+ <w:rsid w:val="00784D58" />
25+ <w:rsid w:val="008D6863" />
26+ <w:rsid w:val="00B86B75" />
27+ <w:rsid w:val="00BC48D5" />
28+ <w:rsid w:val="00C36279" />
29+ <w:rsid w:val="00E315A3" />
2030 </w:rsids>
2131 <m:mathPr>
22− <m:mathFont m:val="Cambria Math" />
32+ <m:mathFont m:val="Lucida Grande" />
2333 <m:brkBin m:val="before" />
2434 <m:brkBinSub m:val="--" />
25− <m:smallFrac m:val="0" />
26− <m:dispDef />
35+ <m:smallFrac m:val="false" />
36+ <m:dispDef m:val="false" />
2737 <m:lMargin m:val="0" />
2838 <m:rMargin m:val="0" />
2939 <m:wrapRight />
3040 <m:intLim m:val="subSup" />
31− <m:naryLim m:val="undOvr" />
41+ <m:naryLim m:val="subSup" />
3242 </m:mathPr>
3343 <w:themeFontLang w:val="en-US" />
3444 <w:clrSchemeMapping w:bg1="light1" w:t1="dark1" w:bg2="light2" w:t2="dark2" w:accent1="accent1" w:accent2="accent2" w:accent3="accent3" w:accent4="accent4" w:accent5="accent5" w:accent6="accent6" w:hyperlink="hyperlink" w:followedHyperlink="followedHyperlink" />
3545 <w:decimalSymbol w:val="." />
3646 <w:listSeparator w:val="," />
37−</w:settings>
47+</w:settings>
data/docx/word/styles.xml−15
@@ -350,21 +350,6 @@
350350 <w:right w:w="108" w:type="dxa" />
351351 </w:tblCellMar>
352352 </w:tblPr>
353− <w:tblStylePr w:type="firstRow">
354− <w:tblPr>
355− <w:jc w:val="left"/>
356− <w:tblInd w:w="0" w:type="dxa"/>
357− </w:tblPr>
358− <w:trPr>
359− <w:jc w:val="left"/>
360− </w:trPr>
361− <w:tcPr>
362− <w:vAlign w:val="bottom"/>
363− <w:tcBorders>
364− <w:bottom w:val="single"/>
365− </w:tcBorders>
366− </w:tcPr>
367− </w:tblStylePr>
368353 </w:style>
369354 <w:style w:type="paragraph" w:customStyle="1" w:styleId="DefinitionTerm">
370355 <w:name w:val="Definition Term" />
data/jats.cslnew file+203
@@ -0,0 +1,203 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" default-locale="en-US">
3+ <info>
4+ <title>Journal Article Tag Suite</title>
5+ <title-short>JATS</title-short>
6+ <id>http://www.zotero.org/styles/journal-article-tag-suite</id>
7+ <link href="https://github.com/MartinPaulEve/JATS-CSL/blob/master/jats.csl" rel="self"/>
8+ <link rel="documentation" href="http://jats.nlm.nih.gov/archiving/tag-library/1.0/index.html"/>
9+ <author>
10+ <name>Martin Paul Eve</name>
11+ <email>martin@martineve.com</email>
12+ </author>
13+ <category citation-format="numeric"/>
14+ <category field="medicine"/>
15+ <category field="biology"/>
16+ <summary>Use this style to generate bibliographic data in Journal Article Tagging Suite (JATS) 1.0 XML format</summary>
17+ <updated>2014-06-21T17:41:26+00:00</updated>
18+ <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Originally by Martin Fenner.</rights>
19+ </info>
20+ <locale xml:lang="en">
21+ <terms>
22+ <term name="et-al">{{jats}}&lt;etal/&gt;{{/jats}}</term>
23+ </terms>
24+ </locale>
25+ <macro name="citation-number">
26+ <text variable="citation-number" prefix="{{jats}}id=&quot;ref-{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}"/>
27+ </macro>
28+ <macro name="author">
29+ <names variable="author" delimiter=" ">
30+ <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator=" ">
31+ <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>
32+ <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;/given-names&gt;{{/jats}}"/>
33+ </name>
34+ <substitute>
35+ <names variable="editor"/>
36+ </substitute>
37+ </names>
38+ </macro>
39+
40+ <macro name="editor" delimiter=" ">
41+ <names variable="editor" prefix="{{jats}}&lt;person-group person-group-type=&quot;editor&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/person-group&gt;{{/jats}}">
42+ <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator=" ">
43+ <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>
44+ <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;/given-names&gt;{{/jats}}"/>
45+ </name>
46+ <substitute>
47+ <names variable="editor"/>
48+ </substitute>
49+ </names>
50+ </macro>
51+
52+ <macro name="editor">
53+ <group delimiter=": ">
54+ <names variable="editor">
55+ <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator="">
56+ <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>
57+ <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;given-names&gt;{{/jats}}"/>
58+ </name>
59+ </names>
60+ </group>
61+ </macro>
62+ <macro name="title">
63+ <choose>
64+ <if type="book" match="any">
65+ <group prefix="{{jats}}&lt;source&gt;{{/jats}}" suffix="{{jats}}&lt;/source&gt;{{/jats}}">
66+ <text variable="title"/>
67+ </group>
68+ </if>
69+ <else>
70+ <group prefix="{{jats}}&lt;article-title&gt;{{/jats}}" suffix="{{jats}}&lt;/article-title&gt;{{/jats}}">
71+ <text variable="title"/>
72+ </group>
73+ </else>
74+ </choose>
75+ </macro>
76+ <macro name="container-title">
77+ <text variable="container-title" form="short" prefix="{{jats}}&lt;source&gt;{{/jats}}" suffix="{{jats}}&lt;/source&gt;{{/jats}}"/>
78+ </macro>
79+ <macro name="publisher">
80+ <text variable="publisher" prefix="{{jats}}&lt;publisher-name&gt;{{/jats}}" suffix="{{jats}}&lt;/publisher-name&gt;{{/jats}}"/>
81+ <text variable="publisher-place" prefix="{{jats}}&lt;publisher-loc&gt;{{/jats}}" suffix="{{jats}}&lt;/publisher-loc&gt;{{/jats}}"/>
82+ </macro>
83+ <macro name="link">
84+ <choose>
85+ <if match="any" variable="DOI">
86+ <group prefix="{{jats}}&lt;pub-id pub-id-type=&quot;doi&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/pub-id&gt;{{/jats}}">
87+ <text variable="DOI"/>
88+ </group>
89+ </if>
90+ </choose>
91+ <choose>
92+ <if match="any" variable="PMID">
93+ <group prefix="{{jats}}&lt;pub-id pub-id-type=&quot;pmid&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/pub-id&gt;{{/jats}}">
94+ <text variable="PMID"/>
95+ </group>
96+ </if>
97+ </choose>
98+ <choose>
99+ <if variable="URL" match="any">
100+ <text variable="URL" />
101+ </if>
102+ </choose>
103+ </macro>
104+ <macro name="date">
105+ <choose>
106+ <if type="article-journal article-magazine article-newspaper report patent book" match="any">
107+ <group prefix="{{jats}}&lt;date&gt;{{/jats}}" suffix="{{jats}}&lt;/date&gt;{{/jats}}">
108+ <date variable="issued">
109+ <date-part name="day" form="numeric-leading-zeros" prefix="{{jats}}&lt;day&gt;{{/jats}}" suffix="{{jats}}&lt;/day&gt;{{/jats}}"/>
110+ <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}&lt;month&gt;{{/jats}}" suffix="{{jats}}&lt;/month&gt;{{/jats}}"/>
111+ <date-part name="year" prefix="{{jats}}&lt;year&gt;{{/jats}}" suffix="{{jats}}&lt;/year&gt;{{/jats}}"/>
112+ </date>
113+ </group>
114+ </if>
115+ <else>
116+ <group prefix="{{jats}}&lt;date-in-citation content-type=&quot;access-date&quot;{{/jats}}" suffix="{{jats}}&lt;/date-in-citation&gt;{{/jats}}">
117+ <date variable="accessed" prefix="{{jats}} iso-8601-date=&quot;{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}">
118+ <date-part name="year"/>
119+ <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}-{{/jats}}"/>
120+ <date-part name="day" form="numeric-leading-zeros" prefix="{{jats}}-{{/jats}}"/>
121+ </date>
122+ <date variable="accessed">
123+ <date-part name="day" prefix="{{jats}}&lt;day&gt;{{/jats}}" suffix="{{jats}}&lt;/day&gt;{{/jats}}"/>
124+ <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}&lt;month&gt;{{/jats}}" suffix="{{jats}}&lt;/month&gt;{{/jats}}"/>
125+ <date-part name="year" prefix="{{jats}}&lt;year&gt;{{/jats}}" suffix="{{jats}}&lt;/year&gt;{{/jats}}"/>
126+ </date>
127+ </group>
128+ </else>
129+ </choose>
130+ </macro>
131+ <macro name="location">
132+ <choose>
133+ <if type="article-journal article-magazine" match="any">
134+ <text variable="volume" prefix="{{jats}}&lt;volume&gt;{{/jats}}" suffix="{{jats}}&lt;/volume&gt;{{/jats}}"/>
135+ <text variable="issue" prefix="{{jats}}&lt;issue&gt;{{/jats}}" suffix="{{jats}}&lt;/issue&gt;{{/jats}}"/>
136+ </if>
137+ </choose>
138+ <choose>
139+ <if type="article-journal article-magazine article-newspaper chapter" match="any">
140+ <text variable="page-first" prefix="{{jats}}&lt;fpage&gt;{{/jats}}" suffix="{{jats}}&lt;/fpage&gt;{{/jats}}"/>
141+ </if>
142+ </choose>
143+ </macro>
144+ <macro name="publication-type">
145+ <group prefix="{{jats}} publication-type=&quot;{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}">
146+ <choose>
147+ <if type="article-journal article-magazine article-newspaper" match="any">
148+ <text value="journal"/>
149+ </if>
150+ <else-if type="book" match="any">
151+ <text value="book"/>
152+ </else-if>
153+ <else-if type="chapter" match="any">
154+ <text value="bookchapter"/>
155+ </else-if>
156+ <else-if type="dataset" match="any">
157+ <text value="dataset"/>
158+ </else-if>
159+ <else-if type="patent" match="any">
160+ <text value="patent"/>
161+ </else-if>
162+ <else-if type="report" match="any">
163+ <text value="report"/>
164+ </else-if>
165+ <else-if type="review" match="any">
166+ <text value="review"/>
167+ </else-if>
168+ <else>
169+ <text value="standard"/>
170+ </else>
171+ </choose>
172+ </group>
173+ </macro>
174+ <citation collapse="citation-number">
175+ <sort>
176+ <key variable="citation-number"/>
177+ </sort>
178+ <layout delimiter=",">
179+ <group prefix="{{jats}}&lt;xref ref-type=&quot;bibr&quot; rid=&quot;{{/jats}}" suffix="{{jats}}&lt;/xref&gt;{{/jats}}">
180+ <text variable="citation-number" prefix="{{jats}}ref-{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}"/>
181+ <text variable="citation-number"/>
182+ </group>
183+ </layout>
184+ </citation>
185+ <bibliography sort-separator="">
186+ <layout>
187+ <group prefix="{{jats}}&lt;ref {{/jats}}" suffix="{{jats}}&lt;/ref&gt;{{/jats}}">
188+ <text macro="citation-number"/>
189+ <group prefix="{{jats}}&lt;element-citation{{/jats}}" suffix="{{jats}}&lt;/element-citation&gt;{{/jats}}">
190+ <text macro="publication-type"/>
191+ <text macro="author" prefix="{{jats}}&lt;person-group person-group-type=&quot;author&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/person-group&gt;{{/jats}}"/>
192+ <text macro="title" />
193+ <text macro="container-title"/>
194+ <text macro="editor"/>
195+ <text macro="publisher"/>
196+ <text macro="date"/>
197+ <text macro="location"/>
198+ <text macro="link"/>
199+ </group>
200+ </group>
201+ </layout>
202+ </bibliography>
203+</style>
data/make-reference-files.hsnew file+27
@@ -0,0 +1,27 @@
1+import System.Environment
2+import System.Directory
3+import Codec.Archive.Zip
4+import qualified Data.ByteString.Lazy as BS
5+import qualified Control.Exception as E
6+import System.IO.Error (isDoesNotExistError)
7+import System.FilePath
8+
9+mkzip :: String -> IO ()
10+mkzip fmt = do
11+ let dir = "data" </> fmt
12+ output = "data" </> "reference" <.> fmt
13+ cd <- getCurrentDirectory
14+ setCurrentDirectory dir
15+ archive <- addFilesToArchive [OptRecursive] emptyArchive ["."]
16+ setCurrentDirectory cd
17+ removeIfExists output
18+ BS.writeFile output $ fromArchive archive
19+
20+removeIfExists :: FilePath -> IO ()
21+removeIfExists fileName = removeFile fileName `E.catch` handleExists
22+ where handleExists e
23+ | isDoesNotExistError e = return ()
24+ | otherwise = E.throwIO e
25+
26+main :: IO ()
27+main = getArgs >>= mkzip . (!!0)
data/odt/styles.xml+1−1
@@ -350,7 +350,7 @@ xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
350350 </style:style>
351351 <style:style style:name="First_20_paragraph"
352352 style:display-name="First paragraph" style:family="paragraph"
353− style:parent-style-name="Text_20_body"
353+ style:parent-style-name="Standard"
354354 style:next-style-name="Text_20_body" style:class="text" />
355355 <style:style style:name="Numbering_20_Symbols"
356356 style:display-name="Numbering Symbols" style:family="text" />
data/sample.lua+8−7
@@ -21,7 +21,7 @@ local stringify = (require "pandoc.utils").stringify
2121-- configure the writer.
2222local meta = PANDOC_DOCUMENT.meta
2323
24−-- Choose the image format based on the value of the
24+-- Chose the image format based on the value of the
2525-- `image_format` meta value.
2626local image_format = meta.image_format
2727 and stringify(meta.image_format)
@@ -45,9 +45,9 @@ local function escape(s, in_attribute)
4545 return '&gt;'
4646 elseif x == '&' then
4747 return '&amp;'
48− elseif in_attribute and x == '"' then
48+ elseif x == '"' then
4949 return '&quot;'
50− elseif in_attribute and x == "'" then
50+ elseif x == "'" then
5151 return '&#39;'
5252 else
5353 return x
@@ -141,8 +141,8 @@ function Strikeout(s)
141141 return '<del>' .. s .. '</del>'
142142end
143143
144−function Link(s, tgt, tit, attr)
145− return "<a href='" .. escape(tgt,true) .. "' title='" ..
144+function Link(s, src, tit, attr)
145+ return "<a href='" .. escape(src,true) .. "' title='" ..
146146 escape(tit,true) .. "'>" .. s .. "</a>"
147147end
148148
@@ -271,7 +271,7 @@ end
271271
272272-- Convert pandoc alignment to something HTML can use.
273273-- align is AlignLeft, AlignRight, AlignCenter, or AlignDefault.
274−local function html_align(align)
274+function html_align(align)
275275 if align == 'AlignLeft' then
276276 return 'left'
277277 elseif align == 'AlignRight' then
@@ -286,7 +286,7 @@ end
286286function CaptionedImage(src, tit, caption, attr)
287287 return '<div class="figure">\n<img src="' .. escape(src,true) ..
288288 '" title="' .. escape(tit,true) .. '"/>\n' ..
289− '<p class="caption">' .. escape(caption) .. '</p>\n</div>'
289+ '<p class="caption">' .. caption .. '</p>\n</div>'
290290end
291291
292292-- Caption is a string, aligns is an array of strings,
@@ -357,3 +357,4 @@ meta.__index =
357357 return function() return "" end
358358 end
359359setmetatable(_G, meta)
360+
data/templates/.github/ISSUE_TEMPLATE.mdnew file+3
@@ -0,0 +1,3 @@
1+This repository is now maintained as a subtree of
2+[jgm/pandoc](https://github.com/jgm/pandoc). Please open
3+your issue there, not here.
data/templates/.github/PULL_REQUEST_TEMPLATE.mdnew file+4
@@ -0,0 +1,4 @@
1+This repository is now maintained as a subtree of
2+[jgm/pandoc](https://github.com/jgm/pandoc). Please open
3+your pull request there, not here.
4+
data/templates/README.markdownnew file+49
@@ -0,0 +1,49 @@
1+The [pandoc-templates] repository contains default templates for [pandoc].
2+
3+If you use custom templates, we recommend forking this
4+repository, so that you can integrate changes to the default
5+templates in future pandoc releases.
6+
7+This repository is a subtree of [pandoc]; it will be updated
8+each time there is a new pandoc release. However, changes to
9+templates are made first in [pandoc]; thus, issues and pull
10+requests should be made [pandoc]'s issue tracker rather than
11+here.
12+
13+[pandoc]: https://github.com/jgm/pandoc
14+[pandoc-templates]: https://github.com/jgm/pandoc-templates
15+
16+All of the templates in this repository are dual licensed, under both
17+the GPL (v2 or higher, same as pandoc) and the BSD 3-clause license
18+(included below).
19+
20+Copyright (c) 2014--2019, John MacFarlane
21+
22+All rights reserved.
23+
24+Redistribution and use in source and binary forms, with or without
25+modification, are permitted provided that the following conditions are met:
26+
27+* Redistributions of source code must retain the above copyright
28+ notice, this list of conditions and the following disclaimer.
29+
30+* Redistributions in binary form must reproduce the above
31+ copyright notice, this list of conditions and the following
32+ disclaimer in the documentation and/or other materials provided
33+ with the distribution.
34+
35+* Neither the name of John MacFarlane nor the names of other
36+ contributors may be used to endorse or promote products derived
37+ from this software without specific prior written permission.
38+
39+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
49+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/templates/affiliations.jatsdeleted−38
@@ -1,38 +0,0 @@
1−$--
2−$-- Affiliations
3−$--
4−$for(affiliation)$
5−<aff id="aff-$affiliation.id$">
6−$-- wrap affiliation if it has a known institution identifier
7−$if(affiliation.group)$
8−<institution content-type="group">$affiliation.group$</institution>
9−$endif$
10−$if(affiliation.department)$
11−<institution content-type="dept">$affiliation.department$</institution>
12−$endif$
13−<institution-wrap>
14−$if(affiliation.organization)$
15−<institution>$affiliation.organization$</institution>
16−$else$
17−<institution>$affiliation.name$</institution>
18−$endif$
19−$if(affiliation.isni)$
20−<institution-id institution-id-type="ISNI">$affiliation.isni$</institution-id>
21−$endif$
22−$if(affiliation.ringgold)$
23−<institution-id institution-id-type="Ringgold">$affiliation.ringgold$</institution-id>
24−$endif$
25−$if(affiliation.ror)$
26−<institution-id institution-id-type="ROR">$affiliation.ror$</institution-id>
27−$endif$
28−$for(affiliation.pid)$
29−<institution-id institution-id-type="$affiliation.pid.type$">$affiliation.pid.id$</institution-id>
30−$endfor$
31−</institution-wrap>$if(affiliation.street-address)$,
32−$for(affiliation.street-address)$
33−<addr-line>$affiliation.street-address$</addr-line>$sep$,
34−$endfor$
35−$else$$if(affiliation.city)$, <city>$affiliation.city$</city>$endif$$endif$$if(affiliation.country)$,
36−<country$if(affiliation.country-code)$ country="$affiliation.country-code$"$endif$>$affiliation.country$</country>$endif$
37−</aff>
38−$endfor$
data/templates/article.jats_publishing+7−23
@@ -14,13 +14,6 @@ $endif$
1414$if(journal.pmc)$
1515<journal-id journal-id-type="pmc">$journal.pmc$</journal-id>
1616$endif$
17−$-- Fallback: an empty journal-id in case none is available.
18−$if(journal.publisher-id)$
19−$elseif(journal.nlm-ta)$
20−$elseif(journal.pmc)$
21−$else$
22−<journal-id></journal-id>
23−$endif$
2417<journal-title-group>
2518$if(journal.title)$
2619<journal-title>$journal.title$</journal-title>
@@ -30,16 +23,10 @@ $if(journal.abbrev-title)$
3023$endif$
3124</journal-title-group>
3225$if(journal.pissn)$
33−<issn publication-format="print">$journal.pissn$</issn>
26+<issn pub-type="ppub">$journal.pissn$</issn>
3427$endif$
3528$if(journal.eissn)$
36−<issn publication-format="electronic">$journal.eissn$</issn>
37−$endif$
38−$-- At least one issn element is required; use empty issn as fallback
39−$if(journal.pissn)$
40−$elseif(journal.eissn)$
41−$else$
42−<issn></issn>
29+<issn pub-type="epub">$journal.eissn$</issn>
4330$endif$
4431<publisher>
4532<publisher-name>$journal.publisher-name$</publisher-name>
@@ -86,7 +73,7 @@ $endif$
8673$if(author)$
8774<contrib-group>
8875$for(author)$
89−<contrib contrib-type="author"$if(author.equal-contrib)$ equal-contrib="true"$endif$>
76+<contrib contrib-type="author">
9077$if(author.orcid)$
9178<contrib-id contrib-id-type="orcid">$author.orcid$</contrib-id>
9279$endif$
@@ -95,23 +82,20 @@ $if(author.surname)$
9582<surname>$author.surname$</surname>
9683<given-names>$author.given-names$</given-names>
9784</name>
98−$elseif(author.name)$
99−<string-name>$author.name$</string-name>
10085$else$
10186<string-name>$author$</string-name>
10287$endif$
10388$if(author.email)$
10489<email>$author.email$</email>
10590$endif$
106−$for(author.affiliation)$
107−<xref ref-type="aff" rid="aff-$author.affiliation$"/>
108−$endfor$
91+$if(author.aff-id)$
92+<xref ref-type="aff" rid="aff-$contrib.aff-id$"/>
93+$endif$
10994$if(author.cor-id)$
11095<xref ref-type="corresp" rid="cor-$author.cor-id$"><sup>*</sup></xref>
11196$endif$
11297</contrib>
11398$endfor$
114−${ affiliations.jats() }
11599</contrib-group>
116100$endif$
117101$if(article.author-notes)$
@@ -130,7 +114,7 @@ $endif$
130114</author-notes>
131115$endif$
132116$if(date)$
133−<pub-date date-type="$if(date.type)$$date.type$$else$pub$endif$" publication-format="electronic"$if(date.iso-8601)$ iso-8601-date="$date.iso-8601$"$endif$>
117+<pub-date pub-type="epub"$if(date.iso-8601)$ iso-8601-date="$date.iso-8601$"$endif$>
134118$if(date.day)$
135119<day>$date.day$</day>
136120$endif$
data/templates/default.biblatexdeleted−10
@@ -1,10 +0,0 @@
1−$for(header-includes)$
2−$header-includes$
3−$endfor$
4−$for(include-before)$
5−$include-before$
6−$endfor$
7−$body$
8−$for(include-after)$
9−$include-after$
10−$endfor$
data/templates/default.bibtexdeleted−10
@@ -1,10 +0,0 @@
1−$for(header-includes)$
2−$header-includes$
3−$endfor$
4−$for(include-before)$
5−$include-before$
6−$endfor$
7−$body$
8−$for(include-after)$
9−$include-after$
10−$endfor$
data/templates/default.context+8−10
@@ -51,7 +51,6 @@ $endif$
5151
5252% use microtypography
5353\definefontfeature[default][default][script=latn, protrusion=quality, expansion=quality, itlc=yes, textitalics=yes, onum=yes, pnum=yes]
54−\definefontfeature[default:tnum][default][tnum=yes, pnum=no]
5554\definefontfeature[smallcaps][script=latn, protrusion=quality, expansion=quality, smcp=yes, onum=yes, pnum=yes]
5655\setupalign[hz,hanging]
5756\setupitaliccorrection[global, always]
@@ -73,9 +72,9 @@ $if(interlinespace)$
7372\setupinterlinespace[$for(interlinespace)$$interlinespace$$sep$,$endfor$]
7473$endif$
7574
76−\setuphead[chapter] [style=\tfd\setupinterlinespace,header=empty]
77−\setuphead[section] [style=\tfc\setupinterlinespace]
78−\setuphead[subsection] [style=\tfb\setupinterlinespace]
75+\setuphead[chapter] [style=\tfd,header=empty]
76+\setuphead[section] [style=\tfc]
77+\setuphead[subsection] [style=\tfb]
7978\setuphead[subsubsection] [style=\bf]
8079\setuphead[subsubsubsection] [style=\sc]
8180\setuphead[subsubsubsubsection][style=\it]
@@ -98,12 +97,11 @@ $endif$
9897\setupitemize[autointro] % prevent orphan list intro
9998\setupitemize[indentnext=no]
10099
101−\defineitemgroup[enumerate]
102−\setupenumerate[each][fit][itemalign=left,distance=.5em,style={\feature[+][default:tnum]}]
103−
104100\setupfloat[figure][default={here,nonumber}]
105101\setupfloat[table][default={here,nonumber}]
106102
103+\setupthinrules[width=15em] % width of horizontal rules
104+
107105\setupxtable[frame=off]
108106\setupxtable[head][topframe=on,bottomframe=on]
109107\setupxtable[body][]
@@ -164,12 +162,12 @@ $endfor$
164162$if(toc)$
165163\completecontent
166164$endif$
167−$if(lof)$
168−\completelistoffigures
169−$endif$
170165$if(lot)$
171166\completelistoftables
172167$endif$
168+$if(lof)$
169+\completelistoffigures
170+$endif$
173171
174172$body$
175173
data/templates/default.dzslides+1−1
@@ -171,7 +171,7 @@ $if(subtitle)$
171171 <h1 class="subtitle">$subtitle$</h1>
172172$endif$
173173 <footer>
174− $if(author)$<span class="author">$for(author)$$author$$sep$, $endfor$</span> · $endif$$if(institute)$<span class="institute">$for(institute)$$institute$$sep$, $endfor$</span> · $endif$$if(date)$<span class="date">$date$</span>$endif$
174+ $if(author)$<span class="author">$for(author)$$author$$sep$, $endfor$</span>$endif$ · $if(date)$<span class="date">$date$</span>$endif$
175175 </footer>
176176</section>
177177$endif$
data/templates/default.epub2+1−1
@@ -48,7 +48,7 @@ $endif$
4848$else$
4949$if(coverpage)$
5050<div id="cover-image">
51−<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="xMidYMid">
51+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="none">
5252<image width="$cover-image-width$" height="$cover-image-height$" xlink:href="../media/$cover-image$" />
5353</svg>
5454</div>
data/templates/default.epub3+1−1
@@ -49,7 +49,7 @@ $endif$
4949$else$
5050$if(coverpage)$
5151<div id="cover-image">
52−<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="xMidYMid">
52+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 $cover-image-width$ $cover-image-height$" preserveAspectRatio="none">
5353<image width="$cover-image-width$" height="$cover-image-height$" xlink:href="../media/$cover-image$" />
5454</svg>
5555</div>
data/templates/default.html4−3
@@ -12,9 +12,6 @@ $if(date-meta)$
1212$endif$
1313$if(keywords)$
1414 <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
15−$endif$
16−$if(description-meta)$
17− <meta name="description" content="$description-meta$" />
1815$endif$
1916 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
2017 <style type="text/css">
data/templates/default.html5−3
@@ -12,9 +12,6 @@ $if(date-meta)$
1212$endif$
1313$if(keywords)$
1414 <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
15−$endif$
16−$if(description-meta)$
17− <meta name="description" content="$description-meta$" />
1815$endif$
1916 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
2017 <style>
data/templates/default.jats_articleauthoring+4−7
@@ -19,7 +19,7 @@ $endif$
1919$if(author)$
2020<contrib-group>
2121$for(author)$
22−<contrib contrib-type="author"$if(author.equal-contrib)$ equal-contrib="true"$endif$>
22+<contrib contrib-type="author">
2323$if(author.orcid)$
2424<contrib-id contrib-id-type="orcid">$author.orcid$</contrib-id>
2525$endif$
@@ -28,23 +28,20 @@ $if(author.surname)$
2828<surname>$author.surname$</surname>
2929<given-names>$author.given-names$</given-names>
3030</name>
31−$elseif(author.name)$
32−<string-name>$author.name$</string-name>
3331$else$
3432<string-name>$author$</string-name>
3533$endif$
3634$if(author.email)$
3735<email>$author.email$</email>
3836$endif$
39−$for(author.affiliation)$
40−<xref ref-type="aff" rid="aff-$author.affiliation$"/>
41−$endfor$
37+$if(author.aff-id)$
38+<xref ref-type="aff" rid="aff-$contrib.aff-id$"/>
39+$endif$
4240$if(author.cor-id)$
4341<xref ref-type="corresp" rid="cor-$author.cor-id$"><sup>*</sup></xref>
4442$endif$
4543</contrib>
4644$endfor$
47−${ affiliations.jats() }
4845</contrib-group>
4946$endif$
5047$if(copyright)$
data/templates/default.latex+44−78
@@ -2,7 +2,7 @@
22\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref}
33\PassOptionsToPackage{hyphens}{url}
44$if(colorlinks)$
5−\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
5+\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}
66$endif$
77$if(dir)$
88$if(latex-dir-rtl)$
@@ -89,7 +89,6 @@ $endif$
8989$if(beamerarticle)$
9090\usepackage{beamerarticle} % needs to be loaded first
9191$endif$
92−\usepackage{amsmath,amssymb}
9392$if(fontfamily)$
9493\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
9594$else$
@@ -98,14 +97,15 @@ $endif$
9897$if(linestretch)$
9998\usepackage{setspace}
10099$endif$
101−\usepackage{iftex}
102−\ifPDFTeX
100+\usepackage{amssymb,amsmath}
101+\usepackage{ifxetex,ifluatex}
102+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
103103 \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
104104 \usepackage[utf8]{inputenc}
105105 \usepackage{textcomp} % provide euro and other symbols
106106\else % if luatex or xetex
107107$if(mathspec)$
108− \ifXeTeX
108+ \ifxetex
109109 \usepackage{mathspec}
110110 \else
111111 \usepackage{unicode-math}
@@ -129,7 +129,7 @@ $for(fontfamilies)$
129129$endfor$
130130$if(mathfont)$
131131$if(mathspec)$
132− \ifXeTeX
132+ \ifxetex
133133 \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
134134 \else
135135 \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
@@ -139,42 +139,23 @@ $else$
139139$endif$
140140$endif$
141141$if(CJKmainfont)$
142− \ifXeTeX
142+ \ifxetex
143143 \usepackage{xeCJK}
144144 \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
145145 \fi
146146$endif$
147147$if(luatexjapresetoptions)$
148− \ifLuaTeX
148+ \ifluatex
149149 \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
150150 \fi
151151$endif$
152152$if(CJKmainfont)$
153− \ifLuaTeX
153+ \ifluatex
154154 \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
155155 \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
156156 \fi
157157$endif$
158158\fi
159−$if(zero-width-non-joiner)$
160−%% Support for zero-width non-joiner characters.
161−\makeatletter
162−\def\zerowidthnonjoiner{%
163− % Prevent ligatures and adjust kerning, but still support hyphenating.
164− \texorpdfstring{%
165− \textormath{\nobreak\discretionary{-}{}{\kern.03em}%
166− \ifvmode\else\nobreak\hskip\z@skip\fi}{}%
167− }{}%
168−}
169−\makeatother
170−\ifPDFTeX
171− \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}
172−\else
173− \catcode`^^^^200c=\active
174− \protected\def ^^^^200c{\zerowidthnonjoiner}
175−\fi
176−%% End of ZWNJ support
177−$endif$
178159$if(beamer)$
179160$if(theme)$
180161\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
@@ -238,10 +219,10 @@ $if(keywords)$
238219$endif$
239220$if(colorlinks)$
240221 colorlinks=true,
241− linkcolor={$if(linkcolor)$$linkcolor$$else$Maroon$endif$},
242− filecolor={$if(filecolor)$$filecolor$$else$Maroon$endif$},
243− citecolor={$if(citecolor)$$citecolor$$else$Blue$endif$},
244− urlcolor={$if(urlcolor)$$urlcolor$$else$Blue$endif$},
222+ linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
223+ filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,
224+ citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
225+ urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
245226$else$
246227 hidelinks,
247228$endif$
@@ -273,11 +254,7 @@ $if(highlighting-macros)$
273254$highlighting-macros$
274255$endif$
275256$if(tables)$
276−\usepackage{longtable,booktabs,array}
277−$if(multirow)$
278−\usepackage{multirow}
279−$endif$
280−\usepackage{calc} % for calculating minipage widths
257+\usepackage{longtable,booktabs}
281258$if(beamer)$
282259\usepackage{caption}
283260% Make caption package work with longtable
@@ -344,36 +321,11 @@ $endif$
344321$if(pagestyle)$
345322\pagestyle{$pagestyle$}
346323$endif$
347−$if(csl-refs)$
348−\newlength{\cslhangindent}
349−\setlength{\cslhangindent}{1.5em}
350−\newlength{\csllabelwidth}
351−\setlength{\csllabelwidth}{3em}
352−\newlength{\cslentryspacingunit} % times entry-spacing
353−\setlength{\cslentryspacingunit}{\parskip}
354−\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
355− {% don't indent paragraphs
356− \setlength{\parindent}{0pt}
357− % turn on hanging indent if param 1 is 1
358− \ifodd #1
359− \let\oldpar\par
360− \def\par{\hangindent=\cslhangindent\oldpar}
361− \fi
362− % set entry spacing
363− \setlength{\parskip}{#2\cslentryspacingunit}
364− }%
365− {}
366−\usepackage{calc}
367−\newcommand{\CSLBlock}[1]{#1\hfill\break}
368−\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
369−\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
370−\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
371−$endif$
372324$for(header-includes)$
373325$header-includes$
374326$endfor$
375327$if(lang)$
376−\ifXeTeX
328+\ifxetex
377329 % Load polyglossia as late as possible: uses bidi with RTL langages (e.g. Hebrew, Arabic)
378330 \usepackage{polyglossia}
379331 \setmainlanguage[$for(polyglossia-lang.options)$$polyglossia-lang.options$$sep$,$endfor$]{$polyglossia-lang.name$}
@@ -381,24 +333,21 @@ $for(polyglossia-otherlangs)$
381333 \setotherlanguage[$for(polyglossia-otherlangs.options)$$polyglossia-otherlangs.options$$sep$,$endfor$]{$polyglossia-otherlangs.name$}
382334$endfor$
383335\else
384− \usepackage[$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
385−% get rid of language-specific shorthands (see #6817):
386−\let\LanguageShortHands\languageshorthands
387−\def\languageshorthands#1{}
336+ \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
388337$if(babel-newcommands)$
389338 $babel-newcommands$
390339$endif$
391340\fi
392341$endif$
393−\ifLuaTeX
342+\ifluatex
394343 \usepackage{selnolig} % disable illegal ligatures
395344\fi
396345$if(dir)$
397−\ifXeTeX
346+\ifxetex
398347 % Load bidi as late as possible as it modifies e.g. graphicx
399348 \usepackage{bidi}
400349\fi
401−\ifPDFTeX
350+\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
402351 \TeXXeTstate=1
403352 \newcommand{\RL}[1]{\beginR #1\endR}
404353 \newcommand{\LR}[1]{\beginL #1\endL}
@@ -416,11 +365,28 @@ $for(bibliography)$
416365\addbibresource{$bibliography$}
417366$endfor$
418367$endif$
419−$if(nocite-ids)$
420−\nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
421−$endif$
422−$if(csquotes)$
423−\usepackage{csquotes}
368+$if(csl-refs)$
369+\newlength{\cslhangindent}
370+\setlength{\cslhangindent}{1.5em}
371+\newlength{\csllabelwidth}
372+\setlength{\csllabelwidth}{3em}
373+\newenvironment{CSLReferences}[3] % #1 hanging-ident, #2 entry sp
374+ {% don't indent paragraphs
375+ \setlength{\parindent}{0pt}
376+ % turn on hanging indent if param 1 is 1
377+ \ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
378+ % set line spacing
379+ % set entry spacing
380+ \ifnum #2 > 0
381+ \setlength{\parskip}{#3\baselineskip}
382+ \fi
383+ }%
384+ {}
385+\usepackage{calc} % for \widthof, \maxof
386+\newcommand{\CSLBlock}[1]{#1\hfill\break}
387+\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\maxof{\widthof{#1}}{\csllabelwidth}}{#1}}
388+\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth}{#1}}
389+\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
424390$endif$
425391
426392$if(title)$
@@ -494,12 +460,12 @@ $endif$
494460}
495461$endif$
496462$endif$
497−$if(lof)$
498−\listoffigures
499−$endif$
500463$if(lot)$
501464\listoftables
502465$endif$
466+$if(lof)$
467+\listoffigures
468+$endif$
503469$if(linestretch)$
504470\setstretch{$linestretch$}
505471$endif$
data/templates/default.man+1−1
@@ -1,5 +1,5 @@
11$if(has-tables)$
2−'\" t
2+.\"t
33$endif$
44$if(pandoc-version)$
55.\" Automatically generated by Pandoc $pandoc-version$
data/templates/default.org+3−3
@@ -1,12 +1,12 @@
11$if(title)$
2−#+title: $title$
2+#+TITLE: $title$
33
44$endif$
55$if(author)$
6−#+author: $for(author)$$author$$sep$; $endfor$
6+#+AUTHOR: $for(author)$$author$$sep$; $endfor$
77$endif$
88$if(date)$
9−#+date: $date$
9+#+DATE: $date$
1010
1111$endif$
1212$for(header-includes)$
data/templates/default.revealjs+122−84
@@ -52,9 +52,6 @@ $endif$
5252$for(author)$
5353 <p class="author">$author$</p>
5454$endfor$
55−$for(institute)$
56− <p class="institute">$institute$</p>
57−$endfor$
5855$if(date)$
5956 <p class="date">$date$</p>
6057$endif$
@@ -62,12 +59,7 @@ $endif$
6259$endif$
6360$if(toc)$
6461<section id="$idprefix$TOC">
65−<nav role="doc-toc">
66−$if(toc-title)$
67−<h2 id="$idprefix$toc-title">$toc-title$</h2>
68−$endif$
6962$table-of-contents$
70−</nav>
7163</section>
7264$endif$
7365
@@ -77,7 +69,7 @@ $body$
7769
7870 <script src="$revealjs-url$/dist/reveal.js"></script>
7971
80− <!-- reveal.js plugins -->
72+ // reveal.js plugins
8173 <script src="$revealjs-url$/plugin/notes/notes.js"></script>
8274 <script src="$revealjs-url$/plugin/search/search.js"></script>
8375 <script src="$revealjs-url$/plugin/zoom/zoom.js"></script>
@@ -90,198 +82,244 @@ $endif$
9082 // Full list of configuration options available at:
9183 // https://revealjs.com/config/
9284 Reveal.initialize({
85+$if(controls)$
9386 // Display controls in the bottom right corner
9487 controls: $controls$,
95−
88+$endif$
89+$if(controlsTutorial)$
9690 // Help the user learn the controls by providing hints, for example by
9791 // bouncing the down arrow when they first encounter a vertical slide
9892 controlsTutorial: $controlsTutorial$,
99−
93+$endif$
94+$if(controlsLayout)$
10095 // Determines where controls appear, "edges" or "bottom-right"
101− controlsLayout: '$controlsLayout$',
102−
96+ controlsLayout: $controlsLayout$,
97+$endif$
98+$if(controlsBackArrows)$
10399 // Visibility rule for backwards navigation arrows; "faded", "hidden"
104100 // or "visible"
105− controlsBackArrows: '$controlsBackArrows$',
106−
101+ controlsBackArrows: $controlsBackArrows$,
102+$endif$
103+$if(progress)$
107104 // Display a presentation progress bar
108105 progress: $progress$,
109−
106+$endif$
107+$if(slideNumber)$
110108 // Display the page number of the current slide
111109 slideNumber: $slideNumber$,
112−
113− // 'all', 'print', or 'speaker'
114− showSlideNumber: '$showSlideNumber$',
115−
110+$endif$
111+$if(hash)$
116112 // Add the current slide number to the URL hash so that reloading the
117113 // page/copying the URL will return you to the same slide
118114 hash: $hash$,
119−
120− // Start with 1 for the hash rather than 0
121− hashOneBasedIndex: $hashOneBasedIndex$,
122−
123− // Flags if we should monitor the hash and change slides accordingly
124− respondToHashChanges: $respondToHashChanges$,
125−
115+$endif$
126116 // Push each slide change to the browser history
117+$if(history)$
127118 history: $history$,
128−
119+$else$
120+ history: true,
121+$endif$
122+$if(keyboard)$
129123 // Enable keyboard shortcuts for navigation
130124 keyboard: $keyboard$,
131−
125+$endif$
126+$if(overview)$
132127 // Enable the slide overview mode
133128 overview: $overview$,
134−
135− // Disables the default reveal.js slide layout (scaling and centering)
136− // so that you can use custom CSS layout
137− disableLayout: false,
138−
129+$endif$
130+$if(center)$
139131 // Vertical centering of slides
140132 center: $center$,
141−
133+$endif$
134+$if(touch)$
142135 // Enables touch navigation on devices with touch input
143136 touch: $touch$,
144−
137+$endif$
138+$if(loop)$
145139 // Loop the presentation
146140 loop: $loop$,
147−
141+$endif$
142+$if(rtl)$
148143 // Change the presentation direction to be RTL
149144 rtl: $rtl$,
150−
145+$endif$
146+$if(navigationMode)$
151147 // see https://revealjs.com/vertical-slides/#navigation-mode
152148 navigationMode: '$navigationMode$',
153−
149+$endif$
150+$if(shuffle)$
154151 // Randomizes the order of slides each time the presentation loads
155152 shuffle: $shuffle$,
156−
153+$endif$
154+$if(fragments)$
157155 // Turns fragments on and off globally
158156 fragments: $fragments$,
159−
157+$endif$
158+$if(fragmentInURL)$
160159 // Flags whether to include the current fragment in the URL,
161160 // so that reloading brings you to the same fragment position
162161 fragmentInURL: $fragmentInURL$,
163−
162+$endif$
163+$if(embedded)$
164164 // Flags if the presentation is running in an embedded mode,
165165 // i.e. contained within a limited portion of the screen
166166 embedded: $embedded$,
167−
167+$endif$
168+$if(help)$
168169 // Flags if we should show a help overlay when the questionmark
169170 // key is pressed
170171 help: $help$,
171−
172− // Flags if it should be possible to pause the presentation (blackout)
173− pause: $pause$,
174−
172+$endif$
173+$if(showNotes)$
175174 // Flags if speaker notes should be visible to all viewers
176175 showNotes: $showNotes$,
177−
178− // Global override for autoplaying embedded media (null/true/false)
176+$endif$
177+$if(autoPlayMedia)$
178+ // Global override for autoplaying embedded media (video/audio/iframe)
179+ // - null: Media will only autoplay if data-autoplay is present
180+ // - true: All media will autoplay, regardless of individual setting
181+ // - false: No media will autoplay, regardless of individual setting
179182 autoPlayMedia: $autoPlayMedia$,
180−
181− // Global override for preloading lazy-loaded iframes (null/true/false)
183+$endif$
184+$if(preloadIframes)$
185+ // Global override for preloading lazy-loaded iframes
186+ // - null: Iframes with data-src AND data-preload will be loaded when within
187+ // the viewDistance, iframes with only data-src will be loaded when visible
188+ // - true: All iframes with data-src will be loaded when within the viewDistance
189+ // - false: All iframes with data-src will be loaded only when visible
182190 preloadIframes: $preloadIframes$,
183−
191+$endif$
192+$if(autoSlide)$
184193 // Number of milliseconds between automatically proceeding to the
185194 // next slide, disabled when set to 0, this value can be overwritten
186195 // by using a data-autoslide attribute on your slides
187196 autoSlide: $autoSlide$,
188−
197+$endif$
198+$if(autoSlideStoppable)$
189199 // Stop auto-sliding after user input
190200 autoSlideStoppable: $autoSlideStoppable$,
191−
201+$endif$
202+$if(autoSlideMethod)$
192203 // Use this method for navigation when auto-sliding
193204 autoSlideMethod: $autoSlideMethod$,
194−
205+$endif$
206+$if(defaultTiming)$
195207 // Specify the average time in seconds that you think you will spend
196208 // presenting each slide. This is used to show a pacing timer in the
197209 // speaker view
198210 defaultTiming: $defaultTiming$,
199−
211+$endif$
212+$if(totalTime)$
213+ // Specify the total time in seconds that is available to
214+ // present. If this is set to a nonzero value, the pacing
215+ // timer will work out the time available for each slide,
216+ // instead of using the defaultTiming value
217+ totalTime: $totalTime$,
218+$endif$
219+$if(minimumTimePerSlide)$
220+ // Specify the minimum amount of time you want to allot to
221+ // each slide, if using the totalTime calculation method. If
222+ // the automated time allocation causes slide pacing to fall
223+ // below this threshold, then you will see an alert in the
224+ // speaker notes window
225+ minimumTimePerSlide: $minimumTimePerSlide$,
226+$endif$
227+$if(mouseWheel)$
200228 // Enable slide navigation via mouse wheel
201229 mouseWheel: $mouseWheel$,
202−
203− // The display mode that will be used to show slides
204− display: '$display$',
205−
230+$endif$
231+$if(rollingLinks)$
232+ // Apply a 3D roll to links on hover
233+ rollingLinks: $rollingLinks$,
234+$endif$
235+$if(hideInactiveCursor)$
206236 // Hide cursor if inactive
207237 hideInactiveCursor: $hideInactiveCursor$,
208−
238+$endif$
239+$if(hideCursorTime)$
209240 // Time before the cursor is hidden (in ms)
210241 hideCursorTime: $hideCursorTime$,
211−
242+$endif$
243+$if(hideAddressBar)$
244+ // Hides the address bar on mobile devices
245+ hideAddressBar: $hideAddressBar$,
246+$endif$
247+$if(previewLinks)$
212248 // Opens links in an iframe preview overlay
213249 previewLinks: $previewLinks$,
214−
215− // Transition style (none/fade/slide/convex/concave/zoom)
216− transition: '$transition$',
217−
218− // Transition speed (default/fast/slow)
219− transitionSpeed: '$transitionSpeed$',
220−
250+$endif$
251+$if(transition)$
252+ // Transition style
253+ transition: '$transition$', // none/fade/slide/convex/concave/zoom
254+$endif$
255+$if(transitionSpeed)$
256+ // Transition speed
257+ transitionSpeed: '$transitionSpeed$', // default/fast/slow
258+$endif$
259+$if(backgroundTransition)$
221260 // Transition style for full page slide backgrounds
222− // (none/fade/slide/convex/concave/zoom)
223− backgroundTransition: '$backgroundTransition$',
224−
261+ backgroundTransition: '$backgroundTransition$', // none/fade/slide/convex/concave/zoom
262+$endif$
263+$if(viewDistance)$
225264 // Number of slides away from the current that are visible
226265 viewDistance: $viewDistance$,
227−
266+$endif$
267+$if(mobileViewDistance)$
228268 // Number of slides away from the current that are visible on mobile
229269 // devices. It is advisable to set this to a lower number than
230270 // viewDistance in order to save resources.
231271 mobileViewDistance: $mobileViewDistance$,
272+$endif$
232273$if(parallaxBackgroundImage)$
233−
234274 // Parallax background image
235275 parallaxBackgroundImage: '$parallaxBackgroundImage$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
236276$else$
237277$if(background-image)$
238−
239278 // Parallax background image
240279 parallaxBackgroundImage: '$background-image$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
241280$endif$
242281$endif$
243282$if(parallaxBackgroundSize)$
244−
245283 // Parallax background size
246284 parallaxBackgroundSize: '$parallaxBackgroundSize$', // CSS syntax, e.g. "2100px 900px"
247285$endif$
248286$if(parallaxBackgroundHorizontal)$
249−
250287 // Amount to move parallax background (horizontal and vertical) on slide change
251288 // Number, e.g. 100
252289 parallaxBackgroundHorizontal: $parallaxBackgroundHorizontal$,
253290$endif$
254291$if(parallaxBackgroundVertical)$
255−
256292 parallaxBackgroundVertical: $parallaxBackgroundVertical$,
257293$endif$
258294$if(width)$
259−
260295 // The "normal" size of the presentation, aspect ratio will be preserved
261296 // when the presentation is scaled to fit different resolutions. Can be
262297 // specified using percentage units.
263298 width: $width$,
264299$endif$
265300$if(height)$
266−
267301 height: $height$,
268302$endif$
269303$if(margin)$
270−
271304 // Factor of the display size that should remain empty around the content
272305 margin: $margin$,
273306$endif$
274307$if(minScale)$
275−
276308 // Bounds for smallest/largest possible scale to apply to content
277309 minScale: $minScale$,
278310$endif$
279311$if(maxScale)$
280−
281312 maxScale: $maxScale$,
282313$endif$
314+$if(zoomKey)$
315+ // Modifier key used to click-zoom to part of the slide
316+ zoomKey: '$zoomKey$',
317+$endif$
318+$if(display)$
319+ // The display mode that will be used to show slides
320+ display: $display$,
321+$endif$
283322$if(mathjax)$
284−
285323 math: {
286324 mathjax: '$mathjaxurl$',
287325 config: 'TeX-AMS_HTML-full',
data/templates/default.s5−3
@@ -61,9 +61,6 @@ $endif$
6161$if(author)$
6262 <h3 class="author">$for(author)$$author$$sep$<br/>$endfor$</h3>
6363$endif$
64−$if(institute)$
65− <h3 class="institute">$for(institute)$$institute$$sep$<br/>$endfor$</h3>
66−$endif$
6764$if(date)$
6865 <h4 class="date">$date$</h4>
6966$endif$
data/templates/default.slideous−7
@@ -63,16 +63,9 @@ $if(title)$
6363$if(subtitle)$
6464 <h1 class="subtitle">$subtitle$</h1>
6565$endif$
66−$if(author)$
6766 <p class="author">
6867$for(author)$$author$$sep$<br/>$endfor$
6968 </p>
70−$endif$
71−$if(institute)$
72− <p class="institute">
73−$for(institute)$$institute$$sep$<br/>$endfor$
74− </p>
75−$endif$
7669$if(date)$
7770 <p class="date">$date$</p>
7871$endif$
data/templates/default.slidy−5
@@ -52,11 +52,6 @@ $if(author)$
5252$for(author)$$author$$sep$<br/>$endfor$
5353 </p>
5454$endif$
55−$if(institute)$
56− <p class="institute">
57−$for(institute)$$institute$$sep$<br/>$endfor$
58− </p>
59−$endif$
6055$if(date)$
6156 <p class="date">$date$</p>
6257$endif$
data/templates/styles.html+18−51
@@ -1,6 +1,6 @@
11$if(document-css)$
22html {
3− line-height: $if(linestretch)$$linestretch$$else$1.5$endif$;
3+ line-height: $if(linestretch)$$linestretch$$else$1.7$endif$;
44 font-family: $if(mainfont)$$mainfont$$else$Georgia, serif$endif$;
55 font-size: $if(fontsize)$$fontsize$$else$20px$endif$;
66 color: $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
@@ -8,13 +8,13 @@ html {
88}
99body {
1010 margin: 0 auto;
11− max-width: 36em;
11+ max-width: 40em;
1212 padding-left: $if(margin-left)$$margin-left$$else$50px$endif$;
1313 padding-right: $if(margin-right)$$margin-right$$else$50px$endif$;
1414 padding-top: $if(margin-top)$$margin-top$$else$50px$endif$;
1515 padding-bottom: $if(margin-bottom)$$margin-bottom$$else$50px$endif$;
1616 hyphens: auto;
17− overflow-wrap: break-word;
17+ word-wrap: break-word;
1818 text-rendering: optimizeLegibility;
1919 font-kerning: normal;
2020}
@@ -28,7 +28,6 @@ body {
2828 body {
2929 background-color: transparent;
3030 color: black;
31− font-size: 12pt;
3231 }
3332 p, h2, h3 {
3433 orphans: 3;
@@ -39,7 +38,7 @@ body {
3938 }
4039}
4140p {
42− margin: 1em 0;
41+ margin-top: 1.7em;
4342}
4443a {
4544 color: $if(linkcolor)$$linkcolor$$else$#1a1a1a$endif$;
@@ -51,91 +50,59 @@ img {
5150 max-width: 100%;
5251}
5352h1, h2, h3, h4, h5, h6 {
54− margin-top: 1.4em;
55−}
56−h5, h6 {
57− font-size: 1em;
58− font-style: italic;
59−}
60−h6 {
61− font-weight: normal;
53+ margin-top: 1.7em;
6254}
6355ol, ul {
6456 padding-left: 1.7em;
65− margin-top: 1em;
57+ margin-top: 1.7em;
6658}
6759li > ol, li > ul {
6860 margin-top: 0;
6961}
7062blockquote {
71− margin: 1em 0 1em 1.7em;
63+ margin: 1.7em 0 1.7em 1.7em;
7264 padding-left: 1em;
7365 border-left: 2px solid #e6e6e6;
74− color: #606060;
66+ font-style: italic;
7567}
7668code {
7769 font-family: $if(monofont)$$monofont$$else$Menlo, Monaco, 'Lucida Console', Consolas, monospace$endif$;
78−$if(monobackgroundcolor)$
79− background-color: $monobackgroundcolor$;
80− padding: .2em .4em;
81−$endif$
70+ background-color: #f0f0f0;
8271 font-size: 85%;
8372 margin: 0;
73+ padding: .2em .4em;
8474}
8575pre {
86− margin: 1em 0;
87−$if(monobackgroundcolor)$
88− background-color: $monobackgroundcolor$;
76+ line-height: 1.5em;
8977 padding: 1em;
90−$endif$
78+ background-color: #f0f0f0;
9179 overflow: auto;
9280}
9381pre code {
9482 padding: 0;
9583 overflow: visible;
96− overflow-wrap: normal;
97−}
98−.sourceCode {
99− background-color: transparent;
100− overflow: visible;
10184}
10285hr {
10386 background-color: #1a1a1a;
10487 border: none;
10588 height: 1px;
106− margin: 1em 0;
89+ margin-top: 1.7em;
10790}
10891table {
109− margin: 1em 0;
11092 border-collapse: collapse;
11193 width: 100%;
11294 overflow-x: auto;
11395 display: block;
114− font-variant-numeric: lining-nums tabular-nums;
115−}
116−table caption {
117− margin-bottom: 0.75em;
11896}
119−tbody {
120− margin-top: 0.5em;
121− border-top: 1px solid $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
122− border-bottom: 1px solid $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
123−}
124−th {
125− border-top: 1px solid $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$;
126− padding: 0.25em 0.5em 0.25em 0.5em;
127−}
128−td {
129− padding: 0.125em 0.5em 0.25em 0.5em;
97+th, td {
98+ border-bottom: 1px solid lightgray;
99+ padding: 1em 3em 1em 0;
130100}
131101header {
132− margin-bottom: 4em;
102+ margin-bottom: 6em;
133103 text-align: center;
134104}
135−#TOC li {
136− list-style: none;
137−}
138−#TOC a:not(:hover) {
105+nav a:not(:hover) {
139106 text-decoration: none;
140107}
141108$endif$
data/translations/zh-Hans.yamldeleted−22
@@ -1,22 +0,0 @@
1−Abstract: 摘要
2−Appendix: 附录
3−Bibliography: 文献目录
4−Cc: 副本
5−Chapter: 章
6−Contents: 目录
7−Encl: 附件
8−Figure: 图
9−Glossary: 术语
10−Index: 索引
11−Listing: 列表
12−ListOfFigures: 附图目录
13−ListOfTables: 表格索引
14−Page: 页
15−Part: 段
16−Preface: 序
17−Proof: 校对
18−References: 参考文献
19−See: 见
20−SeeAlso: 参见
21−Table: 表
22−To: 到
data/translations/zh-Hant.yamldeleted−22
@@ -1,22 +0,0 @@
1−Abstract: 摘要
2−Appendix: 附錄
3−Bibliography: 文獻目錄
4−Cc: 副本
5−Chapter: 章
6−Contents: 目錄
7−Encl: 附件
8−Figure: 圖
9−Glossary: 術語
10−Index: 索引
11−Listing: 列表
12−ListOfFigures: 附圖目錄
13−ListOfTables: 表格索引
14−Page: 頁
15−Part: 段
16−Preface: 序
17−Proof: 校對
18−References: 參考文獻
19−See: 見
20−SeeAlso: 參見
21−Table: 表
22−To: 到
data/vimwiki.cssnew file+82
@@ -0,0 +1,82 @@
1+pre{
2+ font-size: 1.5em
3+}
4+
5+img {vertical-align: middle}
6+
7+body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 120%; line-height: 130%;}
8+h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
9+h1 {font-size: 2.6em; color: #000000;}
10+h2 {font-size: 2.2em; color: #404040;}
11+h3 {font-size: 1.8em; color: #707070;}
12+h4 {font-size: 1.4em; color: #909090;}
13+h5 {font-size: 1.3em; color: #989898;}
14+h6 {font-size: 1.2em; color: #9c9c9c;}
15+p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
16+ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
17+li {margin: 0.3em auto;}
18+ul {margin-left: 2em; padding-left: 0.5em;}
19+dt {font-weight: bold;}
20+img {border: none;}
21+pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
22+blockquote {padding: 0.4em; background-color: #f6f5eb;}
23+th, td {border: 1px solid #ccc; padding: 0.3em;}
24+th {background-color: #f0f0f0;}
25+hr {border: none; border-top: 1px solid #ccc; width: 100%;}
26+del {text-decoration: line-through; color: #777777;}
27+.toc li {list-style-type: none;}
28+.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
29+.justleft {text-align: left;}
30+.justright {text-align: right;}
31+.justcenter {text-align: center;}
32+.center {margin-left: auto; margin-right: auto;}
33+div.center > table {margin-left: auto; margin-right: auto;}
34+.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;}
35+
36+/* classes for items of todo lists */
37+.done0 {
38+ /* list-style: none; */
39+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
40+ background-repeat: no-repeat;
41+ background-position: 0 .2em;
42+ padding-left: 1.5em;
43+}
44+.done1 {
45+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
46+ background-repeat: no-repeat;
47+ background-position: 0 .15em;
48+ padding-left: 1.5em;
49+}
50+.done2 {
51+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
52+ background-repeat: no-repeat;
53+ background-position: 0 .15em;
54+ padding-left: 1.5em;
55+}
56+.done3 {
57+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
58+ background-repeat: no-repeat;
59+ background-position: 0 .15em;
60+ padding-left: 1.5em;
61+}
62+.done4 {
63+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
64+ background-repeat: no-repeat;
65+ background-position: 0 .15em;
66+ padding-left: 1.5em;
67+}
68+
69+*:not(pre) > code {
70+ font-family: Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace;
71+ -webkit-border-radius: 1px;
72+ -moz-border-radius: 1px;
73+ border-radius: 1px;
74+ -moz-background-clip: padding;
75+ -webkit-background-clip: padding-box;
76+ background-clip: padding-box;
77+ padding: 0px 3px;
78+ display: inline-block;
79+ color: #52595d;
80+ border: 1px solid #ccc;
81+ background-color: #f9f9f9;
82+}
default.nixdeleted−13
@@ -1,13 +0,0 @@
1−# default.nix
2−let
3− pkgs = import <nixpkgs> { };
4−in
5− pkgs.haskellPackages.developPackage {
6− root = ./.;
7− modifier = drv:
8− pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
9− [ cabal-install
10− ghcid
11− ]);
12− }
13−
doc/epub.md+2−9
@@ -141,15 +141,8 @@ Pandoc has an EPUB3 writer. It renders LaTeX math into MathML, which
141141EPUB3 readers are supposed to support (but unfortunately few do).
142142
143143Of course, this isn't much help if you want EPUB2 output (`pandoc -t epub2`)
144−or target readers that don't support MathML. Then you have two options:
145−
146−1. Use the [`--webtex`](https://pandoc.org/MANUAL.html#option--webtex) option,
147− which will use a web service to convert the TeX to an image.
148−2. Use the [`--gladtex`](https://pandoc.org/MANUAL.html#option--gladtex) option
149− to convert maths into SVG images on your local machine.
150−
151−Both GladTeX and WebTeX add the LaTeX source of the formula as alternative text
152−of the image, increasing accessibility for blind users.
144+or target readers that don't support MathML. Then you should try using the
145+`--webtex` option, which will use a web service to convert the TeX to an image.
153146
154147[KindleGen]: https://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211
155148[EPUB]: https://en.wikipedia.org/wiki/EPUB
doc/faqs.mddeleted−128
@@ -1,128 +0,0 @@
1−% FAQs
2−
3−::: faqs
4−
5−## How can I convert a whole directory of files from Markdown to RTF?
6−
7−On linux or OSX:
8−
9− for f in *.txt; do pandoc "$f" -s -o "${f%.txt}.rtf"; done
10−
11−
12−In Windows Powershell:
13−
14− gci -r -i *.txt |foreach{$rtf=$_.directoryname+"\"+$_.basename+".rtf";pandoc -f markdown -s $_.name -o $rtf}
15−
16−## I used pandoc to convert a document to ICML (or OPML or RTF), and when I try to open it I'm told it's invalid. What have I done wrong?
17−
18−Be sure to use the `-s` or `--standalone` flag, or you just get a
19−fragment, not a full document with the required header:
20−
21− pandoc -s -f markdown -t icml -o my.icml my.md
22−
23−## I get a blank document when I try to convert a markdown document in Chinese to PDF.
24−
25−By default, pandoc uses pdflatex to generate the PDF, and pdflatex
26−doesn't handle Chinese characters. But you can change the default to
27−use xelatex instead. You should also make sure you're using a font
28−with Chinese glyphs. For example:
29−
30− pandoc -o c.pdf --pdf-engine=xelatex -V mainfont='Adobe Ming Std'
31−
32−## The Windows installer does a single user install, rather than installing pandoc for all users. How can I install pandoc for all users?
33−
34−Run the following command as admin:
35−
36− msiexec /i pandoc-VERSION.msi ALLUSERS=1
37−
38−This will put pandoc in `C:\Program Files\Pandoc`.
39−You can install Pandoc to a different directory by setting APPLICATIONFOLDER parameter,
40−for example:
41−
42− msiexec /i pandoc-1.11.1.msi ALLUSERS=1 APPLICATIONFOLDER="C:\Pandoc"
43−
44−## How do I change the margins in PDF output?
45−
46−The option
47−
48− -V geometry:margin=1in
49−
50−will set the margins to one inch on each side. If you don't want uniform
51−margins, you can do something like
52−
53− -V geometry:"top=2cm, bottom=1.5cm, left=1cm, right=1cm"
54−
55−Or
56−
57− -V geometry:"left=3cm, width=10cm"
58−
59−For more options, see the documentation for the LaTeX [geometry
60−package](https://www.ctan.org/pkg/geometry).
61−
62−## How does pandoc compare to multimarkdown?
63−
64−Here is a [wiki
65−page](https://github.com/jgm/pandoc/wiki/Pandoc-vs-Multimarkdown)
66−comparing the two.
67−
68−## When I specify an image width of 50% and convert to LaTeX, pandoc sets the height to textheight and the aspect ratio isn't preserved. How can I prevent this?
69−
70−For example, if you convert an image with `{width="50%"}`, the LaTeX produced
71−will be `\includegraphics[width=0.5\textwidth,height=\textheight]`.
72−
73−This output presupposes the following code in pandoc's default latex
74−template:
75−
76−```
77−% Scale images if necessary, so that they will not overflow the page
78−% margins by default, and it is still possible to overwrite the defaults
79−% using explicit options in \includegraphics[width, height, ...]{}
80−\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
81−```
82−
83−If you don't have this in your custom template, you should
84−add it. If we didn't set the `height` explicitly in this way,
85−the image would not be resized correctly unless it was
86−being resized to smaller than its original size.
87−
88−## Pandoc sometimes uses too much memory. How can I limit the memory used by pandoc?
89−
90−`pandoc +RTS -M30m -RTS` will limit heap memory to 30MB.
91−When converting a document requires more than this, an out of
92−memory error will be issued.
93−
94−## When using `--include-in-header` with PDF or LaTeX output, how do I reference tex declarations coming after `$header-includes$` in the default template?
95−
96−For various reasons, the `$header-includes$` are not at the very
97−end of the LaTeX preamble. This poses a problem when the code
98−you are inserting depends on declarations in the preamble coming
99−after the `$header-includes$` location. For example, you might
100−want to reference the `\author` and `\title` metadata values
101−(set at the very bottom of the preamble) and present them in
102−margins. In that case you can wrap your code in `etoolbox`'s
103−`\AtEndPreamble`. The technique is demonstrated in [this
104−gist](https://gist.github.com/JohnLukeBentley/9dda6166b9ee5c4127afd2b8cd16b70a).
105−When using `\AtEndPreamble`, keep any `makeatletter` or
106−`makeatother` outside of the `\AtEndPreamble`, as shown in the
107−example.
108−
109−## How can I convert PDFs to other formats using pandoc?
110−
111−You can't. You can try opening the PDF in Word or Google Docs
112−and saving in a format from which pandoc can convert directly.
113−
114−## Do I really need to install a 1 GB TeX installation to produce a PDF using pandoc?
115−
116−No. You can get by with a relatively small TeX installation,
117−for example, by starting with MacTeX's Basic TeX distribution
118−and using the `tlmgr` tool to install a few packages required by pandoc
119−(see https://pandoc.org/MANUAL.html#creating-a-pdf).
120−
121−Or, you can produce PDFs via HTML and `wkhtmltopdf`,
122−or via groff ms and `pdfroff`. (These don't produce as nice
123−topography as TeX, particularly when it comes to math, but they
124−may be fine for many purposes.)
125−
126−
127−:::
128−
doc/filters.md+6−91
@@ -253,15 +253,12 @@ repository](https://github.com/jgm/pandocfilters).
253253
254254For a more Pythonic alternative to pandocfilters, see
255255the [panflute](https://pypi.org/project/panflute) library.
256−Don't like Python? There are also ports of pandocfilters in
257−
258−- [PHP](https://github.com/vinai/pandocfilters-php),
259−- [perl](https://metacpan.org/pod/Pandoc::Filter),
260−- TypeScript/JavaScript via Node.js
261− - [pandoc-filter](https://github.com/mvhenderson/pandoc-filter-node),
262− - [node-pandoc-filter](https://github.com/mu-io/node-pandoc-filter),
263−- [Groovy](https://github.com/dfrommi/groovy-pandoc), and
264−- [Ruby](https://heerdebeer.org/Software/markdown/paru/).
256+Don't like Python? There are also ports of pandocfilters in
257+[PHP](https://github.com/vinai/pandocfilters-php),
258+[perl](https://metacpan.org/pod/Pandoc::Filter),
259+[javascript/node.js](https://github.com/mvhenderson/pandoc-filter-node),
260+[Groovy](https://github.com/dfrommi/groovy-pandoc), and
261+[Ruby](https://heerdebeer.org/Software/markdown/paru/).
265262
266263Starting with pandoc 2.0, pandoc includes built-in support for
267264writing filters in lua. The lua interpreter is built in to
@@ -394,8 +391,6 @@ automatically assign it `Just` the target format or `Nothing`.
394391
395392We compile our script:
396393
397− # first, make sure pandoc-types is installed:
398− cabal install --lib pandoc-types --package-env .
399394 ghc --make handleRuby
400395
401396Then run it:
@@ -430,83 +425,3 @@ the Japanese characters (e.g. "Noto Sans CJK TC"), and add
4304255. Find all code blocks with class `python` and run them
431426 using the python interpreter, printing the results to the console.
432427
433−# Technical details of JSON filters
434−
435−A JSON filter is any program which can consume and produce a
436−valid pandoc JSON document representation. This section describes
437−the technical details surrounding the invocation of filters.
438−
439−## Arguments
440−
441−The program will always be called with the target format as the
442−only argument. A pandoc invocation like
443−
444− pandoc --filter demo --to=html
445−
446−will cause pandoc to call the program `demo` with argument `html`.
447−
448−## Environment variables
449−
450−Pandoc sets additional environment variables before calling a
451−filter.
452−
453−`PANDOC_VERSION`
454−: The version of the pandoc binary used to process the document.
455− Example: `2.11.1`.
456−
457−`PANDOC_READER_OPTIONS`
458−: JSON object representation of the options passed to the input
459− parser.
460−
461− Object fields:
462−
463− `readerAbbreviations`
464− : set of known abbreviations (array of strings).
465−
466− `readerColumns`
467− : number of columns in terminal; an integer.
468−
469− `readerDefaultImageExtension`
470− : default extension for images; a string.
471−
472− `readerExtensions`
473− : integer representation of the syntax extensions bit
474− field.
475−
476− `readerIndentedCodeClasses`
477− : default classes for indented code blocks; array of
478− strings.
479−
480− `readerStandalone`
481− : whether the input was a standalone document with header;
482− either `true` or `false`.
483−
484− `readerStripComments`
485− : HTML comments are stripped instead of parsed as raw HTML;
486− either `true` or `false`.
487−
488− `readerTabStop`
489− : width (i.e. equivalent number of spaces) of tab stops;
490− integer.
491−
492− `readerTrackChanges`
493− : track changes setting for docx; one of
494− `"accept-changes"`, `"reject-changes"`, and
495− `"all-changes"`.
496−
497−## Supported interpreters
498−
499−Files passed to the `--filter`/`-F` parameter are expected to be
500−executable. However, if the executable bit is not set, then
501−pandoc tries to guess a suitable interpreter from the file
502−extension.
503−
504− file extension interpreter
505− ---------------- --------------
506− .py `python`
507− .hs `runhaskell`
508− .pl `perl`
509− .rb `ruby`
510− .php `php`
511− .js `node`
512− .r `Rscript`
doc/jats.mddeleted−414
@@ -1,414 +0,0 @@
1−---
2−title: JATS
3−author: Albert Krewinkel
4−---
5−
6−This document describes pandoc's handling of JATS.
7−
8−Metadata Values
9−===============
10−
11−`abstract`
12−: Article summary. Added via the document's front matter via the
13− [`<abstract>`][elem:abstract] element.
14−
15−`author`
16−: list of article contributors. Each author should have a surname
17− and a given name listed in the entry; if the author has no
18− `surname` value, then the item will be used as the contributors
19− [`string-name`][elem:string-name].
20−
21− `orcid`
22− : the contributor's ORCID identifier.
23−
24− `surname`
25− : surname of the contributor. Usually the family name in
26− western names.
27−
28− See [`<surname>`][elem:surname].
29−
30− `given-names`
31− : personal names of the contributor; this includes middle
32− names (if any) in western-style names.
33−
34− See [`<given-names>`][elem:given-names].
35−
36− `name`
37− : full name of the author; included only as a fallback if
38− `author.surname` is not available. Tagged with
39− [`<string-name>`][elem:string-name].
40−
41− `email`
42− : the contributor's email address.
43−
44− Used as the contents of the [`<email>`][elem:given-names]
45− element.
46−
47− `affiliation`
48− : list of affiliation identifiers; marks the organizations
49− with which an author is affiliated. Each identifier in this
50− list must also occur as the `id` of an affiliation listed in
51− the top-level `affiliation` list.
52−
53− `equal-contrib`
54− : boolean attribute used to mark authors who contributed
55− equally to the work. The
56− [`equal-contrib`][attr:equal-contrib] attribute is added
57− to the author's [`<contrib>`] element if this is set to a
58− truthy value.
59−
60− `cor-id`
61− : identifier linking to the contributor's correspondence
62− information. The info itself must be stored in as an item in
63− `article.author-notes.corresp`. If the `cor-id` value is
64− then, an [`<xref>`][elem:xref] link of
65− [`ref-type`][attr:ref-type] `corresp` is added. The
66− [`rid`][attr:rid] attribute is set to `cor-<ID>`, where
67− `<ID>` is the stringified value of this attribute.
68−
69−`affiliation`
70−: the list of organizations with which contributors are
71− affiliated. Each institution is added as an [`<aff>`] element to
72− the author's contrib-group.
73−
74− The fields are given in the order in which they are included in
75− the output.
76−
77− `id`
78− : internal identifier; used as the [`<aff>`] element's `id`
79− value, prefixed with `aff-`.
80−
81− `group`
82− : name of the research group or other low-level organizational
83− structure; used as value of an [`<institution>`] element with
84− [`content-type`][attr:content-type] set to `group`.
85−
86− `department`
87− : name of the department or other mid-level organizational
88− structure; used as value of an [`<institution>`] element with
89− [`content-type`][attr:content-type] set to `dept`.
90−
91− `organization`
92− : name of the company, university, or other top-level
93− organizational structure; used as value of an
94− [`<institution>`] element. The institution element is wrapped
95− in an [`<institution-wrap>`] element; any identifiers, like
96− `ringgold` or `ror`, are added to the wrapper and must hence
97− belong to this organization (not the department or group).
98−
99− `isni`
100− : International Standard Name Identifier of the organization.
101− Added via an [`<institution-id>`] element with
102− [`institution-id-type`](attr:institution-id-type) set to
103− `ISNI`.
104−
105− `ringgold`
106− : [Ringgold] identifier of the organization. Added via an
107− [`<institution-id>`] element with
108− [`institution-id-type`](attr:institution-id-type) set to
109− `Ringgold`.
110−
111− `ror`
112− : Research Organization Registry identifier of the
113− organization. Added via an [`<institution-id>`] element with
114− [`institution-id-type`](attr:institution-id-type) set to
115− `ROR`.
116−
117− `pid`
118− : Array of persistent identifiers which are added as
119− [`<institution-id>`] elements. Each item must contain a map
120− with keys `type`, used as
121− [`institution-id-type`](attr:institution-id-type), and `id`,
122− used as element content.
123−
124− `street-address`
125− : The organization's street address; each list item is wrapped
126− in an [`<addr-line>`] element, separated by a comma and
127− space (`, `).
128−
129− `city`
130− : City in which the organization is located; used only if
131− `street-address` is not given, in which case the value is
132− wrapped in a [`<city>`] element.
133−
134− `country`
135− : Country in which the organization is located; used as the
136− value of a [`<country>`] element.
137−
138− `country-code`
139− : Two letter ISO-3166-1 country identifier; used as the
140− [`country`][attr:country] attribute in element [`<country>`]
141− (if the latter is present).
142−
143−`copyright`
144−: Licensing and copyright information. This information is
145− rendered via the [`<permissions>`][elem:permissions] element.
146−
147− The variables `type`, `link`, and `text` should always be used
148− together.
149−
150− `statement`
151− : the year of copyright; used as content of the
152− [`<copyright-statement>`][elem:copyright-statement]
153−
154− `year`
155− : the year of copyright; used as content of the
156− [`<copyright-year>`][elem:copyright-year]
157−
158− `holder`
159− : the copyright holder; included via the
160− [`<copyright-holder>`][elem:copyright-holder] element.
161−
162− `text`
163− : inline text setting the license under which the text is
164− published; included via the
165− [`<license-p>`][elem:copyright-holder] element.
166−
167− `type`
168− : type of the license; used as value of the
169− [`license-type`][attr:license-type] attribute.
170−
171− `link`
172− : external link describing the license; used as value of a
173− `xlink:href` attribute in the `<license>` element.
174−
175−`date`
176−: publication date. This value should usually be a string
177− representation of a date. Pandoc will parse and deconstruct the
178− date into the components given below. It is also possible to
179− pass these components directly.
180−
181− The publication date is recorded in the document via the
182− [`<pub-date>`] element and its sub-elements. The
183− [`publication-format`][attr:publication-format] attribute is
184− always set to `electronic`.
185−
186− `iso-8601`
187− : ISO-8601 representation of the publication date. Used as the
188− value of the [`<pub-date>`] element's
189− [`iso-8601-date`][attr:iso-8601-date] attribute.
190−
191− This value is set automatically if pandoc can parse the
192− `date` value as a date.
193−
194− `day`, `month`, `year`
195− : Day, month, and year of the publication date. Only the
196− publication year is required. The values are used as the
197− contents of the elements with the respective names.
198−
199− The values are set automatically if pandoc can parse the
200− `date` value as a date.
201−
202− `type`
203− : The type of event marked by this date. The value is set as
204− the [`date-type`][attr:date-type] attribute on the
205− [`<pub-date>`] element and defaults to "pub" if not
206− specified.
207−
208−`article`
209−: information concerning the article that identifies or describes
210− it. The key-value pairs within this map are typically used
211− within the [`<article-meta>`][elem:article-meta] element.
212−
213− `publisher-id`
214− : external article identifier assigned by the publisher. Used
215− as the content of the [`<article-id>`][elem:article-id]
216− element with attribute [`pub-id-type`][attr:pub-id-type] set
217− to `publisher-id`.
218−
219− `doi`
220− : Digital Object Identifier (DOI) assigned to the article.
221− Used as the content of the [`<article-id>`][elem:article-id]
222− element with attribute [`pub-id-type`][attr:pub-id-type] set
223− to `doi`.
224−
225− `pmid`
226− : PubMed Identifier (PubMed ID) assigned to the article. Used
227− as the content of the [`<article-id>`][elem:article-id]
228− element with attribute [`pub-id-type`][attr:pub-id-type] set
229− to `pmid`.
230−
231− `pmcid`
232− : PubMed Central Identifier assigned to the article. Used as
233− the content of the [`<article-id>`][elem:article-id] element
234− with attribute [`pub-id-type`][attr:pub-id-type] set to
235− `pmcid`.
236−
237− `art-access-id`
238− : generic article accession identifier. Used as the content of
239− the [`<article-id>`][elem:article-id] element with attribute
240− [`pub-id-type`][attr:pub-id-type] set to `art-access-id`.
241−
242− `heading`
243− : name of a subject or topic describing the article. Used as
244− the content of the [`<subject>`][elem:subject] element,
245− nested in a [`<subj-group>`][elem:subj-group] element which
246− has `heading` as its
247− [`subj-group-type`][attr:subj-group-type] attribute.
248−
249− `categories`
250− : list a subject or topic describing the article. Items are
251− each used as the content a the [`<subject>`][elem:subject]
252− element, grouped in a single
253− [`<subj-group>`][elem:subj-group] element with its
254− [`subj-group-type`][attr:subj-group-type] attribute set to
255− `categories`.
256−
257− `author-notes`
258− : Additional information about authors, like conflict of
259− interest statements and corresponding author contact info.
260− Wrapped in an [`<author-notes>`][elem:author-notes] element.
261−
262− `conflict`
263− : Conflict of interest statement. Rendered as a footnote
264− ([`<fn>`][elem:fn]) of [`fn-type`](attr:fn-type)
265− `conflict`.
266−
267− `con`
268− : Contributed-by information. Rendered as a footnote
269− ([`<fn>`][elem:fn]) of [`fn-type`](attr:fn-type) `con`.
270−
271− `corresp`
272− : Correspondence information. This must be a list of
273− contributor correspondence items, where each item must
274− have the properties `id` and `email`. The info is then
275− rendered via a [`<corresp>`][elem:corresp] element.
276−
277− `funding-statement`
278− : Prose describing the funding. Added to the article's
279− frontmatter via the
280− [`funding-statement`][elem:funding-statement] element.
281−
282−`journal`
283−: information on the journal in which the article is published.
284− This must be a map; the following key/value pairs are
285− recognized.
286−
287− `publisher-id`
288− : journal identifier assigned by the publisher. Used as
289− content of element [`<journal-id>`][elem:journal-id] with
290− attribute [`journal-id-type`][attr:journal-id-type] set to
291− `publisher-id`.
292−
293− `nlm-ta`
294− : journal identifier assigned by PubMed. Used as content of
295− element [`<journal-id>`][elem:journal-id] with attribute
296− [`journal-id-type`][attr:journal-id-type] set to `nlm-ta`.
297−
298− `pmc`
299− : journal identifier assigned by PubMed Central. Used as
300− content of element [`<journal-id>`][elem:journal-id] with
301− attribute [`journal-id-type`][attr:journal-id-type] set to
302− `pmc`.
303−
304− `title`
305− : full title of the journal in which the article is published.
306− Used as content of the
307− [`<journal-title>`][elem:journal-title] element.
308−
309− `abbrev-title`
310− : short form of the journal title. Used as content of the
311− [`<abbrev-journal-title>`][elem:abbrev-journal-title]
312− element.
313−
314− `pissn`
315− : ISSN identifier of the publication's print version. Used as
316− content of the [`<issn>`][elem:issn] element with the
317− [`publication-format`][attr:publication-format] attribute
318− set to `print`.
319−
320− `eissn`
321− : ISSN identifier of the publication's electronic version.
322− Used as content of the [`<issn>`][elem:issn] element with
323− the [`publication-format`][attr:publication-format]
324− attribute set to `electronic`.
325−
326− `publisher-name`
327− : name of the publishing entity (person, company, or other).
328− Used as the content of the
329− [`<publisher-name>`][elem:publisher-name] element.
330−
331− `publisher-loc`
332− : place of publication. Used as the content of the
333− [`<publisher-loc>`][elem:publisher-loc] element.
334−
335−`notes`
336−: Additional notes concerning the whole article. Added to the
337− article's frontmatter via the [`<notes>`][elem:notes] element.
338−
339−`tags`
340−: list of keywords. Items are used as contents of the
341− [`<kwd>`][elem:kwd] element; the elements are grouped in a
342− [`<kwd-group>`][elem:kwd-group] with the
343− [`kwd-group-type`][attr:kwd-group-type] value `author`.
344−
345−Required Metadata
346−-----------------
347−
348−Pandoc will try to generate a valid JATS document even when
349−information is missing, filling in placeholders or using empty
350−values. This circumvents the intend to ensure a minimum set of
351−information being present in documents of a certain tag set. It is
352−hence recommended to always provide the information listed below.
353−
354−### Publishing Tag Set
355−
356−Required metadata values:
357−
358−- One or more of `journal.publisher-id`, `journal.nlm-ta`,
359− `journal.pmc`.
360−- One or more of `journal.pissn`, `journal.eissn`.
361−
362−[Ringgold]: https://ringgold.com/
363−[attr:content-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/content-type.html
364−[attr:date-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/date-type.html
365−[attr:equal-contrib]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/equal-contrib.html
366−[attr:fn-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/fn-type.html
367−[attr:institution-id-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/institution-id-type.html
368−[attr:iso-8601-date]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/iso-8601-date.html
369−[attr:journal-id-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/journal-id-type.html
370−[attr:kwd-group-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/kwd-group-type.html
371−[attr:license-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/license-type.html
372−[attr:pub-id-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/pub-id-type.html
373−[attr:publication-format]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/publication-format.html
374−[attr:ref-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/ref-type.html
375−[attr:rid]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/rid.html
376−[attr:subj-group-type]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/attribute/subj-group-type.html
377−[elem:abbrev-journal-title]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/abbrev-journal-title.html
378−[elem:abstract]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/abstract.html
379−[elem:article-id]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/article-id.html
380−[elem:article-meta]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/article-meta.html
381−[elem:copyright-holder]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/copyright-holder.html
382−[elem:copyright-statement]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/copyright-statement.html
383−[elem:copyright-year]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/copyright-year.html
384−[elem:corresp]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/corresp.html
385−[elem:email]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/email.html
386−[elem:fn]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/fn.html
387−[elem:funding-statement]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/funding-statement.html
388−[elem:given-names]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/given-names.html
389−[elem:issn]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/issn.html
390−[elem:journal-id]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/journal-id.html
391−[elem:journal-title]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/journal-title.html
392−[elem:kwd-group]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/kwd-group.html
393−[elem:kwd]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/kwd.html
394−[elem:license-p]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/license-p.html
395−[elem:license]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/license.html
396−[elem:notes]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/notes.html
397−[elem:permissions]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/permissions.html
398−[elem:publisher-loc]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/publisher-loc.html
399−[elem:publisher-name]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/publisher-name.html
400−[elem:string-name]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/string-name.html
401−[elem:subj-group]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/subj-group.html
402−[elem:subject]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/subject.html
403−[elem:surname]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/surname.html
404−[elem:xref]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/xref.html
405−
406−[`<addr-line>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/addr-line.html
407−[`<aff>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/aff.html
408−[`<city>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/city.html
409−[`<contrib>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/contrib.html
410−[`<country>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/country.html
411−[`<institution-id>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/institution-id.html
412−[`<institution-wrap>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/institution-wrap.html
413−[`<institution>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/institution.html
414−[`<pub-date>`]: https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/pub-date.html
doc/libraries.mddeleted−63
@@ -1,63 +0,0 @@
1−---
2−title: The pandoc family of libraries
3−author: John MacFarlane
4−---
5−
6−The following Haskell libraries have been developed to support
7−pandoc:
8−
9−[skylighting-core] and [skylighting]
10−: Syntax highlighting engine supporting over 140 languages.
11−
12−[citeproc]
13−: Citation processing using CSL stylesheets.
14−
15−[texmath]
16−: Conversion of math between tex, Word equation, MathML, and GNU eqn.
17−
18−[unicode-collation]
19−: Proper Unicode collation (sorting).
20−
21−[doclayout]
22−: Combinators for laying out a textual document, with support
23− for line wrapping, tabular layout, and more.
24−
25−[doctemplates]
26−: Supports pandoc's templates.
27−
28−[commonmark], [commonmark-extensions], and [commonmark-pandoc]
29−: Efficient, standards-compliant parser for commonmark and extensions.
30−
31−[ipynb]
32−: Representation of Jupyter notebooks and conversion to and
33− from JSON.
34−
35−[zip-archive]
36−: A pure zip file creator and extractor, used by pandoc for
37− docx, ODT, and EPUB.
38−
39−[rfc5051]
40−: Simple unicode collation (used for citation sorting).
41−
42−[emojis]
43−: Conversion between emoji characters and aliases.
44−
45−[jira-wiki-markup]
46−: Support for parsing Jira wiki syntax.
47−
48−[skylighting]: https://hackage.haskell.org/package/skylighting
49−[skylighting-core]: https://hackage.haskell.org/package/skylighting-core
50−[citeproc]: https://hackage.haskell.org/package/citeproc
51−[texmath]: https://hackage.haskell.org/package/texmath
52−[doclayout]: https://hackage.haskell.org/package/doclayout
53−[doctemplates]: https://hackage.haskell.org/package/doctemplates
54−[commonmark]: https://hackage.haskell.org/package/commonmark
55−[commonmark-extensions]: https://hackage.haskell.org/package/commonmark-extensions
56−[commonmark-pandoc]: https://hackage.haskell.org/package/commonmark-pandoc
57−[ipynb]: https://hackage.haskell.org/package/ipynb
58−[zip-archive]: https://hackage.haskell.org/package/zip-archive
59−[rfc5051]: https://hackage.haskell.org/package/rfc5051
60−[emojis]: https://hackage.haskell.org/package/emojis
61−[jira-wiki-markup]: https://hackage.haskell.org/package/jira-wiki-markup
62−[unicode-collation]: https://hackage.haskell.org/package/unicode-collation
63−
doc/lua-filters.md+16−265
@@ -32,7 +32,7 @@ Starting with version 2.0, pandoc makes it possible to write
3232filters in Lua without any external dependencies at all. A Lua
3333interpreter (version 5.3) and a Lua library for creating pandoc
3434filters is built into the pandoc executable. Pandoc data types
35−are marshaled to Lua directly, avoiding the overhead of writing
35+are marshalled to Lua directly, avoiding the overhead of writing
3636JSON to stdout and reading it from stdin.
3737
3838Here is an example of a Lua filter that converts strong emphasis
@@ -75,7 +75,7 @@ Python (`smallcaps.py`):
7575 `pandoc --lua-filter ./smallcaps.lua` 1.03s
7676
7777As you can see, the Lua filter avoids the substantial overhead
78−associated with marshaling to and from JSON over a pipe.
78+associated with marshalling to and from JSON over a pipe.
7979
8080# Lua filter structure
8181
@@ -109,7 +109,7 @@ element filtering function. In other words, filter entries will
109109be called for each corresponding element in the document,
110110getting the respective element as input.
111111
112−The return of a filter function must be one of the following:
112+The return of a filter function must one of the following:
113113
114114- nil: this means that the object should remain unchanged.
115115- a pandoc object: this must be of the same type as the input
@@ -292,7 +292,7 @@ use-case would be to load additional modules, or even to alter
292292default modules.
293293
294294The following snippet is an example of code that might be useful
295−when added to `init.lua`. The snippet adds all Unicode-aware
295+when added to `init.lua`. The snippet adds all unicode-aware
296296functions defined in the [`text` module](#module-text) to the
297297default `string` module, prefixed with the string `uc_`.
298298
@@ -305,29 +305,6 @@ end
305305This makes it possible to apply these functions on strings using
306306colon syntax (`mystring:uc_upper()`).
307307
308−# Debugging Lua filters
309−
310−It is possible to use a debugging interface to halt execution and
311−step through a Lua filter line by line as it is run inside Pandoc.
312−This is accomplished using the remote-debugging interface of the
313−package [`mobdebug`](https://github.com/pkulchenko/MobDebug).
314−Although mobdebug can be run from the terminal, it is more useful
315−run within the donation-ware Lua editor and IDE,
316−[ZeroBrane](https://studio.zerobrane.com/). ZeroBrane offers a
317−REPL console and UI to step-through and view all variables and
318−state.
319−
320−If you already have Lua 5.3 installed, you can add
321−[`mobdebug`](https://luarocks.org/modules/paulclinger/mobdebug)
322−and its dependency
323−[`luasocket`](https://luarocks.org/modules/luasocket/luasocket)
324−using [`luarocks`](https://luarocks.org), which should then be
325−available on the path. ZeroBrane also includes both of these in
326−its package, so if you don't want to install Lua separately, you
327−should add/modify your `LUA_PATH` and `LUA_CPATH` to include the
328−correct locations; [see detailed instructions
329−here](https://studio.zerobrane.com/doc-remote-debugging).
330−
331308# Examples
332309
333310The following filters are presented as examples. A repository of
@@ -1488,22 +1465,6 @@ Fields:
14881465`tag`, `t`
14891466: the literal `Superscript` (string)
14901467
1491−### Underline {#type-underline}
1492−
1493−Underlined text
1494−
1495−Values of this type can be created with the
1496−[`pandoc.Underline`](#pandoc.underline) constructor.
1497−
1498−Fields:
1499−
1500−`content`
1501−: inline content ([List] of [Inlines])
1502−
1503−`tag`, `t`
1504−: the literal `Underline` (string)
1505−
1506−
15071468## Element components
15081469
15091470### Attr {#type-attr}
@@ -1513,7 +1474,7 @@ with the [`pandoc.Attr`](#pandoc.attr) constructor. For
15131474convenience, it is usually not necessary to construct the value
15141475directly if it is part of an element, and it is sufficient to
15151476pass an HTML-like table. E.g., to create a span with identifier
1516−"text" and classes "a" and "b", one can write:
1477+"text" and classes "a" and "b", on can write:
15171478
15181479 local span = pandoc.Span('text', {id = 'text', class = 'a b'})
15191480
@@ -1769,7 +1730,7 @@ A list is any Lua table with integer indices. Indices start at
17691730one, so if `alist = {'value'}` then `alist[1] == 'value'`.
17701731
17711732Lists, when part of an element, or when generated during
1772−marshaling, are made instances of the `pandoc.List` type for
1733+marshalling, are made instances of the `pandoc.List` type for
17731734convenience. The `pandoc.List` type is defined in the
17741735[*pandoc.List*](#module-pandoc.list) module. See there for
17751736available methods.
@@ -2254,7 +2215,7 @@ format, and functions to filter and modify a subtree.
22542215
22552216[`Emph (content)`]{#pandoc.emph}
22562217
2257−: Creates an inline element representing emphasized text.
2218+: Creates an inline element representing emphasised text.
22582219
22592220 Parameters:
22602221
@@ -2457,7 +2418,7 @@ format, and functions to filter and modify a subtree.
24572418
24582419[`Strikeout (content)`]{#pandoc.strikeout}
24592420
2460−: Creates text which is struck out.
2421+: Creates text which is striked out.
24612422
24622423 Parameters:
24632424
@@ -2500,17 +2461,6 @@ format, and functions to filter and modify a subtree.
25002461
25012462 Returns: [Superscript](#type-superscript) object
25022463
2503−[`Underline (content)`]{#pandoc.underline}
2504−
2505−: Creates an Underline inline element
2506−
2507− Parameters:
2508−
2509− `content`:
2510− : inline content
2511−
2512− Returns: [Underline](#type-underline) object
2513−
25142464## Element components
25152465
25162466[`Attr ([identifier[, classes[, attributes]]])`]{#pandoc.attr}
@@ -2605,8 +2555,7 @@ format, and functions to filter and modify a subtree.
26052555 local caption = "Overview"
26062556 local aligns = {pandoc.AlignDefault, pandoc.AlignDefault}
26072557 local widths = {0, 0} -- let pandoc determine col widths
2608− local headers = {{pandoc.Plain({pandoc.Str "Language"})},
2609− {pandoc.Plain({pandoc.Str "Typing"})}}
2558+ local headers = {"Language", "Typing"}
26102559 local rows = {
26112560 {{pandoc.Plain "Haskell"}, {pandoc.Plain "static"}},
26122561 {{pandoc.Plain "Lua"}, {pandoc.Plain "Dynamic"}},
@@ -2743,21 +2692,9 @@ format, and functions to filter and modify a subtree.
27432692Runs command with arguments, passing it some input, and returns
27442693the output.
27452694
2746−Parameters:
2747−
2748−`command`
2749−: program to run; the executable will be resolved using default
2750− system methods (string).
2751−
2752−`args`
2753−: list of arguments to pass to the program (list of strings).
2754−
2755−`input`
2756−: data which is piped into the program via stdin (string).
2757−
27582695Returns:
27592696
2760−- Output of command, i.e. data printed to stdout (string)
2697+- Output of command.
27612698
27622699Raises:
27632700
@@ -2917,7 +2854,7 @@ Usage:
29172854
29182855`make_sections (number_sections, base_level, blocks)`
29192856
2920−Converts list of [Blocks](#type-block) into sections.
2857+Converst list of [Blocks](#type-block) into sections.
29212858`Div`s will be created beginning at each `Header`
29222859and containing following content until the next `Header`
29232860of comparable level. If `number_sections` is true,
@@ -3084,8 +3021,7 @@ Clear-out the media bag, deleting all items.
30843021
30853022`insert (filepath, mime_type, contents)`
30863023
3087−Adds a new entry to pandoc's media bag. Replaces any existing
3088−mediabag entry with the same `filepath`.
3024+Adds a new entry to pandoc's media bag.
30893025
30903026Parameters:
30913027
@@ -3093,7 +3029,7 @@ Parameters:
30933029: filename and path relative to the output folder.
30943030
30953031`mime_type`:
3096−: the file's MIME type; use `nil` if unknown or unavailable.
3032+: the file's MIME type
30973033
30983034`contents`:
30993035: the binary contents of the file.
@@ -3177,22 +3113,12 @@ Usage:
31773113
31783114### fetch {#pandoc.mediabag.fetch}
31793115
3180−`fetch (source)`
3116+`fetch (source, base_url)`
31813117
31823118Fetches the given source from a URL or local file. Returns two
31833119values: the contents of the file and the MIME type (or an empty
31843120string).
31853121
3186−The function will first try to retrieve `source` from the
3187−mediabag; if that fails, it will try to download it or read it
3188−from the local file system while respecting pandoc's "resource
3189−path" setting.
3190−
3191−Parameters:
3192−
3193−`source`:
3194−: path to a resource; either a local file path or URI
3195−
31963122Returns:
31973123
31983124- the entries MIME type, or nil if the file was not found.
@@ -3201,11 +3127,11 @@ Returns:
32013127Usage:
32023128
32033129 local diagram_url = "https://pandoc.org/diagram.jpg"
3204− local mt, contents = pandoc.mediabag.fetch(diagram_url)
3130+ local mt, contents = pandoc.mediabag.fetch(diagram_url, ".")
32053131
32063132# Module pandoc.List
32073133
3208−This module defines pandoc's list type. It comes with useful
3134+The this module defines pandoc's list type. It comes with useful
32093135methods and convenience functions.
32103136
32113137## Constructor
@@ -3387,181 +3313,6 @@ methods and convenience functions.
33873313 `comp`:
33883314 : Comparison function as described above.
33893315
3390−# Module pandoc.path
3391−
3392−Module for file path manipulations.
3393−
3394−## Static Fields {#pandoc.path-fields}
3395−
3396−### separator {#pandoc.path.separator}
3397−
3398−The character that separates directories.
3399−
3400−### search_path_separator {#pandoc.path.search_path_separator}
3401−
3402−The character that is used to separate the entries in the `PATH`
3403−environment variable.
3404−
3405−## Functions {#pandoc.path-functions}
3406−
3407−### directory (filepath) {#pandoc.path.directory}
3408−
3409−Gets the directory name, i.e., removes the last directory
3410−separator and everything after from the given path.
3411−
3412−Parameters:
3413−
3414−filepath
3415−: path (string)
3416−
3417−Returns:
3418−
3419−- The filepath up to the last directory separator. (string)
3420−
3421−### filename (filepath) {#pandoc.path.filename}
3422−
3423−Get the file name.
3424−
3425−Parameters:
3426−
3427−filepath
3428−: path (string)
3429−
3430−Returns:
3431−
3432−- File name part of the input path. (string)
3433−
3434−### is_absolute (filepath) {#pandoc.path.is_absolute}
3435−
3436−Checks whether a path is absolute, i.e. not fixed to a root.
3437−
3438−Parameters:
3439−
3440−filepath
3441−: path (string)
3442−
3443−Returns:
3444−
3445−- `true` iff `filepath` is an absolute path, `false` otherwise.
3446− (boolean)
3447−
3448−### is_relative (filepath) {#pandoc.path.is_relative}
3449−
3450−Checks whether a path is relative or fixed to a root.
3451−
3452−Parameters:
3453−
3454−filepath
3455−: path (string)
3456−
3457−Returns:
3458−
3459−- `true` iff `filepath` is a relative path, `false` otherwise.
3460− (boolean)
3461−
3462−### join (filepaths) {#pandoc.path.join}
3463−
3464−Join path elements back together by the directory separator.
3465−
3466−Parameters:
3467−
3468−filepaths
3469−: path components (list of strings)
3470−
3471−Returns:
3472−
3473−- The joined path. (string)
3474−
3475−### make_relative (path, root[, unsafe]) {#pandoc.path.make_relative}
3476−
3477−Contract a filename, based on a relative path. Note that the
3478−resulting path will usually not introduce `..` paths, as the
3479−presence of symlinks means `../b` may not reach `a/b` if it starts
3480−from `a/c`. For a worked example see [this blog
3481−post](https://neilmitchell.blogspot.co.uk/2015/10/filepaths-are-subtle-symlinks-are-hard.html).
3482−
3483−Set `unsafe` to a truthy value to a allow `..` in paths.
3484−
3485−Parameters:
3486−
3487−path
3488−: path to be made relative (string)
3489−
3490−root
3491−: root path (string)
3492−
3493−unsafe
3494−: whether to allow `..` in the result. (boolean)
3495−
3496−Returns:
3497−
3498−- contracted filename (string)
3499−
3500−### normalize (filepath) {#pandoc.path.normalize}
3501−
3502−Normalizes a path.
3503−
3504−- `//` makes sense only as part of a (Windows) network drive;
3505− elsewhere, multiple slashes are reduced to a single
3506− `path.separator` (platform dependent).
3507−- `/` becomes `path.separator` (platform dependent)
3508−- `./` -\> ''
3509−- an empty path becomes `.`
3510−
3511−Parameters:
3512−
3513−filepath
3514−: path (string)
3515−
3516−Returns:
3517−
3518−- The normalized path. (string)
3519−
3520−### split (filepath) {#pandoc.path.split}
3521−
3522−Splits a path by the directory separator.
3523−
3524−Parameters:
3525−
3526−filepath
3527−: path (string)
3528−
3529−Returns:
3530−
3531−- List of all path components. (list of strings)
3532−
3533−### split_extension (filepath) {#pandoc.path.split_extension}
3534−
3535−Splits the last extension from a file path and returns the parts. The
3536−extension, if present, includes the leading separator; if the path has
3537−no extension, then the empty string is returned as the extension.
3538−
3539−Parameters:
3540−
3541−filepath
3542−: path (string)
3543−
3544−Returns:
3545−
3546−- filepath without extension (string)
3547−
3548−- extension or empty string (string)
3549−
3550−### split_search_path (search_path) {#pandoc.path.split_search_path}
3551−
3552−Takes a string and splits it on the `search_path_separator` character.
3553−Blank items are ignored on Windows, and converted to `.` on Posix. On
3554−Windows path elements are stripped of quotes.
3555−
3556−Parameters:
3557−
3558−search_path
3559−: platform-specific search path (string)
3560−
3561−Returns:
3562−
3563−- list of directories in search path (list of strings)
3564−
35653316# Module pandoc.system
35663317
35673318Access to system information and functionality.
doc/org.md+5−22
@@ -22,10 +22,10 @@ The following export keywords are supported:
2222- EMAIL: author email address; passed as plain-text metadata
2323 field `email`, but not used by any default templates.
2424
25−- LANGUAGE: document language; included as plain-text metadata
26− field `lang`. The value should be a [BCP47 language tag].
25+- LANGUAGE: currently unsupported; use `#+LANG:` instead.
2726
28−- SELECT_TAGS: tags which select a tree for export.
27+- SELECT_TAGS: tags which select a tree for export. Currently
28+ *unsupported*.
2929
3030- EXCLUDE\_TAGS: tags which prevent a subtree from being
3131 exported. Fully supported.
@@ -36,23 +36,6 @@ The following export keywords are supported:
3636 defaults to stdout unless a target has to be given as a command
3737 line option.
3838
39−::: {.alert .alert-info}
40−Pandoc tries to be compatible with org-mode when exporting an org document. If
41−you find some behavior confusing, please do refer to org-mode
42−[Export-Settings](https://orgmode.org/manual/Export-Settings.html)
43−documentation. For example, a common confusion
44−([#3214](https://github.com/jgm/pandoc/issues/3214 "Problem with headers lower
45−then 3 in org-mode reader"), [#5169](https://github.com/jgm/pandoc/issues/5169
46−"org mode headings past level three converted to numbered outline list"),
47−[#6145](https://github.com/jgm/pandoc/issues/6145 "Headers 4 levels deep render
48−differently"), [#7236](https://github.com/jgm/pandoc/issues/7236 "In Org mode,
49−Header with level > 3 are not recognized as headers")) is treatment of headers
50−with level > 3 differently because org-mode sets `org-export-headline-levels`
51−(configurable with `#+OPTIONS: H:3`) to 3 by default.
52−:::
53−
54−[BCP47 language tag]: https://tools.ietf.org/html/bcp47
55−
5639Format-specific options
5740-----------------------
5841
@@ -223,7 +206,7 @@ Example:
223206
224207### Parenthetical citation
225208
226−Citations surrounded by parentheses. The syntax is identical to
209+Citations surrounded by parantheses. The syntax is identical to
227210in-text citations, except for the additional parentheses enclosing
228211the initial `cite` tag.
229212
@@ -284,7 +267,7 @@ Use normal latex citation commands like `\cite{x}` or
284267Tables
285268======
286269
287−Pandoc supports normal org tables (sometimes called "pipe tables")
270+Pandoc supports normal org tables (sometimes calles "pipe tables")
288271and grid tables (tables created by [table.el]).
289272
290273Column widths
doc/using-the-pandoc-api.md+15−28
@@ -14,7 +14,7 @@ and types is available at
1414Pandoc is structured as a set of *readers*, which translate
1515various input formats into an abstract syntax tree (the
1616Pandoc AST) representing a structured document, and a set of
17−*writers*, which render this AST into various output formats.
17+*writers*, which render this AST into various input formats.
1818Pictorially:
1919
2020```
@@ -90,14 +90,8 @@ Some notes:
9090Let's look at the types of `readMarkdown` and `writeRST`:
9191
9292```haskell
93−readMarkdown :: (PandocMonad m, ToSources a)
94− => ReaderOptions
95− -> a
96− -> m Pandoc
97−writeRST :: PandocMonad m
98− => WriterOptions
99− -> Pandoc
100− -> m Text
93+readMarkdown :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
94+writeRST :: PandocMonad m => WriterOptions -> Pandoc -> m Text
10195```
10296
10397The `PandocMonad m =>` part is a typeclass constraint.
@@ -126,7 +120,7 @@ getVerbosity :: PandocMonad m => m Verbosity
126120-- | Set the verbosity level.
127121setVerbosity :: PandocMonad m => Verbosity -> m ()
128122
129−-- Get the accumulated log messages (in temporal order).
123+-- Get the accomulated log messages (in temporal order).
130124getLog :: PandocMonad m => m [LogMessage]
131125getLog = reverse <$> getsCommonState stLog
132126
@@ -139,7 +133,7 @@ report :: PandocMonad m => LogMessage -> m ()
139133-- | Fetch an image or other item from the local filesystem or the net.
140134-- Returns raw content and maybe mime type.
141135fetchItem :: PandocMonad m
142− => Text
136+ => String
143137 -> m (B.ByteString, Maybe MimeType)
144138
145139-- Set the resource path searched by 'fetchItem'.
@@ -161,13 +155,6 @@ Note that `PandocIO` is an instance of `MonadIO`, so you can
161155use `liftIO` to perform arbitrary IO operations inside a pandoc
162156conversion chain.
163157
164−`readMarkdown` is polymorphic in its second argument, which
165−can be any type that is an instance of the `ToSources`
166−typeclass. You can use `Text`, as in the example above.
167−But you can also use `[(FilePath, Text)]`, if the input comes
168−from multiple files and you want to track source positions
169−accurately.
170−
171158# Options
172159
173160The first argument of each reader or writer is for
@@ -213,8 +200,8 @@ of the Monoid typeclass and can easily be concatenated:
213200import Text.Pandoc.Builder
214201
215202mydoc :: Pandoc
216−mydoc = doc $ header 1 (text (T.pack "Hello!"))
217− <> para (emph (text (T.pack "hello world")) <> text (T.pack "."))
203+mydoc = doc $ header 1 (text "Hello!")
204+ <> para (emph (text "hello world") <> text ".")
218205
219206main :: IO ()
220207main = print mydoc
@@ -261,16 +248,16 @@ import qualified Data.Text as T
261248import Data.List (intersperse)
262249
263250data Station = Station{
264− address :: T.Text
265− , name :: T.Text
266− , cardsAccepted :: [T.Text]
251+ address :: String
252+ , name :: String
253+ , cardsAccepted :: [String]
267254 } deriving Show
268255
269256instance FromJSON Station where
270257 parseJSON (Object v) = Station <$>
271258 v .: "street_address" <*>
272259 v .: "station_name" <*>
273− (T.words <$> (v .:? "cards_accepted" .!= ""))
260+ (words <$> (v .:? "cards_accepted" .!= ""))
274261 parseJSON _ = mzero
275262
276263createLetter :: [Station] -> Pandoc
@@ -328,7 +315,7 @@ users to override the system defaults. If you want to disable
328315this behavior, use `setUserDataDir Nothing`.
329316
330317To render a template, use `renderTemplate'`, which takes two
331−arguments, a template (Text) and a context (any instance
318+arguments, a template (String) and a context (any instance
332319of ToJSON). If you want to create a context from the metadata
333320part of a Pandoc document, use `metaToJSON'` from
334321[Text.Pandoc.Writers.Shared]. If you also want to incorporate
@@ -350,7 +337,7 @@ use `throwError`.
350337In addition to errors, which stop execution of the conversion
351338pipeline, one can generate informational messages.
352339Use `report` from [Text.Pandoc.Class] to issue a `LogMessage`.
353−For a list of constructors for `LogMessage`, see
340+For a list of cosntructors for `LogMessage`, see
354341[Text.Pandoc.Logging]. Note that each type of log message
355342is associated with a verbosity level. The verbosity level
356343(`setVerbosity`/`getVerbosity`) determines whether the report
@@ -426,7 +413,7 @@ concatenated together. Here's an example that returns a
426413list of the URLs linked to in a document:
427414
428415```haskell
429−listURLs :: Pandoc -> [Text]
416+listURLs :: Pandoc -> [String]
430417listURLs = query urls
431418 where urls (Link _ _ (src, _)) = [src]
432419 urls _ = []
@@ -445,7 +432,7 @@ structure and calling this function.
4454321. Pandoc's parsers can exhibit pathological behavior on some
446433 inputs. So it is always a good idea to wrap uses of pandoc
447434 in a timeout function (e.g. `System.Timeout.timeout` from `base`)
448− to prevent DoS attacks.
435+ to prevent DOS attacks.
449436
4504372. If pandoc generates HTML from untrusted user input, it is
451438 always a good idea to filter the generated HTML through
linux/make_artifacts.sh+7−19
@@ -2,23 +2,13 @@ set -e
22
33MACHINE=$(uname -m)
44case "$MACHINE" in
5− x86_64) ARCHITECTURE=amd64;;
6− i686) ARCHITECTURE=i386;;
7− i386) ARCHITECTURE=i386;;
8− aarch64) ARCHITECTURE=arm64;;
9− *) ARCHITECTURE=unknown;;
5+ x86_64) ARCHITECTURE=amd64;;
6+ i686) ARCHITECTURE=i386;;
7+ i386) ARCHITECTURE=i386;;
108esac
119
1210ARTIFACTS="${ARTIFACTS:-/artifacts}"
1311
14−# This is our sentinel that tells us when we're done.
15−rm -f $ARTIFACTS/DONE
16−
17−clean_up() {
18− echo "All done!" > "$ARTIFACTS/DONE"
19−}
20−trap clean_up EXIT
21−
2212# build binaries
2313
2414cabal --version
@@ -26,9 +16,9 @@ ghc --version
2616
2717cabal v2-update
2818cabal v2-clean
29−cabal v2-configure --enable-tests -f-export-dynamic -fembed_data_files --enable-executable-static --ghc-options '-j4 +RTS -A256m -RTS -split-sections -optc-Os -optl=-pthread' pandoc
30−cabal v2-build -j4
31−cabal v2-test -j4
19+cabal v2-configure --enable-tests -f-export-dynamic -fstatic -fembed_data_files -fbibutils --enable-executable-static --ghc-options '-optc-Os -optl=-pthread -split-sections' pandoc
20+cabal v2-build
21+cabal v2-test -j1
3222for f in $(find dist-newstyle -name 'pandoc' -type f -perm /400); do cp $f /artifacts/; done
3323
3424# make deb
@@ -78,7 +68,5 @@ mv pandoc $TARGET/bin
7868strip $TARGET/bin/pandoc
7969gzip -9 $TARGET/share/man/man1/pandoc.1
8070
81−tar cvzf $TARGET-linux-$ARCHITECTURE.tar.gz $TARGET
71+tar cvzf $TARGET-linux-amd64.tar.gz $TARGET
8272rm -r $TARGET
83−
84−exit 0
man/pandoc.1+650−1144
@@ -1,13 +1,13 @@
1−'\" t
2−.\" Automatically generated by Pandoc 2.14.0.1
1+.\"t
2+.\" Automatically generated by Pandoc 2.10.1
33.\"
4−.TH "Pandoc User\[cq]s Guide" "" "June 20, 2021" "pandoc 2.14.0.3" ""
4+.TH "Pandoc User\[aq]s Guide" "" "July 23, 2020" "pandoc 2.10.1" ""
55.hy
66.SH NAME
77pandoc - general markup converter
88.SH SYNOPSIS
99.PP
10−\f[C]pandoc\f[R] [\f[I]options\f[R]] [\f[I]input-file\f[R]]\&...
10+\f[C]pandoc\f[R] [\f[I]options\f[R]] [\f[I]input-file\f[R]]...
1111.SH DESCRIPTION
1212.PP
1313Pandoc is a Haskell library for converting from one markup format to
@@ -20,10 +20,10 @@ For the full lists of input and output formats, see the \f[C]--from\f[R]
2020and \f[C]--to\f[R] options below.
2121Pandoc can also produce PDF output: see creating a PDF, below.
2222.PP
23−Pandoc\[cq]s enhanced version of Markdown includes syntax for tables,
23+Pandoc\[aq]s enhanced version of Markdown includes syntax for tables,
2424definition lists, metadata blocks, footnotes, citations, math, and much
2525more.
26−See below under Pandoc\[cq]s Markdown.
26+See below under Pandoc\[aq]s Markdown.
2727.PP
2828Pandoc has a modular design: it consists of a set of readers, which
2929parse text in a given format and produce a native representation of the
@@ -33,15 +33,15 @@ Thus, adding an input or output format requires only adding a reader or
3333writer.
3434Users can also run custom pandoc filters to modify the intermediate AST.
3535.PP
36−Because pandoc\[cq]s intermediate representation of a document is less
36+Because pandoc\[aq]s intermediate representation of a document is less
3737expressive than many of the formats it converts between, one should not
3838expect perfect conversions between every format and every other.
3939Pandoc attempts to preserve the structural elements of a document, but
4040not formatting details such as margin size.
4141And some document elements, such as complex tables, may not fit into
42−pandoc\[cq]s simple document model.
43−While conversions from pandoc\[cq]s Markdown to all formats aspire to be
44−perfect, conversions from formats more expressive than pandoc\[cq]s
42+pandoc\[aq]s simple document model.
43+While conversions from pandoc\[aq]s Markdown to all formats aspire to be
44+perfect, conversions from formats more expressive than pandoc\[aq]s
4545Markdown can be expected to be lossy.
4646.SS Using pandoc
4747.PP
@@ -57,9 +57,9 @@ pandoc -o output.html input.txt
5757.fi
5858.PP
5959By default, pandoc produces a document fragment.
60−To produce a standalone document (e.g.\ a valid HTML file including
61−\f[C]<head>\f[R] and \f[C]<body>\f[R]), use the \f[C]-s\f[R] or
62−\f[C]--standalone\f[R] flag:
60+To produce a standalone document (e.g.
61+a valid HTML file including \f[C]<head>\f[R] and \f[C]<body>\f[R]), use
62+the \f[C]-s\f[R] or \f[C]--standalone\f[R] flag:
6363.IP
6464.nf
6565\f[C]
@@ -115,10 +115,10 @@ pandoc -o hello.tex hello.txt
115115.PP
116116will convert \f[C]hello.txt\f[R] from Markdown to LaTeX.
117117If no output file is specified (so that output goes to
118−\f[I]stdout\f[R]), or if the output file\[cq]s extension is unknown, the
118+\f[I]stdout\f[R]), or if the output file\[aq]s extension is unknown, the
119119output format will default to HTML.
120120If no input file is specified (so that input comes from
121−\f[I]stdin\f[R]), or if the input files\[cq] extensions are unknown, the
121+\f[I]stdin\f[R]), or if the input files\[aq] extensions are unknown, the
122122input format will be assumed to be Markdown.
123123.SS Character encoding
124124.PP
@@ -172,15 +172,15 @@ You can then test it with \f[C]pdflatex test.tex\f[R].
172172When using LaTeX, the following packages need to be available (they are
173173included with all recent versions of TeX Live): \f[C]amsfonts\f[R],
174174\f[C]amsmath\f[R], \f[C]lm\f[R], \f[C]unicode-math\f[R],
175−\f[C]iftex\f[R], \f[C]listings\f[R] (if the \f[C]--listings\f[R] option
176−is used), \f[C]fancyvrb\f[R], \f[C]longtable\f[R], \f[C]booktabs\f[R],
177−\f[C]graphicx\f[R] (if the document contains images),
178−\f[C]hyperref\f[R], \f[C]xcolor\f[R], \f[C]ulem\f[R], \f[C]geometry\f[R]
179−(with the \f[C]geometry\f[R] variable set), \f[C]setspace\f[R] (with
180−\f[C]linestretch\f[R]), and \f[C]babel\f[R] (with \f[C]lang\f[R]).
175+\f[C]ifxetex\f[R], \f[C]ifluatex\f[R], \f[C]listings\f[R] (if the
176+\f[C]--listings\f[R] option is used), \f[C]fancyvrb\f[R],
177+\f[C]longtable\f[R], \f[C]booktabs\f[R], \f[C]graphicx\f[R] (if the
178+document contains images), \f[C]hyperref\f[R], \f[C]xcolor\f[R],
179+\f[C]ulem\f[R], \f[C]geometry\f[R] (with the \f[C]geometry\f[R] variable
180+set), \f[C]setspace\f[R] (with \f[C]linestretch\f[R]), and
181+\f[C]babel\f[R] (with \f[C]lang\f[R]).
181182The use of \f[C]xelatex\f[R] or \f[C]lualatex\f[R] as the PDF engine
182183requires \f[C]fontspec\f[R].
183−\f[C]lualatex\f[R] uses \f[C]selnolig\f[R].
184184\f[C]xelatex\f[R] uses \f[C]polyglossia\f[R] (with \f[C]lang\f[R]),
185185\f[C]xecjk\f[R], and \f[C]bidi\f[R] (with the \f[C]dir\f[R] variable
186186set).
@@ -227,18 +227,12 @@ Specify input format.
227227\f[I]FORMAT\f[R] can be:
228228.RS
229229.IP \[bu] 2
230−\f[C]bibtex\f[R] (BibTeX bibliography)
231−.IP \[bu] 2
232−\f[C]biblatex\f[R] (BibLaTeX bibliography)
233−.IP \[bu] 2
234230\f[C]commonmark\f[R] (CommonMark Markdown)
235231.IP \[bu] 2
236232\f[C]commonmark_x\f[R] (CommonMark Markdown with extensions)
237233.IP \[bu] 2
238234\f[C]creole\f[R] (Creole 1.0)
239235.IP \[bu] 2
240−\f[C]csljson\f[R] (CSL JSON bibliography)
241−.IP \[bu] 2
242236\f[C]csv\f[R] (CSV table)
243237.IP \[bu] 2
244238\f[C]docbook\f[R] (DocBook)
@@ -269,7 +263,7 @@ if you need extensions not supported in \f[C]gfm\f[R].
269263.IP \[bu] 2
270264\f[C]latex\f[R] (LaTeX)
271265.IP \[bu] 2
272−\f[C]markdown\f[R] (Pandoc\[cq]s Markdown)
266+\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)
273267.IP \[bu] 2
274268\f[C]markdown_mmd\f[R] (MultiMarkdown)
275269.IP \[bu] 2
@@ -319,18 +313,12 @@ Specify output format.
319313.IP \[bu] 2
320314\f[C]beamer\f[R] (LaTeX beamer slide show)
321315.IP \[bu] 2
322−\f[C]bibtex\f[R] (BibTeX bibliography)
323−.IP \[bu] 2
324−\f[C]biblatex\f[R] (BibLaTeX bibliography)
325−.IP \[bu] 2
326316\f[C]commonmark\f[R] (CommonMark Markdown)
327317.IP \[bu] 2
328318\f[C]commonmark_x\f[R] (CommonMark Markdown with extensions)
329319.IP \[bu] 2
330320\f[C]context\f[R] (ConTeXt)
331321.IP \[bu] 2
332−\f[C]csljson\f[R] (CSL JSON bibliography)
333−.IP \[bu] 2
334322\f[C]docbook\f[R] or \f[C]docbook4\f[R] (DocBook 4)
335323.IP \[bu] 2
336324\f[C]docbook5\f[R] (DocBook 5)
@@ -351,8 +339,8 @@ if you need extensions not supported in \f[C]gfm\f[R].
351339.IP \[bu] 2
352340\f[C]haddock\f[R] (Haddock markup)
353341.IP \[bu] 2
354−\f[C]html\f[R] or \f[C]html5\f[R] (HTML, i.e.\ HTML5/XHTML polyglot
355−markup)
342+\f[C]html\f[R] or \f[C]html5\f[R] (HTML, i.e.
343+HTML5/XHTML polyglot markup)
356344.IP \[bu] 2
357345\f[C]html4\f[R] (XHTML 1.0 Transitional)
358346.IP \[bu] 2
@@ -376,7 +364,7 @@ markup)
376364.IP \[bu] 2
377365\f[C]man\f[R] (roff man)
378366.IP \[bu] 2
379−\f[C]markdown\f[R] (Pandoc\[cq]s Markdown)
367+\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)
380368.IP \[bu] 2
381369\f[C]markdown_mmd\f[R] (MultiMarkdown)
382370.IP \[bu] 2
@@ -457,15 +445,16 @@ On *nix and macOS systems this will be the \f[C]pandoc\f[R] subdirectory
457445of the XDG data directory (by default, \f[C]$HOME/.local/share\f[R],
458446overridable by setting the \f[C]XDG_DATA_HOME\f[R] environment
459447variable).
460−If that directory does not exist and \f[C]$HOME/.pandoc\f[R] exists, it
461−will be used (for backwards compatibility).
462−On Windows the default user data directory is
448+If that directory does not exist, \f[C]$HOME/.pandoc\f[R] will be used
449+(for backwards compatibility).
450+In Windows the default user data directory is
463451\f[C]C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]pandoc\f[R].
464452You can find the default user data directory on your system by looking
465453at the output of \f[C]pandoc --version\f[R].
466−Data files placed in this directory (for example,
467−\f[C]reference.odt\f[R], \f[C]reference.docx\f[R], \f[C]epub.css\f[R],
468−\f[C]templates\f[R]) will override pandoc\[cq]s normal defaults.
454+A \f[C]reference.odt\f[R], \f[C]reference.docx\f[R], \f[C]epub.css\f[R],
455+\f[C]templates\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R], or
456+\f[C]s5\f[R] directory placed in this directory will override
457+pandoc\[aq]s normal defaults.
469458.TP
470459\f[B]\f[CB]-d\f[B]\f[R] \f[I]FILE\f[R], \f[B]\f[CB]--defaults=\f[B]\f[R]\f[I]FILE\f[R]
471460Specify a set of default option settings.
@@ -518,7 +507,7 @@ List supported output formats, one per line.
518507List supported extensions for \f[I]FORMAT\f[R], one per line, preceded
519508by a \f[C]+\f[R] or \f[C]-\f[R] indicating whether it is enabled by
520509default in \f[I]FORMAT\f[R].
521−If \f[I]FORMAT\f[R] is not specified, defaults for pandoc\[cq]s Markdown
510+If \f[I]FORMAT\f[R] is not specified, defaults for pandoc\[aq]s Markdown
522511are given.
523512.TP
524513\f[B]\f[CB]--list-highlight-languages\f[B]\f[R]
@@ -563,7 +552,7 @@ This option is useful for converting word processing documents where
563552users have used empty paragraphs to create inter-paragraph space.
564553.TP
565554\f[B]\f[CB]--indented-code-classes=\f[B]\f[R]\f[I]CLASSES\f[R]
566−Specify classes to use for indented code blocks\[en]for example,
555+Specify classes to use for indented code blocks--for example,
567556\f[C]perl,numberLines\f[R] or \f[C]haskell\f[R].
568557Multiple classes may be separated by spaces or commas.
569558.TP
@@ -585,7 +574,7 @@ Reading binary files (docx, odt, epub) implies \f[C]--file-scope\f[R].
585574Specify an executable to be used as a filter transforming the pandoc AST
586575after the input is parsed and before the output is written.
587576The executable should read JSON from stdin and write JSON to stdout.
588−The JSON must be formatted like pandoc\[cq]s own JSON input and output.
577+The JSON must be formatted like pandoc\[aq]s own JSON input and output.
589578The name of the output format will be passed to the filter as the first
590579argument.
591580Hence,
@@ -625,13 +614,13 @@ above).
625614.IP "3." 3
626615\f[C]$PATH\f[R] (executable only)
627616.PP
628−Filters, Lua-filters, and citeproc processing are applied in the order
629−specified on the command line.
617+Filters and Lua-filters are applied in the order specified on the
618+command line.
630619.RE
631620.TP
632621\f[B]\f[CB]-L\f[B]\f[R] \f[I]SCRIPT\f[R], \f[B]\f[CB]--lua-filter=\f[B]\f[R]\f[I]SCRIPT\f[R]
633622Transform the document in a similar fashion as JSON filters (see
634−\f[C]--filter\f[R]), but use pandoc\[cq]s built-in Lua filtering system.
623+\f[C]--filter\f[R]), but use pandoc\[aq]s build-in Lua filtering system.
635624The given Lua script is expected to return a list of Lua filters which
636625will be applied in order.
637626Each Lua filter must contain element-transforming functions indexed by
@@ -641,19 +630,31 @@ applied.
641630.PP
642631The \f[C]pandoc\f[R] Lua module provides helper functions for element
643632creation.
644−It is always loaded into the script\[cq]s Lua environment.
633+It is always loaded into the script\[aq]s Lua environment.
645634.PP
646−See the Lua filters documentation for further details.
635+The following is an example Lua script for macro-expansion:
636+.IP
637+.nf
638+\f[C]
639+function expand_hello_world(inline)
640+ if inline.c == \[aq]{{helloworld}}\[aq] then
641+ return pandoc.Emph{ pandoc.Str \[dq]Hello, World\[dq] }
642+ else
643+ return inline
644+ end
645+end
646+
647+return {{Str = expand_hello_world}}
648+\f[R]
649+.fi
647650.PP
648651In order of preference, pandoc will look for Lua filters in
649652.IP "1." 3
650−a specified full or relative path
653+a specified full or relative path (executable or non-executable)
651654.IP "2." 3
652−\f[C]$DATADIR/filters\f[R] where \f[C]$DATADIR\f[R] is the user data
653−directory (see \f[C]--data-dir\f[R], above).
654−.PP
655−Filters, Lua filters, and citeproc processing are applied in the order
656−specified on the command line.
655+\f[C]$DATADIR/filters\f[R] (executable or non-executable) where
656+\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],
657+above).
657658.RE
658659.TP
659660\f[B]\f[CB]-M\f[B]\f[R] \f[I]KEY\f[R][\f[B]\f[CB]=\f[B]\f[R]\f[I]VAL\f[R]], \f[B]\f[CB]--metadata=\f[B]\f[R]\f[I]KEY\f[R][\f[B]\f[CB]:\f[B]\f[R]\f[I]VAL\f[R]]
@@ -693,13 +694,13 @@ Specify the number of spaces per tab (default is 4).
693694.TP
694695\f[B]\f[CB]--track-changes=accept\f[B]\f[R]|\f[B]\f[CB]reject\f[B]\f[R]|\f[B]\f[CB]all\f[B]\f[R]
695696Specifies what to do with insertions, deletions, and comments produced
696−by the MS Word \[lq]Track Changes\[rq] feature.
697−\f[C]accept\f[R] (the default) processes all the insertions and
697+by the MS Word \[dq]Track Changes\[dq] feature.
698+\f[C]accept\f[R] (the default), inserts all insertions, and ignores all
698699deletions.
699−\f[C]reject\f[R] ignores them.
700+\f[C]reject\f[R] inserts all deletions and ignores insertions.
700701Both \f[C]accept\f[R] and \f[C]reject\f[R] ignore comments.
701−\f[C]all\f[R] includes all insertions, deletions, and comments, wrapped
702−in spans with \f[C]insertion\f[R], \f[C]deletion\f[R],
702+\f[C]all\f[R] puts in insertions, deletions, and comments, wrapped in
703+spans with \f[C]insertion\f[R], \f[C]deletion\f[R],
703704\f[C]comment-start\f[R], and \f[C]comment-end\f[R] classes,
704705respectively.
705706The author and time of change is included.
@@ -716,11 +717,11 @@ Extract images and other media contained in or linked from the source
716717document to the path \f[I]DIR\f[R], creating it if necessary, and adjust
717718the images references in the document so they point to the extracted
718719files.
719−Media are downloaded, read from the file system, or extracted from a
720−binary container (e.g.\ docx), as needed.
721−The original file paths are used if they are relative paths not
722−containing \f[C]..\f[R].
723−Otherwise filenames are constructed from the SHA1 hash of the contents.
720+If the source format is a binary container (docx, epub, or odt), the
721+media is extracted from the container and the original filenames are
722+used.
723+Otherwise the media is read from the file system or downloaded, and new
724+filenames are constructed based on SHA1 hashes of the contents.
724725.TP
725726\f[B]\f[CB]--abbreviations=\f[B]\f[R]\f[I]FILE\f[R]
726727Specifies a custom abbreviations file, with abbreviations one to a line.
@@ -730,14 +731,14 @@ system default.
730731To see the system default, use
731732\f[C]pandoc --print-default-data-file=abbreviations\f[R].
732733The only use pandoc makes of this list is in the Markdown reader.
733−Strings found in this list will be followed by a nonbreaking space, and
734−the period will not produce sentence-ending space in formats like LaTeX.
735−The strings may not contain spaces.
734+Strings ending in a period that are found in this list will be followed
735+by a nonbreaking space, so that the period will not produce
736+sentence-ending space in formats like LaTeX.
736737.SS General writer options
737738.TP
738739\f[B]\f[CB]-s\f[B]\f[R], \f[B]\f[CB]--standalone\f[B]\f[R]
739−Produce output with an appropriate header and footer (e.g.\ a standalone
740−HTML, LaTeX, TEI, or RTF file, not a fragment).
740+Produce output with an appropriate header and footer (e.g.
741+a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).
741742This option is set automatically for \f[C]pdf\f[R], \f[C]epub\f[R],
742743\f[C]epub3\f[R], \f[C]fb2\f[R], \f[C]docx\f[R], and \f[C]odt\f[R]
743744output.
@@ -897,7 +898,8 @@ Implies \f[C]--standalone\f[R].
897898.TP
898899\f[B]\f[CB]-B\f[B]\f[R] \f[I]FILE\f[R], \f[B]\f[CB]--include-before-body=\f[B]\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]
899900Include contents of \f[I]FILE\f[R], verbatim, at the beginning of the
900−document body (e.g.\ after the \f[C]<body>\f[R] tag in HTML, or the
901+document body (e.g.
902+after the \f[C]<body>\f[R] tag in HTML, or the
901903\f[C]\[rs]begin{document}\f[R] command in LaTeX).
902904This can be used to include navigation bars or banners in HTML
903905documents.
@@ -923,17 +925,19 @@ Note that, if \f[C]--resource-path\f[R] is specified, the working
923925directory must be explicitly listed or it will not be searched.
924926For example: \f[C]--resource-path=.:test\f[R] will search the working
925927directory and the \f[C]test\f[R] subdirectory, in that order.
926−This option can be used repeatedly.
927−Search path components that come later on the command line will be
928−searched before those that come earlier, so
929−\f[C]--resource-path foo:bar --resource-path baz:bim\f[R] is equivalent
930−to \f[C]--resource-path baz:bim:foo:bar\f[R].
928+.RS
929+.PP
930+\f[C]--resource-path\f[R] only has an effect if (a) the output format
931+embeds images (for example, \f[C]docx\f[R], \f[C]pdf\f[R], or
932+\f[C]html\f[R] with \f[C]--self-contained\f[R]) or (b) it is used
933+together with \f[C]--extract-media\f[R].
934+.RE
931935.TP
932936\f[B]\f[CB]--request-header=\f[B]\f[R]\f[I]NAME\f[R]\f[B]\f[CB]:\f[B]\f[R]\f[I]VAL\f[R]
933937Set the request header \f[I]NAME\f[R] to the value \f[I]VAL\f[R] when
934938making HTTP requests (for example, when a URL is given on the command
935939line, or when resources used in a document must be downloaded).
936−If you\[cq]re behind a proxy, you also need to set the environment
940+If you\[aq]re behind a proxy, you also need to set the environment
937941variable \f[C]http_proxy\f[R] to \f[C]http://...\f[R].
938942.TP
939943\f[B]\f[CB]--no-check-certificate\f[B]\f[R]
@@ -947,7 +951,7 @@ Produce a standalone HTML file with no external dependencies, using
947951\f[C]data:\f[R] URIs to incorporate the contents of linked scripts,
948952stylesheets, images, and videos.
949953Implies \f[C]--standalone\f[R].
950−The resulting file should be \[lq]self-contained,\[rq] in the sense that
954+The resulting file should be \[dq]self-contained,\[dq] in the sense that
951955it needs no external files and no net access to be displayed properly by
952956a browser.
953957This option works only with HTML output formats, including
@@ -963,14 +967,12 @@ left alone; the documents they link to will not be incorporated in the
963967document.
964968Limitation: resources that are loaded dynamically through JavaScript
965969cannot be incorporated; as a result, \f[C]--self-contained\f[R] does not
966−work with \f[C]--mathjax\f[R], and some advanced features (e.g.\ zoom or
967−speaker notes) may not work in an offline \[lq]self-contained\[rq]
968−\f[C]reveal.js\f[R] slide show.
970+work with \f[C]--mathjax\f[R], and some advanced features (e.g.
971+zoom or speaker notes) may not work in an offline
972+\[dq]self-contained\[dq] \f[C]reveal.js\f[R] slide show.
969973.TP
970974\f[B]\f[CB]--html-q-tags\f[B]\f[R]
971975Use \f[C]<q>\f[R] tags for quotes in HTML.
972−(This option only has an effect if the \f[C]smart\f[R] extension is
973−enabled for the input format used.)
974976.TP
975977\f[B]\f[CB]--ascii\f[B]\f[R]
976978Use only ASCII characters in output.
@@ -988,24 +990,21 @@ By default inline links are used.
988990The placement of link references is affected by the
989991\f[C]--reference-location\f[R] option.
990992.TP
991−\f[B]\f[CB]--reference-location=block\f[B]\f[R]|\f[B]\f[CB]section\f[B]\f[R]|\f[B]\f[CB]document\f[B]\f[R]
993+\f[B]\f[CB]--reference-location = block\f[B]\f[R]|\f[B]\f[CB]section\f[B]\f[R]|\f[B]\f[CB]document\f[B]\f[R]
992994Specify whether footnotes (and references, if \f[C]reference-links\f[R]
993995is set) are placed at the end of the current (top-level) block, the
994996current section, or the document.
995997The default is \f[C]document\f[R].
996998Currently only affects the markdown writer.
997999.TP
998−\f[B]\f[CB]--markdown-headings=setext\f[B]\f[R]|\f[B]\f[CB]atx\f[B]\f[R]
999−Specify whether to use ATX-style (\f[C]#\f[R]-prefixed) or Setext-style
1000−(underlined) headings for level 1 and 2 headings in Markdown output.
1001−(The default is \f[C]atx\f[R].) ATX-style headings are always used for
1002−levels 3+.
1003−This option also affects Markdown cells in \f[C]ipynb\f[R] output.
1004−.TP
10051000\f[B]\f[CB]--atx-headers\f[B]\f[R]
1006−\f[I]Deprecated synonym for \f[CI]--markdown-headings=atx\f[I].\f[R]
1001+Use ATX-style headings in Markdown output.
1002+The default is to use setext-style headings for levels 1 to 2, and then
1003+ATX headings.
1004+(Note: for \f[C]gfm\f[R] output, ATX headings are always used.) This
1005+option also affects markdown cells in \f[C]ipynb\f[R] output.
10071006.TP
1008−\f[B]\f[CB]--top-level-division=default\f[B]\f[R]|\f[B]\f[CB]section\f[B]\f[R]|\f[B]\f[CB]chapter\f[B]\f[R]|\f[B]\f[CB]part\f[B]\f[R]
1007+\f[B]\f[CB]--top-level-division=[default|section|chapter|part]\f[B]\f[R]
10091008Treat top-level headings as the given division type in LaTeX, ConTeXt,
10101009DocBook, and TEI output.
10111010The hierarchy order is part, chapter, then section; all headings are
@@ -1022,22 +1021,21 @@ become \f[C]\[rs]part{..}\f[R], while second-level headings remain as
10221021their default type.
10231022.TP
10241023\f[B]\f[CB]-N\f[B]\f[R], \f[B]\f[CB]--number-sections\f[B]\f[R]
1025−Number section headings in LaTeX, ConTeXt, HTML, Docx, ms, or EPUB
1026−output.
1024+Number section headings in LaTeX, ConTeXt, HTML, Docx, or EPUB output.
10271025By default, sections are not numbered.
10281026Sections with class \f[C]unnumbered\f[R] will never be numbered, even if
10291027\f[C]--number-sections\f[R] is specified.
10301028.TP
1031−\f[B]\f[CB]--number-offset=\f[B]\f[R]\f[I]NUMBER\f[R][\f[B]\f[CB],\f[B]\f[R]\f[I]NUMBER\f[R]\f[B]\f[CB],\f[B]\f[R]\f[I]\&...\f[R]]
1029+\f[B]\f[CB]--number-offset=\f[B]\f[R]\f[I]NUMBER\f[R][\f[B]\f[CB],\f[B]\f[R]\f[I]NUMBER\f[R]\f[B]\f[CB],\f[B]\f[R]\f[I]...\f[R]]
10321030Offset for section headings in HTML output (ignored in other output
10331031formats).
10341032The first number is added to the section number for top-level headings,
10351033the second for second-level headings, and so on.
10361034So, for example, if you want the first top-level heading in your
1037−document to be numbered \[lq]6\[rq], specify
1035+document to be numbered \[dq]6\[dq], specify
10381036\f[C]--number-offset=5\f[R].
10391037If your document starts with a level-2 heading which you want to be
1040−numbered \[lq]1.5\[rq], specify \f[C]--number-offset=1,4\f[R].
1038+numbered \[dq]1.5\[dq], specify \f[C]--number-offset=1,4\f[R].
10411039Offsets are 0 by default.
10421040Implies \f[C]--number-sections\f[R].
10431041.TP
@@ -1336,7 +1334,7 @@ body { font-family: \[dq]DejaVuSans\[dq]; }
13361334.TP
13371335\f[B]\f[CB]--epub-chapter-level=\f[B]\f[R]\f[I]NUMBER\f[R]
13381336Specify the heading level at which to split the EPUB into separate
1339−\[lq]chapter\[rq] files.
1337+\[dq]chapter\[dq] files.
13401338The default is to split into chapters at level-1 headings.
13411339This option only affects the internal composition of the EPUB, not the
13421340way chapters and sections are displayed to users.
@@ -1388,69 +1386,47 @@ introduction to PDF generation from HTML/CSS.)
13881386Use the given string as a command-line argument to the
13891387\f[C]pdf-engine\f[R].
13901388For example, to use a persistent directory \f[C]foo\f[R] for
1391−\f[C]latexmk\f[R]\[cq]s auxiliary files, use
1389+\f[C]latexmk\f[R]\[aq]s auxiliary files, use
13921390\f[C]--pdf-engine-opt=-outdir=foo\f[R].
13931391Note that no check for duplicate options is done.
13941392.SS Citation rendering
13951393.TP
1396−\f[B]\f[CB]-C\f[B]\f[R], \f[B]\f[CB]--citeproc\f[B]\f[R]
1397−Process the citations in the file, replacing them with rendered
1398−citations and adding a bibliography.
1399−Citation processing will not take place unless bibliographic data is
1400−supplied, either through an external file specified using the
1401−\f[C]--bibliography\f[R] option or the \f[C]bibliography\f[R] field in
1402−metadata, or via a \f[C]references\f[R] section in metadata containing a
1403−list of citations in CSL YAML format with Markdown formatting.
1404−The style is controlled by a CSL stylesheet specified using the
1405−\f[C]--csl\f[R] option or the \f[C]csl\f[R] field in metadata.
1406−(If no stylesheet is specified, the \f[C]chicago-author-date\f[R] style
1407−will be used by default.) The citation processing transformation may be
1408−applied before or after filters or Lua filters (see \f[C]--filter\f[R],
1409−\f[C]--lua-filter\f[R]): these transformations are applied in the order
1410−they appear on the command line.
1411−For more information, see the section on Citations.
1412−.TP
14131394\f[B]\f[CB]--bibliography=\f[B]\f[R]\f[I]FILE\f[R]
1414−Set the \f[C]bibliography\f[R] field in the document\[cq]s metadata to
1415−\f[I]FILE\f[R], overriding any value set in the metadata.
1395+Set the \f[C]bibliography\f[R] field in the document\[aq]s metadata to
1396+\f[I]FILE\f[R], overriding any value set in the metadata, and process
1397+citations using \f[C]pandoc-citeproc\f[R].
1398+(This is equivalent to
1399+\f[C]--metadata bibliography=FILE --filter pandoc-citeproc\f[R].) If
1400+\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] is also supplied,
1401+\f[C]pandoc-citeproc\f[R] is not used, making this equivalent to
1402+\f[C]--metadata bibliography=FILE\f[R].
14161403If you supply this argument multiple times, each \f[I]FILE\f[R] will be
14171404added to bibliography.
1418−If \f[I]FILE\f[R] is a URL, it will be fetched via HTTP.
1419−If \f[I]FILE\f[R] is not found relative to the working directory, it
1420−will be sought in the resource path (see \f[C]--resource-path\f[R]).
14211405.TP
14221406\f[B]\f[CB]--csl=\f[B]\f[R]\f[I]FILE\f[R]
1423−Set the \f[C]csl\f[R] field in the document\[cq]s metadata to
1407+Set the \f[C]csl\f[R] field in the document\[aq]s metadata to
14241408\f[I]FILE\f[R], overriding any value set in the metadata.
1425−(This is equivalent to \f[C]--metadata csl=FILE\f[R].) If \f[I]FILE\f[R]
1426−is a URL, it will be fetched via HTTP.
1427−If \f[I]FILE\f[R] is not found relative to the working directory, it
1428−will be sought in the resource path (see \f[C]--resource-path\f[R]) and
1429−finally in the \f[C]csl\f[R] subdirectory of the pandoc user data
1430−directory.
1409+(This is equivalent to \f[C]--metadata csl=FILE\f[R].) This option is
1410+only relevant with \f[C]pandoc-citeproc\f[R].
14311411.TP
14321412\f[B]\f[CB]--citation-abbreviations=\f[B]\f[R]\f[I]FILE\f[R]
1433−Set the \f[C]citation-abbreviations\f[R] field in the document\[cq]s
1413+Set the \f[C]citation-abbreviations\f[R] field in the document\[aq]s
14341414metadata to \f[I]FILE\f[R], overriding any value set in the metadata.
14351415(This is equivalent to
1436−\f[C]--metadata citation-abbreviations=FILE\f[R].) If \f[I]FILE\f[R] is
1437−a URL, it will be fetched via HTTP.
1438−If \f[I]FILE\f[R] is not found relative to the working directory, it
1439−will be sought in the resource path (see \f[C]--resource-path\f[R]) and
1440−finally in the \f[C]csl\f[R] subdirectory of the pandoc user data
1441−directory.
1416+\f[C]--metadata citation-abbreviations=FILE\f[R].) This option is only
1417+relevant with \f[C]pandoc-citeproc\f[R].
14421418.TP
14431419\f[B]\f[CB]--natbib\f[B]\f[R]
14441420Use \f[C]natbib\f[R] for citations in LaTeX output.
1445−This option is not for use with the \f[C]--citeproc\f[R] option or with
1446−PDF output.
1421+This option is not for use with the \f[C]pandoc-citeproc\f[R] filter or
1422+with PDF output.
14471423It is intended for use in producing a LaTeX file that can be processed
14481424with \f[C]bibtex\f[R].
14491425.TP
14501426\f[B]\f[CB]--biblatex\f[B]\f[R]
14511427Use \f[C]biblatex\f[R] for citations in LaTeX output.
1452−This option is not for use with the \f[C]--citeproc\f[R] option or with
1453−PDF output.
1428+This option is not for use with the \f[C]pandoc-citeproc\f[R] filter or
1429+with PDF output.
14541430It is intended for use in producing a LaTeX file that can be processed
14551431with \f[C]bibtex\f[R] or \f[C]biber\f[R].
14561432.SS Math rendering in HTML
@@ -1491,7 +1467,7 @@ For SVG images you can for example use
14911467If no URL is specified, the CodeCogs URL generating PNGs will be used
14921468(\f[C]https://latex.codecogs.com/png.latex?\f[R]).
14931469Note: the \f[C]--webtex\f[R] option will affect Markdown output as well
1494−as HTML, which is useful if you\[cq]re targeting a version of Markdown
1470+as HTML, which is useful if you\[aq]re targeting a version of Markdown
14951471without native math support.
14961472.TP
14971473\f[B]\f[CB]--katex\f[B]\f[R][\f[B]\f[CB]=\f[B]\f[R]\f[I]URL\f[R]]
@@ -1504,16 +1480,16 @@ inserted.
15041480.TP
15051481\f[B]\f[CB]--gladtex\f[B]\f[R]
15061482Enclose TeX math in \f[C]<eq>\f[R] tags in HTML output.
1507−The resulting HTML can then be processed by GladTeX to produce SVG
1508−images of the typeset formulas and an HTML file with these images
1509−embedded.
1483+The resulting HTML can then be processed by GladTeX to produce images of
1484+the typeset formulas and an HTML file with links to these images.
1485+So, the procedure is:
15101486.RS
15111487.IP
15121488.nf
15131489\f[C]
15141490pandoc -s --gladtex input.md -o myfile.htex
1515−gladtex -d image_dir myfile.htex
1516−# produces myfile.html and images in image_dir
1491+gladtex -d myfile-images myfile.htex
1492+# produces myfile.html and images in myfile-images
15171493\f[R]
15181494.fi
15191495.RE
@@ -1602,11 +1578,6 @@ T}@T{
16021578PandocUnsupportedExtensionError
16031579T}
16041580T{
1605−24
1606−T}@T{
1607−PandocCiteprocError
1608−T}
1609−T{
1610158131
16111582T}@T{
16121583PandocEpubSubdirectoryError
@@ -1617,11 +1588,6 @@ T}@T{
16171588PandocPDFError
16181589T}
16191590T{
1620−44
1621−T}@T{
1622−PandocXMLError
1623−T}
1624−T{
1625159147
16261592T}@T{
16271593PandocPDFProgramNotFoundError
@@ -1682,11 +1648,6 @@ T}@T{
16821648PandocIpynbDecodingError
16831649T}
16841650T{
1685−94
1686−T}@T{
1687−PandocUnsupportedCharsetError
1688−T}
1689−T{
1690165197
16911652T}@T{
16921653PandocCouldNotFindDataFileError
@@ -1719,16 +1680,6 @@ input-files:
17191680- content.md
17201681# or you may use input-file: with a single value
17211682
1722−# Include options from the specified defaults files.
1723−# The files will be searched for first in the working directory
1724−# and then in the defaults subdirectory of the user data directory.
1725−# The files are included in the same order in which they appear in
1726−# the list. Options specified in this defaults file always have
1727−# priority over the included ones.
1728−defaults:
1729−- defsA
1730−- defsB
1731−
17321683template: letter
17331684standalone: true
17341685self-contained: false
@@ -1756,24 +1707,11 @@ include-after-body: []
17561707include-in-header: []
17571708resource-path: [\[dq].\[dq]]
17581709
1759−# turn on built-in citation processing. Note that if you need
1760−# control over when the citeproc processing is done relative
1761−# to other filters, you should instead use \[ga]citeproc\[ga] in the
1762−# list of \[ga]filters\[ga] (see below).
1763−citeproc: true
1764−csl: ieee
1765−bibliography:
1766−- foobar.bib
1767−- barbaz.json
1768−citation-abbreviations: abbrevs.json
1769−
1770−# Filters will be assumed to be Lua filters if they have
1710+# filters will be assumed to be Lua filters if they have
17711711# the .lua extension, and json filters otherwise. But
1772−# the filter type can also be specified explicitly, as shown.
1773−# Filters are run in the order specified.
1774−# To include the built-in citeproc filter, use either \[ga]citeproc\[ga]
1775−# or \[ga]{type: citeproc}\[ga].
1712+# the filter type can also be specified explicitly, as shown:
17761713filters:
1714+- pandoc-citeproc
17771715- wordcount.lua
17781716- type: json
17791717 path: foo.lua
@@ -1786,11 +1724,8 @@ data-dir:
17861724verbosity: INFO
17871725log-file: log.json
17881726
1789−# citeproc, natbib, or biblatex. This only affects LaTeX
1790−# output. If you want to use citeproc to format citations,
1791−# you should also set \[aq]citeproc: true\[aq] (see above).
1727+# citeproc, natbib, or biblatex
17921728cite-method: citeproc
1793−
17941729# part, chapter, section, or default:
17951730top-level-division: chapter
17961731abbreviations:
@@ -1859,7 +1794,7 @@ epub-cover-image: cover.jpg
18591794reference-links: true
18601795# block, section, or document
18611796reference-location: block
1862−markdown-headings: setext
1797+atx-headers: false
18631798
18641799# accept, reject, or all
18651800track-changes: accept
@@ -1891,38 +1826,6 @@ verbosity: INFO
18911826\f[R]
18921827.fi
18931828.PP
1894−In fields that expect a file path (or list of file paths), the following
1895−syntax may be used to interpolate environment variables:
1896−.IP
1897−.nf
1898−\f[C]
1899−csl: ${HOME}/mycsldir/special.csl
1900−\f[R]
1901−.fi
1902−.PP
1903−\f[C]${USERDATA}\f[R] may also be used; this will always resolve to the
1904−user data directory that is current when the defaults file is parsed,
1905−regardless of the setting of the environment variable
1906−\f[C]USERDATA\f[R].
1907−.PP
1908−\f[C]${.}\f[R] will resolve to the directory containing the default file
1909−itself.
1910−This allows you to refer to resources contained in that directory:
1911−.IP
1912−.nf
1913−\f[C]
1914−epub-cover-image: ${.}/cover.jpg
1915−epub-metadata: ${.}/meta.xml
1916−resource-path:
1917−- . # the working directory from which pandoc is run
1918−- ${.}/images # the images subdirectory of the directory
1919− # containing this defaults file
1920−\f[R]
1921−.fi
1922−.PP
1923−This environment variable interpolation syntax \f[I]only\f[R] works in
1924−fields that expect file paths.
1925−.PP
19261829Default files can be placed in the \f[C]defaults\f[R] subdirectory of
19271830the user data directory and used from any directory.
19281831For example, one could create a file specifying defaults for writing
@@ -1979,10 +1882,10 @@ arbitrary information at any point in the file.
19791882They may be set at the command line using the \f[C]-V/--variable\f[R]
19801883option.
19811884If a variable is not set, pandoc will look for the key in the
1982−document\[cq]s metadata, which can be set using either YAML metadata
1885+document\[aq]s metadata, which can be set using either YAML metadata
19831886blocks or with the \f[C]-M/--metadata\f[R] option.
19841887In addition, some variables are given default values by pandoc.
1985−See Variables below for a list of variables used in pandoc\[cq]s default
1888+See Variables below for a list of variables used in pandoc\[aq]s default
19861889templates.
19871890.PP
19881891If you use custom templates, you may need to revise them as pandoc
@@ -1999,8 +1902,8 @@ be treated as a comment and omitted from the output.
19991902.SS Delimiters
20001903.PP
20011904To mark variables and control structures in the template, either
2002−\f[C]$\f[R]\&...\f[C]$\f[R] or \f[C]${\f[R]\&...\f[C]}\f[R] may be used
2003−as delimiters.
1905+\f[C]$\f[R]...\f[C]$\f[R] or \f[C]${\f[R]...\f[C]}\f[R] may be used as
1906+delimiters.
20041907The styles may also be mixed in the same template, but the opening and
20051908closing delimiter must match in each case.
20061909The opening delimiter may be followed by one or more spaces or tabs,
@@ -2182,9 +2085,9 @@ ${ styles.html() }
21822085\f[R]
21832086.fi
21842087.PP
2185−(If a partial is not found in the directory of the template and the
2186−template path is given as a relative path, it will also be sought in the
2187−\f[C]templates\f[R] subdirectory of the user data directory.)
2088+(If a partial is not found in the directory of the template, it will
2089+also be sought in the \f[C]templates\f[R] subdirectory of the user data
2090+directory.)
21882091.PP
21892092Partials may optionally be applied to variables using a colon:
21902093.IP
@@ -2233,7 +2136,7 @@ an explicit \f[C]for\f[R] loop) cannot contain interpolated variables or
22332136other template directives.
22342137.SS Nesting
22352138.PP
2236−To ensure that content is \[lq]nested,\[rq] that is, subsequent lines
2139+To ensure that content is \[dq]nested,\[dq] that is, subsequent lines
22372140indented, use the \f[C]\[ha]\f[R] directive:
22382141.IP
22392142.nf
@@ -2275,7 +2178,7 @@ will produce
22752178.PP
22762179If a variable occurs by itself on a line, preceded by whitespace and not
22772180followed by further text or directives on the same line, and the
2278−variable\[cq]s value contains multiple lines, it will be nested
2181+variable\[aq]s value contains multiple lines, it will be nested
22792182automatically.
22802183.SS Breakable spaces
22812184.PP
@@ -2417,8 +2320,7 @@ including a title block in the document itself, you can set the
24172320\f[C]title-meta\f[R], \f[C]author-meta\f[R], and \f[C]date-meta\f[R]
24182321variables.
24192322(By default these are set automatically, based on \f[C]title\f[R],
2420−\f[C]author\f[R], and \f[C]date\f[R].) The page title in HTML is set by
2421−\f[C]pagetitle\f[R], which is equal to \f[C]title\f[R] by default.
2323+\f[C]author\f[R], and \f[C]date\f[R].)
24222324.RE
24232325.TP
24242326\f[B]\f[CB]subtitle\f[B]\f[R]
@@ -2508,81 +2410,13 @@ For bidirectional documents, native pandoc \f[C]span\f[R]s and
25082410\f[C]div\f[R]s with the \f[C]dir\f[R] attribute (value \f[C]rtl\f[R] or
25092411\f[C]ltr\f[R]) can be used to override the base direction in some output
25102412formats.
2511−This may not always be necessary if the final renderer (e.g.\ the
2512−browser, when generating HTML) supports the Unicode Bidirectional
2413+This may not always be necessary if the final renderer (e.g.
2414+the browser, when generating HTML) supports the Unicode Bidirectional
25132415Algorithm.
25142416.PP
25152417When using LaTeX for bidirectional documents, only the \f[C]xelatex\f[R]
25162418engine is fully supported (use \f[C]--pdf-engine=xelatex\f[R]).
25172419.RE
2518−.SS Variables for HTML
2519−.TP
2520−\f[B]\f[CB]document-css\f[B]\f[R]
2521−Enables inclusion of most of the CSS in the \f[C]styles.html\f[R]
2522−partial (have a look with
2523−\f[C]pandoc --print-default-data-file=templates/styles.html\f[R]).
2524−Unless you use \f[C]--css\f[R], this variable is set to \f[C]true\f[R]
2525−by default.
2526−You can disable it with e.g.\ \f[C]pandoc -M document-css=false\f[R].
2527−.TP
2528−\f[B]\f[CB]mainfont\f[B]\f[R]
2529−sets the CSS \f[C]font-family\f[R] property on the \f[C]html\f[R]
2530−element.
2531−.TP
2532−\f[B]\f[CB]fontsize\f[B]\f[R]
2533−sets the base CSS \f[C]font-size\f[R], which you\[cq]d usually set to
2534−e.g.\ \f[C]20px\f[R], but it also accepts \f[C]pt\f[R] (12pt = 16px in
2535−most browsers).
2536−.TP
2537−\f[B]\f[CB]fontcolor\f[B]\f[R]
2538−sets the CSS \f[C]color\f[R] property on the \f[C]html\f[R] element.
2539−.TP
2540−\f[B]\f[CB]linkcolor\f[B]\f[R]
2541−sets the CSS \f[C]color\f[R] property on all links.
2542−.TP
2543−\f[B]\f[CB]monofont\f[B]\f[R]
2544−sets the CSS \f[C]font-family\f[R] property on \f[C]code\f[R] elements.
2545−.TP
2546−\f[B]\f[CB]monobackgroundcolor\f[B]\f[R]
2547−sets the CSS \f[C]background-color\f[R] property on \f[C]code\f[R]
2548−elements and adds extra padding.
2549−.TP
2550−\f[B]\f[CB]linestretch\f[B]\f[R]
2551−sets the CSS \f[C]line-height\f[R] property on the \f[C]html\f[R]
2552−element, which is preferred to be unitless.
2553−.TP
2554−\f[B]\f[CB]backgroundcolor\f[B]\f[R]
2555−sets the CSS \f[C]background-color\f[R] property on the \f[C]html\f[R]
2556−element.
2557−.TP
2558−\f[B]\f[CB]margin-left\f[B]\f[R], \f[B]\f[CB]margin-right\f[B]\f[R], \f[B]\f[CB]margin-top\f[B]\f[R], \f[B]\f[CB]margin-bottom\f[B]\f[R]
2559−sets the corresponding CSS \f[C]padding\f[R] properties on the
2560−\f[C]body\f[R] element.
2561−.PP
2562−To override or extend some CSS for just one document, include for
2563−example:
2564−.IP
2565−.nf
2566−\f[C]
2567−---
2568−header-includes: |
2569− <style>
2570− blockquote {
2571− font-style: italic;
2572− }
2573− tr.even {
2574− background-color: #f0f0f0;
2575− }
2576− td, th {
2577− padding: 0.5em 2em 0.5em 0.5em;
2578− }
2579− tbody {
2580− border-bottom: none;
2581− }
2582− </style>
2583−---
2584−\f[R]
2585−.fi
25862420.SS Variables for HTML math
25872421.TP
25882422\f[B]\f[CB]classoption\f[B]\f[R]
@@ -2590,10 +2424,11 @@ when using KaTeX, you can render display math equations flush left using
25902424YAML metadata or with \f[C]-M classoption=fleqn\f[R].
25912425.SS Variables for HTML slides
25922426.PP
2593−These affect HTML output when [producing slide shows with pandoc].
2594−.TP
2595−\f[B]\f[CB]institute\f[B]\f[R]
2596−author affiliations: can be a list when there are multiple authors
2427+These affect HTML output when producing slide shows with pandoc.
2428+.PP
2429+All reveal.js configuration options are available as variables.
2430+To turn off boolean flags that default to true in reveal.js, use
2431+\f[C]0\f[R].
25972432.TP
25982433\f[B]\f[CB]revealjs-url\f[B]\f[R]
25992434base URL for reveal.js documents (defaults to
@@ -2612,10 +2447,6 @@ base URL for Slideous documents (defaults to \f[C]slideous\f[R])
26122447\f[B]\f[CB]title-slide-attributes\f[B]\f[R]
26132448additional attributes for the title slide of reveal.js slide shows.
26142449See background in reveal.js and beamer for an example.
2615−.PP
2616−All reveal.js configuration options are available as variables.
2617−To turn off boolean flags that default to true in reveal.js, use
2618−\f[C]0\f[R].
26192450.SS Variables for Beamer slides
26202451.PP
26212452These variables change the appearance of PDF slides using
@@ -2644,7 +2475,7 @@ navigation symbols; other valid values are \f[C]frame\f[R],
26442475\f[C]vertical\f[R], and \f[C]horizontal\f[R])
26452476.TP
26462477\f[B]\f[CB]section-titles\f[B]\f[R]
2647−enables \[lq]title pages\[rq] for new sections (default is true)
2478+enables \[dq]title pages\[dq] for new sections (default is true)
26482479.TP
26492480\f[B]\f[CB]theme\f[B]\f[R], \f[B]\f[CB]colortheme\f[B]\f[R], \f[B]\f[CB]fonttheme\f[B]\f[R], \f[B]\f[CB]innertheme\f[B]\f[R], \f[B]\f[CB]outertheme\f[B]\f[R]
26502481beamer themes
@@ -2696,8 +2527,8 @@ header-includes: |
26962527.RE
26972528.TP
26982529\f[B]\f[CB]classoption\f[B]\f[R]
2699−option for document class, e.g.\ \f[C]oneside\f[R]; repeat for multiple
2700−options:
2530+option for document class, e.g.
2531+\f[C]oneside\f[R]; repeat for multiple options:
27012532.RS
27022533.IP
27032534.nf
@@ -2718,8 +2549,8 @@ document class: usually one of the standard classes, \f[C]article\f[R],
27182549default to smaller margins; or \f[C]memoir\f[R]
27192550.TP
27202551\f[B]\f[CB]geometry\f[B]\f[R]
2721−option for \f[C]geometry\f[R] package, e.g.\ \f[C]margin=1in\f[R];
2722−repeat for multiple options:
2552+option for \f[C]geometry\f[R] package, e.g.
2553+\f[C]margin=1in\f[R]; repeat for multiple options:
27232554.RS
27242555.IP
27252556.nf
@@ -2735,8 +2566,8 @@ geometry:
27352566.RE
27362567.TP
27372568\f[B]\f[CB]hyperrefoptions\f[B]\f[R]
2738−option for \f[C]hyperref\f[R] package, e.g.\ \f[C]linktoc=all\f[R];
2739−repeat for multiple options:
2569+option for \f[C]hyperref\f[R] package, e.g.
2570+\f[C]linktoc=all\f[R]; repeat for multiple options:
27402571.RS
27412572.IP
27422573.nf
@@ -2752,13 +2583,12 @@ hyperrefoptions:
27522583.RE
27532584.TP
27542585\f[B]\f[CB]indent\f[B]\f[R]
2755−if true, pandoc will use document class settings for indentation (the
2756−default LaTeX template otherwise removes indentation and adds space
2757−between paragraphs)
2586+uses document class settings for indentation (the default LaTeX template
2587+otherwise removes indentation and adds space between paragraphs)
27582588.TP
27592589\f[B]\f[CB]linestretch\f[B]\f[R]
2760−adjusts line spacing using the \f[C]setspace\f[R] package,
2761−e.g.\ \f[C]1.25\f[R], \f[C]1.5\f[R]
2590+adjusts line spacing using the \f[C]setspace\f[R] package, e.g.
2591+\f[C]1.25\f[R], \f[C]1.5\f[R]
27622592.TP
27632593\f[B]\f[CB]margin-left\f[B]\f[R], \f[B]\f[CB]margin-right\f[B]\f[R], \f[B]\f[CB]margin-top\f[B]\f[R], \f[B]\f[CB]margin-bottom\f[B]\f[R]
27642594sets margins if \f[C]geometry\f[R] is not used (otherwise
@@ -2770,7 +2600,8 @@ control \f[C]\[rs]pagestyle{}\f[R]: the default article class supports
27702600numbers), and \f[C]headings\f[R] (section titles in running heads)
27712601.TP
27722602\f[B]\f[CB]papersize\f[B]\f[R]
2773−paper size, e.g.\ \f[C]letter\f[R], \f[C]a4\f[R]
2603+paper size, e.g.
2604+\f[C]letter\f[R], \f[C]a4\f[R]
27742605.TP
27752606\f[B]\f[CB]secnumdepth\f[B]\f[R]
27762607numbering depth for sections (with \f[C]--number-sections\f[R] option or
@@ -2895,32 +2726,35 @@ list of options for natbib
28952726Pandoc uses these variables when creating a PDF with ConTeXt.
28962727.TP
28972728\f[B]\f[CB]fontsize\f[B]\f[R]
2898−font size for body text (e.g.\ \f[C]10pt\f[R], \f[C]12pt\f[R])
2729+font size for body text (e.g.
2730+\f[C]10pt\f[R], \f[C]12pt\f[R])
28992731.TP
29002732\f[B]\f[CB]headertext\f[B]\f[R], \f[B]\f[CB]footertext\f[B]\f[R]
29012733text to be placed in running header or footer (see ConTeXt Headers and
29022734Footers); repeat up to four times for different placement
29032735.TP
29042736\f[B]\f[CB]indenting\f[B]\f[R]
2905−controls indentation of paragraphs, e.g.\ \f[C]yes,small,next\f[R] (see
2906−ConTeXt Indentation); repeat for multiple options
2737+controls indentation of paragraphs, e.g.
2738+\f[C]yes,small,next\f[R] (see ConTeXt Indentation); repeat for multiple
2739+options
29072740.TP
29082741\f[B]\f[CB]interlinespace\f[B]\f[R]
2909−adjusts line spacing, e.g.\ \f[C]4ex\f[R] (using
2910−\f[C]setupinterlinespace\f[R]); repeat for multiple options
2742+adjusts line spacing, e.g.
2743+\f[C]4ex\f[R] (using \f[C]setupinterlinespace\f[R]); repeat for multiple
2744+options
29112745.TP
29122746\f[B]\f[CB]layout\f[B]\f[R]
29132747options for page margins and text arrangement (see ConTeXt Layout);
29142748repeat for multiple options
29152749.TP
29162750\f[B]\f[CB]linkcolor\f[B]\f[R], \f[B]\f[CB]contrastcolor\f[B]\f[R]
2917−color for links outside and inside a page, e.g.\ \f[C]red\f[R],
2918−\f[C]blue\f[R] (see ConTeXt Color)
2751+color for links outside and inside a page, e.g.
2752+\f[C]red\f[R], \f[C]blue\f[R] (see ConTeXt Color)
29192753.TP
29202754\f[B]\f[CB]linkstyle\f[B]\f[R]
2921−typeface style for links, e.g.\ \f[C]normal\f[R], \f[C]bold\f[R],
2922−\f[C]slanted\f[R], \f[C]boldslanted\f[R], \f[C]type\f[R], \f[C]cap\f[R],
2923−\f[C]small\f[R]
2755+typeface style for links, e.g.
2756+\f[C]normal\f[R], \f[C]bold\f[R], \f[C]slanted\f[R],
2757+\f[C]boldslanted\f[R], \f[C]type\f[R], \f[C]cap\f[R], \f[C]small\f[R]
29242758.TP
29252759\f[B]\f[CB]lof\f[B]\f[R], \f[B]\f[CB]lot\f[B]\f[R]
29262760include list of figures, list of tables
@@ -2938,13 +2772,16 @@ page number style and location (using \f[C]setuppagenumbering\f[R]);
29382772repeat for multiple options
29392773.TP
29402774\f[B]\f[CB]papersize\f[B]\f[R]
2941−paper size, e.g.\ \f[C]letter\f[R], \f[C]A4\f[R], \f[C]landscape\f[R]
2942−(see ConTeXt Paper Setup); repeat for multiple options
2775+paper size, e.g.
2776+\f[C]letter\f[R], \f[C]A4\f[R], \f[C]landscape\f[R] (see ConTeXt Paper
2777+Setup); repeat for multiple options
29432778.TP
29442779\f[B]\f[CB]pdfa\f[B]\f[R]
29452780adds to the preamble the setup necessary to generate PDF/A of the type
2946−specified, e.g.\ \f[C]1a:2005\f[R], \f[C]2a\f[R].
2947−If no type is specified (i.e.\ the value is set to True, by e.g.
2781+specified, e.g.
2782+\f[C]1a:2005\f[R], \f[C]2a\f[R].
2783+If no type is specified (i.e.
2784+the value is set to True, by e.g.
29482785\f[C]--metadata=pdfa\f[R] or \f[C]pdfa: true\f[R] in a YAML metadata
29492786block), \f[C]1b:2005\f[R] will be used as default, for reasons of
29502787backwards compatibility.
@@ -2959,7 +2796,8 @@ See also ConTeXt PDFA for more details.
29592796.TP
29602797\f[B]\f[CB]pdfaiccprofile\f[B]\f[R]
29612798when used in conjunction with \f[C]pdfa\f[R], specifies the ICC profile
2962−to use in the PDF, e.g.\ \f[C]default.cmyk\f[R].
2799+to use in the PDF, e.g.
2800+\f[C]default.cmyk\f[R].
29632801If left unspecified, \f[C]sRGB.icc\f[R] is used as default.
29642802May be repeated to include multiple profiles.
29652803Note that the profiles have to be available on the system.
@@ -2967,17 +2805,17 @@ They can be obtained from ConTeXt ICC Profiles.
29672805.TP
29682806\f[B]\f[CB]pdfaintent\f[B]\f[R]
29692807when used in conjunction with \f[C]pdfa\f[R], specifies the output
2970−intent for the colors,
2971−e.g.\ \f[C]ISO coated v2 300\[rs]letterpercent\[rs]space (ECI)\f[R] If
2972−left unspecified, \f[C]sRGB IEC61966-2.1\f[R] is used as default.
2808+intent for the colors, e.g.
2809+\f[C]ISO coated v2 300\[rs]letterpercent\[rs]space (ECI)\f[R] If left
2810+unspecified, \f[C]sRGB IEC61966-2.1\f[R] is used as default.
29732811.TP
29742812\f[B]\f[CB]toc\f[B]\f[R]
29752813include table of contents (can also be set using
29762814\f[C]--toc/--table-of-contents\f[R])
29772815.TP
29782816\f[B]\f[CB]whitespace\f[B]\f[R]
2979−spacing between paragraphs, e.g.\ \f[C]none\f[R], \f[C]small\f[R] (using
2980−\f[C]setupwhitespace\f[R])
2817+spacing between paragraphs, e.g.
2818+\f[C]none\f[R], \f[C]small\f[R] (using \f[C]setupwhitespace\f[R])
29812819.TP
29822820\f[B]\f[CB]includesource\f[B]\f[R]
29832821include all source documents as file attachments in the PDF file
@@ -3015,16 +2853,20 @@ section number in man pages
30152853.SS Variables for ms
30162854.TP
30172855\f[B]\f[CB]fontfamily\f[B]\f[R]
3018−font family (e.g.\ \f[C]T\f[R] or \f[C]P\f[R])
2856+font family (e.g.
2857+\f[C]T\f[R] or \f[C]P\f[R])
30192858.TP
30202859\f[B]\f[CB]indent\f[B]\f[R]
3021−paragraph indent (e.g.\ \f[C]2m\f[R])
2860+paragraph indent (e.g.
2861+\f[C]2m\f[R])
30222862.TP
30232863\f[B]\f[CB]lineheight\f[B]\f[R]
3024−line height (e.g.\ \f[C]12p\f[R])
2864+line height (e.g.
2865+\f[C]12p\f[R])
30252866.TP
30262867\f[B]\f[CB]pointsize\f[B]\f[R]
3027−point size (e.g.\ \f[C]10p\f[R])
2868+point size (e.g.
2869+\f[C]10p\f[R])
30282870.SS Variables set automatically
30292871.PP
30302872Pandoc sets these variables automatically in response to options or
@@ -3040,9 +2882,10 @@ in all HTML based formats (dzslides, epub, html, html4, html5, revealjs,
30402882s5, slideous, slidy).
30412883The recognized formats for \f[C]date\f[R] are: \f[C]mm/dd/yyyy\f[R],
30422884\f[C]mm/dd/yy\f[R], \f[C]yyyy-mm-dd\f[R] (ISO 8601),
3043−\f[C]dd MM yyyy\f[R] (e.g.\ either \f[C]02 Apr 2018\f[R] or
3044−\f[C]02 April 2018\f[R]), \f[C]MM dd, yyyy\f[R]
3045−(e.g.\ \f[C]Apr. 02, 2018\f[R] or
2885+\f[C]dd MM yyyy\f[R] (e.g.
2886+either \f[C]02 Apr 2018\f[R] or \f[C]02 April 2018\f[R]),
2887+\f[C]MM dd, yyyy\f[R] (e.g.
2888+\f[C]Apr. 02, 2018\f[R] or
30462889\f[C]April 02, 2018),\f[R]yyyy[mm[dd]]]\f[C](e.g.\f[R]20180402,
30472890\f[C]201804\f[R] or \f[C]2018\f[R]).
30482891.TP
@@ -3059,7 +2902,7 @@ contents specified by \f[C]-A/--include-after-body\f[R] (may have
30592902multiple values)
30602903.TP
30612904\f[B]\f[CB]meta-json\f[B]\f[R]
3062−JSON representation of all of the document\[cq]s metadata.
2905+JSON representation of all of the document\[aq]s metadata.
30632906Field values are transformed to the selected output format.
30642907.TP
30652908\f[B]\f[CB]numbersections\f[B]\f[R]
@@ -3087,7 +2930,8 @@ $endif$
30872930Similarly, \f[C]outputfile\f[R] can be \f[C]-\f[R] if output goes to the
30882931terminal.
30892932.PP
3090−If you need absolute paths, use e.g.\ \f[C]$curdir$/$sourcefile$\f[R].
2933+If you need absolute paths, use e.g.
2934+\f[C]$curdir$/$sourcefile$\f[R].
30912935.RE
30922936.TP
30932937\f[B]\f[CB]curdir\f[B]\f[R]
@@ -3108,12 +2952,12 @@ An extension can be enabled by adding \f[C]+EXTENSION\f[R] to the format
31082952name and disabled by adding \f[C]-EXTENSION\f[R].
31092953For example, \f[C]--from markdown_strict+footnotes\f[R] is strict
31102954Markdown with footnotes enabled, while
3111−\f[C]--from markdown-footnotes-pipe_tables\f[R] is pandoc\[cq]s Markdown
2955+\f[C]--from markdown-footnotes-pipe_tables\f[R] is pandoc\[aq]s Markdown
31122956without footnotes or pipe tables.
31132957.PP
31142958The markdown reader and writer make by far the most use of extensions.
31152959Extensions only used by them are therefore covered in the section
3116−Pandoc\[cq]s Markdown below (See Markdown variants for
2960+Pandoc\[aq]s Markdown below (See Markdown variants for
31172961\f[C]commonmark\f[R] and \f[C]gfm\f[R].) In the following, extensions
31182962that also work for other formats are covered.
31192963.PP
@@ -3126,7 +2970,7 @@ Markdown cells in Jupyter notebooks (as do command-line options like
31262970Interpret straight quotes as curly quotes, \f[C]---\f[R] as em-dashes,
31272971\f[C]--\f[R] as en-dashes, and \f[C]...\f[R] as ellipses.
31282972Nonbreaking spaces are inserted after certain abbreviations, such as
3129−\[lq]Mr.\[rq]
2973+\[dq]Mr.\[dq]
31302974.PP
31312975This extension can be enabled/disabled for the following formats:
31322976.TP
@@ -3276,7 +3120,7 @@ letters are omitted.
32763120.SS Extension: \f[C]gfm_auto_identifiers\f[R]
32773121.PP
32783122Changes the algorithm used by \f[C]auto_identifiers\f[R] to conform to
3279−GitHub\[cq]s method.
3123+GitHub\[aq]s method.
32803124Spaces are converted to dashes (\f[C]-\f[R]), uppercase characters to
32813125lowercase characters, and punctuation characters other than \f[C]-\f[R]
32823126and \f[C]_\f[R] are removed.
@@ -3286,7 +3130,7 @@ Emojis are replaced by their names.
32863130The extensions \f[C]tex_math_dollars\f[R],
32873131\f[C]tex_math_single_backslash\f[R], and
32883132\f[C]tex_math_double_backslash\f[R] are described in the section about
3289−Pandoc\[cq]s Markdown.
3133+Pandoc\[aq]s Markdown.
32903134.PP
32913135However, they can also be used with HTML input.
32923136This is handy for reading web pages formatted using MathJax, for
@@ -3294,10 +3138,10 @@ example.
32943138.SS Raw HTML/TeX
32953139.PP
32963140The following extensions are described in more detail in their
3297−respective sections of Pandoc\[cq]s Markdown:
3141+respective sections of Pandoc\[aq]s Markdown:
32983142.IP \[bu] 2
32993143\f[C]raw_html\f[R] allows HTML elements which are not representable in
3300−pandoc\[cq]s AST to be parsed as raw HTML.
3144+pandoc\[aq]s AST to be parsed as raw HTML.
33013145By default, this is disabled for HTML input.
33023146.IP \[bu] 2
33033147\f[C]raw_tex\f[R] allows raw LaTeX, TeX, and ConTeXt to be included in a
@@ -3307,8 +3151,9 @@ addition to \f[C]markdown\f[R]):
33073151.RS 2
33083152.TP
33093153input formats
3310−\f[C]latex\f[R], \f[C]textile\f[R], \f[C]html\f[R] (environments,
3311−\f[C]\[rs]ref\f[R], and \f[C]\[rs]eqref\f[R] only), \f[C]ipynb\f[R]
3154+\f[C]latex\f[R], \f[C]org\f[R], \f[C]textile\f[R], \f[C]html\f[R]
3155+(environments, \f[C]\[rs]ref\f[R], and \f[C]\[rs]eqref\f[R] only),
3156+\f[C]ipynb\f[R]
33123157.TP
33133158output formats
33143159\f[C]textile\f[R], \f[C]commonmark\f[R]
@@ -3319,7 +3164,7 @@ with mime type \f[C]text/html\f[R] in output cells.
33193164Since the \f[C]ipynb\f[R] reader attempts to preserve the richest
33203165possible outputs when several options are given, you will get best
33213166results if you disable \f[C]raw_html\f[R] and \f[C]raw_tex\f[R] when
3322−converting to formats like \f[C]docx\f[R] which don\[cq]t allow raw
3167+converting to formats like \f[C]docx\f[R] which don\[aq]t allow raw
33233168\f[C]html\f[R] or \f[C]tex\f[R].
33243169.RE
33253170.IP \[bu] 2
@@ -3353,22 +3198,23 @@ the formats above, pandoc will treat the document as literate Haskell
33533198source.
33543199This means that
33553200.IP \[bu] 2
3356−In Markdown input, \[lq]bird track\[rq] sections will be parsed as
3201+In Markdown input, \[dq]bird track\[dq] sections will be parsed as
33573202Haskell code rather than block quotations.
33583203Text between \f[C]\[rs]begin{code}\f[R] and \f[C]\[rs]end{code}\f[R]
33593204will also be treated as Haskell code.
3360−For ATX-style headings the character `=' will be used instead of `#'.
3205+For ATX-style headings the character \[aq]=\[aq] will be used instead of
3206+\[aq]#\[aq].
33613207.IP \[bu] 2
33623208In Markdown output, code blocks with classes \f[C]haskell\f[R] and
33633209\f[C]literate\f[R] will be rendered using bird tracks, and block
33643210quotations will be indented one space, so they will not be treated as
33653211Haskell code.
33663212In addition, headings will be rendered setext-style (with underlines)
3367−rather than ATX-style (with `#' characters).
3368−(This is because ghc treats `#' characters in column 1 as introducing
3369−line numbers.)
3213+rather than ATX-style (with \[aq]#\[aq] characters).
3214+(This is because ghc treats \[aq]#\[aq] characters in column 1 as
3215+introducing line numbers.)
33703216.IP \[bu] 2
3371−In restructured text input, \[lq]bird track\[rq] sections will be parsed
3217+In restructured text input, \[dq]bird track\[dq] sections will be parsed
33723218as Haskell code.
33733219.IP \[bu] 2
33743220In restructured text output, code blocks with class \f[C]haskell\f[R]
@@ -3404,8 +3250,9 @@ writes HTML with the Haskell code in bird tracks, so it can be copied
34043250and pasted as literate Haskell source.
34053251.PP
34063252Note that GHC expects the bird tracks in the first column, so indented
3407−literate code blocks (e.g.\ inside an itemized environment) will not be
3408−picked up by the Haskell compiler.
3253+literate code blocks (e.g.
3254+inside an itemized environment) will not be picked up by the Haskell
3255+compiler.
34093256.SS Other extensions
34103257.SS Extension: \f[C]empty_paragraphs\f[R]
34113258.PP
@@ -3428,44 +3275,7 @@ This extension can be enabled/disabled for the following formats:
34283275.TP
34293276output formats
34303277\f[C]odt\f[R], \f[C]opendocument\f[R]
3431−.SS Extension: \f[C]xrefs_name\f[R]
3432−.PP
3433−Links to headings, figures and tables inside the document are
3434−substituted with cross-references that will use the name or caption of
3435−the referenced item.
3436−The original link text is replaced once the generated document is
3437−refreshed.
3438−This extension can be combined with \f[C]xrefs_number\f[R] in which case
3439−numbers will appear before the name.
3440−.PP
3441−Text in cross-references is only made consistent with the referenced
3442−item once the document has been refreshed.
3443−.PP
3444−This extension can be enabled/disabled for the following formats:
3445−.TP
3446−output formats
3447−\f[C]odt\f[R], \f[C]opendocument\f[R]
3448−.SS Extension: \f[C]xrefs_number\f[R]
3449−.PP
3450−Links to headings, figures and tables inside the document are
3451−substituted with cross-references that will use the number of the
3452−referenced item.
3453−The original link text is discarded.
3454−This extension can be combined with \f[C]xrefs_name\f[R] in which case
3455−the name or caption numbers will appear after the number.
3456−.PP
3457−For the \f[C]xrefs_number\f[R] to be useful heading numbers must be
3458−enabled in the generated document, also table and figure captions must
3459−be enabled using for example the \f[C]native_numbering\f[R] extension.
3460−.PP
3461−Numbers in cross-references are only visible in the final document once
3462−it has been refreshed.
3463−.PP
3464−This extension can be enabled/disabled for the following formats:
3465−.TP
3466−output formats
3467−\f[C]odt\f[R], \f[C]opendocument\f[R]
3468−.SS Extension: \f[C]styles\f[R]
3278+.SS Extension: \f[C]styles\f[R] {#ext-styles}
34693279.PP
34703280When converting from docx, read all docx styles as divs (for paragraph
34713281styles) and spans (for character styles) regardless of whether pandoc
@@ -3484,28 +3294,22 @@ to Emacs Muse markup.
34843294In the \f[C]ipynb\f[R] input format, this causes Markdown cells to be
34853295included as raw Markdown blocks (allowing lossless round-tripping)
34863296rather than being parsed.
3487−Use this only when you are targeting \f[C]ipynb\f[R] or a markdown-based
3488−output format.
3297+Use this only when you are targetting \f[C]ipynb\f[R] or a
3298+markdown-based output format.
34893299.SS Extension: \f[C]citations\f[R]
34903300.PP
3491−Some aspects of Pandoc\[cq]s Markdown citation syntax are also accepted
3301+Some aspects of Pandoc\[aq]s Markdown citation syntax are also accepted
34923302in \f[C]org\f[R] input.
3493−.SS Extension: \f[C]element_citations\f[R]
3494−.PP
3495−In the \f[C]jats\f[R] output formats, this causes reference items to be
3496−replaced with \f[C]<element-citation>\f[R] elements.
3497−These elements are not influenced by CSL styles, but all information on
3498−the item is included in tags.
34993303.SS Extension: \f[C]ntb\f[R]
35003304.PP
35013305In the \f[C]context\f[R] output format this enables the use of Natural
35023306Tables (TABLE) instead of the default Extreme Tables (xtables).
35033307Natural tables allow more fine-grained global customization but come at
35043308a performance penalty compared to extreme tables.
3505−.SH PANDOC\[cq]S MARKDOWN
3309+.SH PANDOC\[aq]S MARKDOWN
35063310.PP
35073311Pandoc understands an extended and slightly revised version of John
3508−Gruber\[cq]s Markdown syntax.
3312+Gruber\[aq]s Markdown syntax.
35093313This document explains the syntax, noting differences from standard
35103314Markdown.
35113315Except where noted, these differences can be suppressed by using the
@@ -3522,15 +3326,15 @@ easy to read:
35223326.RS
35233327.PP
35243328A Markdown-formatted document should be publishable as-is, as plain
3525−text, without looking like it\[cq]s been marked up with tags or
3329+text, without looking like it\[aq]s been marked up with tags or
35263330formatting instructions.
3527−\[en] John Gruber
3331+-- John Gruber
35283332.RE
35293333.PP
3530−This principle has guided pandoc\[cq]s decisions in finding syntax for
3334+This principle has guided pandoc\[aq]s decisions in finding syntax for
35313335tables, footnotes, and other extensions.
35323336.PP
3533−There is, however, one respect in which pandoc\[cq]s aims are different
3337+There is, however, one respect in which pandoc\[aq]s aims are different
35343338from the original aims of Markdown.
35353339Whereas Markdown was originally designed with HTML generation in mind,
35363340pandoc is designed for multiple output formats.
@@ -3555,7 +3359,7 @@ a hard line break, since trailing spaces in the cells are ignored.
35553359There are two kinds of headings: Setext and ATX.
35563360.SS Setext-style headings
35573361.PP
3558−A setext-style heading is a line of text \[lq]underlined\[rq] with a row
3362+A setext-style heading is a line of text \[dq]underlined\[dq] with a row
35593363of \f[C]=\f[R] signs (for a level-one heading) or \f[C]-\f[R] signs (for
35603364a level-two heading):
35613365.IP
@@ -3646,7 +3450,7 @@ My other heading {#foo}
36463450(This syntax is compatible with PHP Markdown Extra.)
36473451.PP
36483452Note that although this syntax allows assignment of classes and
3649−key/value attributes, writers generally don\[cq]t use all of this
3453+key/value attributes, writers generally don\[aq]t use all of this
36503454information.
36513455Identifiers, classes, and key/value attributes are used in HTML and
36523456HTML-based formats such as EPUB and slidy.
@@ -3761,7 +3565,7 @@ indented more than three spaces.)
37613565\f[R]
37623566.fi
37633567.PP
3764−A \[lq]lazy\[rq] form, which requires the \f[C]>\f[R] character only on
3568+A \[dq]lazy\[dq] form, which requires the \f[C]>\f[R] character only on
37653569the first line of each block, is also allowed:
37663570.IP
37673571.nf
@@ -3979,9 +3783,6 @@ begin with a space.
39793783\f[R]
39803784.fi
39813785.PP
3982−Inline formatting (such as emphasis) is allowed in the content, but not
3983−block-level formatting (such as block quotes or lists).
3984−.PP
39853786This syntax is borrowed from reStructuredText.
39863787.SS Lists
39873788.SS Bullet lists
@@ -3999,8 +3800,8 @@ Here is a simple example:
39993800\f[R]
40003801.fi
40013802.PP
4002−This will produce a \[lq]compact\[rq] list.
4003−If you want a \[lq]loose\[rq] list, in which each item is formatted as a
3803+This will produce a \[dq]compact\[dq] list.
3804+If you want a \[dq]loose\[dq] list, in which each item is formatted as a
40043805paragraph, put spaces between the items:
40053806.IP
40063807.nf
@@ -4028,7 +3829,7 @@ List items look best if subsequent lines are flush with the first line
40283829\f[R]
40293830.fi
40303831.PP
4031−But Markdown also allows a \[lq]lazy\[rq] format:
3832+But Markdown also allows a \[dq]lazy\[dq] format:
40323833.IP
40333834.nf
40343835\f[C]
@@ -4091,7 +3892,7 @@ character after the list marker of the containing list item.
40913892.fi
40923893.PP
40933894As noted above, Markdown allows you to write list items
4094−\[lq]lazily,\[rq] instead of indenting continuation lines.
3895+\[dq]lazily,\[dq] instead of indenting continuation lines.
40953896However, if there are multiple paragraphs or other blocks in a list
40963897item, the first line of each must be indented.
40973898.IP
@@ -4145,8 +3946,8 @@ They must be separated from the text that follows by at least one space,
41453946and, if the list marker is a capital letter with a period, by at least
41463947two spaces.
41473948.PP
4148−The \f[C]fancy_lists\f[R] extension also allows `\f[C]#\f[R]' to be used
4149−as an ordered list marker in place of a numeral:
3949+The \f[C]fancy_lists\f[R] extension also allows \[aq]\f[C]#\f[R]\[aq] to
3950+be used as an ordered list marker in place of a numeral:
41503951.IP
41513952.nf
41523953\f[C]
@@ -4239,7 +4040,7 @@ one or more block elements (paragraph, code block, list, etc.), each
42394040indented four spaces or one tab stop.
42404041The body of the definition (including the first line, aside from the
42414042colon or tilde) should be indented four spaces.
4242−However, as with other Markdown lists, you can \[lq]lazily\[rq] omit
4043+However, as with other Markdown lists, you can \[dq]lazily\[dq] omit
42434044indentation except at the beginning of a paragraph or other block
42444045element:
42454046.IP
@@ -4273,16 +4074,16 @@ Term 2
42734074.fi
42744075.PP
42754076Note that space between items in a definition list is required.
4276−(A variant that loosens this requirement, but disallows \[lq]lazy\[rq]
4077+(A variant that loosens this requirement, but disallows \[dq]lazy\[dq]
42774078hard wrapping, can be activated with \f[C]compact_definition_lists\f[R]:
4278−see Non-default extensions, below.)
4079+see Non-pandoc extensions, below.)
42794080.SS Numbered example lists
42804081.SS Extension: \f[C]example_lists\f[R]
42814082.PP
42824083The special list marker \f[C]\[at]\f[R] can be used for sequentially
42834084numbered examples.
4284−The first list item with a \f[C]\[at]\f[R] marker will be numbered `1',
4285−the next `2', and so on, throughout the document.
4085+The first list item with a \f[C]\[at]\f[R] marker will be numbered
4086+\[aq]1\[aq], the next \[aq]2\[aq], and so on, throughout the document.
42864087The numbered examples need not occur in a single list; each new list
42874088using \f[C]\[at]\f[R] will take up where the last stopped.
42884089So, for example:
@@ -4318,6 +4119,39 @@ That is, example lists always behave as if the \f[C]four_space_rule\f[R]
43184119extension is set.
43194120This is because example labels tend to be long, and indenting content to
43204121the first non-space character after the label would be awkward.
4122+.SS Compact and loose lists
4123+.PP
4124+Pandoc behaves differently from \f[C]Markdown.pl\f[R] on some \[dq]edge
4125+cases\[dq] involving lists.
4126+Consider this source:
4127+.IP
4128+.nf
4129+\f[C]
4130++ First
4131++ Second:
4132+ - Fee
4133+ - Fie
4134+ - Foe
4135+
4136++ Third
4137+\f[R]
4138+.fi
4139+.PP
4140+Pandoc transforms this into a \[dq]compact list\[dq] (with no
4141+\f[C]<p>\f[R] tags around \[dq]First\[dq], \[dq]Second\[dq], or
4142+\[dq]Third\[dq]), while Markdown puts \f[C]<p>\f[R] tags around
4143+\[dq]Second\[dq] and \[dq]Third\[dq] (but not \[dq]First\[dq]), because
4144+of the blank space around \[dq]Third\[dq].
4145+Pandoc follows a simple rule: if the text is followed by a blank line,
4146+it is treated as a paragraph.
4147+Since \[dq]Second\[dq] is followed by a list, and not a blank line, it
4148+isn\[aq]t treated as a paragraph.
4149+The fact that the list is followed by a blank line is irrelevant.
4150+(Note: Pandoc works this way even when the \f[C]markdown_strict\f[R]
4151+format is specified.
4152+This behavior is consistent with the official Markdown syntax
4153+description, even though it is different from that of
4154+\f[C]Markdown.pl\f[R].)
43214155.SS Ending a list
43224156.PP
43234157What if you want to put an indented code block after a list?
@@ -4335,8 +4169,8 @@ Trouble! Here pandoc (like other Markdown implementations) will treat
43354169\f[C]{ my code block }\f[R] as the second paragraph of item two, and not
43364170as a code block.
43374171.PP
4338−To \[lq]cut off\[rq] the list after item two, you can insert some
4339−non-indented content, like an HTML comment, which won\[cq]t produce
4172+To \[dq]cut off\[dq] the list after item two, you can insert some
4173+non-indented content, like an HTML comment, which won\[aq]t produce
43404174visible output in any format:
43414175.IP
43424176.nf
@@ -4532,7 +4366,7 @@ can be omitted for a headerless table.
45324366The cells of grid tables may contain arbitrary block elements (multiple
45334367paragraphs, code blocks, lists, etc.).
45344368Cells that span multiple columns or rows are not supported.
4535−Grid tables can be created easily using Emacs\[cq] table-mode
4369+Grid tables can be created easily using Emacs\[aq] table-mode
45364370(\f[C]M-x table-insert\f[R]).
45374371.PP
45384372Alignments can be specified as with pipe tables, by putting colons at
@@ -4616,7 +4450,7 @@ lines are wider than column width, then cell contents will not be
46164450wrapped, and the cells will be sized to their contents.
46174451.PP
46184452Note: pandoc also recognizes pipe tables of the following form, as can
4619−be produced by Emacs\[cq] orgtbl-mode:
4453+be produced by Emacs\[aq] orgtbl-mode:
46204454.IP
46214455.nf
46224456\f[C]
@@ -4629,7 +4463,7 @@ be produced by Emacs\[cq] orgtbl-mode:
46294463.PP
46304464The difference is that \f[C]+\f[R] is used instead of \f[C]|\f[R].
46314465Other orgtbl features are not supported.
4632−In particular, to get non-default column alignment, you\[cq]ll need to
4466+In particular, to get non-default column alignment, you\[aq]ll need to
46334467add colons as above.
46344468.SS Metadata blocks
46354469.SS Extension: \f[C]pandoc_title_block\f[R]
@@ -4707,13 +4541,13 @@ All three metadata fields may contain standard inline formatting
47074541.PP
47084542Title blocks will always be parsed, but they will affect the output only
47094543when the \f[C]--standalone\f[R] (\f[C]-s\f[R]) option is chosen.
4710−In HTML output, titles will appear twice: once in the document head
4711−\[en] this is the title that will appear at the top of the window in a
4712−browser \[en] and once at the beginning of the document body.
4544+In HTML output, titles will appear twice: once in the document head --
4545+this is the title that will appear at the top of the window in a browser
4546+-- and once at the beginning of the document body.
47134547The title in the document head can have an optional prefix attached
47144548(\f[C]--title-prefix\f[R] or \f[C]-T\f[R] option).
47154549The title in the body appears as an H1 element with class
4716−\[lq]title\[rq], so it can be suppressed or reformatted with CSS.
4550+\[dq]title\[dq], so it can be suppressed or reformatted with CSS.
47174551If a title prefix is specified with \f[C]-T\f[R] and no title block
47184552appears in the document, the title prefix will be used by itself as the
47194553HTML title.
@@ -4742,7 +4576,7 @@ will yield a man page with the title \f[C]PANDOC\f[R] and section 1.
47424576\f[R]
47434577.fi
47444578.PP
4745−will also have \[lq]Pandoc User Manuals\[rq] in the footer.
4579+will also have \[dq]Pandoc User Manuals\[dq] in the footer.
47464580.IP
47474581.nf
47484582\f[C]
@@ -4750,7 +4584,7 @@ will also have \[lq]Pandoc User Manuals\[rq] in the footer.
47504584\f[R]
47514585.fi
47524586.PP
4753−will also have \[lq]Version 4.0\[rq] in the header.
4587+will also have \[dq]Version 4.0\[dq] in the header.
47544588.SS Extension: \f[C]yaml_metadata_block\f[R]
47554589.PP
47564590A YAML metadata block is a valid YAML object, delimited by a line of
@@ -4796,9 +4630,7 @@ All of the metadata will appear in a single block at the beginning of
47964630the document.
47974631.PP
47984632Note that YAML escaping rules must be followed.
4799−Thus, for example, if a title contains a colon, it must be quoted, and
4800−if it contains a backslash escape, then it must be ensured that it is
4801−not treated as a YAML escape sequence.
4633+Thus, for example, if a title contains a colon, it must be quoted.
48024634The pipe character (\f[C]|\f[R]) can be used to begin an indented block
48034635that will be interpreted literally, without need for escaping.
48044636This form is necessary when the field contains blank lines or
@@ -4820,13 +4652,6 @@ abstract: |
48204652\f[R]
48214653.fi
48224654.PP
4823−The literal block after the \f[C]|\f[R] must be indented relative to the
4824−line containing the \f[C]|\f[R].
4825−If it is not, the YAML will be invalid and pandoc will not interpret it
4826−as metadata.
4827−For an overview of the complex rules governing YAML, see the Wikipedia
4828−entry on YAML syntax.
4829−.PP
48304655Template variables will be set automatically from the metadata.
48314656Thus, for example, in writing HTML, the variable \f[C]abstract\f[R] will
48324657be set to the HTML equivalent of the Markdown in the \f[C]abstract\f[R]
@@ -4875,7 +4700,7 @@ $endfor$
48754700\f[R]
48764701.fi
48774702.PP
4878−Raw content to include in the document\[cq]s header may be specified
4703+Raw content to include in the document\[aq]s header may be specified
48794704using \f[C]header-includes\f[R]; however, it is important to mark up
48804705this content as raw code for a particular output format, using the
48814706\f[C]raw_attribute\f[R] extension), or it will be interpreted as
@@ -4892,21 +4717,6 @@ header-includes:
48924717 \[ga]\[ga]\[ga]
48934718\f[R]
48944719.fi
4895−.PP
4896−Note: the \f[C]yaml_metadata_block\f[R] extension works with
4897−\f[C]commonmark\f[R] as well as \f[C]markdown\f[R] (and it is enabled by
4898−default in \f[C]gfm\f[R] and \f[C]commonmark_x\f[R]).
4899−However, in these formats the following restrictions apply:
4900−.IP \[bu] 2
4901−The YAML metadata block must occur at the beginning of the document (and
4902−there can be only one).
4903−If multiple files are given as arguments to pandoc, only the first can
4904−be a YAML metadata block.
4905−.IP \[bu] 2
4906−The leaf nodes of the YAML structure are parsed in isolation from each
4907−other and from the rest of the document.
4908−So, for example, you can\[cq]t use a reference link in these contexts if
4909−the link definition is somewhere else in the document.
49104720.SS Backslash escapes
49114721.SS Extension: \f[C]all_symbols_escapable\f[R]
49124722.PP
@@ -4937,7 +4747,7 @@ instead of
49374747\f[R]
49384748.fi
49394749.PP
4940−This rule is easier to remember than standard Markdown\[cq]s rule, which
4750+This rule is easier to remember than standard Markdown\[aq]s rule, which
49414751allows only the following characters to be backslash-escaped:
49424752.IP
49434753.nf
@@ -4953,15 +4763,16 @@ A backslash-escaped space is parsed as a nonbreaking space.
49534763In TeX output, it will appear as \f[C]\[ti]\f[R].
49544764In HTML and XML output, it will appear as a literal unicode nonbreaking
49554765space character (note that it will thus actually look
4956−\[lq]invisible\[rq] in the generated HTML source; you can still use the
4766+\[dq]invisible\[dq] in the generated HTML source; you can still use the
49574767\f[C]--ascii\f[R] command-line option to make it appear as an explicit
49584768entity).
49594769.PP
4960−A backslash-escaped newline (i.e.\ a backslash occurring at the end of a
4961−line) is parsed as a hard line break.
4770+A backslash-escaped newline (i.e.
4771+a backslash occurring at the end of a line) is parsed as a hard line
4772+break.
49624773It will appear in TeX output as \f[C]\[rs]\[rs]\f[R] and in HTML as
49634774\f[C]<br />\f[R].
4964−This is a nice alternative to Markdown\[cq]s \[lq]invisible\[rq] way of
4775+This is a nice alternative to Markdown\[aq]s \[dq]invisible\[dq] way of
49654776indicating hard line breaks using two trailing spaces on a line.
49664777.PP
49674778Backslash escapes do not work in verbatim contexts.
@@ -5038,8 +4849,8 @@ If the superscripted or subscripted text contains spaces, these spaces
50384849must be escaped with backslashes.
50394850(This is to prevent accidental superscripting and subscripting through
50404851the ordinary use of \f[C]\[ti]\f[R] and \f[C]\[ha]\f[R], and also bad
5041−interactions with footnotes.) Thus, if you want the letter P with `a
5042−cat' in subscripts, use \f[C]P\[ti]a\[rs] cat\[ti]\f[R], not
4852+interactions with footnotes.) Thus, if you want the letter P with \[aq]a
4853+cat\[aq] in subscripts, use \f[C]P\[ti]a\[rs] cat\[ti]\f[R], not
50434854\f[C]P\[ti]a cat\[ti]\f[R].
50444855.SS Verbatim
50454856.PP
@@ -5119,16 +4930,14 @@ The opening \f[C]$\f[R] must have a non-space character immediately to
51194930its right, while the closing \f[C]$\f[R] must have a non-space character
51204931immediately to its left, and must not be followed immediately by a
51214932digit.
5122−Thus, \f[C]$20,000 and $30,000\f[R] won\[cq]t parse as math.
4933+Thus, \f[C]$20,000 and $30,000\f[R] won\[aq]t parse as math.
51234934If for some reason you need to enclose text in literal \f[C]$\f[R]
5124−characters, backslash-escape them and they won\[cq]t be treated as math
4935+characters, backslash-escape them and they won\[aq]t be treated as math
51254936delimiters.
51264937.PP
51274938For display math, use \f[C]$$\f[R] delimiters.
51284939(In this case, the delimiters may be separated from the formula by
5129−whitespace.
5130−However, there can be no blank lines betwen the opening and closing
5131−\f[C]$$\f[R] delimiters.)
4940+whitespace.)
51324941.PP
51334942TeX math will be printed in all output formats.
51344943How it is rendered depends on the output format:
@@ -5159,7 +4968,7 @@ Texinfo
51594968It will be rendered inside a \f[C]\[at]math\f[R] command.
51604969.TP
51614970roff man, Jira markup
5162−It will be rendered verbatim without \f[C]$\f[R]\[cq]s.
4971+It will be rendered verbatim without \f[C]$\f[R]\[aq]s.
51634972.TP
51644973MediaWiki, DokuWiki
51654974It will be rendered inside \f[C]<math>\f[R] tags.
@@ -5217,7 +5026,7 @@ Note that even if \f[C]raw_html\f[R] is disabled, tables will be
52175026rendered with HTML syntax if they cannot use pipe syntax.
52185027.SS Extension: \f[C]markdown_in_html_blocks\f[R]
52195028.PP
5220−Standard Markdown allows you to include HTML \[lq]blocks\[rq]: blocks of
5029+Standard Markdown allows you to include HTML \[dq]blocks\[dq]: blocks of
52215030HTML between balanced tags that are separated from the surrounding text
52225031with blank lines, and start and end at the left margin.
52235032Within these blocks, everything is interpreted as HTML, not Markdown; so
@@ -5254,9 +5063,8 @@ into
52545063.PP
52555064whereas \f[C]Markdown.pl\f[R] will preserve it as is.
52565065.PP
5257−There is one exception to this rule: text between \f[C]<script>\f[R],
5258−\f[C]<style>\f[R], and \f[C]<textarea>\f[R] tags is not interpreted as
5259−Markdown.
5066+There is one exception to this rule: text between \f[C]<script>\f[R] and
5067+\f[C]<style>\f[R] tags is not interpreted as Markdown.
52605068.PP
52615069This departure from standard Markdown should make it easier to mix
52625070Markdown with HTML block elements.
@@ -5556,7 +5364,7 @@ slide shows and EPUB), LaTeX, and ConTeXt.
55565364.PP
55575365A link immediately preceded by a \f[C]!\f[R] will be treated as an
55585366image.
5559−The link text will be used as the image\[cq]s alt text:
5367+The link text will be used as the image\[aq]s alt text:
55605368.IP
55615369.nf
55625370\f[C]
@@ -5571,7 +5379,7 @@ The link text will be used as the image\[cq]s alt text:
55715379.PP
55725380An image with nonempty alt text, occurring by itself in a paragraph,
55735381will be rendered as a figure with a caption.
5574−The image\[cq]s alt text will be used as the caption.
5382+The image\[aq]s alt text will be used as the caption.
55755383.IP
55765384.nf
55775385\f[C]
@@ -5580,8 +5388,9 @@ The image\[cq]s alt text will be used as the caption.
55805388.fi
55815389.PP
55825390How this is rendered depends on the output format.
5583−Some output formats (e.g.\ RTF) do not yet support figures.
5584−In those formats, you\[cq]ll just get an image in a paragraph by itself,
5391+Some output formats (e.g.
5392+RTF) do not yet support figures.
5393+In those formats, you\[aq]ll just get an image in a paragraph by itself,
55855394with no caption.
55865395.PP
55875396If you just want a regular inline image, just make sure it is not the
@@ -5652,7 +5461,7 @@ HTML:
56525461.IP \[bu] 2
56535462LaTeX:
56545463\f[C]\[rs]includegraphics[width=0.5\[rs]textwidth,height=\[rs]textheight]{file.jpg}\f[R]
5655−(If you\[cq]re using a custom template, you need to configure
5464+(If you\[aq]re using a custom template, you need to configure
56565465\f[C]graphicx\f[R] as in the default template.)
56575466.IP \[bu] 2
56585467ConTeXt:
@@ -5735,7 +5544,7 @@ immediately by attributes:
57355544.SS Footnotes
57365545.SS Extension: \f[C]footnotes\f[R]
57375546.PP
5738−Pandoc\[cq]s Markdown allows footnotes, using the following syntax:
5547+Pandoc\[aq]s Markdown allows footnotes, using the following syntax:
57395548.IP
57405549.nf
57415550\f[C]
@@ -5784,73 +5593,198 @@ note.]
57845593.fi
57855594.PP
57865595Inline and regular footnotes may be mixed freely.
5787−.SS Citation syntax
5596+.SS Citations
57885597.SS Extension: \f[C]citations\f[R]
57895598.PP
5790−To cite a bibliographic item with an identifier foo, use the syntax
5791−\f[C]\[at]foo\f[R].
5792−Normal citations should be included in square brackets, with semicolons
5793−separating distinct items:
5599+Using an external filter, \f[C]pandoc-citeproc\f[R], pandoc can
5600+automatically generate citations and a bibliography in a number of
5601+styles.
5602+Basic usage is
57945603.IP
57955604.nf
57965605\f[C]
5797−Blah blah [\[at]doe99; \[at]smith2000; \[at]smith2004].
5606+pandoc --filter pandoc-citeproc myinput.txt
57985607\f[R]
57995608.fi
58005609.PP
5801−How this is rendered depends on the citation style.
5802−In an author-date style, it might render as
5803−.IP
5804−.nf
5805−\f[C]
5806−Blah blah (Doe 1999, Smith 2000, 2004).
5807−\f[R]
5808−.fi
5610+In order to use this feature, you will need to specify a bibliography
5611+file using the \f[C]bibliography\f[R] metadata field in a YAML metadata
5612+section, or \f[C]--bibliography\f[R] command line argument.
5613+You can supply multiple \f[C]--bibliography\f[R] arguments or set
5614+\f[C]bibliography\f[R] metadata field to YAML array, if you want to use
5615+multiple bibliography files.
5616+The bibliography may have any of these formats:
5617+.PP
5618+.TS
5619+tab(@);
5620+l l.
5621+T{
5622+Format
5623+T}@T{
5624+File extension
5625+T}
5626+_
5627+T{
5628+BibLaTeX
5629+T}@T{
5630+\&.bib
5631+T}
5632+T{
5633+BibTeX
5634+T}@T{
5635+\&.bibtex
5636+T}
5637+T{
5638+Copac
5639+T}@T{
5640+\&.copac
5641+T}
5642+T{
5643+CSL JSON
5644+T}@T{
5645+\&.json
5646+T}
5647+T{
5648+CSL YAML
5649+T}@T{
5650+\&.yaml
5651+T}
5652+T{
5653+EndNote
5654+T}@T{
5655+\&.enl
5656+T}
5657+T{
5658+EndNote XML
5659+T}@T{
5660+\&.xml
5661+T}
5662+T{
5663+ISI
5664+T}@T{
5665+\&.wos
5666+T}
5667+T{
5668+MEDLINE
5669+T}@T{
5670+\&.medline
5671+T}
5672+T{
5673+MODS
5674+T}@T{
5675+\&.mods
5676+T}
5677+T{
5678+RIS
5679+T}@T{
5680+\&.ris
5681+T}
5682+.TE
5683+.PP
5684+Note that \f[C].bib\f[R] can be used with both BibTeX and BibLaTeX
5685+files; use \f[C].bibtex\f[R] to force BibTeX.
5686+.PP
5687+Note that \f[C]pandoc-citeproc --bib2json\f[R] and
5688+\f[C]pandoc-citeproc --bib2yaml\f[R] can produce \f[C].json\f[R] and
5689+\f[C].yaml\f[R] files from any of the supported formats.
5690+.PP
5691+In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc
5692+parses a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown;
5693+and in CSL JSON databases, an HTML-like markup:
5694+.TP
5695+\f[B]\f[CB]<i>...</i>\f[B]\f[R]
5696+italics
5697+.TP
5698+\f[B]\f[CB]<b>...</b>\f[B]\f[R]
5699+bold
5700+.TP
5701+\f[B]\f[CB]<span style=\[dq]font-variant:small-caps;\[dq]>...</span>\f[B]\f[R] or \f[B]\f[CB]<sc>...</sc>\f[B]\f[R]
5702+small capitals
5703+.TP
5704+\f[B]\f[CB]<sub>...</sub>\f[B]\f[R]
5705+subscript
5706+.TP
5707+\f[B]\f[CB]<sup>...</sup>\f[B]\f[R]
5708+superscript
5709+.TP
5710+\f[B]\f[CB]<span class=\[dq]nocase\[dq]>...</span>\f[B]\f[R]
5711+prevent a phrase from being capitalized as title case
58095712.PP
5810−In a footnote style, it might render as
5713+\f[C]pandoc-citeproc -j\f[R] and \f[C]-y\f[R] interconvert the CSL JSON
5714+and CSL YAML formats as far as possible.
5715+.PP
5716+As an alternative to specifying a bibliography file using
5717+\f[C]--bibliography\f[R] or the YAML metadata field
5718+\f[C]bibliography\f[R], you can include the citation data directly in
5719+the \f[C]references\f[R] field of the document\[aq]s YAML metadata.
5720+The field should contain an array of YAML-encoded references, for
5721+example:
58115722.IP
58125723.nf
58135724\f[C]
5814−Blah blah.[\[ha]1]
5815−
5816−[\[ha]1]: John Doe, \[dq]Frogs,\[dq] *Journal of Amphibians* 44 (1999);
5817−Susan Smith, \[dq]Flies,\[dq] *Journal of Insects* (2000);
5818−Susan Smith, \[dq]Bees,\[dq] *Journal of Insects* (2004).
5725+---
5726+references:
5727+- type: article-journal
5728+ id: WatsonCrick1953
5729+ author:
5730+ - family: Watson
5731+ given: J. D.
5732+ - family: Crick
5733+ given: F. H. C.
5734+ issued:
5735+ date-parts:
5736+ - - 1953
5737+ - 4
5738+ - 25
5739+ title: \[aq]Molecular structure of nucleic acids: a structure for deoxyribose
5740+ nucleic acid\[aq]
5741+ title-short: Molecular structure of nucleic acids
5742+ container-title: Nature
5743+ volume: 171
5744+ issue: 4356
5745+ page: 737-738
5746+ DOI: 10.1038/171737a0
5747+ URL: https://www.nature.com/articles/171737a0
5748+ language: en-GB
5749+\&...
58195750\f[R]
58205751.fi
58215752.PP
5822−See the CSL user documentation for more information about CSL styles and
5823−how they affect rendering.
5753+(\f[C]pandoc-citeproc --bib2yaml\f[R] can produce these from a
5754+bibliography file in one of the supported formats.)
58245755.PP
5825−Unless a citation key start with a letter, digit, or \f[C]_\f[R], and
5826−contains only alphanumerics and internal punctuation characters
5827−(\f[C]:.#$%&-+?<>\[ti]/\f[R]), it must be surrounded by curly braces,
5828−which are not considered part of the key.
5829−In \f[C]\[at]Foo_bar.baz.\f[R], the key is \f[C]Foo_bar.baz\f[R].
5830−The final period is not \f[I]internal\f[R] punctuation, so it is not
5831−included in the key.
5832−In \f[C]\[at]{Foo_bar.baz.}\f[R], the key is \f[C]Foo_bar.baz.\f[R],
5833−including the final period.
5834−The curly braces are recommended if you use URLs as keys:
5835−\f[C][\[at]{https://example.com/bib?name=foobar&date=2000}, p. 33]\f[R].
5836−.PP
5837−Citation items may optionally include a prefix, a locator, and a suffix.
5838−In
5756+Citations and references can be formatted using any style supported by
5757+the Citation Style Language, listed in the Zotero Style Repository.
5758+These files are specified using the \f[C]--csl\f[R] option or the
5759+\f[C]csl\f[R] metadata field.
5760+By default, \f[C]pandoc-citeproc\f[R] will use the Chicago Manual of
5761+Style author-date format.
5762+The CSL project provides further information on finding and editing
5763+styles.
5764+.PP
5765+To make your citations hyperlinks to the corresponding bibliography
5766+entries, add \f[C]link-citations: true\f[R] to your YAML metadata.
5767+.PP
5768+Citations go inside square brackets and are separated by semicolons.
5769+Each citation must have a key, composed of \[aq]\[at]\[aq] + the
5770+citation identifier from the database, and may optionally have a prefix,
5771+a locator, and a suffix.
5772+The citation key must begin with a letter, digit, or \f[C]_\f[R], and
5773+may contain alphanumerics, \f[C]_\f[R], and internal punctuation
5774+characters (\f[C]:.#$%&-+?<>\[ti]/\f[R]).
5775+Here are some examples:
58395776.IP
58405777.nf
58415778\f[C]
5842−Blah blah [see \[at]doe99, pp. 33-35 and *passim*; \[at]smith04, chap. 1].
5779+Blah blah [see \[at]doe99, pp. 33-35; also \[at]smith04, chap. 1].
5780+
5781+Blah blah [\[at]doe99, pp. 33-35, 38-39 and *passim*].
5782+
5783+Blah blah [\[at]smith04; \[at]doe99].
58435784\f[R]
58445785.fi
58455786.PP
5846−The first item (\f[C]doe99\f[R]) has prefix \f[C]see\f[R], locator
5847−\f[C]pp. 33-35\f[R], and suffix \f[C]and *passim*\f[R].
5848−The second item (\f[C]smith04\f[R]) has locator \f[C]chap. 1\f[R] and no
5849−prefix or suffix.
5850−.PP
5851−Pandoc uses some heuristics to separate the locator from the rest of the
5852−subject.
5853−It is sensitive to the locator terms defined in the CSL locale files.
5787+\f[C]pandoc-citeproc\f[R] detects locator terms in the CSL locale files.
58545788Either abbreviated or unabbreviated forms are accepted.
58555789In the \f[C]en-US\f[R] locale, locator terms can be written in either
58565790singular or plural forms, as \f[C]book\f[R],
@@ -5870,17 +5804,17 @@ singular or plural forms, as \f[C]book\f[R],
58705804\f[C]v.\f[R]/\f[C]vv.\f[R]; \f[C]volume\f[R],
58715805\f[C]vol.\f[R]/\f[C]vols.\f[R]; \f[C]\[ps]\f[R]/\f[C]\[ps]\[ps]\f[R];
58725806\f[C]\[sc]\f[R]/\f[C]\[sc]\[sc]\f[R].
5873−If no locator term is used, \[lq]page\[rq] is assumed.
5807+If no locator term is used, \[dq]page\[dq] is assumed.
58745808.PP
5875−In complex cases, you can force something to be treated as a locator by
5876−enclosing it in curly braces or prevent parsing the suffix as locator by
5877−prepending curly braces:
5809+\f[C]pandoc-citeproc\f[R] will use heuristics to distinguish the locator
5810+from the suffix.
5811+In complex cases, the locator can be enclosed in curly braces (using
5812+\f[C]pandoc-citeproc\f[R] 0.15 and higher only):
58785813.IP
58795814.nf
58805815\f[C]
58815816[\[at]smith{ii, A, D-Z}, with a suffix]
58825817[\[at]smith, {pp. iv, vi-xi, (xv)-(xvii)} with suffix here]
5883−[\[at]smith{}, 99 years later]
58845818\f[R]
58855819.fi
58865820.PP
@@ -5894,8 +5828,7 @@ Smith says blah [-\[at]smith04].
58945828\f[R]
58955829.fi
58965830.PP
5897−You can also write an author-in-text citation, by omitting the square
5898−brackets:
5831+You can also write an in-text citation, as follows:
58995832.IP
59005833.nf
59015834\f[C]
@@ -5905,63 +5838,84 @@ brackets:
59055838\f[R]
59065839.fi
59075840.PP
5908−This will cause the author\[cq]s name to be rendered, followed by the
5909−bibliographical details.
5910−Use this form when you want to make the citation the subject of a
5911−sentence.
5912−.PP
5913−When you are using a note style, it is usually better to let citeproc
5914−create the footnotes from citations rather than writing an explicit
5915−note.
5916−If you do write an explicit note that contains a citation, note that
5917−normal citations will be put in parentheses, while author-in-text
5918−citations will not.
5919−For this reason, it is sometimes preferable to use the author-in-text
5920−style inside notes when using a note style.
5921−.SS Non-default extensions
5922−.PP
5923−The following Markdown syntax extensions are not enabled by default in
5924−pandoc, but may be enabled by adding \f[C]+EXTENSION\f[R] to the format
5925−name, where \f[C]EXTENSION\f[R] is the name of the extension.
5926−Thus, for example, \f[C]markdown+hard_line_breaks\f[R] is Markdown with
5927−hard line breaks.
5928−.SS Extension: \f[C]rebase_relative_paths\f[R]
5929−.PP
5930−Rewrite relative paths for Markdown links and images, depending on the
5931−path of the file containing the link or image link.
5932−For each link or image, pandoc will compute the directory of the
5933−containing file, relative to the working directory, and prepend the
5934−resulting path to the link or image path.
5935−.PP
5936−The use of this extension is best understood by example.
5937−Suppose you have a a subdirectory for each chapter of a book,
5938−\f[C]chap1\f[R], \f[C]chap2\f[R], \f[C]chap3\f[R].
5939−Each contains a file \f[C]text.md\f[R] and a number of images used in
5940−the chapter.
5941−You would like to have \f[C]![image](spider.jpg)\f[R] in
5942−\f[C]chap1/text.md\f[R] refer to \f[C]chap1/spider.jpg\f[R] and
5943−\f[C]![image](spider.jpg)\f[R] in \f[C]chap2/text.md\f[R] refer to
5944−\f[C]chap2/spider.jpg\f[R].
5945−To do this, use
5841+If the style calls for a list of works cited, it will be placed in a div
5842+with id \f[C]refs\f[R], if one exists:
59465843.IP
59475844.nf
59485845\f[C]
5949−pandoc chap*/*.md -f markdown+rebase_relative_paths
5846+::: {#refs}
5847+:::
59505848\f[R]
59515849.fi
59525850.PP
5953−Without this extension, you would have to use
5954−\f[C]![image](chap1/spider.jpg)\f[R] in \f[C]chap1/text.md\f[R] and
5955−\f[C]![image](chap2/spider.jpg)\f[R] in \f[C]chap2/text.md\f[R].
5956−Links with relative paths will be rewritten in the same way as images.
5851+Otherwise, it will be placed at the end of the document.
5852+Generation of the bibliography can be suppressed by setting
5853+\f[C]suppress-bibliography: true\f[R] in the YAML metadata.
59575854.PP
5958−Absolute paths and URLs are not changed.
5959−Neither are empty paths or paths consisting entirely of a fragment,
5960−e.g., \f[C]#foo\f[R].
5855+If you wish the bibliography to have a section heading, you can set
5856+\f[C]reference-section-title\f[R] in the metadata, or put the heading at
5857+the beginning of the div with id \f[C]refs\f[R] (if you are using it) or
5858+at the end of your document:
5859+.IP
5860+.nf
5861+\f[C]
5862+last paragraph...
5863+
5864+# References
5865+\f[R]
5866+.fi
5867+.PP
5868+The bibliography will be inserted after this heading.
5869+Note that the \f[C]unnumbered\f[R] class will be added to this heading,
5870+so that the section will not be numbered.
5871+.PP
5872+If you want to include items in the bibliography without actually citing
5873+them in the body text, you can define a dummy \f[C]nocite\f[R] metadata
5874+field and put the citations there:
5875+.IP
5876+.nf
5877+\f[C]
5878+---
5879+nocite: |
5880+ \[at]item1, \[at]item2
5881+\&...
5882+
5883+\[at]item3
5884+\f[R]
5885+.fi
5886+.PP
5887+In this example, the document will contain a citation for
5888+\f[C]item3\f[R] only, but the bibliography will contain entries for
5889+\f[C]item1\f[R], \f[C]item2\f[R], and \f[C]item3\f[R].
5890+.PP
5891+It is possible to create a bibliography with all the citations, whether
5892+or not they appear in the document, by using a wildcard:
5893+.IP
5894+.nf
5895+\f[C]
5896+---
5897+nocite: |
5898+ \[at]*
5899+\&...
5900+\f[R]
5901+.fi
5902+.PP
5903+For LaTeX output, you can also use \f[C]natbib\f[R] or
5904+\f[C]biblatex\f[R] to render the bibliography.
5905+In order to do so, specify bibliography files as outlined above, and add
5906+\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] argument to \f[C]pandoc\f[R]
5907+invocation.
5908+Bear in mind that bibliography files have to be in respective format
5909+(either BibTeX or BibLaTeX).
5910+.PP
5911+For more information, see the pandoc-citeproc man page.
5912+.SS Non-pandoc extensions
59615913.PP
5962−Note that relative paths in reference links and images will be rewritten
5963−relative to the file containing the link reference definition, not the
5964−file containing the reference link or image itself, if these differ.
5914+The following Markdown syntax extensions are not enabled by default in
5915+pandoc, but may be enabled by adding \f[C]+EXTENSION\f[R] to the format
5916+name, where \f[C]EXTENSION\f[R] is the name of the extension.
5917+Thus, for example, \f[C]markdown+hard_line_breaks\f[R] is Markdown with
5918+hard line breaks.
59655919.SS Extension: \f[C]attributes\f[R]
59665920.PP
59675921Allows attributes to be attached to any inline or block-level element.
@@ -5992,7 +5946,7 @@ affect the code block element.
59925946Attributes that occur at the end of a reference link definition affect
59935947links that refer to that definition.
59945948.PP
5995−Note that pandoc\[cq]s AST does not currently allow attributes to be
5949+Note that pandoc\[aq]s AST does not currently allow attributes to be
59965950attached to arbitrary elements.
59975951Hence a Span or Div container will be added if needed.
59985952.SS Extension: \f[C]old_dashes\f[R]
@@ -6006,7 +5960,7 @@ It is selected automatically for \f[C]textile\f[R] input.
60065960.PP
60075961Allow \f[C]<\f[R] and \f[C]>\f[R] to be backslash-escaped, as they can
60085962be in GitHub flavored Markdown but not original Markdown.
6009−This is implied by pandoc\[cq]s default \f[C]all_symbols_escapable\f[R].
5963+This is implied by pandoc\[aq]s default \f[C]all_symbols_escapable\f[R].
60105964.SS Extension: \f[C]lists_without_preceding_blankline\f[R]
60115965.PP
60125966Allow a list to occur right after a paragraph, with no intervening blank
@@ -6130,7 +6084,7 @@ in several respects:
61306084No blank line is required between consecutive items of the definition
61316085list.
61326086.IP \[bu] 2
6133−To get a \[lq]tight\[rq] or \[lq]compact\[rq] list, omit space between
6087+To get a \[dq]tight\[dq] or \[dq]compact\[dq] list, omit space between
61346088consecutive items; the space between a term and its definition does not
61356089affect anything.
61366090.IP \[bu] 2
@@ -6141,489 +6095,65 @@ be indented four spaces.
61416095Use Project Gutenberg conventions for \f[C]plain\f[R] output: all-caps
61426096for strong emphasis, surround by underscores for regular emphasis, add
61436097extra blank space around headings.
6144−.SS Extension: \f[C]sourcepos\f[R]
6145−.PP
6146−Include source position attributes when parsing \f[C]commonmark\f[R].
6147−For elements that accept attributes, a \f[C]data-pos\f[R] attribute is
6148−added; other elements are placed in a surrounding Div or Span elemnet
6149−with a \f[C]data-pos\f[R] attribute.
61506098.SS Markdown variants
61516099.PP
6152−In addition to pandoc\[cq]s extended Markdown, the following Markdown
6100+In addition to pandoc\[aq]s extended Markdown, the following Markdown
61536101variants are supported:
6154−.IP \[bu] 2
6155−\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)
6156−.IP \[bu] 2
6157−\f[C]markdown_github\f[R] (deprecated GitHub-Flavored Markdown)
6158−.IP \[bu] 2
6159−\f[C]markdown_mmd\f[R] (MultiMarkdown)
6160−.IP \[bu] 2
6161−\f[C]markdown_strict\f[R] (Markdown.pl)
6162−.IP \[bu] 2
6163−\f[C]commonmark\f[R] (CommonMark)
6164−.IP \[bu] 2
6165−\f[C]gfm\f[R] (Github-Flavored Markdown)
6166−.IP \[bu] 2
6167−\f[C]commonmark_x\f[R] (CommonMark with many pandoc extensions)
6168−.PP
6169−To see which extensions are supported for a given format, and which are
6170−enabled by default, you can use the command
6171−.IP
6172−.nf
6173−\f[C]
6174−pandoc --list-extensions=FORMAT
6175−\f[R]
6176−.fi
6177−.PP
6178−where \f[C]FORMAT\f[R] is replaced with the name of the format.
6179−.PP
6180−Note that the list of extensions for \f[C]commonmark\f[R],
6181−\f[C]gfm\f[R], and \f[C]commonmark_x\f[R] are defined relative to
6182−default commonmark.
6183−So, for example, \f[C]backtick_code_blocks\f[R] does not appear as an
6184−extension, since it is enabled by default and cannot be disabled.
6185−.SH CITATIONS
6186−.PP
6187−When the \f[C]--citeproc\f[R] option is used, pandoc can automatically
6188−generate citations and a bibliography in a number of styles.
6189−Basic usage is
6190−.IP
6191−.nf
6192−\f[C]
6193−pandoc --citeproc myinput.txt
6194−\f[R]
6195−.fi
6196−.PP
6197−To use this feature, you will need to have
6198−.IP \[bu] 2
6199−a document containing citations (see Extension: \f[C]citations\f[R]);
6200−.IP \[bu] 2
6201−a source of bibliographic data: either an external bibliography file or
6202−a list of \f[C]references\f[R] in the document\[cq]s YAML metadata
6203−.IP \[bu] 2
6204−optionally, a CSL citation style.
6205−.SS Specifying bibliographic data
6206−.PP
6207−You can specify an external bibliography using the
6208−\f[C]bibliography\f[R] metadata field in a YAML metadata section or the
6209−\f[C]--bibliography\f[R] command line argument.
6210−If you want to use multiple bibliography files, you can supply multiple
6211−\f[C]--bibliography\f[R] arguments or set \f[C]bibliography\f[R]
6212−metadata field to YAML array.
6213−A bibliography may have any of these formats:
6214−.PP
6215−.TS
6216−tab(@);
6217−l l.
6218−T{
6219−Format
6220−T}@T{
6221−File extension
6222−T}
6223−_
6224−T{
6225−BibLaTeX
6226−T}@T{
6227−\&.bib
6228−T}
6229−T{
6230−BibTeX
6231−T}@T{
6232−\&.bibtex
6233−T}
6234−T{
6235−CSL JSON
6236−T}@T{
6237−\&.json
6238−T}
6239−T{
6240−CSL YAML
6241−T}@T{
6242−\&.yaml
6243−T}
6244−.TE
6245−.PP
6246−Note that \f[C].bib\f[R] can be used with both BibTeX and BibLaTeX
6247−files; use the extension \f[C].bibtex\f[R] to force interpretation as
6248−BibTeX.
6249−.PP
6250−In BibTeX and BibLaTeX databases, pandoc parses LaTeX markup inside
6251−fields such as \f[C]title\f[R]; in CSL YAML databases, pandoc Markdown;
6252−and in CSL JSON databases, an HTML-like markup:
6253−.TP
6254−\f[B]\f[CB]<i>...</i>\f[B]\f[R]
6255−italics
6256−.TP
6257−\f[B]\f[CB]<b>...</b>\f[B]\f[R]
6258−bold
6259−.TP
6260−\f[B]\f[CB]<span style=\[dq]font-variant:small-caps;\[dq]>...</span>\f[B]\f[R] or \f[B]\f[CB]<sc>...</sc>\f[B]\f[R]
6261−small capitals
62626102.TP
6263−\f[B]\f[CB]<sub>...</sub>\f[B]\f[R]
6264−subscript
6265−.TP
6266−\f[B]\f[CB]<sup>...</sup>\f[B]\f[R]
6267−superscript
6268−.TP
6269−\f[B]\f[CB]<span class=\[dq]nocase\[dq]>...</span>\f[B]\f[R]
6270−prevent a phrase from being capitalized as title case
6271−.PP
6272−As an alternative to specifying a bibliography file using
6273−\f[C]--bibliography\f[R] or the YAML metadata field
6274−\f[C]bibliography\f[R], you can include the citation data directly in
6275−the \f[C]references\f[R] field of the document\[cq]s YAML metadata.
6276−The field should contain an array of YAML-encoded references, for
6277−example:
6278−.IP
6279−.nf
6280−\f[C]
6281−---
6282−references:
6283−- type: article-journal
6284− id: WatsonCrick1953
6285− author:
6286− - family: Watson
6287− given: J. D.
6288− - family: Crick
6289− given: F. H. C.
6290− issued:
6291− date-parts:
6292− - - 1953
6293− - 4
6294− - 25
6295− title: \[aq]Molecular structure of nucleic acids: a structure for
6296− deoxyribose nucleic acid\[aq]
6297− title-short: Molecular structure of nucleic acids
6298− container-title: Nature
6299− volume: 171
6300− issue: 4356
6301− page: 737-738
6302− DOI: 10.1038/171737a0
6303− URL: https://www.nature.com/articles/171737a0
6304− language: en-GB
6305−\&...
6306−\f[R]
6307−.fi
6308−.PP
6309−If both an external bibliography and inline (YAML metadata) references
6310−are provided, both will be used.
6311−In case of conflicting \f[C]id\f[R]s, the inline references will take
6312−precedence.
6313−.PP
6314−Note that \f[C]pandoc\f[R] can be used to produce such a YAML metadata
6315−section from a BibTeX, BibLaTeX, or CSL JSON bibliography:
6316−.IP
6317−.nf
6318−\f[C]
6319−pandoc chem.bib -s -f biblatex -t markdown
6320−pandoc chem.json -s -f csljson -t markdown
6321−\f[R]
6322−.fi
6323−.PP
6324−Indeed, \f[C]pandoc\f[R] can convert between any of these citation
6325−formats:
6326−.IP
6327−.nf
6328−\f[C]
6329−pandoc chem.bib -s -f biblatex -t csljson
6330−pandoc chem.yaml -s -f markdown -t biblatex
6331−\f[R]
6332−.fi
6333−.PP
6334−Running pandoc on a bibliography file with the \f[C]--citeproc\f[R]
6335−option will create a formatted bibliography in the format of your
6336−choice:
6337−.IP
6338−.nf
6339−\f[C]
6340−pandoc chem.bib -s --citeproc -o chem.html
6341−pandoc chem.bib -s --citeproc -o chem.pdf
6342−\f[R]
6343−.fi
6344−.SS Capitalization in titles
6345−.PP
6346−If you are using a bibtex or biblatex bibliography, then observe the
6347−following rules:
6348−.IP \[bu] 2
6349−English titles should be in title case.
6350−Non-English titles should be in sentence case, and the \f[C]langid\f[R]
6351−field in biblatex should be set to the relevant language.
6352−(The following values are treated as English: \f[C]american\f[R],
6353−\f[C]british\f[R], \f[C]canadian\f[R], \f[C]english\f[R],
6354−\f[C]australian\f[R], \f[C]newzealand\f[R], \f[C]USenglish\f[R], or
6355−\f[C]UKenglish\f[R].)
6356−.IP \[bu] 2
6357−As is standard with bibtex/biblatex, proper names should be protected
6358−with curly braces so that they won\[cq]t be lowercased in styles that
6359−call for sentence case.
6360−For example:
6361−.RS 2
6362−.IP
6363−.nf
6364−\f[C]
6365−title = {My Dinner with {Andre}}
6366−\f[R]
6367−.fi
6368−.RE
6369−.IP \[bu] 2
6370−In addition, words that should remain lowercase (or camelCase) should be
6371−protected:
6372−.RS 2
6373−.IP
6374−.nf
6375−\f[C]
6376−title = {Spin Wave Dispersion on the {nm} Scale}
6377−\f[R]
6378−.fi
6379−.PP
6380−Though this is not necessary in bibtex/biblatex, it is necessary with
6381−citeproc, which stores titles internally in sentence case, and converts
6382−to title case in styles that require it.
6383−Here we protect \[lq]nm\[rq] so that it doesn\[cq]t get converted to
6384−\[lq]Nm\[rq] at this stage.
6385−.RE
6386−.PP
6387−If you are using a CSL bibliography (either JSON or YAML), then observe
6388−the following rules:
6389−.IP \[bu] 2
6390−All titles should be in sentence case.
6391−.IP \[bu] 2
6392−Use the \f[C]language\f[R] field for non-English titles to prevent their
6393−conversion to title case in styles that call for this.
6394−(Conversion happens only if \f[C]language\f[R] begins with \f[C]en\f[R]
6395−or is left empty.)
6396−.IP \[bu] 2
6397−Protect words that should not be converted to title case using this
6398−syntax:
6399−.RS 2
6400−.IP
6401−.nf
6402−\f[C]
6403−Spin wave dispersion on the <span class=\[dq]nocase\[dq]>nm</span> scale
6404−\f[R]
6405−.fi
6406−.RE
6407−.SS Conference Papers, Published vs.\ Unpublished
6408−.PP
6409−For a formally published conference paper, use the biblatex entry type
6410−\f[C]inproceedings\f[R] (which will be mapped to CSL
6411−\f[C]paper-conference\f[R]).
6412−.PP
6413−For an unpublished manuscript, use the biblatex entry type
6414−\f[C]unpublished\f[R] without an \f[C]eventtitle\f[R] field (this entry
6415−type will be mapped to CSL \f[C]manuscript\f[R]).
6416−.PP
6417−For a talk, an unpublished conference paper, or a poster presentation,
6418−use the biblatex entry type \f[C]unpublished\f[R] with an
6419−\f[C]eventtitle\f[R] field (this entry type will be mapped to CSL
6420−\f[C]speech\f[R]).
6421−Use the biblatex \f[C]type\f[R] field to indicate the type,
6422−e.g.\ \[lq]Paper\[rq], or \[lq]Poster\[rq].
6423−\f[C]venue\f[R] and \f[C]eventdate\f[R] may be useful too, though
6424−\f[C]eventdate\f[R] will not be rendered by most CSL styles.
6425−Note that \f[C]venue\f[R] is for the event\[cq]s venue, unlike
6426−\f[C]location\f[R] which describes the publisher\[cq]s location; do not
6427−use the latter for an unpublished conference paper.
6428−.SS Specifying a citation style
6429−.PP
6430−Citations and references can be formatted using any style supported by
6431−the Citation Style Language, listed in the Zotero Style Repository.
6432−These files are specified using the \f[C]--csl\f[R] option or the
6433−\f[C]csl\f[R] (or \f[C]citation-style\f[R]) metadata field.
6434−By default, pandoc will use the Chicago Manual of Style author-date
6435−format.
6436−(You can override this default by copying a CSL style of your choice to
6437−\f[C]default.csl\f[R] in your user data directory.) The CSL project
6438−provides further information on finding and editing styles.
6439−.PP
6440−The \f[C]--citation-abbreviations\f[R] option (or the
6441−\f[C]citation-abbreviations\f[R] metadata field) may be used to specify
6442−a JSON file containing abbreviations of journals that should be used in
6443−formatted bibliographies when \f[C]form=\[dq]short\[dq]\f[R] is
6444−specified.
6445−The format of the file can be illustrated with an example:
6446−.IP
6447−.nf
6448−\f[C]
6449−{ \[dq]default\[dq]: {
6450− \[dq]container-title\[dq]: {
6451− \[dq]Lloyd\[aq]s Law Reports\[dq]: \[dq]Lloyd\[aq]s Rep\[dq],
6452− \[dq]Estates Gazette\[dq]: \[dq]EG\[dq],
6453− \[dq]Scots Law Times\[dq]: \[dq]SLT\[dq]
6454− }
6455− }
6456−}
6457−\f[R]
6458−.fi
6459−.SS Citations in note styles
6460−.PP
6461−Pandoc\[cq]s citation processing is designed to allow you to move
6462−between author-date, numerical, and note styles without modifying the
6463−markdown source.
6464−When you\[cq]re using a note style, avoid inserting footnotes manually.
6465−Instead, insert citations just as you would in an author-date
6466−style\[em]for example,
6467−.IP
6468−.nf
6469−\f[C]
6470−Blah blah [\[at]foo, p. 33].
6471−\f[R]
6472−.fi
6473−.PP
6474−The footnote will be created automatically.
6475−Pandoc will take care of removing the space and moving the note before
6476−or after the period, depending on the setting of
6477−\f[C]notes-after-punctuation\f[R], as described below in Other relevant
6478−metadata fields.
6479−.PP
6480−In some cases you may need to put a citation inside a regular footnote.
6481−Normal citations in footnotes (such as \f[C][\[at]foo, p. 33]\f[R]) will
6482−be rendered in parentheses.
6483−In-text citations (such as \f[C]\[at]foo [p. 33]\f[R]) will be rendered
6484−without parentheses.
6485−(A comma will be added if appropriate.) Thus:
6486−.IP
6487−.nf
6488−\f[C]
6489−[\[ha]1]: Some studies [\[at]foo; \[at]bar, p. 33] show that
6490−frubulicious zoosnaps are quantical. For a survey
6491−of the literature, see \[at]baz [chap. 1].
6492−\f[R]
6493−.fi
6494−.SS Raw content in a style
6495−.PP
6496−To include raw content in a prefix, suffix, delimiter, or term, surround
6497−it with these tags indicating the format:
6498−.IP
6499−.nf
6500−\f[C]
6501−{{jats}}&lt;ref&gt;{{/jats}}
6502−\f[R]
6503−.fi
6504−.PP
6505−Without the tags, the string will be interpreted as a string and escaped
6506−in the output, rather than being passed through raw.
6507−.PP
6508−This feature allows stylesheets to be customized to give different
6509−output for different output formats.
6510−However, stylesheets customized in this way will not be usable by other
6511−CSL implementations.
6512−.SS Placement of the bibliography
6513−.PP
6514−If the style calls for a list of works cited, it will be placed in a div
6515−with id \f[C]refs\f[R], if one exists:
6516−.IP
6517−.nf
6518−\f[C]
6519−::: {#refs}
6520−:::
6521−\f[R]
6522−.fi
6523−.PP
6524−Otherwise, it will be placed at the end of the document.
6525−Generation of the bibliography can be suppressed by setting
6526−\f[C]suppress-bibliography: true\f[R] in the YAML metadata.
6527−.PP
6528−If you wish the bibliography to have a section heading, you can set
6529−\f[C]reference-section-title\f[R] in the metadata, or put the heading at
6530−the beginning of the div with id \f[C]refs\f[R] (if you are using it) or
6531−at the end of your document:
6532−.IP
6533−.nf
6534−\f[C]
6535−last paragraph...
6536−
6537−# References
6538−\f[R]
6539−.fi
6540−.PP
6541−The bibliography will be inserted after this heading.
6542−Note that the \f[C]unnumbered\f[R] class will be added to this heading,
6543−so that the section will not be numbered.
6544−.SS Including uncited items in the bibliography
6545−.PP
6546−If you want to include items in the bibliography without actually citing
6547−them in the body text, you can define a dummy \f[C]nocite\f[R] metadata
6548−field and put the citations there:
6549−.IP
6550−.nf
6551−\f[C]
6552−---
6553−nocite: |
6554− \[at]item1, \[at]item2
6555−\&...
6556−
6557−\[at]item3
6558−\f[R]
6559−.fi
6560−.PP
6561−In this example, the document will contain a citation for
6562−\f[C]item3\f[R] only, but the bibliography will contain entries for
6563−\f[C]item1\f[R], \f[C]item2\f[R], and \f[C]item3\f[R].
6564−.PP
6565−It is possible to create a bibliography with all the citations, whether
6566−or not they appear in the document, by using a wildcard:
6567−.IP
6568−.nf
6569−\f[C]
6570−---
6571−nocite: |
6572− \[at]*
6573−\&...
6574−\f[R]
6575−.fi
6576−.PP
6577−For LaTeX output, you can also use \f[C]natbib\f[R] or
6578−\f[C]biblatex\f[R] to render the bibliography.
6579−In order to do so, specify bibliography files as outlined above, and add
6580−\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] argument to \f[C]pandoc\f[R]
6581−invocation.
6582−Bear in mind that bibliography files have to be in either BibTeX (for
6583−\f[C]--natbib\f[R]) or BibLaTeX (for \f[C]--biblatex\f[R]) format.
6584−.SS Other relevant metadata fields
6585−.PP
6586−A few other metadata fields affect bibliography formatting:
6587−.TP
6588−\f[B]\f[CB]link-citations\f[B]\f[R]
6589−If true, citations will be hyperlinked to the corresponding bibliography
6590−entries (for author-date and numerical styles only).
6591−.TP
6592−\f[B]\f[CB]lang\f[B]\f[R]
6593−The \f[C]lang\f[R] field will affect how the style is localized, for
6594−example in the translation of labels, the use of quotation marks, and
6595−the way items are sorted.
6596−(For backwards compatibility, \f[C]locale\f[R] may be used instead of
6597−\f[C]lang\f[R], but this use is deprecated.)
6598−.RS
6599−.PP
6600−A BCP 47 language tag is expected: for example, \f[C]en\f[R],
6601−\f[C]de\f[R], \f[C]en-US\f[R], \f[C]fr-CA\f[R], \f[C]ug-Cyrl\f[R].
6602−The unicode extension syntax (after \f[C]-u-\f[R]) may be used to
6603−specify options for collation (sorting) more precisely.
6604−Here are some examples:
6605−.IP \[bu] 2
6606−\f[C]zh-u-co-pinyin\f[R] \[en] Chinese with the Pinyin collation.
6607−.IP \[bu] 2
6608−\f[C]es-u-co-trad\f[R] \[en] Spanish with the traditional collation
6609−(with \f[C]Ch\f[R] sorting after \f[C]C\f[R]).
6610−.IP \[bu] 2
6611−\f[C]fr-u-kb\f[R] \[en] French with \[lq]backwards\[rq] accent sorting
6612−(with \f[C]cot\['e]\f[R] sorting after \f[C]c\[^o]te\f[R]).
6613−.IP \[bu] 2
6614−\f[C]en-US-u-kf-upper\f[R] \[en] English with uppercase letters sorting
6615−before lower (default is lower before upper).
6616−.RE
6617−.TP
6618−\f[B]\f[CB]notes-after-punctuation\f[B]\f[R]
6619−If true (the default), pandoc will put footnote citations after
6620−following punctuation.
6621−For example, if the source contains \f[C]blah blah [\[at]jones99].\f[R],
6622−the result will look like \f[C]blah blah.[\[ha]1]\f[R], with the note
6623−moved after the period and the space collapsed.
6624−If false, the space will still be collapsed, but the footnote will not
6625−be moved after the punctuation.
6626−.SH SLIDE SHOWS
6103+\f[B]\f[CB]markdown_phpextra\f[B]\f[R] (PHP Markdown Extra)
6104+\f[C]footnotes\f[R], \f[C]pipe_tables\f[R], \f[C]raw_html\f[R],
6105+\f[C]markdown_attribute\f[R], \f[C]fenced_code_blocks\f[R],
6106+\f[C]definition_lists\f[R], \f[C]intraword_underscores\f[R],
6107+\f[C]header_attributes\f[R], \f[C]link_attributes\f[R],
6108+\f[C]abbreviations\f[R], \f[C]shortcut_reference_links\f[R],
6109+\f[C]spaced_reference_links\f[R].
6110+.TP
6111+\f[B]\f[CB]markdown_github\f[B]\f[R] (deprecated GitHub-Flavored Markdown)
6112+\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],
6113+\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],
6114+\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],
6115+\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],
6116+\f[C]strikeout\f[R], \f[C]task_lists\f[R], \f[C]emoji\f[R],
6117+\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],
6118+\f[C]lists_without_preceding_blankline\f[R].
6119+.TP
6120+\f[B]\f[CB]markdown_mmd\f[B]\f[R] (MultiMarkdown)
6121+\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]markdown_attribute\f[R],
6122+\f[C]mmd_link_attributes\f[R], \f[C]tex_math_double_backslash\f[R],
6123+\f[C]intraword_underscores\f[R], \f[C]mmd_title_block\f[R],
6124+\f[C]footnotes\f[R], \f[C]definition_lists\f[R],
6125+\f[C]all_symbols_escapable\f[R], \f[C]implicit_header_references\f[R],
6126+\f[C]auto_identifiers\f[R], \f[C]mmd_header_identifiers\f[R],
6127+\f[C]shortcut_reference_links\f[R], \f[C]implicit_figures\f[R],
6128+\f[C]superscript\f[R], \f[C]subscript\f[R],
6129+\f[C]backtick_code_blocks\f[R], \f[C]spaced_reference_links\f[R],
6130+\f[C]raw_attribute\f[R].
6131+.TP
6132+\f[B]\f[CB]markdown_strict\f[B]\f[R] (Markdown.pl)
6133+\f[C]raw_html\f[R], \f[C]shortcut_reference_links\f[R],
6134+\f[C]spaced_reference_links\f[R].
6135+.PP
6136+We also support \f[C]commonmark\f[R] and \f[C]gfm\f[R] (GitHub-Flavored
6137+Markdown, which is implemented as a set of extensions on
6138+\f[C]commonmark\f[R]).
6139+.PP
6140+Note, however, that \f[C]commonmark\f[R] and \f[C]gfm\f[R] have limited
6141+support for extensions.
6142+Only those listed below (and \f[C]smart\f[R], \f[C]raw_tex\f[R], and
6143+\f[C]hard_line_breaks\f[R]) will work.
6144+The extensions can, however, all be individually disabled.
6145+Also, \f[C]raw_tex\f[R] only affects \f[C]gfm\f[R] output, not input.
6146+.TP
6147+\f[B]\f[CB]gfm\f[B]\f[R] (GitHub-Flavored Markdown)
6148+\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]native_divs\f[R],
6149+\f[C]fenced_code_blocks\f[R], \f[C]auto_identifiers\f[R],
6150+\f[C]gfm_auto_identifiers\f[R], \f[C]backtick_code_blocks\f[R],
6151+\f[C]autolink_bare_uris\f[R], \f[C]space_in_atx_header\f[R],
6152+\f[C]intraword_underscores\f[R], \f[C]strikeout\f[R],
6153+\f[C]task_lists\f[R], \f[C]emoji\f[R],
6154+\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],
6155+\f[C]lists_without_preceding_blankline\f[R].
6156+.SH PRODUCING SLIDE SHOWS WITH PANDOC
66276157.PP
66286158You can use pandoc to produce an HTML + JavaScript slide presentation
66296159that can be viewed via a web browser.
@@ -6632,7 +6162,7 @@ reveal.js.
66326162You can also produce a PDF slide show using LaTeX \f[C]beamer\f[R], or
66336163slides shows in Microsoft PowerPoint format.
66346164.PP
6635−Here\[cq]s the Markdown source for a simple slide show,
6165+Here\[aq]s the Markdown source for a simple slide show,
66366166\f[C]habits.txt\f[R]:
66376167.IP
66386168.nf
@@ -6734,26 +6264,21 @@ A heading at the slide level always starts a new slide.
67346264.IP \[bu] 2
67356265Headings \f[I]below\f[R] the slide level in the hierarchy create
67366266headings \f[I]within\f[R] a slide.
6737−(In beamer, a \[lq]block\[rq] will be created.
6738−If the heading has the class \f[C]example\f[R], an
6739−\f[C]exampleblock\f[R] environment will be used; if it has the class
6740−\f[C]alert\f[R], an \f[C]alertblock\f[R] will be used; otherwise a
6741−regular \f[C]block\f[R] will be used.)
67426267.IP \[bu] 2
67436268Headings \f[I]above\f[R] the slide level in the hierarchy create
6744−\[lq]title slides,\[rq] which just contain the section title and help to
6269+\[dq]title slides,\[dq] which just contain the section title and help to
67456270break the slide show into sections.
67466271Non-slide content under these headings will be included on the title
67476272slide (for HTML slide shows) or in a subsequent slide with the same
67486273title (for beamer).
67496274.IP \[bu] 2
6750−A title page is constructed automatically from the document\[cq]s title
6275+A title page is constructed automatically from the document\[aq]s title
67516276block, if present.
67526277(In the case of beamer, this can be disabled by commenting out some
67536278lines in the default template.)
67546279.PP
67556280These rules are designed to support many different styles of slide show.
6756−If you don\[cq]t care about structuring your slides into sections and
6281+If you don\[aq]t care about structuring your slides into sections and
67576282subsections, you can just use level-1 headings for all each slide.
67586283(In that case, level-1 will be the slide level.) But you can also
67596284structure the slide show into sections, as in the example above.
@@ -6765,8 +6290,8 @@ It is not recommended that you use deeper nesting of section levels with
67656290reveal.js.
67666291.SS Incremental lists
67676292.PP
6768−By default, these writers produce lists that display \[lq]all at
6769−once.\[rq] If you want your lists to display incrementally (one item at
6293+By default, these writers produce lists that display \[dq]all at
6294+once.\[dq] If you want your lists to display incrementally (one item at
67706295a time), use the \f[C]-i\f[R] option.
67716296If you want a particular list to depart from the default, put it in a
67726297\f[C]div\f[R] block with class \f[C]incremental\f[R] or
@@ -6819,7 +6344,7 @@ Note: Neither the \f[C]-i/--incremental\f[R] option nor any of the
68196344methods described here currently works for PowerPoint output.
68206345.SS Inserting pauses
68216346.PP
6822−You can add \[lq]pauses\[rq] within a slide by including a paragraph
6347+You can add \[dq]pauses\[dq] within a slide by including a paragraph
68236348containing three dots, separated by spaces:
68246349.IP
68256350.nf
@@ -6842,7 +6367,7 @@ in \f[C]$DATADIR/s5/default\f[R] (for S5), \f[C]$DATADIR/slidy\f[R] (for
68426367Slidy), or \f[C]$DATADIR/slideous\f[R] (for Slideous), where
68436368\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],
68446369above).
6845−The originals may be found in pandoc\[cq]s system data directory
6370+The originals may be found in pandoc\[aq]s system data directory
68466371(generally \f[C]$CABALDIR/pandoc-VERSION/s5/default\f[R]).
68476372Pandoc will look there for any files it does not find in the user data
68486373directory.
@@ -6972,7 +6497,7 @@ contents...
69726497The class \f[C]onlytextwidth\f[R] sets the \f[C]totalwidth\f[R] to
69736498\f[C]\[rs]textwidth\f[R].
69746499.PP
6975−See Section 12.7 of the Beamer User\[cq]s Guide for more details.
6500+See Section 12.7 of the Beamer User\[aq]s Guide for more details.
69766501.SS Frame attributes in beamer
69776502.PP
69786503Sometimes it is necessary to add the LaTeX \f[C][fragile]\f[R] option to
@@ -6988,7 +6513,7 @@ introducing the slide:
69886513.fi
69896514.PP
69906515All of the other frame attributes described in Section 8.1 of the Beamer
6991−User\[cq]s Guide may also be used: \f[C]allowdisplaybreaks\f[R],
6516+User\[aq]s Guide may also be used: \f[C]allowdisplaybreaks\f[R],
69926517\f[C]allowframebreaks\f[R], \f[C]b\f[R], \f[C]c\f[R], \f[C]t\f[R],
69936518\f[C]environment\f[R], \f[C]label\f[R], \f[C]plain\f[R],
69946519\f[C]shrink\f[R], \f[C]standout\f[R], \f[C]noframenumbering\f[R].
@@ -7013,7 +6538,7 @@ To set an image for a particular reveal.js slide, add
70136538\f[C]{data-background-image=\[dq]/path/to/image\[dq]}\f[R] to the first
70146539slide-level heading on the slide (which may even be empty).
70156540.PP
7016−In reveal.js\[cq]s overview mode, the parallaxBackgroundImage will show
6541+In reveal.js\[aq]s overview mode, the parallaxBackgroundImage will show
70176542up only on the first slide.
70186543.PP
70196544Other reveal.js background settings also work on individual slides,
@@ -7049,7 +6574,7 @@ Slide 1 has background_image.png as its background.
70496574Slide 2 has a special image for its background, even though the heading has no content.
70506575\f[R]
70516576.fi
7052−.SH EPUBS
6577+.SH CREATING EPUBS WITH PANDOC
70536578.SS EPUB Metadata
70546579.PP
70556580EPUB metadata may be specified using the \f[C]--epub-metadata\f[R]
@@ -7103,8 +6628,8 @@ Valid values for \f[C]type\f[R] are \f[C]main\f[R], \f[C]subtitle\f[R],
71036628Either a string value, or an object with fields \f[C]role\f[R],
71046629\f[C]file-as\f[R], and \f[C]text\f[R], or a list of such objects.
71056630Valid values for \f[C]role\f[R] are MARC relators, but pandoc will
7106−attempt to translate the human-readable versions (like \[lq]author\[rq]
7107−and \[lq]editor\[rq]) to the appropriate marc relators.
6631+attempt to translate the human-readable versions (like \[dq]author\[dq]
6632+and \[dq]editor\[dq]) to the appropriate marc relators.
71086633.TP
71096634\f[B]\f[CB]contributor\f[B]\f[R]
71106635Same format as \f[C]creator\f[R].
@@ -7139,16 +6664,6 @@ A string value.
71396664\f[B]\f[CB]rights\f[B]\f[R]
71406665A string value.
71416666.TP
7142−\f[B]\f[CB]belongs-to-collection\f[B]\f[R]
7143−A string value.
7144−identifies the name of a collection to which the EPUB Publication
7145−belongs.
7146−.TP
7147−\f[B]\f[CB]group-position\f[B]\f[R]
7148−The \f[C]group-position\f[R] field indicates the numeric position in
7149−which the EPUB Publication belongs relative to other works belonging to
7150−the same \f[C]belongs-to-collection\f[R] field.
7151−.TP
71526667\f[B]\f[CB]cover-image\f[B]\f[R]
71536668A string value (path to cover image).
71546669.TP
@@ -7303,6 +6818,11 @@ T}@T{
73036818frontmatter
73046819T}
73056820T{
6821+seriespage
6822+T}@T{
6823+frontmatter
6824+T}
6825+T{
73066826appendix
73076827T}@T{
73086828backmatter
@@ -7343,7 +6863,7 @@ For example:
73436863</audio>
73446864\f[R]
73456865.fi
7346−.SH JUPYTER NOTEBOOKS
6866+.SH CREATING JUPYTER NOTEBOOKS WITH PANDOC
73476867.PP
73486868When creating a Jupyter notebook, pandoc will try to infer the notebook
73496869structure.
@@ -7458,7 +6978,7 @@ hello
74586978If you include raw HTML or TeX in an output cell, use the [raw
74596979attribute][Extension: \f[C]fenced_attribute\f[R]], as shown in the last
74606980cell of the example above.
7461−Although pandoc can process \[lq]bare\[rq] raw HTML and TeX, the result
6981+Although pandoc can process \[dq]bare\[dq] raw HTML and TeX, the result
74626982is often interspersed raw elements and normal textual elements, and in
74636983an output cell pandoc expects a single, connected raw block.
74646984To avoid using raw HTML or TeX except when marked explicitly using raw
@@ -7511,10 +7031,10 @@ pandoc --highlight-style my.theme
75117031.fi
75127032.PP
75137033If you are not satisfied with the built-in highlighting, or you want
7514−highlight a language that isn\[cq]t supported, you can use the
7034+highlight a language that isn\[aq]t supported, you can use the
75157035\f[C]--syntax-definition\f[R] option to load a KDE-style XML syntax
75167036definition file.
7517−Before writing your own, have a look at KDE\[cq]s repository of syntax
7037+Before writing your own, have a look at KDE\[aq]s repository of syntax
75187038definitions.
75197039.PP
75207040To disable highlighting, use the \f[C]--no-highlight\f[R] option.
@@ -7523,7 +7043,7 @@ To disable highlighting, use the \f[C]--no-highlight\f[R] option.
75237043Custom styles can be used in the docx and ICML formats.
75247044.SS Output
75257045.PP
7526−By default, pandoc\[cq]s docx and ICML output applies a predefined set
7046+By default, pandoc\[aq]s docx and ICML output applies a predefined set
75277047of styles for blocks such as paragraphs and block quotes, and uses
75287048largely default formatting (italics, bold) for inlines.
75297049This will work for most purposes, especially alongside a
@@ -7544,7 +7064,7 @@ So, for example, using the \f[C]bracketed_spans\f[R] syntax,
75447064\f[R]
75457065.fi
75467066.PP
7547−would produce a docx file with \[lq]Get out\[rq] styled with character
7067+would produce a docx file with \[dq]Get out\[dq] styled with character
75487068style \f[C]Emphatically\f[R].
75497069Similarly, using the \f[C]fenced_divs\f[R] syntax,
75507070.IP
@@ -7575,13 +7095,13 @@ character style (perhaps to change their color), you can write a filter
75757095which will transform all italicized inlines to inlines within an
75767096\f[C]Emphasis\f[R] custom-style \f[C]span\f[R].
75777097.PP
7578−For docx output, you don\[cq]t need to enable any extensions for custom
7098+For docx output, you don\[aq]t need to enable any extensions for custom
75797099styles to work.
75807100.SS Input
75817101.PP
75827102The docx reader, by default, only reads those styles that it can convert
75837103into pandoc elements, either by direct conversion or interpreting the
7584−derivation of the input document\[cq]s styles.
7104+derivation of the input document\[aq]s styles.
75857105.PP
75867106By enabling the \f[C]styles\f[R] extension in the docx reader
75877107(\f[C]-f docx+styles\f[R]), you can produce output that maintains the
@@ -7664,20 +7184,6 @@ need to specify a template manually using \f[C]--template\f[R] or add a
76647184new default template with the name
76657185\f[C]default.NAME_OF_CUSTOM_WRITER.lua\f[R] to the \f[C]templates\f[R]
76667186subdirectory of your user data directory (see Templates).
7667−.SH REPRODUCIBLE BUILDS
7668−.PP
7669−Some of the document formats pandoc targets (such as EPUB, docx, and
7670−ODT) include build timestamps in the generated document.
7671−That means that the files generated on successive builds will differ,
7672−even if the source does not.
7673−To avoid this, set the \f[C]SOURCE_DATE_EPOCH\f[R] environment variable,
7674−and the timestamp will be taken from it instead of the current time.
7675−\f[C]SOURCE_DATE_EPOCH\f[R] should contain an integer unix timestamp
7676−(specifying the number of second since midnight UTC January 1, 1970).
7677−.PP
7678−Some document formats also include a unique identifier.
7679−For EPUB, this can be set explicitly by setting the \f[C]identifier\f[R]
7680−metadata field (see EPUB Metadata, above).
76817187.SH A NOTE ON SECURITY
76827188.PP
76837189If you use pandoc to convert user-contributed content in a web
@@ -7696,7 +7202,7 @@ fully isolates pandoc from your file system, by running the pandoc
76967202operations in the \f[C]PandocPure\f[R] monad.
76977203See the document Using the pandoc API for more details.
76987204.IP "3." 3
7699−Pandoc\[cq]s parsers can exhibit pathological performance on some corner
7205+Pandoc\[aq]s parsers can exhibit pathological performance on some corner
77007206cases.
77017207It is wise to put any pandoc operations under a timeout, to avoid DOS
77027208attacks that exploit these issues.
@@ -7708,16 +7214,16 @@ The HTML generated by pandoc is not guaranteed to be safe.
77087214If \f[C]raw_html\f[R] is enabled for the Markdown input, users can
77097215inject arbitrary HTML.
77107216Even if \f[C]raw_html\f[R] is disabled, users can include dangerous
7711−content in URLs and attributes.
7217+content in attributes for headings, spans, and code blocks.
77127218To be safe, you should run all the generated HTML through an HTML
77137219sanitizer.
77147220.SH AUTHORS
77157221.PP
7716−Copyright 2006\[en]2021 John MacFarlane (jgm\[at]berkeley.edu).
7222+Copyright 2006--2020 John MacFarlane (jgm\[at]berkeley.edu).
77177223Released under the GPL, version 2 or greater.
77187224This software carries no warranty of any kind.
77197225(See COPYRIGHT for full copyright and warranty notices.) For a full list
77207226of contributors, see the file AUTHORS.md in the pandoc source code.
77217227.PP
77227228The Pandoc source code and all documentation may be downloaded
7723−from <https://pandoc.org>.
7229+from <http://pandoc.org>.
man/pandoc.1.after+1−1
@@ -1,3 +1,3 @@
11.PP
22The Pandoc source code and all documentation may be downloaded
3−from <https://pandoc.org>.
3+from <http://pandoc.org>.
pandoc.cabal+181−134
@@ -1,10 +1,10 @@
11cabal-version: 2.2
22name: pandoc
3−version: 2.14.0.3
3+version: 2.11
44build-type: Simple
55license: GPL-2.0-or-later
66license-file: COPYING.md
7−copyright: (c) 2006-2021 John MacFarlane
7+copyright: (c) 2006-2020 John MacFarlane
88author: John MacFarlane <jgm@berkeley.edu>
99maintainer: John MacFarlane <jgm@berkeley.edu>
1010bug-reports: https://github.com/jgm/pandoc/issues
@@ -12,7 +12,7 @@ stability: alpha
1212homepage: https://pandoc.org
1313category: Text
1414tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5,
15− GHC == 8.8.4, GHC == 8.10.2, GHC == 9.0.1
15+ GHC == 8.8.4, GHC == 8.10.2
1616synopsis: Conversion between markup formats
1717description: Pandoc is a Haskell library for converting from one markup
1818 format to another, and a command-line tool that uses
@@ -22,15 +22,14 @@ description: Pandoc is a Haskell library for converting from one markup
2222 TikiWiki markup, Jira markup, Creole 1.0, Haddock markup,
2323 OPML, Emacs Org-Mode, Emacs Muse, txt2tags, ipynb (Jupyter
2424 notebooks), Vimwiki, Word Docx, ODT, EPUB, FictionBook2,
25− roff man, Textile, BibTeX, BibLaTeX, CSL JSON,
26− , and CSV, and it can write Markdown,
25+ roff man, Textile, and CSV, and it can write Markdown,
2726 reStructuredText, XHTML, HTML 5, LaTeX, ConTeXt, DocBook,
2827 JATS, OPML, TEI, OpenDocument, ODT, Word docx,
2928 PowerPoint pptx, RTF, MediaWiki, DokuWiki, XWiki,
3029 ZimWiki, Textile, Jira, roff man, roff ms, plain text,
3130 Emacs Org-Mode, AsciiDoc, Haddock markup,
3231 EPUB (v2 and v3), ipynb, FictionBook2,
33− InDesign ICML, Muse, CSL JSON, LaTeX beamer slides,
32+ InDesign ICML, Muse, LaTeX beamer slides,
3433 and several kinds of HTML/JavaScript slide shows
3534 (S5, Slidy, Slideous, DZSlides, reveal.js).
3635 .
@@ -56,8 +55,6 @@ data-files:
5655 data/templates/default.icml
5756 data/templates/default.opml
5857 data/templates/default.latex
59− data/templates/default.bibtex
60− data/templates/default.biblatex
6158 data/templates/default.context
6259 data/templates/default.texinfo
6360 data/templates/default.jira
@@ -86,7 +83,6 @@ data-files:
8683 data/templates/default.epub2
8784 data/templates/default.epub3
8885 data/templates/article.jats_publishing
89− data/templates/affiliations.jats
9086 -- translations
9187 data/translations/*.yaml
9288 -- source files for reference.docx
@@ -182,6 +178,8 @@ data-files:
182178 data/pandoc.List.lua
183179 -- bash completion template
184180 data/bash_completion.tpl
181+ -- jats csl
182+ data/jats.csl
185183 -- citeproc
186184 data/default.csl
187185 citeproc/biblatex-localization/*.lbx.strings
@@ -208,25 +206,14 @@ extra-source-files:
208206 test/command/*.md
209207 test/command/*.csl
210208 test/command/biblio.bib
211− test/command/averroes.bib
209+ test/command/biblatex-examples.bib
212210 test/command/A.txt
213211 test/command/B.txt
214212 test/command/C.txt
215213 test/command/D.txt
216214 test/command/01.csv
217− test/command/chap1/spider.png
218− test/command/chap2/spider.png
219− test/command/chap1/text.md
220− test/command/chap2/text.md
221215 test/command/defaults1.yaml
222216 test/command/defaults2.yaml
223− test/command/defaults3.yaml
224− test/command/defaults4.yaml
225− test/command/defaults5.yaml
226− test/command/defaults6.yaml
227− test/command/defaults7.yaml
228− test/command/defaults8.yaml
229− test/command/defaults9.yaml
230217 test/command/3533-rst-csv-tables.csv
231218 test/command/3880.txt
232219 test/command/5182.txt
@@ -298,7 +285,6 @@ extra-source-files:
298285 test/tables.opendocument
299286 test/tables.org
300287 test/tables.asciidoc
301− test/tables.asciidoctor
302288 test/tables.haddock
303289 test/tables.texinfo
304290 test/tables.rst
@@ -310,9 +296,7 @@ extra-source-files:
310296 test/tables.xwiki
311297 test/tables/*.html4
312298 test/tables/*.html5
313− test/tables/*.latex
314299 test/tables/*.native
315− test/tables/*.jats_archiving
316300 test/testsuite.txt
317301 test/writer.latex
318302 test/writer.context
@@ -333,7 +317,6 @@ extra-source-files:
333317 test/writer.opendocument
334318 test/writer.org
335319 test/writer.asciidoc
336− test/writer.asciidoctor
337320 test/writer.haddock
338321 test/writer.rst
339322 test/writer.icml
@@ -392,6 +375,10 @@ source-repository head
392375 type: git
393376 location: git://github.com/jgm/pandoc.git
394377
378+flag static
379+ Description: Use static linking for pandoc executable.
380+ Default: False
381+
395382flag embed_data_files
396383 Description: Embed data files in binary for relocatable executable.
397384 Default: False
@@ -400,116 +387,104 @@ flag trypandoc
400387 Description: Build trypandoc cgi executable.
401388 Default: False
402389
403−common common-options
404− default-language: Haskell2010
405− build-depends: base >= 4.9 && < 5
406− ghc-options: -Wall -fno-warn-unused-do-bind
407− -Wincomplete-record-updates
408− -Wnoncanonical-monad-instances
409−
410− if impl(ghc < 8.4)
411− hs-source-dirs: prelude
412− other-modules: Prelude
413− build-depends: base-compat >= 0.9
414− other-extensions: NoImplicitPrelude
415−
416− if os(windows)
417− cpp-options: -D_WINDOWS
418−
419− -- Later:
420− -- -Wpartial-fields (currently used in Powerpoint writer)
421− -- -Wmissing-export-lists (currently some Odt modules violate this)
422− -- -Wredundant-constraints (problematic if we want to support older base)
423− if impl(ghc >= 8.2)
424− ghc-options: -Wcpp-undef
425− if impl(ghc >= 8.4)
426− ghc-options: -Wincomplete-uni-patterns
427− -Widentities
428− -fhide-source-paths
429−
430−common common-executable
431− import: common-options
432− build-depends: pandoc
433− ghc-options: -rtsopts -with-rtsopts=-A8m -threaded
434−
435−
436390library
437− import: common-options
438− build-depends: Glob >= 0.7 && < 0.11,
391+ build-depends: base >= 4.9 && < 5,
392+ Glob >= 0.7 && < 0.11,
439393 HTTP >= 4000.0.5 && < 4000.4,
440394 HsYAML >= 0.2 && < 0.3,
441395 JuicyPixels >= 3.1.6.1 && < 3.4,
442396 SHA >= 1.6 && < 1.7,
443397 aeson >= 0.7 && < 1.6,
444398 aeson-pretty >= 0.8.5 && < 0.9,
445− array >= 0.5 && < 0.6,
446− attoparsec >= 0.12 && < 0.15,
447− base64-bytestring >= 0.1 && < 1.3,
448− binary >= 0.7 && < 0.11,
399+ attoparsec >= 0.12 && < 0.14,
400+ base64-bytestring >= 0.1 && < 1.2,
401+ binary >= 0.5 && < 0.11,
449402 blaze-html >= 0.9 && < 0.10,
450403 blaze-markup >= 0.8 && < 0.9,
451404 bytestring >= 0.9 && < 0.12,
452405 case-insensitive >= 1.2 && < 1.3,
453− citeproc >= 0.4.0.1 && < 0.4.1,
454− commonmark >= 0.2.1 && < 0.3,
455− commonmark-extensions >= 0.2.1.2 && < 0.3,
456− commonmark-pandoc >= 0.2.1.1 && < 0.3,
406+ citeproc >= 0.1 && < 0.2,
407+ commonmark >= 0.1.0.2 && < 0.2,
408+ commonmark-extensions >= 0.2 && < 0.3,
409+ commonmark-pandoc >= 0.2 && < 0.3,
457410 connection >= 0.3.1,
458411 containers >= 0.4.2.1 && < 0.7,
459412 data-default >= 0.4 && < 0.8,
460413 deepseq >= 1.3 && < 1.5,
461414 directory >= 1.2.3 && < 1.4,
462− doclayout >= 0.3.0.1 && < 0.4,
463− doctemplates >= 0.9 && < 0.10,
415+ doclayout >= 0.3 && < 0.4,
416+ doctemplates >= 0.8.2 && < 0.9,
464417 emojis >= 0.1 && < 0.2,
465418 exceptions >= 0.8 && < 0.11,
466419 file-embed >= 0.0 && < 0.1,
467420 filepath >= 1.1 && < 1.5,
468− haddock-library >= 1.10 && < 1.11,
469− hslua >= 1.1 && < 1.4,
470− hslua-module-path >= 0.1.0 && < 0.2.0,
421+ haddock-library >= 1.8 && < 1.10,
422+ hslua >= 1.1 && < 1.3,
471423 hslua-module-system >= 0.2 && < 0.3,
472424 hslua-module-text >= 0.2.1 && < 0.4,
473425 http-client >= 0.4.30 && < 0.8,
474426 http-client-tls >= 0.2.4 && < 0.4,
475427 http-types >= 0.8 && < 0.13,
476428 ipynb >= 0.1 && < 0.2,
477− jira-wiki-markup >= 1.4 && < 1.5,
429+ jira-wiki-markup >= 1.3.2 && < 1.4,
478430 mtl >= 2.2 && < 2.3,
479431 network >= 2.6,
480− network-uri >= 2.6 && < 2.8,
432+ network-uri >= 2.6 && < 2.7,
481433 pandoc-types >= 1.22 && < 1.23,
482434 parsec >= 3.1 && < 3.2,
483435 process >= 1.2.3 && < 1.7,
484− random >= 1 && < 1.3,
485− safe >= 0.3.18 && < 0.4,
436+ random >= 1 && < 1.2,
437+ safe >= 0.3 && < 0.4,
486438 scientific >= 0.3 && < 0.4,
487− skylighting >= 0.10.5.2 && < 0.10.6,
488− skylighting-core >= 0.10.5.2 && < 0.10.6,
439+ skylighting >= 0.10 && < 0.11,
440+ skylighting-core >= 0.10 && < 0.11,
489441 split >= 0.2 && < 0.3,
490442 syb >= 0.1 && < 0.8,
491443 tagsoup >= 0.14.6 && < 0.15,
492444 temporary >= 1.1 && < 1.4,
493− texmath >= 0.12.3 && < 0.12.4,
445+ texmath >= 0.12.0.2 && < 0.13,
494446 text >= 1.1.1.0 && < 1.3,
495447 text-conversions >= 0.3 && < 0.4,
496− time >= 1.5 && < 1.12,
448+ time >= 1.5 && < 1.10,
497449 unicode-transforms >= 0.3 && < 0.4,
498450 unordered-containers >= 0.2 && < 0.3,
499451 xml >= 1.3.12 && < 1.4,
500− xml-conduit >= 1.9.1.1 && < 1.10,
501− unicode-collation >= 0.1.1 && < 0.2,
502452 zip-archive >= 0.2.3.4 && < 0.5,
503453 zlib >= 0.5 && < 0.7
504454 if os(windows) && arch(i386)
505455 build-depends: basement >= 0.0.10,
506456 foundation >= 0.0.23
507457 -- basement 0.0.9 won't build on 32-bit windows.
508− if !os(windows)
458+ if impl(ghc < 8.4)
459+ hs-source-dirs: prelude
460+ other-modules: Prelude
461+ build-depends: base-compat >= 0.9
462+ if os(windows)
463+ cpp-options: -D_WINDOWS
464+ else
509465 build-depends: unix >= 2.4 && < 2.8
510466 if flag(embed_data_files)
511467 cpp-options: -DEMBED_DATA_FILES
512468 other-modules: Text.Pandoc.Data
469+ if os(windows)
470+ cpp-options: -D_WINDOWS
471+ ghc-options: -Wall -fno-warn-unused-do-bind
472+ -Wincomplete-record-updates
473+ -Wnoncanonical-monad-instances
474+ -- Later:
475+ -- -Wpartial-fields (currently used in Powerpoint writer)
476+ -- -Wmissing-export-lists (currently some Odt modules violate this)
477+ -- -Wredundant-constraints (problematic if we want to support older base)
478+ if impl(ghc >= 8.2)
479+ ghc-options: -Wcpp-undef
480+ if impl(ghc >= 8.4)
481+ ghc-options: -Wincomplete-uni-patterns
482+ -Widentities
483+ -Werror=missing-home-modules
484+ -fhide-source-paths
485+
486+ default-language: Haskell2010
487+ other-extensions: NoImplicitPrelude
513488 hs-source-dirs: src
514489
515490 exposed-modules: Text.Pandoc,
@@ -517,13 +492,13 @@ library
517492 Text.Pandoc.Options,
518493 Text.Pandoc.Extensions,
519494 Text.Pandoc.Shared,
520− Text.Pandoc.Sources,
521495 Text.Pandoc.MediaBag,
522496 Text.Pandoc.Error,
523497 Text.Pandoc.Filter,
524498 Text.Pandoc.Readers,
525499 Text.Pandoc.Readers.HTML,
526500 Text.Pandoc.Readers.LaTeX,
501+ Text.Pandoc.Readers.LaTeX.Types,
527502 Text.Pandoc.Readers.Markdown,
528503 Text.Pandoc.Readers.CommonMark,
529504 Text.Pandoc.Readers.Creole,
@@ -592,7 +567,6 @@ library
592567 Text.Pandoc.Writers.Shared,
593568 Text.Pandoc.Writers.OOXML,
594569 Text.Pandoc.Writers.AnnotatedTable,
595− Text.Pandoc.Writers.BibTeX,
596570 Text.Pandoc.Lua,
597571 Text.Pandoc.PDF,
598572 Text.Pandoc.UTF8,
@@ -607,6 +581,7 @@ library
607581 Text.Pandoc.Asciify,
608582 Text.Pandoc.Emoji,
609583 Text.Pandoc.ImageSize,
584+ Text.Pandoc.BCP47,
610585 Text.Pandoc.Class,
611586 Text.Pandoc.Citeproc
612587 other-modules: Text.Pandoc.App.CommandLineOptions,
@@ -627,19 +602,9 @@ library
627602 Text.Pandoc.Readers.Docx.Parse.Styles,
628603 Text.Pandoc.Readers.Docx.Util,
629604 Text.Pandoc.Readers.Docx.Fields,
630− Text.Pandoc.Readers.HTML.Parsing,
631− Text.Pandoc.Readers.HTML.Table,
632− Text.Pandoc.Readers.HTML.TagCategories,
633− Text.Pandoc.Readers.HTML.Types,
634− Text.Pandoc.Readers.LaTeX.Inline,
635− Text.Pandoc.Readers.LaTeX.Citation,
636− Text.Pandoc.Readers.LaTeX.Lang,
637− Text.Pandoc.Readers.LaTeX.Macro,
638− Text.Pandoc.Readers.LaTeX.Math,
639605 Text.Pandoc.Readers.LaTeX.Parsing,
606+ Text.Pandoc.Readers.LaTeX.Lang,
640607 Text.Pandoc.Readers.LaTeX.SIunitx,
641− Text.Pandoc.Readers.LaTeX.Table,
642− Text.Pandoc.Readers.LaTeX.Types,
643608 Text.Pandoc.Readers.Odt.Base,
644609 Text.Pandoc.Readers.Odt.Namespaces,
645610 Text.Pandoc.Readers.Odt.StyleReader,
@@ -663,21 +628,6 @@ library
663628 Text.Pandoc.Readers.Metadata,
664629 Text.Pandoc.Readers.Roff,
665630 Text.Pandoc.Writers.Docx.StyleMap,
666− Text.Pandoc.Writers.Docx.Table,
667− Text.Pandoc.Writers.Docx.Types,
668− Text.Pandoc.Writers.GridTable
669− Text.Pandoc.Writers.JATS.References,
670− Text.Pandoc.Writers.JATS.Table,
671− Text.Pandoc.Writers.JATS.Types,
672− Text.Pandoc.Writers.LaTeX.Caption,
673− Text.Pandoc.Writers.LaTeX.Notes,
674− Text.Pandoc.Writers.LaTeX.Table,
675− Text.Pandoc.Writers.LaTeX.Lang,
676− Text.Pandoc.Writers.LaTeX.Types,
677− Text.Pandoc.Writers.LaTeX.Citation,
678− Text.Pandoc.Writers.LaTeX.Util,
679− Text.Pandoc.Writers.Markdown.Types,
680− Text.Pandoc.Writers.Markdown.Inline,
681631 Text.Pandoc.Writers.Roff,
682632 Text.Pandoc.Writers.Powerpoint.Presentation,
683633 Text.Pandoc.Writers.Powerpoint.Output,
@@ -705,10 +655,6 @@ library
705655 Text.Pandoc.Lua.PandocLua,
706656 Text.Pandoc.Lua.Util,
707657 Text.Pandoc.Lua.Walk,
708− Text.Pandoc.XML.Light,
709− Text.Pandoc.XML.Light.Types,
710− Text.Pandoc.XML.Light.Proc,
711− Text.Pandoc.XML.Light.Output,
712658 Text.Pandoc.CSS,
713659 Text.Pandoc.CSV,
714660 Text.Pandoc.RoffChar,
@@ -727,50 +673,121 @@ library
727673 buildable: True
728674
729675executable pandoc
730− import: common-executable
731− hs-source-dirs: app
676+ build-depends: pandoc, base >= 4.8 && < 5
677+ if impl(ghc < 8.4)
678+ hs-source-dirs: prelude
679+ other-modules: Prelude
680+ build-depends: base-compat >= 0.9
681+ if flag(static)
682+ ld-options: -static
683+ default-language: Haskell2010
684+ other-extensions: NoImplicitPrelude
685+ hs-source-dirs: .
732686 main-is: pandoc.hs
733687 buildable: True
734688 other-modules: Paths_pandoc
689+ ghc-options: -rtsopts -with-rtsopts=-K16m -threaded
690+ -Wall -fno-warn-unused-do-bind
691+ -Wincomplete-record-updates
692+ -Wnoncanonical-monad-instances
693+ if impl(ghc >= 8.2)
694+ ghc-options: -Wcpp-undef
695+ if impl(ghc >= 8.4)
696+ ghc-options: -Wincomplete-uni-patterns
697+ -Widentities
698+ -Werror=missing-home-modules
699+ -fhide-source-paths
735700
736701executable trypandoc
737− import: common-executable
738702 main-is: trypandoc.hs
739703 hs-source-dirs: trypandoc
704+ default-language: Haskell2010
705+ other-extensions: NoImplicitPrelude
740706 if flag(trypandoc)
741− build-depends: aeson, http-types, text, wai >= 0.3, wai-extra >= 3.0.24
707+ build-depends: base, aeson, pandoc,
708+ text, wai-extra, wai >= 0.3, http-types
742709 buildable: True
743710 else
744711 buildable: False
712+ if impl(ghc < 8.4)
713+ hs-source-dirs: prelude
714+ other-modules: Prelude
715+ build-depends: base-compat >= 0.9
716+ ghc-options: -rtsopts -with-rtsopts=-K16m -threaded
717+ -Wall -fno-warn-unused-do-bind
718+ -Wincomplete-record-updates
719+ -Wnoncanonical-monad-instances
720+ if impl(ghc >= 8.2)
721+ ghc-options: -Wcpp-undef
722+ if impl(ghc >= 8.4)
723+ ghc-options: -Wincomplete-uni-patterns
724+ -Widentities
725+ -Werror=missing-home-modules
726+ -fhide-source-paths
727+
728+benchmark weigh-pandoc
729+ type: exitcode-stdio-1.0
730+ main-is: weigh-pandoc.hs
731+ hs-source-dirs: benchmark
732+ build-depends: pandoc,
733+ base >= 4.8 && < 5,
734+ mtl >= 2.2 && < 2.3,
735+ text,
736+ weigh >= 0.0 && < 0.1,
737+ if impl(ghc < 8.4)
738+ hs-source-dirs: prelude
739+ other-modules: Prelude
740+ build-depends: base-compat >= 0.9
741+ default-language: Haskell2010
742+ other-extensions: NoImplicitPrelude
743+ ghc-options: -rtsopts -with-rtsopts=-K16m -threaded
744+ -Wall -fno-warn-unused-do-bind
745+ -Wincomplete-record-updates
746+ -Wnoncanonical-monad-instances
747+ if impl(ghc >= 8.2)
748+ ghc-options: -Wcpp-undef
749+ if impl(ghc >= 8.4)
750+ ghc-options: -Wincomplete-uni-patterns
751+ -Widentities
752+ -Werror=missing-home-modules
753+ -fhide-source-paths
754+
745755
746756test-suite test-pandoc
747− import: common-executable
748757 type: exitcode-stdio-1.0
749758 main-is: test-pandoc.hs
750759 hs-source-dirs: test
751760 build-depends: pandoc,
761+ base >= 4.8 && < 5,
752762 Diff >= 0.2 && < 0.5,
753763 Glob >= 0.7 && < 0.11,
754764 QuickCheck >= 2.4 && < 2.15,
765+ base64-bytestring >= 0.1 && < 1.2,
755766 bytestring >= 0.9 && < 0.12,
756767 containers >= 0.4.2.1 && < 0.7,
757768 directory >= 1.2.3 && < 1.4,
758− doctemplates >= 0.9 && < 0.10,
769+ doctemplates >= 0.8.2 && < 0.9,
759770 exceptions >= 0.8 && < 0.11,
771+ executable-path >= 0.0 && < 0.1,
760772 filepath >= 1.1 && < 1.5,
761− hslua >= 1.1 && < 1.4,
773+ hslua >= 1.1 && < 1.3,
762774 mtl >= 2.2 && < 2.3,
763775 pandoc-types >= 1.22 && < 1.23,
764776 process >= 1.2.3 && < 1.7,
765− tasty >= 0.11 && < 1.5,
777+ tasty >= 0.11 && < 1.4,
766778 tasty-golden >= 2.3 && < 2.4,
767779 tasty-hunit >= 0.9 && < 0.11,
768780 tasty-lua >= 0.2 && < 0.3,
769781 tasty-quickcheck >= 0.8 && < 0.11,
770− text >= 1.1.1.0 && < 1.3,
771− time >= 1.5 && < 1.12,
782+ temporary >= 1.1 && < 1.4,
783+ text >= 1.1.1.0 && < 1.3,
784+ time >= 1.5 && < 1.10,
772785 xml >= 1.3.12 && < 1.4,
773786 zip-archive >= 0.2.3.4 && < 0.5
787+ if impl(ghc < 8.4)
788+ hs-source-dirs: prelude
789+ other-modules: Prelude
790+ build-depends: base-compat >= 0.9
774791 other-modules: Tests.Old
775792 Tests.Command
776793 Tests.Helpers
@@ -826,19 +843,49 @@ test-suite test-pandoc
826843 Tests.Writers.OOXML
827844 Tests.Writers.Ms
828845 Tests.Writers.AnnotatedTable
846+ if os(windows)
847+ cpp-options: -D_WINDOWS
848+ default-language: Haskell2010
849+ other-extensions: NoImplicitPrelude
850+ ghc-options: -rtsopts -with-rtsopts=-K16m -threaded
851+ -Wall -fno-warn-unused-do-bind
852+ -Wincomplete-record-updates
853+ -Wnoncanonical-monad-instances
854+ if impl(ghc >= 8.2)
855+ ghc-options: -Wcpp-undef
856+ if impl(ghc >= 8.4)
857+ ghc-options: -Wincomplete-uni-patterns
858+ -Widentities
859+ -Werror=missing-home-modules
860+ -fhide-source-paths
861+
829862
830863benchmark benchmark-pandoc
831− import: common-executable
832864 type: exitcode-stdio-1.0
833865 main-is: benchmark-pandoc.hs
834866 hs-source-dirs: benchmark
835− build-depends: bytestring,
867+ build-depends: pandoc,
868+ base >= 4.8 && < 5,
869+ bytestring,
836870 containers,
837− -- gauge >= 0.2 && < 0.3,
838− tasty-bench >= 0.2 && <= 0.3,
871+ criterion >= 1.0 && < 1.6,
839872 mtl >= 2.2 && < 2.3,
840873 text >= 1.1.1.0 && < 1.3,
841− time,
842− deepseq
843− -- we increase heap size to avoid benchmarking garbage collection:
844− ghc-options: -rtsopts -with-rtsopts=-A8m -threaded
874+ time
875+ if impl(ghc < 8.4)
876+ hs-source-dirs: prelude
877+ other-modules: Prelude
878+ build-depends: base-compat >= 0.9
879+ default-language: Haskell2010
880+ other-extensions: NoImplicitPrelude
881+ ghc-options: -rtsopts -with-rtsopts=-K16m -threaded
882+ -Wall -fno-warn-unused-do-bind
883+ -Wincomplete-record-updates
884+ -Wnoncanonical-monad-instances
885+ if impl(ghc >= 8.2)
886+ ghc-options: -Wcpp-undef
887+ if impl(ghc >= 8.4)
888+ ghc-options: -Wincomplete-uni-patterns
889+ -Widentities
890+ -Werror=missing-home-modules
891+ -fhide-source-paths
app/pandoc.hs → pandoc.hsrenamed+3−1
@@ -1,6 +1,7 @@
1+{-# LANGUAGE NoImplicitPrelude #-}
12{- |
23 Module : Main
3− Copyright : Copyright (C) 2006-2021 John MacFarlane
4+ Copyright : Copyright (C) 2006-2020 John MacFarlane
45 License : GNU GPL, version 2 or above
56
67 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -11,6 +12,7 @@ Parses command-line options and calls the appropriate readers and
1112writers.
1213-}
1314module Main where
15+import Prelude
1416import qualified Control.Exception as E
1517import Text.Pandoc.App (convertWithOpts, defaultOpts, options, parseOptions)
1618import Text.Pandoc.Error (handleError)
release.nixdeleted−4
@@ -1,4 +0,0 @@
1−let
2− pkgs = import <nixpkgs> { };
3−in
4− pkgs.haskellPackages.callPackage ./project.nix { }
shell.nixdeleted−106
@@ -1,106 +0,0 @@
1−{nixpkgs ? import <nixpkgs> {} }:
2−let
3− inherit (nixpkgs) pkgs;
4− inherit (pkgs) haskellPackages;
5−
6− haskellDeps = ps: with ps; [
7− Diff
8− Glob
9− HTTP
10− HTTP
11− HsYAML
12− JuicyPixels
13− QuickCheck
14− SHA
15− aeson
16− aeson-pretty
17− attoparsec
18− base
19− base-compat
20− base64-bytestring
21− binary
22− blaze-html
23− blaze-markup
24− bytestring
25− case-insensitive
26− citeproc
27− commonmark
28− commonmark-extensions
29− commonmark-pandoc
30− conduit-extra
31− connection
32− connection
33− containers
34− data-default
35− deepseq
36− directory
37− doclayout
38− doctemplates
39− emojis
40− exceptions
41− file-embed
42− filepath
43− haddock-library
44− hsc2hs
45− hslua
46− hslua-module-system
47− hslua-module-text
48− http-client
49− http-client
50− http-client-tls
51− http-client-tls
52− http-types
53− ipynb
54− jira-wiki-markup
55− mtl
56− network
57− network
58− network-uri
59− pandoc-types
60− parsec
61− process
62− random
63− safe
64− scientific
65− skylighting
66− skylighting-core
67− socks
68− split
69− streaming-commons
70− syb
71− tagsoup
72− tasty
73− tasty-golden
74− tasty-hunit
75− tasty-lua
76− tasty-quickcheck
77− temporary
78− texmath
79− text
80− text-conversions
81− time
82− tls
83− unicode-transforms
84− unordered-containers
85− weigh
86− xml
87− xml-conduit
88− zip-archive
89− zlib
90− ];
91−
92− ghc = haskellPackages.ghcWithPackages haskellDeps;
93−
94− nixPackages = [
95− pkgs.zlib
96− ghc
97− pkgs.gdb
98− haskellPackages.ghcid
99− haskellPackages.cabal2nix
100− haskellPackages.cabal-install
101− ];
102−in
103−pkgs.stdenv.mkDerivation {
104− name = "env";
105− buildInputs = nixPackages;
106−}
src/Text/Pandoc.hs+1−1
@@ -3,7 +3,7 @@
33{-# LANGUAGE ScopedTypeVariables #-}
44{- |
55 Module : Text.Pandoc
6− Copyright : Copyright (C) 2006-2021 John MacFarlane
6+ Copyright : Copyright (C) 2006-2020 John MacFarlane
77 License : GNU GPL, version 2 or above
88
99 Maintainer : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/App.hs+58−85
@@ -1,10 +1,9 @@
1−{-# LANGUAGE LambdaCase #-}
21{-# LANGUAGE OverloadedStrings #-}
32{-# LANGUAGE CPP #-}
43{-# LANGUAGE ScopedTypeVariables #-}
54{- |
65 Module : Text.Pandoc.App
7− Copyright : Copyright (C) 2006-2021 John MacFarlane
6+ Copyright : Copyright (C) 2006-2020 John MacFarlane
87 License : GNU GPL, version 2 or above
98
109 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -20,16 +19,14 @@ module Text.Pandoc.App (
2019 , Filter(..)
2120 , defaultOpts
2221 , parseOptions
23− , parseOptionsFromArgs
2422 , options
2523 , applyFilters
2624 ) where
2725import qualified Control.Exception as E
28−import Control.Monad ( (>=>), when )
29−import Control.Monad.Trans ( MonadIO(..) )
26+import Control.Monad
27+import Control.Monad.Trans
3028import Control.Monad.Except (throwError)
3129import qualified Data.ByteString as BS
32−import qualified Data.ByteString.Char8 as B8
3330import qualified Data.ByteString.Lazy as BL
3431import Data.Char (toLower)
3532import Data.Maybe (fromMaybe, isJust, isNothing)
@@ -43,25 +40,23 @@ import qualified Data.Text.Encoding.Error as TSE
4340import Network.URI (URI (..), parseURI)
4441import System.Directory (doesDirectoryExist)
4542import System.Exit (exitSuccess)
46−import System.FilePath ( takeBaseName, takeExtension )
43+import System.FilePath
4744import System.IO (nativeNewline, stdout)
4845import qualified System.IO as IO (Newline (..))
4946import Text.Pandoc
50−import Text.Pandoc.Builder (setMeta)
51−import Text.Pandoc.MIME (getCharset)
5247import Text.Pandoc.App.FormatHeuristics (formatFromFilePaths)
5348import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), defaultOpts,
54− IpynbOutput (..))
55−import Text.Pandoc.App.CommandLineOptions (parseOptions, parseOptionsFromArgs,
56− options)
49+ IpynbOutput (..) )
50+import Text.Pandoc.App.CommandLineOptions (parseOptions, options)
5751import Text.Pandoc.App.OutputSettings (OutputSettings (..), optToOutputSettings)
58−import Text.Collate.Lang (Lang (..), parseLang)
52+import Text.Pandoc.BCP47 (Lang (..), parseBCP47)
53+import Text.Pandoc.Builder (setMeta)
5954import Text.Pandoc.Filter (Filter (JSONFilter, LuaFilter), applyFilters)
6055import Text.Pandoc.PDF (makePDF)
61−import Text.Pandoc.SelfContained (makeSelfContained)
56+import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)
6257import Text.Pandoc.Shared (eastAsianLineBreakFilter, stripEmptyParagraphs,
6358 headerShift, isURI, tabFilter, uriPathToPath, filterIpynbOutput,
64− defaultUserDataDir, tshow)
59+ defaultUserDataDirs, tshow, findM)
6560import Text.Pandoc.Writers.Shared (lookupMetaString)
6661import Text.Pandoc.Readers.Markdown (yamlToMeta)
6762import qualified Text.Pandoc.UTF8 as UTF8
@@ -72,29 +67,25 @@ import System.Posix.Terminal (queryTerminal)
7267
7368convertWithOpts :: Opt -> IO ()
7469convertWithOpts opts = do
75− datadir <- case optDataDir opts of
76− Nothing -> do
77− d <- defaultUserDataDir
78− exists <- doesDirectoryExist d
79− return $ if exists
80− then Just d
81− else Nothing
82− Just _ -> return $ optDataDir opts
83−
8470 let outputFile = fromMaybe "-" (optOutputFile opts)
8571 let filters = optFilters opts
8672 let verbosity = optVerbosity opts
8773
8874 when (optDumpArgs opts) $
89− do UTF8.hPutStrLn stdout (T.pack outputFile)
90− mapM_ (UTF8.hPutStrLn stdout . T.pack)
91− (fromMaybe ["-"] $ optInputFiles opts)
75+ do UTF8.hPutStrLn stdout outputFile
76+ mapM_ (UTF8.hPutStrLn stdout) (fromMaybe ["-"] $ optInputFiles opts)
9277 exitSuccess
9378
9479 let sources = case optInputFiles opts of
9580 Just xs | not (optIgnoreArgs opts) -> xs
9681 _ -> ["-"]
9782
83+ datadir <- case optDataDir opts of
84+ Nothing -> do
85+ ds <- defaultUserDataDirs
86+ findM doesDirectoryExist ds
87+ Just _ -> return $ optDataDir opts
88+
9889 let runIO' :: PandocIO a -> IO a
9990 runIO' f = do
10091 (res, reports) <- runIOorExplode $ do
@@ -140,10 +131,9 @@ convertWithOpts opts = do
140131 (map (T.pack . takeExtension) sources) "markdown"
141132 return "markdown"
142133
143− let readerNameBase = T.takeWhile (\c -> c /= '+' && c /= '-') readerName
144134 let pdfOutput = map toLower (takeExtension outputFile) == ".pdf"
145135
146− when (pdfOutput && readerNameBase == "latex") $
136+ when (pdfOutput && readerName == "latex") $
147137 case optInputFiles opts of
148138 Just (inputFile:_) -> report $ UnusualConversion $ T.pack $
149139 "to convert a .tex file to PDF, you get better results by using pdflatex "
@@ -154,29 +144,26 @@ convertWithOpts opts = do
154144 (reader :: Reader PandocIO, readerExts) <- getReader readerName
155145
156146 let convertTabs = tabFilter (if optPreserveTabs opts ||
157− readerNameBase == "t2t" ||
158− readerNameBase == "man"
147+ readerName == "t2t" ||
148+ readerName == "man"
159149 then 0
160150 else optTabStop opts)
161151
162152
163− let readSources :: [FilePath] -> PandocIO [(FilePath, Text)]
164− readSources srcs =
165− mapM (\fp -> do
166− t <- readSource fp
167− return (if fp == "-" then "" else fp, convertTabs t)) srcs
153+ let readSources :: [FilePath] -> PandocIO Text
154+ readSources srcs = convertTabs . T.intercalate (T.pack "\n") <$>
155+ mapM readSource srcs
168156
169157
170158 outputSettings <- optToOutputSettings opts
171159 let format = outputFormat outputSettings
172160 let writer = outputWriter outputSettings
173161 let writerName = outputWriterName outputSettings
174− let writerNameBase = T.takeWhile (\c -> c /= '+' && c /= '-') writerName
175162 let writerOptions = outputWriterOptions outputSettings
176163
177− let bibOutput = writerNameBase == "bibtex" ||
178− writerNameBase == "biblatex" ||
179− writerNameBase == "csljson"
164+ let bibOutput = writerName == "bibtex" ||
165+ writerName == "biblatex" ||
166+ writerName == "csljson"
180167
181168 let standalone = optStandalone opts ||
182169 not (isTextFormat format) ||
@@ -201,9 +188,20 @@ convertWithOpts opts = do
201188 Nothing -> readDataFile "abbreviations"
202189 Just f -> readFileStrict f
203190
191+ metadata <- if format == "jats" &&
192+ isNothing (lookupMeta "csl" (optMetadata opts)) &&
193+ isNothing (lookupMeta "citation-style"
194+ (optMetadata opts))
195+ then do
196+ jatsCSL <- readDataFile "jats.csl"
197+ let jatsEncoded = makeDataURI
198+ ("application/xml", jatsCSL)
199+ return $ setMeta "csl" jatsEncoded $ optMetadata opts
200+ else return $ optMetadata opts
201+
204202 case lookupMetaString "lang" (optMetadata opts) of
205− "" -> setTranslations $ Lang "en" Nothing (Just "US") [] [] []
206− l -> case parseLang l of
203+ "" -> setTranslations $ Lang "en" "" "US" []
204+ l -> case parseBCP47 l of
207205 Left _ -> report $ InvalidLang l
208206 Right l' -> setTranslations l'
209207
@@ -223,9 +221,8 @@ convertWithOpts opts = do
223221 metadataFromFile <-
224222 case optMetadataFiles opts of
225223 [] -> return mempty
226− paths -> mconcat <$>
227− mapM (\path -> do raw <- readFileLazy path
228− yamlToMeta readerOpts (Just path) raw) paths
224+ paths -> mapM readFileLazy paths >>=
225+ fmap mconcat . mapM (yamlToMeta readerOpts)
229226
230227 let transforms = (case optShiftHeadingLevelBy opts of
231228 0 -> id
@@ -241,7 +238,6 @@ convertWithOpts opts = do
241238 then (eastAsianLineBreakFilter :)
242239 else id) .
243240 (case optIpynbOutput opts of
244− _ | readerNameBase /= "ipynb" -> id
245241 IpynbOutputAll -> id
246242 IpynbOutputNone -> (filterIpynbOutput Nothing :)
247243 IpynbOutputBest -> (filterIpynbOutput (Just $
@@ -257,21 +253,17 @@ convertWithOpts opts = do
257253 let sourceToDoc :: [FilePath] -> PandocIO Pandoc
258254 sourceToDoc sources' =
259255 case reader of
260− TextReader r
261− | readerNameBase == "json" ->
262− mconcat <$> mapM (readSource >=> r readerOpts) sources'
263− | optFileScope opts ->
264− -- Read source and convert tabs (see #6709)
265− let readSource' = fmap convertTabs . readSource
266− in mconcat <$> mapM (readSource' >=> r readerOpts) sources'
267− | otherwise ->
268− readSources sources' >>= r readerOpts
269− ByteStringReader r ->
270− mconcat <$> mapM (readFile' >=> r readerOpts) sources'
271−
272−
273− when (readerNameBase == "markdown_github" ||
274− writerNameBase == "markdown_github") $
256+ TextReader r
257+ | optFileScope opts || readerName == "json" ->
258+ mconcat <$> mapM (readSource >=> r readerOpts) sources'
259+ | otherwise ->
260+ readSources sources' >>= r readerOpts
261+ ByteStringReader r ->
262+ mconcat <$> mapM (readFile' >=> r readerOpts) sources'
263+
264+
265+ when (readerName == "markdown_github" ||
266+ writerName == "markdown_github") $
275267 report $ Deprecated "markdown_github" "Use gfm instead."
276268
277269 mapM_ (uncurry setRequestHeader) (optRequestHeaders opts)
@@ -285,21 +277,12 @@ convertWithOpts opts = do
285277 report $ Deprecated "pandoc-citeproc filter"
286278 "Use --citeproc instead."
287279
288− let cslMetadata =
289− maybe id (setMeta "csl") (optCSL opts) .
290− (case optBibliography opts of
291− [] -> id
292− xs -> setMeta "bibliography" xs) .
293− maybe id (setMeta "citation-abbreviations")
294− (optCitationAbbreviations opts) $ mempty
295−
296280 doc <- sourceToDoc sources >>=
297281 ( (if isJust (optExtractMedia opts)
298282 then fillMediaBag
299283 else return)
300284 >=> return . adjustMetadata (metadataFromFile <>)
301− >=> return . adjustMetadata (<> optMetadata opts)
302− >=> return . adjustMetadata (<> cslMetadata)
285+ >=> return . adjustMetadata (<> metadata)
303286 >=> applyTransforms transforms
304287 >=> applyFilters readerOpts filters [T.unpack format]
305288 >=> maybe return extractMedia (optExtractMedia opts)
@@ -366,18 +349,7 @@ readSource src = case parseURI src of
366349 _ -> PandocAppError (tshow e))
367350
368351readURI :: FilePath -> PandocIO Text
369−readURI src = do
370− (bs, mt) <- openURL (T.pack src)
371− case mt >>= getCharset of
372− Just "UTF-8" -> return $ UTF8.toText bs
373− Just "ISO-8859-1" -> return $ T.pack $ B8.unpack bs
374− Just charset -> throwError $ PandocUnsupportedCharsetError charset
375− Nothing -> liftIO $ -- try first as UTF-8, then as latin1
376− E.catch (return $! UTF8.toText bs)
377− (\case
378− TSE.DecodeError{} ->
379− return $ T.pack $ B8.unpack bs
380− e -> E.throwIO e)
352+readURI src = UTF8.toText . fst <$> openURL (T.pack src)
381353
382354readFile' :: MonadIO m => FilePath -> m BL.ByteString
383355readFile' "-" = liftIO BL.getContents
@@ -388,5 +360,6 @@ writeFnBinary "-" = liftIO . BL.putStr
388360writeFnBinary f = liftIO . BL.writeFile (UTF8.encodePath f)
389361
390362writerFn :: MonadIO m => IO.Newline -> FilePath -> Text -> m ()
391−writerFn eol "-" = liftIO . UTF8.putStrWith eol
392−writerFn eol f = liftIO . UTF8.writeFileWith eol f
363+-- TODO this implementation isn't maximally efficient:
364+writerFn eol "-" = liftIO . UTF8.putStrWith eol . T.unpack
365+writerFn eol f = liftIO . UTF8.writeFileWith eol f . T.unpack
src/Text/Pandoc/App/CommandLineOptions.hs+57−88
@@ -6,7 +6,7 @@
66{-# LANGUAGE FlexibleContexts #-}
77{- |
88 Module : Text.Pandoc.App.CommandLineOptions
9− Copyright : Copyright (C) 2006-2021 John MacFarlane
9+ Copyright : Copyright (C) 2006-2020 John MacFarlane
1010 License : GNU GPL, version 2 or above
1111
1212 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -17,7 +17,6 @@ Does a pandoc conversion based on command-line options.
1717-}
1818module Text.Pandoc.App.CommandLineOptions (
1919 parseOptions
20− , parseOptionsFromArgs
2120 , options
2221 , engines
2322 , lookupHighlightStyle
@@ -26,12 +25,11 @@ module Text.Pandoc.App.CommandLineOptions (
2625import Control.Monad
2726import Control.Monad.Trans
2827import Control.Monad.Except (throwError)
29−import Control.Monad.State.Strict
3028import Data.Aeson.Encode.Pretty (encodePretty', Config(..), keyOrder,
3129 defConfig, Indent(..), NumberFormat(..))
3230import Data.Bifunctor (second)
3331import Data.Char (toLower)
34−import Data.List (intercalate, sort, foldl')
32+import Data.List (intercalate, sort)
3533#ifdef _WINDOWS
3634#if MIN_VERSION_base(4,12,0)
3735import Data.List (isPrefixOf)
@@ -48,13 +46,10 @@ import System.FilePath
4846import System.IO (stdout)
4947import Text.DocTemplates (Context (..), ToContext (toVal), Val (..))
5048import Text.Pandoc
51−import Text.Pandoc.Builder (setMeta)
52−import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..),
53− DefaultsState (..), applyDefaults,
54− fullDefaultsPath)
49+import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..), addMeta)
5550import Text.Pandoc.Filter (Filter (..))
5651import Text.Pandoc.Highlighting (highlightingStyles)
57−import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDir)
52+import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDirs, findM)
5853import Text.Printf
5954
6055#ifdef EMBED_DATA_FILES
@@ -69,19 +64,16 @@ import qualified Data.ByteString as BS
6964import qualified Data.ByteString.Lazy as B
7065import qualified Data.Map as M
7166import qualified Data.Text as T
67+import qualified Data.YAML as Y
7268import qualified Text.Pandoc.UTF8 as UTF8
7369
7470parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt
7571parseOptions options' defaults = do
7672 rawArgs <- map UTF8.decodeArg <$> getArgs
7773 prg <- getProgName
78− parseOptionsFromArgs options' defaults prg rawArgs
7974
80−parseOptionsFromArgs
81− :: [OptDescr (Opt -> IO Opt)] -> Opt -> String -> [String] -> IO Opt
82−parseOptionsFromArgs options' defaults prg rawArgs = do
8375 let (actions, args, unrecognizedOpts, errors) =
84− getOpt' Permute options' (map UTF8.decodeArg rawArgs)
76+ getOpt' Permute options' rawArgs
8577
8678 let unknownOptionErrors =
8779 foldr (handleUnrecognizedOption . takeWhile (/= '=')) []
@@ -93,7 +85,7 @@ parseOptionsFromArgs options' defaults prg rawArgs = do
9385 ("Try " ++ prg ++ " --help for more information.")
9486
9587 -- thread option data structure through all supplied option actions
96− opts <- foldl' (>>=) (return defaults) actions
88+ opts <- foldl (>>=) (return defaults) actions
9789 let mbArgs = case args of
9890 [] -> Nothing
9991 xs -> Just xs
@@ -174,11 +166,7 @@ options =
174166
175167 , Option "d" ["defaults"]
176168 (ReqArg
177− (\arg opt -> runIOorExplode $ do
178− let defsState = DefaultsState { curDefaults = Nothing,
179− inheritanceGraph = [] }
180− fp <- fullDefaultsPath (optDataDir opt) arg
181− evalStateT (applyDefaults opt fp) defsState
169+ (\arg opt -> applyDefaults opt arg
182170 )
183171 "FILE")
184172 ""
@@ -288,8 +276,7 @@ options =
288276 , Option "" ["resource-path"]
289277 (ReqArg
290278 (\arg opt -> return opt { optResourcePath =
291− splitSearchPath arg ++
292− optResourcePath opt })
279+ splitSearchPath arg })
293280 "SEARCHPATH")
294281 "" -- "Paths to search for images and other resources"
295282
@@ -542,26 +529,9 @@ options =
542529
543530 , Option "" ["atx-headers"]
544531 (NoArg
545− (\opt -> do
546− deprecatedOption "--atx-headers"
547− "Use --markdown-headings=atx instead."
548− return opt { optSetextHeaders = False } ))
532+ (\opt -> return opt { optSetextHeaders = False } ))
549533 "" -- "Use atx-style headers for markdown"
550534
551− , Option "" ["markdown-headings"]
552− (ReqArg
553− (\arg opt -> do
554− headingFormat <- case arg of
555− "setext" -> pure True
556− "atx" -> pure False
557− _ -> E.throwIO $ PandocOptionError $ T.pack
558− ("Unknown markdown heading format: " ++ arg ++
559− ". Expecting atx or setext")
560− pure opt { optSetextHeaders = headingFormat }
561− )
562− "setext|atx")
563− ""
564−
565535 , Option "" ["listings"]
566536 (NoArg
567537 (\opt -> return opt { optListings = True }))
@@ -814,10 +784,10 @@ options =
814784 map (\c -> ['-',c]) shorts ++
815785 map ("--" ++) longs
816786 let allopts = unwords (concatMap optnames options)
817− UTF8.hPutStrLn stdout $ T.pack $ printf tpl allopts
818− (T.unpack $ T.unwords readersNames)
819− (T.unpack $ T.unwords writersNames)
820− (T.unpack $ T.unwords $ map fst highlightingStyles)
787+ UTF8.hPutStrLn stdout $ printf tpl allopts
788+ (unwords readersNames)
789+ (unwords writersNames)
790+ (unwords $ map (T.unpack . fst) highlightingStyles)
821791 (unwords datafiles)
822792 exitSuccess ))
823793 "" -- "Print bash completion script"
@@ -856,7 +826,7 @@ options =
856826 else if extensionEnabled x allExts
857827 then '-'
858828 else ' ') : drop 4 (show x)
859− mapM_ (UTF8.hPutStrLn stdout . T.pack . showExt)
829+ mapM_ (UTF8.hPutStrLn stdout . showExt)
860830 [ex | ex <- extList, extensionEnabled ex allExts]
861831 exitSuccess )
862832 "FORMAT")
@@ -870,14 +840,14 @@ options =
870840 , sShortname s `notElem`
871841 [T.pack "Alert", T.pack "Alert_indent"]
872842 ]
873− mapM_ (UTF8.hPutStrLn stdout . T.pack) (sort langs)
843+ mapM_ (UTF8.hPutStrLn stdout) langs
874844 exitSuccess ))
875845 ""
876846
877847 , Option "" ["list-highlight-styles"]
878848 (NoArg
879849 (\_ -> do
880− mapM_ (UTF8.hPutStrLn stdout . fst) highlightingStyles
850+ mapM_ (UTF8.hPutStrLn stdout . T.unpack . fst) highlightingStyles
881851 exitSuccess ))
882852 ""
883853
@@ -895,7 +865,7 @@ options =
895865 | T.null t -> -- e.g. for docx, odt, json:
896866 E.throwIO $ PandocCouldNotFindDataFileError $ T.pack
897867 ("templates/default." ++ arg)
898− | otherwise -> write t
868+ | otherwise -> write . T.unpack $ t
899869 Left e -> E.throwIO e
900870 exitSuccess)
901871 "FORMAT")
@@ -941,13 +911,11 @@ options =
941911 (NoArg
942912 (\_ -> do
943913 prg <- getProgName
944− defaultDatadir <- defaultUserDataDir
945− UTF8.hPutStrLn stdout
946− $ T.pack
947− $ prg ++ " " ++ T.unpack pandocVersion ++
948− compileInfo ++
949− "\nUser data directory: " ++ defaultDatadir ++
950− ('\n':copyrightMessage)
914+ defaultDatadirs <- defaultUserDataDirs
915+ UTF8.hPutStrLn stdout (prg ++ " " ++ T.unpack pandocVersion ++
916+ compileInfo ++ "\nDefault user data directory: " ++
917+ intercalate " or " defaultDatadirs ++
918+ ('\n':copyrightMessage))
951919 exitSuccess ))
952920 "" -- "Print version"
953921
@@ -955,7 +923,7 @@ options =
955923 (NoArg
956924 (\_ -> do
957925 prg <- getProgName
958− UTF8.hPutStr stdout (T.pack $ usageMessage prg options)
926+ UTF8.hPutStr stdout (usageMessage prg options)
959927 exitSuccess ))
960928 "" -- "Show help"
961929 ]
@@ -976,16 +944,16 @@ usageMessage programName = usageInfo (programName ++ " [OPTIONS] [FILES]")
976944
977945copyrightMessage :: String
978946copyrightMessage = intercalate "\n" [
979− "Copyright (C) 2006-2021 John MacFarlane. Web: https://pandoc.org",
980− "This is free software; see the source for copying conditions. There is no",
981− "warranty, not even for merchantability or fitness for a particular purpose." ]
947+ "Copyright (C) 2006-2020 John MacFarlane",
948+ "Web: https://pandoc.org",
949+ "This is free software; see the source for copying conditions.",
950+ "There is no warranty, not even for merchantability or fitness",
951+ "for a particular purpose." ]
982952
983953compileInfo :: String
984954compileInfo =
985− "\nCompiled with pandoc-types " ++ VERSION_pandoc_types ++
986− ", texmath " ++ VERSION_texmath ++ ", skylighting " ++
987− VERSION_skylighting ++ ",\nciteproc " ++ VERSION_citeproc ++
988− ", ipynb " ++ VERSION_ipynb
955+ "\nCompiled with pandoc-types " ++ VERSION_pandoc_types ++ ", texmath " ++
956+ VERSION_texmath ++ ", skylighting " ++ VERSION_skylighting
989957
990958handleUnrecognizedOption :: String -> [String] -> [String]
991959handleUnrecognizedOption "--smart" =
@@ -1016,16 +984,38 @@ handleUnrecognizedOption "-R" = handleUnrecognizedOption "--parse-raw"
1016984handleUnrecognizedOption x =
1017985 (("Unknown option " ++ x ++ ".") :)
1018986
1019−readersNames :: [Text]
1020−readersNames = sort (map fst (readers :: [(Text, Reader PandocIO)]))
987+readersNames :: [String]
988+readersNames = sort (map (T.unpack . fst) (readers :: [(Text, Reader PandocIO)]))
1021989
1022−writersNames :: [Text]
990+writersNames :: [String]
1023991writersNames = sort
1024− ("pdf" : map fst (writers :: [(Text, Writer PandocIO)]))
992+ ("pdf" : map (T.unpack . fst) (writers :: [(Text, Writer PandocIO)]))
1025993
1026994splitField :: String -> (String, String)
1027995splitField = second (tailDef "true") . break (`elemText` ":=")
1028996
997+-- | Apply defaults from --defaults file.
998+applyDefaults :: Opt -> FilePath -> IO Opt
999+applyDefaults opt file = runIOorExplode $ do
1000+ let fp = if null (takeExtension file)
1001+ then addExtension file "yaml"
1002+ else file
1003+ setVerbosity $ optVerbosity opt
1004+ dataDirs <- liftIO defaultUserDataDirs
1005+ let fps = fp : case optDataDir opt of
1006+ Nothing -> map (</> ("defaults" </> fp))
1007+ dataDirs
1008+ Just dd -> [dd </> "defaults" </> fp]
1009+ fp' <- fromMaybe fp <$> findM fileExists fps
1010+ inp <- readFileLazy fp'
1011+ case Y.decode1 inp of
1012+ Right (f :: Opt -> Opt) -> return $ f opt
1013+ Left (errpos, errmsg) -> throwError $
1014+ PandocParseError $ T.pack $
1015+ "Error parsing " ++ fp' ++ " line " ++
1016+ show (Y.posLine errpos) ++ " column " ++
1017+ show (Y.posColumn errpos) ++ ":\n" ++ errmsg
1018+
10291019lookupHighlightStyle :: PandocMonad m => String -> m Style
10301020lookupHighlightStyle s
10311021 | takeExtension s == ".theme" = -- attempt to load KDE theme
@@ -1054,27 +1044,6 @@ setVariable key val (Context ctx) = Context $ M.alter go key ctx
10541044 go (Just (ListVal xs)) = Just $ ListVal $ xs ++ [toVal val]
10551045 go (Just x) = Just $ ListVal [x, toVal val]
10561046
1057−addMeta :: String -> String -> Meta -> Meta
1058−addMeta k v meta =
1059− case lookupMeta k' meta of
1060− Nothing -> setMeta k' v' meta
1061− Just (MetaList xs) ->
1062− setMeta k' (MetaList (xs ++ [v'])) meta
1063− Just x -> setMeta k' (MetaList [x, v']) meta
1064− where
1065− v' = readMetaValue v
1066− k' = T.pack k
1067−
1068−readMetaValue :: String -> MetaValue
1069−readMetaValue s
1070− | s == "true" = MetaBool True
1071− | s == "True" = MetaBool True
1072− | s == "TRUE" = MetaBool True
1073− | s == "false" = MetaBool False
1074− | s == "False" = MetaBool False
1075− | s == "FALSE" = MetaBool False
1076− | otherwise = MetaString $ T.pack s
1077−
10781047-- On Windows with ghc 8.6+, we need to rewrite paths
10791048-- beginning with \\ to \\?\UNC\. -- See #5127.
10801049normalizePath :: FilePath -> FilePath
src/Text/Pandoc/App/FormatHeuristics.hs+8−19
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.App.FormatHeuristics
4− Copyright : Copyright (C) 2006-2021 John MacFarlane
4+ Copyright : Copyright (C) 2006-2020 John MacFarlane
55 License : GNU GPL, version 2 or above
66
77 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -15,24 +15,18 @@ module Text.Pandoc.App.FormatHeuristics
1515 ) where
1616
1717import Data.Char (toLower)
18−import Data.Foldable (asum)
1918import Data.Text (Text)
2019import System.FilePath (takeExtension)
2120
22−-- | Determines default format based on file extensions; uses the format
23−-- of the first extension that's associated with a format.
24−--
25−-- Examples:
26−--
27−-- > formatFromFilePaths ["text.unknown", "no-extension"]
28−-- Nothing
29−--
30−-- > formatFromFilePaths ["my.md", "other.rst"]
31−-- Just "markdown"
21+-- Determine default format based on file extensions.
3222formatFromFilePaths :: [FilePath] -> Maybe Text
33−formatFromFilePaths = asum . map formatFromFilePath
23+formatFromFilePaths [] = Nothing
24+formatFromFilePaths (x:xs) =
25+ case formatFromFilePath x of
26+ Just f -> Just f
27+ Nothing -> formatFromFilePaths xs
3428
35−-- | Determines format based on file extension.
29+-- Determine format based on file extension
3630formatFromFilePath :: FilePath -> Maybe Text
3731formatFromFilePath x =
3832 case takeExtension (map toLower x) of
@@ -54,11 +48,6 @@ formatFromFilePath x =
5448 ".lhs" -> Just "markdown+lhs"
5549 ".ltx" -> Just "latex"
5650 ".markdown" -> Just "markdown"
57− ".mkdn" -> Just "markdown"
58− ".mkd" -> Just "markdown"
59− ".mdwn" -> Just "markdown"
60− ".mdown" -> Just "markdown"
61− ".Rmd" -> Just "markdown"
6251 ".md" -> Just "markdown"
6352 ".ms" -> Just "ms"
6453 ".muse" -> Just "muse"
src/Text/Pandoc/App/Opt.hs+48−269
@@ -7,7 +7,7 @@
77{-# LANGUAGE FlexibleContexts #-}
88{- |
99 Module : Text.Pandoc.App.Opt
10− Copyright : Copyright (C) 2006-2021 John MacFarlane
10+ Copyright : Copyright (C) 2006-2020 John MacFarlane
1111 License : GNU GPL, version 2 or above
1212
1313 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -20,31 +20,21 @@ module Text.Pandoc.App.Opt (
2020 Opt(..)
2121 , LineEnding (..)
2222 , IpynbOutput (..)
23− , DefaultsState (..)
2423 , defaultOpts
25− , applyDefaults
26− , fullDefaultsPath
24+ , addMeta
2725 ) where
28−import Control.Monad.Except (MonadIO, liftIO, throwError, (>=>), foldM)
29−import Control.Monad.State.Strict (StateT, modify, gets)
30−import System.FilePath ( addExtension, (</>), takeExtension, takeDirectory )
31−import System.Directory ( canonicalizePath )
3226import Data.Char (isLower, toLower)
33−import Data.Maybe (fromMaybe)
3427import GHC.Generics hiding (Meta)
28+import Text.Pandoc.Builder (setMeta)
3529import Text.Pandoc.Filter (Filter (..))
36−import Text.Pandoc.Logging (Verbosity (WARNING), LogMessage(..))
30+import Text.Pandoc.Logging (Verbosity (WARNING))
3731import Text.Pandoc.Options (TopLevelDivision (TopLevelDefault),
3832 TrackChanges (AcceptChanges),
3933 WrapOption (WrapAuto), HTMLMathMethod (PlainMath),
4034 ReferenceLocation (EndOfDocument),
4135 ObfuscationMethod (NoObfuscation),
4236 CiteMethod (Citeproc))
43−import Text.Pandoc.Class (readFileLazy, fileExists, setVerbosity, report,
44− PandocMonad(lookupEnv), getUserDataDir)
45−import Text.Pandoc.Error (PandocError (PandocParseError, PandocSomeError))
46−import Text.Pandoc.Shared (camelCaseStrToHyphenated, defaultUserDataDir,
47− findM, ordNub)
37+import Text.Pandoc.Shared (camelCaseStrToHyphenated)
4838import qualified Text.Pandoc.Parsing as P
4939import Text.Pandoc.Readers.Metadata (yamlMap)
5040import Text.Pandoc.Class.PandocPure
@@ -53,7 +43,7 @@ import Data.Text (Text, unpack)
5343import Data.Default (def)
5444import qualified Data.Text as T
5545import qualified Data.Map as M
56−import Text.Pandoc.Definition (Meta(..), MetaValue(..))
46+import Text.Pandoc.Definition (Meta(..), MetaValue(..), lookupMeta)
5747import Data.Aeson (defaultOptions, Options(..))
5848import Data.Aeson.TH (deriveJSON)
5949import Control.Applicative ((<|>))
@@ -157,194 +147,19 @@ data Opt = Opt
157147 , optNoCheckCertificate :: Bool -- ^ Disable certificate validation
158148 , optEol :: LineEnding -- ^ Style of line-endings to use
159149 , optStripComments :: Bool -- ^ Skip HTML comments
160− , optCSL :: Maybe FilePath -- ^ CSL stylesheet
161− , optBibliography :: [FilePath] -- ^ Bibliography files
162− , optCitationAbbreviations :: Maybe FilePath -- ^ Citation abbreviations
163150 } deriving (Generic, Show)
164151
165152instance FromYAML (Opt -> Opt) where
166− parseYAML (Mapping _ _ m) = chain doOpt (M.toList m)
153+ parseYAML (Mapping _ _ m) =
154+ foldr (.) id <$> mapM doOpt (M.toList m)
167155 parseYAML n = failAtNode n "Expected a mapping"
168156
169−data DefaultsState = DefaultsState
170− {
171− curDefaults :: Maybe FilePath -- currently parsed file
172− , inheritanceGraph :: [[FilePath]] -- defaults file inheritance graph
173− } deriving (Show)
174−
175−instance (PandocMonad m, MonadIO m)
176− => FromYAML (Opt -> StateT DefaultsState m Opt) where
177− parseYAML (Mapping _ _ m) = do
178− let opts = M.mapKeys toText m
179− dataDir <- case M.lookup "data-dir" opts of
180− Nothing -> return Nothing
181− Just v -> Just . unpack <$> parseYAML v
182− f <- parseOptions (M.toList m)
183− case M.lookup "defaults" opts of
184− Just v -> do
185− g <- parseDefaults v dataDir
186− return $ g >=> f >=> resolveVarsInOpt
187− Nothing -> return $ f >=> resolveVarsInOpt
188− where
189− toText (Scalar _ (SStr s)) = s
190− toText _ = ""
191− parseYAML n = failAtNode n "Expected a mapping"
192−
193−resolveVarsInOpt :: forall m. (PandocMonad m, MonadIO m)
194− => Opt -> StateT DefaultsState m Opt
195−resolveVarsInOpt
196− opt@Opt
197− { optTemplate = oTemplate
198− , optMetadataFiles = oMetadataFiles
199− , optOutputFile = oOutputFile
200− , optInputFiles = oInputFiles
201− , optSyntaxDefinitions = oSyntaxDefinitions
202− , optAbbreviations = oAbbreviations
203− , optReferenceDoc = oReferenceDoc
204− , optEpubMetadata = oEpubMetadata
205− , optEpubFonts = oEpubFonts
206− , optEpubCoverImage = oEpubCoverImage
207− , optLogFile = oLogFile
208− , optFilters = oFilters
209− , optDataDir = oDataDir
210− , optExtractMedia = oExtractMedia
211− , optCss = oCss
212− , optIncludeBeforeBody = oIncludeBeforeBody
213− , optIncludeAfterBody = oIncludeAfterBody
214− , optIncludeInHeader = oIncludeInHeader
215− , optResourcePath = oResourcePath
216− , optCSL = oCSL
217− , optBibliography = oBibliography
218− , optCitationAbbreviations = oCitationAbbreviations
219− }
220− = do
221− oTemplate' <- mapM resolveVars oTemplate
222− oMetadataFiles' <- mapM resolveVars oMetadataFiles
223− oOutputFile' <- mapM resolveVars oOutputFile
224− oInputFiles' <- mapM (mapM resolveVars) oInputFiles
225− oSyntaxDefinitions' <- mapM resolveVars oSyntaxDefinitions
226− oAbbreviations' <- mapM resolveVars oAbbreviations
227− oReferenceDoc' <- mapM resolveVars oReferenceDoc
228− oEpubMetadata' <- mapM resolveVars oEpubMetadata
229− oEpubFonts' <- mapM resolveVars oEpubFonts
230− oEpubCoverImage' <- mapM resolveVars oEpubCoverImage
231− oLogFile' <- mapM resolveVars oLogFile
232− oFilters' <- mapM resolveVarsInFilter oFilters
233− oDataDir' <- mapM resolveVars oDataDir
234− oExtractMedia' <- mapM resolveVars oExtractMedia
235− oCss' <- mapM resolveVars oCss
236− oIncludeBeforeBody' <- mapM resolveVars oIncludeBeforeBody
237− oIncludeAfterBody' <- mapM resolveVars oIncludeAfterBody
238− oIncludeInHeader' <- mapM resolveVars oIncludeInHeader
239− oResourcePath' <- mapM resolveVars oResourcePath
240− oCSL' <- mapM resolveVars oCSL
241− oBibliography' <- mapM resolveVars oBibliography
242− oCitationAbbreviations' <- mapM resolveVars oCitationAbbreviations
243− return opt{ optTemplate = oTemplate'
244− , optMetadataFiles = oMetadataFiles'
245− , optOutputFile = oOutputFile'
246− , optInputFiles = oInputFiles'
247− , optSyntaxDefinitions = oSyntaxDefinitions'
248− , optAbbreviations = oAbbreviations'
249− , optReferenceDoc = oReferenceDoc'
250− , optEpubMetadata = oEpubMetadata'
251− , optEpubFonts = oEpubFonts'
252− , optEpubCoverImage = oEpubCoverImage'
253− , optLogFile = oLogFile'
254− , optFilters = oFilters'
255− , optDataDir = oDataDir'
256− , optExtractMedia = oExtractMedia'
257− , optCss = oCss'
258− , optIncludeBeforeBody = oIncludeBeforeBody'
259− , optIncludeAfterBody = oIncludeAfterBody'
260− , optIncludeInHeader = oIncludeInHeader'
261− , optResourcePath = oResourcePath'
262− , optCSL = oCSL'
263− , optBibliography = oBibliography'
264− , optCitationAbbreviations = oCitationAbbreviations'
265− }
266−
267− where
268− resolveVars :: FilePath -> StateT DefaultsState m FilePath
269− resolveVars [] = return []
270− resolveVars ('$':'{':xs) =
271− let (ys, zs) = break (=='}') xs
272− in if null zs
273− then return $ '$':'{':xs
274− else do
275− val <- lookupEnv' ys
276− (val ++) <$> resolveVars (drop 1 zs)
277− resolveVars (c:cs) = (c:) <$> resolveVars cs
278− lookupEnv' :: String -> StateT DefaultsState m String
279− lookupEnv' "." = do
280− mbCurDefaults <- gets curDefaults
281− maybe (return "")
282− (fmap takeDirectory . liftIO . canonicalizePath)
283− mbCurDefaults
284− lookupEnv' "USERDATA" = do
285− mbodatadir <- mapM resolveVars oDataDir
286− mbdatadir <- getUserDataDir
287− defdatadir <- liftIO defaultUserDataDir
288− return $ fromMaybe defdatadir (mbodatadir <|> mbdatadir)
289− lookupEnv' v = do
290− mbval <- fmap T.unpack <$> lookupEnv (T.pack v)
291− case mbval of
292− Nothing -> do
293− report $ EnvironmentVariableUndefined (T.pack v)
294− return mempty
295− Just x -> return x
296− resolveVarsInFilter (JSONFilter fp) =
297− JSONFilter <$> resolveVars fp
298− resolveVarsInFilter (LuaFilter fp) =
299− LuaFilter <$> resolveVars fp
300− resolveVarsInFilter CiteprocFilter = return CiteprocFilter
301−
302−
303−
304−parseDefaults :: (PandocMonad m, MonadIO m)
305− => Node Pos
306− -> Maybe FilePath
307− -> Parser (Opt -> StateT DefaultsState m Opt)
308−parseDefaults n dataDir = parseDefsNames n >>= \ds -> return $ \o -> do
309− -- get parent defaults:
310− defsParent <- gets $ fromMaybe "" . curDefaults
311− -- get child defaults:
312− defsChildren <- mapM (fullDefaultsPath dataDir) ds
313− -- expand parent in defaults inheritance graph by children:
314− defsGraph <- gets inheritanceGraph
315− let defsGraphExp = expand defsGraph defsChildren defsParent
316− modify $ \defsState -> defsState{ inheritanceGraph = defsGraphExp }
317− -- check for cyclic inheritance:
318− if cyclic defsGraphExp
319− then throwError $
320− PandocSomeError $ T.pack $
321− "Error: Circular defaults file reference in " ++
322− "'" ++ defsParent ++ "'"
323− else foldM applyDefaults o defsChildren
324− where parseDefsNames x = (parseYAML x >>= \xs -> return $ map unpack xs)
325− <|> (parseYAML x >>= \x' -> return [unpack x'])
326−
327−parseOptions :: Monad m
328− => [(Node Pos, Node Pos)]
329− -> Parser (Opt -> StateT DefaultsState m Opt)
330−parseOptions ns = do
331− f <- chain doOpt' ns
332− return $ return . f
333−
334−chain :: Monad m => (a -> m (b -> b)) -> [a] -> m (b -> b)
335−chain f = foldM g id
336− where g o n = f n >>= \o' -> return $ o' . o
337−
338−doOpt' :: (Node Pos, Node Pos) -> Parser (Opt -> Opt)
339−doOpt' (k',v) = do
340− k <- parseStringKey k'
341− case k of
342− "defaults" -> return id
343− _ -> doOpt (k',v)
344−
345157doOpt :: (Node Pos, Node Pos) -> Parser (Opt -> Opt)
346158doOpt (k',v) = do
347− k <- parseStringKey k'
159+ k <- case k' of
160+ Scalar _ (SStr t) -> return t
161+ Scalar _ _ -> failAtNode k' "Non-string key"
162+ _ -> failAtNode k' "Non-scalar key"
348163 case k of
349164 "tab-stop" ->
350165 parseYAML v >>= \x -> return (\o -> o{ optTabStop = x })
@@ -515,12 +330,6 @@ doOpt (k',v) = do
515330 parseYAML v >>= \x -> return (\o -> o{ optSlideLevel = x })
516331 "atx-headers" ->
517332 parseYAML v >>= \x -> return (\o -> o{ optSetextHeaders = not x })
518− "markdown-headings" ->
519− parseYAML v >>= \x -> return (\o ->
520− case T.toLower x of
521− "atx" -> o{ optSetextHeaders = False }
522− "setext" -> o{ optSetextHeaders = True }
523− _ -> o)
524333 "ascii" ->
525334 parseYAML v >>= \x -> return (\o -> o{ optAscii = x })
526335 "default-image-extension" ->
@@ -543,18 +352,21 @@ doOpt (k',v) = do
543352 (parseYAML v >>= \x -> return (\o -> o{ optCss = optCss o <>
544353 [unpack x] }))
545354 "bibliography" ->
546− (parseYAML v >>= \x -> return (\o ->
547− o{ optBibliography = optBibliography o <>
548− map unpack x }))
549− <|>
550− (parseYAML v >>= \x -> return (\o ->
551− o{ optBibliography = optBibliography o <>
552− [unpack x] }))
355+ do let addItem x o = o{ optMetadata =
356+ addMeta "bibliography" (T.unpack x)
357+ (optMetadata o) }
358+ (parseYAML v >>= \(xs :: [Text]) -> return $ \o ->
359+ foldr addItem o xs)
360+ <|>
361+ (parseYAML v >>= \(x :: Text) -> return $ \o -> addItem x o)
553362 "csl" ->
554− parseYAML v >>= \x -> return (\o -> o{ optCSL = unpack <$> x })
555− "citation-abbreviations" ->
556− parseYAML v >>= \x -> return (\o -> o{ optCitationAbbreviations =
557− unpack <$> x })
363+ do let addItem x o = o{ optMetadata =
364+ addMeta "csl" (T.unpack x)
365+ (optMetadata o) }
366+ (parseYAML v >>= \(xs :: [Text]) -> return $ \o ->
367+ foldr addItem o xs)
368+ <|>
369+ (parseYAML v >>= \(x :: Text) -> return $ \o -> addItem x o)
558370 "ipynb-output" ->
559371 parseYAML v >>= \x -> return (\o -> o{ optIpynbOutput = x })
560372 "include-before-body" ->
@@ -583,8 +395,7 @@ doOpt (k',v) = do
583395 optIncludeInHeader o <> [unpack x] }))
584396 "resource-path" ->
585397 parseYAML v >>= \x ->
586− return (\o -> o{ optResourcePath = map unpack x <>
587− optResourcePath o })
398+ return (\o -> o{ optResourcePath = map unpack x })
588399 "request-headers" ->
589400 parseYAML v >>= \x ->
590401 return (\o -> o{ optRequestHeaders = x })
@@ -653,7 +464,7 @@ defaultOpts = Opt
653464 , optPdfEngine = Nothing
654465 , optPdfEngineOpts = []
655466 , optSlideLevel = Nothing
656− , optSetextHeaders = False
467+ , optSetextHeaders = True
657468 , optAscii = False
658469 , optDefaultImageExtension = ""
659470 , optExtractMedia = Nothing
@@ -670,70 +481,38 @@ defaultOpts = Opt
670481 , optNoCheckCertificate = False
671482 , optEol = Native
672483 , optStripComments = False
673− , optCSL = Nothing
674− , optBibliography = []
675− , optCitationAbbreviations = Nothing
676484 }
677485
678−parseStringKey :: Node Pos -> Parser Text
679−parseStringKey k = case k of
680− Scalar _ (SStr t) -> return t
681− Scalar _ _ -> failAtNode k "Non-string key"
682− _ -> failAtNode k "Non-scalar key"
683−
684486yamlToMeta :: Node Pos -> Parser Meta
685487yamlToMeta (Mapping _ _ m) =
686488 either (fail . show) return $ runEverything (yamlMap pMetaString m)
687489 where
688490 pMetaString = pure . MetaString <$> P.manyChar P.anyChar
689− runEverything p =
690− runPure (P.readWithM p (def :: P.ParserState) ("" :: Text))
491+ runEverything p = runPure (P.readWithM p def "")
691492 >>= fmap (Meta . flip P.runF def)
692493yamlToMeta _ = return mempty
693494
694−-- | Apply defaults from --defaults file.
695−applyDefaults :: (PandocMonad m, MonadIO m)
696− => Opt
697− -> FilePath
698− -> StateT DefaultsState m Opt
699−applyDefaults opt file = do
700− setVerbosity $ optVerbosity opt
701− modify $ \defsState -> defsState{ curDefaults = Just file }
702− inp <- readFileLazy file
703− case decode1 inp of
704− Right f -> f opt
705− Left (errpos, errmsg) -> throwError $
706− PandocParseError $ T.pack $
707− "Error parsing " ++ file ++ " line " ++
708− show (posLine errpos) ++ " column " ++
709− show (posColumn errpos) ++ ":\n" ++ errmsg
495+addMeta :: String -> String -> Meta -> Meta
496+addMeta k v meta =
497+ case lookupMeta k' meta of
498+ Nothing -> setMeta k' v' meta
499+ Just (MetaList xs) ->
500+ setMeta k' (MetaList (xs ++ [v'])) meta
501+ Just x -> setMeta k' (MetaList [x, v']) meta
502+ where
503+ v' = readMetaValue v
504+ k' = T.pack k
710505
711−fullDefaultsPath :: (PandocMonad m, MonadIO m)
712− => Maybe FilePath
713− -> FilePath
714− -> m FilePath
715−fullDefaultsPath dataDir file = do
716− let fp = if null (takeExtension file)
717− then addExtension file "yaml"
718− else file
719− defaultDataDir <- liftIO defaultUserDataDir
720− let defaultFp = fromMaybe defaultDataDir dataDir </> "defaults" </> fp
721− fromMaybe fp <$> findM fileExists [fp, defaultFp]
506+readMetaValue :: String -> MetaValue
507+readMetaValue s
508+ | s == "true" = MetaBool True
509+ | s == "True" = MetaBool True
510+ | s == "TRUE" = MetaBool True
511+ | s == "false" = MetaBool False
512+ | s == "False" = MetaBool False
513+ | s == "FALSE" = MetaBool False
514+ | otherwise = MetaString $ T.pack s
722515
723−-- | In a list of lists, append another list in front of every list which
724−-- starts with specific element.
725−expand :: Ord a => [[a]] -> [a] -> a -> [[a]]
726−expand [] ns n = fmap (\x -> x : [n]) ns
727−expand ps ns n = concatMap (ext n ns) ps
728− where
729− ext x xs p = case p of
730− (l : _) | x == l -> fmap (: p) xs
731− _ -> [p]
732−
733−cyclic :: Ord a => [[a]] -> Bool
734−cyclic = any hasDuplicate
735− where
736− hasDuplicate xs = length (ordNub xs) /= length xs
737516
738517-- see https://github.com/jgm/pandoc/pull/4083
739518-- using generic deriving caused long compilation times
src/Text/Pandoc/App/OutputSettings.hs+3−3
@@ -5,7 +5,7 @@
55{-# LANGUAGE TupleSections #-}
66{- |
77 Module : Text.Pandoc.App
8− Copyright : Copyright (C) 2006-2021 John MacFarlane
8+ Copyright : Copyright (C) 2006-2020 John MacFarlane
99 License : GNU GPL, version 2 or above
1010
1111 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -59,8 +59,8 @@ optToOutputSettings opts = do
5959 let outputFile = fromMaybe "-" (optOutputFile opts)
6060
6161 when (optDumpArgs opts) . liftIO $ do
62− UTF8.hPutStrLn stdout (T.pack outputFile)
63− mapM_ (UTF8.hPutStrLn stdout . T.pack) (fromMaybe [] $ optInputFiles opts)
62+ UTF8.hPutStrLn stdout outputFile
63+ mapM_ (UTF8.hPutStrLn stdout) (fromMaybe [] $ optInputFiles opts)
6464 exitSuccess
6565
6666 epubMetadata <- traverse readUtf8File $ optEpubMetadata opts
src/Text/Pandoc/Asciify.hs+391−14
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Asciify
3− Copyright : Copyright (C) 2013-2021 John MacFarlane
3+ Copyright : Copyright (C) 2013-2020 John MacFarlane
44 License : GNU GPL, version 2 or above
55
66 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -10,19 +10,396 @@
1010Function to convert accented latin letters to their unaccented
1111ascii equivalents (used in constructing HTML identifiers).
1212-}
13−module Text.Pandoc.Asciify (toAsciiChar, toAsciiText)
13+module Text.Pandoc.Asciify (toAsciiChar)
1414where
15−import Data.Char (isAscii, isMark)
16−import qualified Data.Text.Normalize as TN
17−import Data.Text (Text)
18−import qualified Data.Text as T
19−
20−toAsciiText :: Text -> Text
21−toAsciiText = T.filter isAscii . TN.normalize (TN.NFD)
15+import Data.Char (isAscii)
16+import qualified Data.Map as M
2217
2318toAsciiChar :: Char -> Maybe Char
24−toAsciiChar c = case T.unpack (TN.normalize TN.NFD (T.singleton c)) of
25− (x:xs) | isAscii x
26− , all isMark xs
27− -> Just x
28− _ -> Nothing
19+toAsciiChar c | isAscii c = Just c
20+ | otherwise = M.lookup c asciiMap
21+
22+asciiMap :: M.Map Char Char
23+asciiMap = M.fromList
24+ [('\192','A')
25+ ,('\193','A')
26+ ,('\194','A')
27+ ,('\195','A')
28+ ,('\196','A')
29+ ,('\197','A')
30+ ,('\199','C')
31+ ,('\200','E')
32+ ,('\201','E')
33+ ,('\202','E')
34+ ,('\203','E')
35+ ,('\204','I')
36+ ,('\205','I')
37+ ,('\206','I')
38+ ,('\207','I')
39+ ,('\209','N')
40+ ,('\210','O')
41+ ,('\211','O')
42+ ,('\212','O')
43+ ,('\213','O')
44+ ,('\214','O')
45+ ,('\217','U')
46+ ,('\218','U')
47+ ,('\219','U')
48+ ,('\220','U')
49+ ,('\221','Y')
50+ ,('\224','a')
51+ ,('\225','a')
52+ ,('\226','a')
53+ ,('\227','a')
54+ ,('\228','a')
55+ ,('\229','a')
56+ ,('\231','c')
57+ ,('\232','e')
58+ ,('\233','e')
59+ ,('\234','e')
60+ ,('\235','e')
61+ ,('\236','i')
62+ ,('\237','i')
63+ ,('\238','i')
64+ ,('\239','i')
65+ ,('\241','n')
66+ ,('\242','o')
67+ ,('\243','o')
68+ ,('\244','o')
69+ ,('\245','o')
70+ ,('\246','o')
71+ ,('\249','u')
72+ ,('\250','u')
73+ ,('\251','u')
74+ ,('\252','u')
75+ ,('\253','y')
76+ ,('\255','y')
77+ ,('\256','A')
78+ ,('\257','a')
79+ ,('\258','A')
80+ ,('\259','a')
81+ ,('\260','A')
82+ ,('\261','a')
83+ ,('\262','C')
84+ ,('\263','c')
85+ ,('\264','C')
86+ ,('\265','c')
87+ ,('\266','C')
88+ ,('\267','c')
89+ ,('\268','C')
90+ ,('\269','c')
91+ ,('\270','D')
92+ ,('\271','d')
93+ ,('\274','E')
94+ ,('\275','e')
95+ ,('\276','E')
96+ ,('\277','e')
97+ ,('\278','E')
98+ ,('\279','e')
99+ ,('\280','E')
100+ ,('\281','e')
101+ ,('\282','E')
102+ ,('\283','e')
103+ ,('\284','G')
104+ ,('\285','g')
105+ ,('\286','G')
106+ ,('\287','g')
107+ ,('\288','G')
108+ ,('\289','g')
109+ ,('\290','G')
110+ ,('\291','g')
111+ ,('\292','H')
112+ ,('\293','h')
113+ ,('\296','I')
114+ ,('\297','i')
115+ ,('\298','I')
116+ ,('\299','i')
117+ ,('\300','I')
118+ ,('\301','i')
119+ ,('\302','I')
120+ ,('\303','i')
121+ ,('\304','I')
122+ ,('\305','i')
123+ ,('\308','J')
124+ ,('\309','j')
125+ ,('\310','K')
126+ ,('\311','k')
127+ ,('\313','L')
128+ ,('\314','l')
129+ ,('\315','L')
130+ ,('\316','l')
131+ ,('\317','L')
132+ ,('\318','l')
133+ ,('\323','N')
134+ ,('\324','n')
135+ ,('\325','N')
136+ ,('\326','n')
137+ ,('\327','N')
138+ ,('\328','n')
139+ ,('\332','O')
140+ ,('\333','o')
141+ ,('\334','O')
142+ ,('\335','o')
143+ ,('\336','O')
144+ ,('\337','o')
145+ ,('\340','R')
146+ ,('\341','r')
147+ ,('\342','R')
148+ ,('\343','r')
149+ ,('\344','R')
150+ ,('\345','r')
151+ ,('\346','S')
152+ ,('\347','s')
153+ ,('\348','S')
154+ ,('\349','s')
155+ ,('\350','S')
156+ ,('\351','s')
157+ ,('\352','S')
158+ ,('\353','s')
159+ ,('\354','T')
160+ ,('\355','t')
161+ ,('\356','T')
162+ ,('\357','t')
163+ ,('\360','U')
164+ ,('\361','u')
165+ ,('\362','U')
166+ ,('\363','u')
167+ ,('\364','U')
168+ ,('\365','u')
169+ ,('\366','U')
170+ ,('\367','u')
171+ ,('\368','U')
172+ ,('\369','u')
173+ ,('\370','U')
174+ ,('\371','u')
175+ ,('\372','W')
176+ ,('\373','w')
177+ ,('\374','Y')
178+ ,('\375','y')
179+ ,('\376','Y')
180+ ,('\377','Z')
181+ ,('\378','z')
182+ ,('\379','Z')
183+ ,('\380','z')
184+ ,('\381','Z')
185+ ,('\382','z')
186+ ,('\416','O')
187+ ,('\417','o')
188+ ,('\431','U')
189+ ,('\432','u')
190+ ,('\461','A')
191+ ,('\462','a')
192+ ,('\463','I')
193+ ,('\464','i')
194+ ,('\465','O')
195+ ,('\466','o')
196+ ,('\467','U')
197+ ,('\468','u')
198+ ,('\486','G')
199+ ,('\487','g')
200+ ,('\488','K')
201+ ,('\489','k')
202+ ,('\490','O')
203+ ,('\491','o')
204+ ,('\496','j')
205+ ,('\500','G')
206+ ,('\501','g')
207+ ,('\504','N')
208+ ,('\505','n')
209+ ,('\512','A')
210+ ,('\513','a')
211+ ,('\514','A')
212+ ,('\515','a')
213+ ,('\516','E')
214+ ,('\517','e')
215+ ,('\518','E')
216+ ,('\519','e')
217+ ,('\520','I')
218+ ,('\521','i')
219+ ,('\522','I')
220+ ,('\523','i')
221+ ,('\524','O')
222+ ,('\525','o')
223+ ,('\526','O')
224+ ,('\527','o')
225+ ,('\528','R')
226+ ,('\529','r')
227+ ,('\530','R')
228+ ,('\531','r')
229+ ,('\532','U')
230+ ,('\533','u')
231+ ,('\534','U')
232+ ,('\535','u')
233+ ,('\536','S')
234+ ,('\537','s')
235+ ,('\538','T')
236+ ,('\539','t')
237+ ,('\542','H')
238+ ,('\543','h')
239+ ,('\550','A')
240+ ,('\551','a')
241+ ,('\552','E')
242+ ,('\553','e')
243+ ,('\558','O')
244+ ,('\559','o')
245+ ,('\562','Y')
246+ ,('\563','y')
247+ ,('\894',';')
248+ ,('\7680','A')
249+ ,('\7681','a')
250+ ,('\7682','B')
251+ ,('\7683','b')
252+ ,('\7684','B')
253+ ,('\7685','b')
254+ ,('\7686','B')
255+ ,('\7687','b')
256+ ,('\7690','D')
257+ ,('\7691','d')
258+ ,('\7692','D')
259+ ,('\7693','d')
260+ ,('\7694','D')
261+ ,('\7695','d')
262+ ,('\7696','D')
263+ ,('\7697','d')
264+ ,('\7698','D')
265+ ,('\7699','d')
266+ ,('\7704','E')
267+ ,('\7705','e')
268+ ,('\7706','E')
269+ ,('\7707','e')
270+ ,('\7710','F')
271+ ,('\7711','f')
272+ ,('\7712','G')
273+ ,('\7713','g')
274+ ,('\7714','H')
275+ ,('\7715','h')
276+ ,('\7716','H')
277+ ,('\7717','h')
278+ ,('\7718','H')
279+ ,('\7719','h')
280+ ,('\7720','H')
281+ ,('\7721','h')
282+ ,('\7722','H')
283+ ,('\7723','h')
284+ ,('\7724','I')
285+ ,('\7725','i')
286+ ,('\7728','K')
287+ ,('\7729','k')
288+ ,('\7730','K')
289+ ,('\7731','k')
290+ ,('\7732','K')
291+ ,('\7733','k')
292+ ,('\7734','L')
293+ ,('\7735','l')
294+ ,('\7738','L')
295+ ,('\7739','l')
296+ ,('\7740','L')
297+ ,('\7741','l')
298+ ,('\7742','M')
299+ ,('\7743','m')
300+ ,('\7744','M')
301+ ,('\7745','m')
302+ ,('\7746','M')
303+ ,('\7747','m')
304+ ,('\7748','N')
305+ ,('\7749','n')
306+ ,('\7750','N')
307+ ,('\7751','n')
308+ ,('\7752','N')
309+ ,('\7753','n')
310+ ,('\7754','N')
311+ ,('\7755','n')
312+ ,('\7764','P')
313+ ,('\7765','p')
314+ ,('\7766','P')
315+ ,('\7767','p')
316+ ,('\7768','R')
317+ ,('\7769','r')
318+ ,('\7770','R')
319+ ,('\7771','r')
320+ ,('\7774','R')
321+ ,('\7775','r')
322+ ,('\7776','S')
323+ ,('\7777','s')
324+ ,('\7778','S')
325+ ,('\7779','s')
326+ ,('\7786','T')
327+ ,('\7787','t')
328+ ,('\7788','T')
329+ ,('\7789','t')
330+ ,('\7790','T')
331+ ,('\7791','t')
332+ ,('\7792','T')
333+ ,('\7793','t')
334+ ,('\7794','U')
335+ ,('\7795','u')
336+ ,('\7796','U')
337+ ,('\7797','u')
338+ ,('\7798','U')
339+ ,('\7799','u')
340+ ,('\7804','V')
341+ ,('\7805','v')
342+ ,('\7806','V')
343+ ,('\7807','v')
344+ ,('\7808','W')
345+ ,('\7809','w')
346+ ,('\7810','W')
347+ ,('\7811','w')
348+ ,('\7812','W')
349+ ,('\7813','w')
350+ ,('\7814','W')
351+ ,('\7815','w')
352+ ,('\7816','W')
353+ ,('\7817','w')
354+ ,('\7818','X')
355+ ,('\7819','x')
356+ ,('\7820','X')
357+ ,('\7821','x')
358+ ,('\7822','Y')
359+ ,('\7823','y')
360+ ,('\7824','Z')
361+ ,('\7825','z')
362+ ,('\7826','Z')
363+ ,('\7827','z')
364+ ,('\7828','Z')
365+ ,('\7829','z')
366+ ,('\7830','h')
367+ ,('\7831','t')
368+ ,('\7832','w')
369+ ,('\7833','y')
370+ ,('\7840','A')
371+ ,('\7841','a')
372+ ,('\7842','A')
373+ ,('\7843','a')
374+ ,('\7864','E')
375+ ,('\7865','e')
376+ ,('\7866','E')
377+ ,('\7867','e')
378+ ,('\7868','E')
379+ ,('\7869','e')
380+ ,('\7880','I')
381+ ,('\7881','i')
382+ ,('\7882','I')
383+ ,('\7883','i')
384+ ,('\7884','O')
385+ ,('\7885','o')
386+ ,('\7886','O')
387+ ,('\7887','o')
388+ ,('\7908','U')
389+ ,('\7909','u')
390+ ,('\7910','U')
391+ ,('\7911','u')
392+ ,('\7922','Y')
393+ ,('\7923','y')
394+ ,('\7924','Y')
395+ ,('\7925','y')
396+ ,('\7926','Y')
397+ ,('\7927','y')
398+ ,('\7928','Y')
399+ ,('\7929','y')
400+ ,('\8175','`')
401+ ,('\8490','K')
402+ ,('\8800','=')
403+ ,('\8814','<')
404+ ,('\8815','>')
405+ ]
src/Text/Pandoc/BCP47.hsnew file+112
@@ -0,0 +1,112 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{- |
3+ Module : Text.Pandoc.BCP47
4+ Copyright : Copyright (C) 2017–2020 John MacFarlane
5+ License : GNU GPL, version 2 or above
6+
7+ Maintainer : John MacFarlane <jgm@berkeley.edu>
8+ Stability : alpha
9+ Portability : portable
10+
11+Functions for parsing and rendering BCP47 language identifiers.
12+-}
13+module Text.Pandoc.BCP47 (
14+ getLang
15+ , parseBCP47
16+ , Lang(..)
17+ , renderLang
18+ )
19+where
20+import Control.Monad (guard)
21+import Data.Char (isAlphaNum, isAscii, isLetter, isLower, isUpper)
22+import Text.Pandoc.Definition
23+import Text.Pandoc.Options
24+import Text.DocTemplates (FromContext(..))
25+import qualified Data.Text as T
26+import qualified Text.Parsec as P
27+
28+-- | Represents BCP 47 language/country code.
29+data Lang = Lang{ langLanguage :: T.Text
30+ , langScript :: T.Text
31+ , langRegion :: T.Text
32+ , langVariants :: [T.Text] }
33+ deriving (Eq, Ord, Show)
34+
35+-- | Render a Lang as BCP 47.
36+renderLang :: Lang -> T.Text
37+renderLang lang = T.intercalate "-" (langLanguage lang : filter (not . T.null)
38+ ([langScript lang, langRegion lang] ++ langVariants lang))
39+
40+-- | Get the contents of the `lang` metadata field or variable.
41+getLang :: WriterOptions -> Meta -> Maybe T.Text
42+getLang opts meta =
43+ case lookupContext "lang" (writerVariables opts) of
44+ Just s -> Just s
45+ _ ->
46+ case lookupMeta "lang" meta of
47+ Just (MetaBlocks [Para [Str s]]) -> Just s
48+ Just (MetaBlocks [Plain [Str s]]) -> Just s
49+ Just (MetaInlines [Str s]) -> Just s
50+ Just (MetaString s) -> Just s
51+ _ -> Nothing
52+
53+-- | Parse a BCP 47 string as a Lang. Currently we parse
54+-- extensions and private-use fields as "variants," even
55+-- though officially they aren't.
56+parseBCP47 :: T.Text -> Either T.Text Lang
57+parseBCP47 lang =
58+ case P.parse bcp47 "lang" lang of
59+ Right r -> Right r
60+ Left e -> Left $ T.pack $ show e
61+ where bcp47 = do
62+ language <- pLanguage
63+ script <- P.option "" pScript
64+ region <- P.option "" pRegion
65+ variants <- P.many (pVariant P.<|> pExtension P.<|> pPrivateUse)
66+ P.eof
67+ return Lang{ langLanguage = language
68+ , langScript = script
69+ , langRegion = region
70+ , langVariants = variants }
71+ asciiLetter = P.satisfy (\c -> isAscii c && isLetter c)
72+ pLanguage = do
73+ cs <- P.many1 asciiLetter
74+ let lcs = length cs
75+ guard $ lcs == 2 || lcs == 3
76+ return $ T.toLower $ T.pack cs
77+ pScript = P.try $ do
78+ P.char '-'
79+ x <- P.satisfy (\c -> isAscii c && isLetter c && isUpper c)
80+ xs <- P.count 3
81+ (P.satisfy (\c -> isAscii c && isLetter c && isLower c))
82+ return $ T.toLower $ T.pack (x:xs)
83+ pRegion = P.try $ do
84+ P.char '-'
85+ cs <- P.many1 asciiLetter
86+ let lcs = length cs
87+ guard $ lcs == 2 || lcs == 3
88+ return $ T.toUpper $ T.pack cs
89+ pVariant = P.try $ do
90+ P.char '-'
91+ ds <- P.option "" (P.count 1 P.digit)
92+ cs <- P.many1 asciiLetter
93+ let var = ds ++ cs
94+ lv = length var
95+ guard $ if null ds
96+ then lv >= 5 && lv <= 8
97+ else lv == 4
98+ return $ T.toLower $ T.pack var
99+ pExtension = P.try $ do
100+ P.char '-'
101+ cs <- P.many1 $ P.satisfy (\c -> isAscii c && isAlphaNum c)
102+ let lcs = length cs
103+ guard $ lcs >= 2 && lcs <= 8
104+ return $ T.toLower $ T.pack cs
105+ pPrivateUse = P.try $ do
106+ P.char '-'
107+ P.char 'x'
108+ P.char '-'
109+ cs <- P.many1 $ P.satisfy (\c -> isAscii c && isAlphaNum c)
110+ guard $ not (null cs) && length cs <= 8
111+ let var = "x-" ++ cs
112+ return $ T.toLower $ T.pack var
src/Text/Pandoc/CSS.hs+25−24
@@ -1,6 +1,6 @@
11{- |
22Module : Text.Pandoc.CSS
3−Copyright : © 2006-2021 John MacFarlane <jgm@berkeley.edu>,
3+Copyright : © 2006-2020 John MacFarlane <jgm@berkeley.edu>,
44 2015-2016 Mauro Bieg,
55 2015 Ophir Lifshitz <hangfromthefloor@gmail.com>
66License : GNU GPL, version 2 or above
@@ -11,46 +11,47 @@ Portability : portable
1111
1212Tools for working with CSS.
1313-}
14−module Text.Pandoc.CSS
15− ( cssAttributes
16− , pickStyleAttrProps
17− , pickStylesToKVs
18− )
14+module Text.Pandoc.CSS ( foldOrElse
15+ , pickStyleAttrProps
16+ , pickStylesToKVs
17+ )
1918where
2019
21−import Data.Maybe (mapMaybe, listToMaybe)
22−import Data.Text (Text, pack)
20+import qualified Data.Text as T
2321import Text.Pandoc.Shared (trim)
2422import Text.Parsec
2523import Text.Parsec.Text
2624
27−ruleParser :: Parser (Text, Text)
25+ruleParser :: Parser (T.Text, T.Text)
2826ruleParser = do
2927 p <- many1 (noneOf ":") <* char ':'
3028 v <- many1 (noneOf ":;") <* optional (char ';') <* spaces
31− return (trim $ pack p, trim $ pack v)
29+ return (trim $ T.pack p, trim $ T.pack v)
3230
33−styleAttrParser :: Parser [(Text, Text)]
31+styleAttrParser :: Parser [(T.Text, T.Text)]
3432styleAttrParser = many1 ruleParser
3533
36−-- | Parses a style string, returning the CSS attributes.
37−-- Returns an empty list on failure.
38−cssAttributes :: Text -> [(Text, Text)]
39−cssAttributes styleString =
40− -- Use Data.Either.fromRight once GHC 8.0 is no longer supported
41− case parse styleAttrParser "" styleString of
42− Left _ -> []
43− Right x -> x
34+orElse :: Eq a => a -> a -> a -> a
35+orElse v x y = if v == x then y else x
36+
37+foldOrElse :: Eq a => a -> [a] -> a
38+foldOrElse v xs = foldr (orElse v) v xs
39+
40+eitherToMaybe :: Either a b -> Maybe b
41+eitherToMaybe (Right x) = Just x
42+eitherToMaybe _ = Nothing
4443
4544-- | takes a list of keys/properties and a CSS string and
4645-- returns the corresponding key-value-pairs.
47−pickStylesToKVs :: [Text] -> Text -> [(Text, Text)]
46+pickStylesToKVs :: [T.Text] -> T.Text -> [(T.Text, T.Text)]
4847pickStylesToKVs props styleAttr =
49− filter (\s -> fst s `elem` props) $ cssAttributes styleAttr
48+ case parse styleAttrParser "" styleAttr of
49+ Left _ -> []
50+ Right styles -> filter (\s -> fst s `elem` props) styles
5051
5152-- | takes a list of key/property synonyms and a CSS string and maybe
5253-- returns the value of the first match (in order of the supplied list)
53−pickStyleAttrProps :: [Text] -> Text -> Maybe Text
54+pickStyleAttrProps :: [T.Text] -> T.Text -> Maybe T.Text
5455pickStyleAttrProps lookupProps styleAttr = do
55− styles <- either (const Nothing) Just $ parse styleAttrParser "" styleAttr
56− listToMaybe $ mapMaybe (`lookup` styles) lookupProps
56+ styles <- eitherToMaybe $ parse styleAttrParser "" styleAttr
57+ foldOrElse Nothing $ map (`lookup` styles) lookupProps
src/Text/Pandoc/CSV.hs+3−2
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.CSV
3− Copyright : Copyright (C) 2017-2021 John MacFarlane <jgm@berkeley.edu>
3+ Copyright : Copyright (C) 2017–2020 John MacFarlane <jgm@berkeley.edu>
44 License : GNU GPL, version 2 or above
55 Maintainer : John MacFarlane <jgm@berkeley.edu>
66 Stability : alpha
@@ -68,7 +68,8 @@ escaped opts = try $
6868
6969pCSVUnquotedCell :: CSVOptions -> Parser Text
7070pCSVUnquotedCell opts = T.pack <$>
71− many (satisfy (\c -> c /= csvDelim opts && c /= '\r' && c /= '\n'))
71+ many (satisfy (\c -> c /= csvDelim opts && c /= '\r' && c /= '\n'
72+ && c /= csvQuote opts))
7273
7374pCSVDelim :: CSVOptions -> Parser ()
7475pCSVDelim opts = do
src/Text/Pandoc/Citeproc.hs+140−292
@@ -1,80 +1,128 @@
11{-# LANGUAGE ScopedTypeVariables #-}
22{-# LANGUAGE FlexibleContexts #-}
3+{-# LANGUAGE ViewPatterns #-}
34{-# LANGUAGE StrictData #-}
45{-# LANGUAGE MultiParamTypeClasses #-}
56{-# LANGUAGE FlexibleInstances #-}
67{-# LANGUAGE OverloadedStrings #-}
8+{-# LANGUAGE DeriveFunctor #-}
9+{-# LANGUAGE DeriveFoldable #-}
10+{-# LANGUAGE DeriveTraversable #-}
711module Text.Pandoc.Citeproc
8− ( processCitations,
9− getReferences,
10− getStyle
11− )
12+ ( processCitations )
1213where
1314
14−import Citeproc
15+import Citeproc as Citeproc
1516import Citeproc.Pandoc ()
1617import Text.Pandoc.Citeproc.Locator (parseLocator)
1718import Text.Pandoc.Citeproc.CslJson (cslJsonToReferences)
1819import Text.Pandoc.Citeproc.BibTeX (readBibtexString, Variant(..))
1920import Text.Pandoc.Citeproc.MetaValue (metaValueToReference, metaValueToText)
20−import Text.Pandoc.Readers.Markdown (yamlToRefs)
21−import Text.Pandoc.Builder (Inlines, Many(..), deleteMeta, setMeta)
22−import qualified Text.Pandoc.Builder as B
21+import Data.ByteString (ByteString)
22+import qualified Data.ByteString.Lazy as L
2323import Text.Pandoc.Definition as Pandoc
24−import Text.Pandoc.Class (PandocMonad(..), getResourcePath, getUserDataDir,
25− fetchItem, readDataFile, report, setResourcePath)
26−import Text.Pandoc.Error (PandocError(..))
27−import Text.Pandoc.Extensions (pandocExtensions)
28−import Text.Pandoc.Logging (LogMessage(..))
29−import Text.Pandoc.Options (ReaderOptions(..))
30−import Text.Pandoc.Shared (stringify, ordNub, tshow)
24+import Text.Pandoc.Walk
25+import Text.Pandoc.Builder as B
26+import Text.Pandoc (PandocMonad(..), PandocError(..), readMarkdown,
27+ readDataFile, ReaderOptions(..), pandocExtensions,
28+ report, LogMessage(..), fetchItem)
29+import Text.Pandoc.Shared (stringify, ordNub, blocksToInlines)
3130import qualified Text.Pandoc.UTF8 as UTF8
32−import Text.Pandoc.Walk (query, walk, walkM)
33−import Control.Applicative ((<|>))
34−import Control.Monad.Except (catchError, throwError)
35−import Control.Monad.State (State, evalState, get, put, runState)
3631import Data.Aeson (eitherDecode)
37−import Data.ByteString (ByteString)
38−import qualified Data.ByteString.Lazy as L
39−import Data.Char (isPunctuation, isUpper)
40−import Data.Default (Default(def))
41−import qualified Data.Foldable as Foldable
42−import qualified Data.Map as M
43−import Data.Maybe (mapMaybe, fromMaybe)
32+import Data.Default
4433import Data.Ord ()
45−import qualified Data.Sequence as Seq
34+import qualified Data.Map as M
4635import qualified Data.Set as Set
36+import Data.Char (isPunctuation)
4737import Data.Text (Text)
4838import qualified Data.Text as T
49−import System.FilePath (takeExtension)
39+import Control.Monad.State
40+import qualified Data.Sequence as Seq
41+import qualified Data.Foldable as Foldable
42+import System.FilePath
43+import Control.Applicative
44+import Control.Monad.Except
45+import Data.Maybe (mapMaybe, fromMaybe)
5046import Safe (lastMay, initSafe)
47+-- import Debug.Trace as Trace (trace, traceShowId)
5148
5249
53−processCitations :: PandocMonad m => Pandoc -> m Pandoc
50+processCitations :: PandocMonad m => Pandoc -> m Pandoc
5451processCitations (Pandoc meta bs) = do
55− style <- getStyle (Pandoc meta bs)
52+ let cslfile = (lookupMeta "csl" meta <|> lookupMeta "citation-style" meta)
53+ >>= metaValueToText
5654
57− mblang <- getLang meta
58− let locale = Citeproc.mergeLocales mblang style
55+ let getFile fp = catchError (fst <$> fetchItem fp)
56+ (\e -> catchError (readDataFile
57+ (T.unpack $ "csl/" <> fp))
58+ (\_ -> throwError e))
59+
60+ let getCslDefault = readDataFile "default.csl"
5961
60− refs <- getReferences (Just locale) (Pandoc meta bs)
62+ cslContents <- UTF8.toText <$> maybe getCslDefault getFile cslfile
6163
64+ let abbrevFile = lookupMeta "citation-abbreviations" meta >>= metaValueToText
65+
66+ mbAbbrevs <- case abbrevFile of
67+ Nothing -> return Nothing
68+ Just fp -> do
69+ rawAbbr <- getFile fp
70+ case eitherDecode (L.fromStrict rawAbbr) of
71+ Left err -> throwError $ PandocCiteprocError $
72+ CiteprocParseError $
73+ "Could not parse abbreviations file " <> fp
74+ <> "\n" <> T.pack err
75+ Right abbr -> return $ Just abbr
76+
77+ let getParentStyle url = UTF8.toText . fst <$> fetchItem url
78+
79+ -- TODO check .csl directory if not found
80+ styleRes <- Citeproc.parseStyle getParentStyle cslContents
81+ style <-
82+ case styleRes of
83+ Left err -> throwError $ PandocAppError $ prettyCiteprocError err
84+ Right style -> return style{ styleAbbreviations = mbAbbrevs }
85+ let mblang = parseLang <$>
86+ ((lookupMeta "lang" meta <|> lookupMeta "locale" meta) >>= metaValueToText)
87+ let locale = Citeproc.mergeLocales mblang style
88+ let getCiteId (Cite cs _) = Set.fromList $ map B.citationId cs
89+ getCiteId _ = mempty
90+ let metanocites = lookupMeta "nocite" meta
91+ let meta' = deleteMeta "nocite" meta
92+ let nocites = maybe mempty (query getCiteId) metanocites
93+ let citeIds = query getCiteId (Pandoc meta bs)
94+ let idpred = if "*" `Set.member` nocites
95+ then const True
96+ else (\c -> c `Set.member` citeIds ||
97+ c `Set.member` nocites)
98+ refs <- map (linkifyVariables . legacyDateRanges) <$>
99+ case lookupMeta "references" meta of
100+ Just (MetaList rs) -> return $ mapMaybe metaValueToReference rs
101+ _ ->
102+ case lookupMeta "bibliography" meta of
103+ Just (MetaList xs) ->
104+ mconcat <$>
105+ mapM (getRefsFromBib locale idpred)
106+ (mapMaybe metaValueToText xs)
107+ Just x ->
108+ case metaValueToText x of
109+ Just fp -> getRefsFromBib locale idpred fp
110+ Nothing -> return []
111+ Nothing -> return []
62112 let otherIdsMap = foldr (\ref m ->
63113 case T.words . extractText <$>
64− M.lookup "other-ids"
65− (referenceVariables ref) of
114+ M.lookup "other-ids" (referenceVariables ref) of
66115 Nothing -> m
67116 Just ids -> foldr
68117 (\id' ->
69118 M.insert id' (referenceId ref)) m ids)
70119 M.empty refs
71− let meta' = deleteMeta "nocite" meta
120+ -- TODO: issue warning if no refs defined
72121 let citations = getCitations locale otherIdsMap $ Pandoc meta' bs
73−
74−
75122 let linkCites = maybe False truish $ lookupMeta "link-citations" meta
76123 let opts = defaultCiteprocOptions{ linkCitations = linkCites }
77− let result = Citeproc.citeproc opts style mblang refs citations
124+ let result = Citeproc.citeproc opts style (localeLanguage locale)
125+ refs citations
78126 mapM_ (report . CiteprocWarning) (resultWarnings result)
79127 let sopts = styleOptions style
80128 let classes = "references" : -- TODO remove this or keep for compatibility?
@@ -88,128 +136,24 @@ processCitations (Pandoc meta bs) = do
88136 _ -> id) $ []
89137 let bibs = mconcat $ map (\(ident, out) ->
90138 B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para .
91− walk (convertQuotes locale) .
92− insertSpace $ out)
139+ walk (convertQuotes locale) . insertSpace $ out)
93140 (resultBibliography result)
94− let moveNotes = styleIsNoteStyle sopts &&
95− maybe True truish (lookupMeta "notes-after-punctuation" meta)
141+ let moveNotes = maybe True truish $
142+ lookupMeta "notes-after-punctuation" meta
96143 let cits = map (walk (convertQuotes locale)) $
97144 resultCitations result
98145
99− let metanocites = lookupMeta "nocite" meta
146+ let fixQuotes = case localePunctuationInQuote locale of
147+ Just True ->
148+ B.toList . movePunctuationInsideQuotes . B.fromList
149+ _ -> id
150+
100151 let Pandoc meta'' bs' =
101− maybe id (setMeta "nocite") metanocites .
102− walk (mvPunct moveNotes locale) .
103− (if styleIsNoteStyle sopts
104− then walk addNote . walk deNote
105− else id) .
152+ maybe id (setMeta "nocite") metanocites $
153+ walk (fixQuotes . mvPunct moveNotes locale) $ walk deNote $
106154 evalState (walkM insertResolvedCitations $ Pandoc meta' bs)
107155 $ cits
108− return $ Pandoc meta''
109− $ insertRefs refkvs classes meta''
110− (walk fixLinks $ B.toList bibs) bs'
111−
112−-- | Retrieve the CSL style specified by the csl or citation-style
113−-- metadata field in a pandoc document, or the default CSL style
114−-- if none is specified. Retrieve the parent style
115−-- if the style is a dependent style. Add abbreviations defined
116−-- in an abbreviation file if one has been specified.
117−getStyle :: PandocMonad m => Pandoc -> m (Style Inlines)
118−getStyle (Pandoc meta _) = do
119− let cslfile = (lookupMeta "csl" meta <|> lookupMeta "citation-style" meta)
120− >>= metaValueToText
121−
122− let getFile defaultExtension fp = do
123− oldRp <- getResourcePath
124− mbUdd <- getUserDataDir
125− setResourcePath $ oldRp ++ maybe []
126− (\u -> [u <> "/csl",
127− u <> "/csl/dependent"]) mbUdd
128− let fp' = if T.any (=='.') fp || "data:" `T.isPrefixOf` fp
129− then fp
130− else fp <> defaultExtension
131− (result, _) <- fetchItem fp'
132− setResourcePath oldRp
133− return result
134−
135− let getCslDefault = readDataFile "default.csl"
136−
137− cslContents <- UTF8.toText <$> maybe getCslDefault (getFile ".csl") cslfile
138−
139− let abbrevFile = lookupMeta "citation-abbreviations" meta >>= metaValueToText
140−
141− mbAbbrevs <- case abbrevFile of
142− Nothing -> return Nothing
143− Just fp -> do
144− rawAbbr <- getFile ".json" fp
145− case eitherDecode (L.fromStrict rawAbbr) of
146− Left err -> throwError $ PandocCiteprocError $
147− CiteprocParseError $
148− "Could not parse abbreviations file " <> fp
149− <> "\n" <> T.pack err
150− Right abbr -> return $ Just abbr
151−
152− let getParentStyle url = do
153− -- first, try to retrieve the style locally, then use HTTP.
154− let basename = T.takeWhileEnd (/='/') url
155− UTF8.toText <$>
156− catchError (getFile ".csl" basename) (\_ -> fst <$> fetchItem url)
157−
158− styleRes <- Citeproc.parseStyle getParentStyle cslContents
159− case styleRes of
160− Left err -> throwError $ PandocAppError $ prettyCiteprocError err
161− Right style -> return style{ styleAbbreviations = mbAbbrevs }
162−
163−
164−-- Retrieve citeproc lang based on metadata.
165−getLang :: PandocMonad m => Meta -> m (Maybe Lang)
166−getLang meta = maybe (return Nothing) bcp47LangToIETF
167− ((lookupMeta "lang" meta <|> lookupMeta "locale" meta) >>=
168− metaValueToText)
169−
170−-- | Get references defined inline in the metadata and via an external
171−-- bibliography. Only references that are actually cited in the document
172−-- (either with a genuine citation or with `nocite`) are returned.
173−-- URL variables are converted to links.
174−getReferences :: PandocMonad m
175− => Maybe Locale -> Pandoc -> m [Reference Inlines]
176−getReferences mblocale (Pandoc meta bs) = do
177− locale <- case mblocale of
178− Just l -> return l
179− Nothing -> do
180− mblang <- getLang meta
181− case mblang of
182− Just lang -> return $ either mempty id $ getLocale lang
183− Nothing -> return mempty
184−
185− let getCiteId (Cite cs _) = Set.fromList $ map B.citationId cs
186− getCiteId _ = mempty
187− let metanocites = lookupMeta "nocite" meta
188− let nocites = maybe mempty (query getCiteId) metanocites
189− let citeIds = query getCiteId (Pandoc meta bs)
190− let idpred = if "*" `Set.member` nocites
191− then const True
192− else (`Set.member` citeIds)
193− let inlineRefs = case lookupMeta "references" meta of
194− Just (MetaList rs) ->
195− filter (idpred . unItemId . referenceId)
196− $ mapMaybe metaValueToReference rs
197− _ -> []
198− externalRefs <- case lookupMeta "bibliography" meta of
199− Just (MetaList xs) ->
200− mconcat <$>
201− mapM (getRefsFromBib locale idpred)
202− (mapMaybe metaValueToText xs)
203− Just x ->
204− case metaValueToText x of
205− Just fp -> getRefsFromBib locale idpred fp
206− Nothing -> return []
207− Nothing -> return []
208− return $ map (linkifyVariables . legacyDateRanges)
209− (externalRefs ++ inlineRefs)
210− -- note that inlineRefs can override externalRefs
211−
212−
156+ return $ Pandoc meta'' $ insertRefs refkvs classes meta'' (B.toList bibs) bs'
213157
214158-- If we have a span.csl-left-margin followed by span.csl-right-inline,
215159-- we insert a space. This ensures that they will be separated by a space,
@@ -230,40 +174,42 @@ insertSpace ils =
230174
231175getRefsFromBib :: PandocMonad m
232176 => Locale -> (Text -> Bool) -> Text -> m [Reference Inlines]
233−getRefsFromBib locale idpred fp = do
234− (raw, _) <- fetchItem fp
235− case formatFromExtension (T.unpack fp) of
236− Just f -> getRefs locale f idpred (Just fp) raw
177+getRefsFromBib locale idpred t = do
178+ let fp = T.unpack t
179+ raw <- readFileStrict fp
180+ case formatFromExtension fp of
181+ Just f -> getRefs locale f idpred raw
237182 Nothing -> throwError $ PandocAppError $
238− "Could not determine bibliography format for " <> fp
183+ "Could not deterine bibliography format for " <> t
239184
240185getRefs :: PandocMonad m
241186 => Locale
242187 -> BibFormat
243188 -> (Text -> Bool)
244− -> Maybe Text
245189 -> ByteString
246190 -> m [Reference Inlines]
247−getRefs locale format idpred mbfp raw = do
248− let err' = throwError .
249− PandocBibliographyError (fromMaybe mempty mbfp)
191+getRefs locale format idpred raw =
250192 case format of
251193 Format_bibtex ->
252− either (err' . tshow) return .
194+ either (throwError . PandocAppError . T.pack . show) return .
253195 readBibtexString Bibtex locale idpred . UTF8.toText $ raw
254196 Format_biblatex ->
255− either (err' . tshow) return .
197+ either (throwError . PandocAppError . T.pack . show) return .
256198 readBibtexString Biblatex locale idpred . UTF8.toText $ raw
257199 Format_json ->
258− either (err' . T.pack)
200+ either (throwError . PandocAppError . T.pack)
259201 (return . filter (idpred . unItemId . referenceId)) .
260202 cslJsonToReferences $ raw
261203 Format_yaml -> do
262− rs <- yamlToRefs idpred
263− def{ readerExtensions = pandocExtensions }
264− (T.unpack <$> mbfp)
265− (L.fromStrict raw)
266− return $ mapMaybe metaValueToReference rs
204+ Pandoc meta _ <-
205+ readMarkdown
206+ def{ readerExtensions = pandocExtensions }
207+ (UTF8.toText raw)
208+ case lookupMeta "references" meta of
209+ Just (MetaList rs) ->
210+ return $ filter (idpred . unItemId . referenceId)
211+ $ mapMaybe metaValueToReference rs
212+ _ -> throwError $ PandocAppError "No references field"
267213
268214-- localized quotes
269215convertQuotes :: Locale -> Inline -> Inline
@@ -290,7 +236,7 @@ insertResolvedCitations (Cite cs ils) = do
290236 [] -> return (Cite cs ils)
291237 (x:xs) -> do
292238 put xs
293− return $ Cite cs (walk fixLinks $ B.toList x)
239+ return $ Cite cs (B.toList x)
294240insertResolvedCitations x = return x
295241
296242getCitations :: Locale
@@ -372,6 +318,7 @@ formatFromExtension fp = case dropWhile (== '.') $ takeExtension fp of
372318
373319
374320isNote :: Inline -> Bool
321+isNote (Note _) = True
375322isNote (Cite _ [Note _]) = True
376323 -- the following allows citation styles that are "in-text" but use superscript
377324 -- references to be treated as if they are "notes" for the purposes of moving
@@ -384,12 +331,6 @@ isSpacy Space = True
384331isSpacy SoftBreak = True
385332isSpacy _ = False
386333
387−movePunctInsideQuotes :: Locale -> [Inline] -> [Inline]
388−movePunctInsideQuotes locale
389− | localePunctuationInQuote locale == Just True
390− = B.toList . movePunctuationInsideQuotes . B.fromList
391− | otherwise
392− = id
393334
394335mvPunct :: Bool -> Locale -> [Inline] -> [Inline]
395336mvPunct moveNotes locale (x : xs)
@@ -402,8 +343,7 @@ mvPunct moveNotes locale (q : s : x : ys)
402343 in if moveNotes
403344 then if T.null spunct
404345 then q : x : mvPunct moveNotes locale ys
405− else movePunctInsideQuotes locale
406− [q , Str spunct , x] ++ mvPunct moveNotes locale
346+ else q : Str spunct : x : mvPunct moveNotes locale
407347 (B.toList
408348 (dropTextWhile isPunctuation (B.fromList ys)))
409349 else q : x : mvPunct moveNotes locale ys
@@ -415,10 +355,9 @@ mvPunct moveNotes locale (Cite cs ils : ys)
415355 , moveNotes
416356 = let s = stringify ys
417357 spunct = T.takeWhile isPunctuation s
418− in Cite cs (movePunctInsideQuotes locale $
419− init ils
420− ++ [Str spunct | not (endWithPunct False (init ils))]
421− ++ [last ils]) :
358+ in Cite cs (init ils
359+ ++ [Str spunct | not (endWithPunct False (init ils))]
360+ ++ [last ils]) :
422361 mvPunct moveNotes locale
423362 (B.toList (dropTextWhile isPunctuation (B.fromList ys)))
424363mvPunct moveNotes locale (s : x : ys) | isSpacy s, isNote x =
@@ -431,15 +370,6 @@ mvPunct moveNotes locale (Cite cs ils : Str "." : ys)
431370mvPunct moveNotes locale (x:xs) = x : mvPunct moveNotes locale xs
432371mvPunct _ _ [] = []
433372
434−-- move https://doi.org etc. prefix inside link text (#6723):
435−fixLinks :: [Inline] -> [Inline]
436−fixLinks (Str t : Link attr [Str u1] (u2,tit) : xs)
437− | u2 == t <> u1
438− = Link attr [Str (t <> u1)] (u2,tit) : fixLinks xs
439−fixLinks (x:xs) = x : fixLinks xs
440−fixLinks [] = []
441−
442−
443373endWithPunct :: Bool -> [Inline] -> Bool
444374endWithPunct _ [] = False
445375endWithPunct onlyFinal xs@(_:_) =
@@ -504,8 +434,7 @@ insertRefs refkvs refclasses meta refs bs =
504434 put True
505435 -- refHeader isn't used if you have an explicit references div
506436 let cs' = ordNub $ cs ++ refclasses
507− let kvs' = ordNub $ kvs ++ refkvs
508− return $ Div ("refs",cs',kvs') (xs ++ refs)
437+ return $ Div ("refs",cs',kvs) (xs ++ refs)
509438 go x = return x
510439
511440refTitle :: Meta -> Maybe [Inline]
@@ -540,23 +469,16 @@ linkifyVariables ref =
540469 ref{ referenceVariables = M.mapWithKey go $ referenceVariables ref }
541470 where
542471 go "URL" x = tolink "https://" x
543− go "DOI" x = tolink "https://doi.org/" (fixShortDOI x)
472+ go "DOI" x = tolink "https://doi.org/" x
544473 go "ISBN" x = tolink "https://worldcat.org/isbn/" x
545474 go "PMID" x = tolink "https://www.ncbi.nlm.nih.gov/pubmed/" x
546475 go "PMCID" x = tolink "https://www.ncbi.nlm.nih.gov/pmc/articles/" x
547476 go _ x = x
548− fixShortDOI x = let x' = extractText x
549− in if "10/" `T.isPrefixOf` x'
550− then TextVal $ T.drop 3 x'
551− -- see https://shortdoi.org
552− else TextVal x'
553477 tolink pref x = let x' = extractText x
554478 x'' = if "://" `T.isInfixOf` x'
555479 then x'
556480 else pref <> x'
557− in if T.null x'
558− then x
559− else FancyVal (B.link x'' "" (B.str x'))
481+ in FancyVal (B.link x'' "" (B.str x'))
560482
561483extractText :: Val Inlines -> Text
562484extractText (TextVal x) = x
@@ -564,98 +486,24 @@ extractText (FancyVal x) = toText x
564486extractText (NumVal n) = T.pack (show n)
565487extractText _ = mempty
566488
567−-- Here we take the Spans with class csl-note that are left
568−-- after deNote has removed nested ones, and convert them
569−-- into real notes.
570−addNote :: Inline -> Inline
571−addNote (Span ("",["csl-note"],[]) ils) =
572− Note [Para $
573− B.toList . addTextCase Nothing CapitalizeFirst . B.fromList $ ils]
574−addNote x = x
575−
576−-- Here we handle citation notes that occur inside footnotes
577−-- or other citation notes, in a note style. We don't want
578−-- notes inside notes, so we convert these to parenthesized
579−-- or comma-separated citations.
580489deNote :: Inline -> Inline
581−deNote (Note bs) =
582− case bs of
583− [Para (cit@(Cite (c:_) _) : ils)]
584− | citationMode c /= AuthorInText ->
585− -- if citation is first in note, no need to parenthesize.
586− Note [Para (walk removeNotes $ cit : walk addParens ils)]
587− _ -> Note (walk removeNotes . walk addParens $ bs)
588−
490+deNote (Note bs) = Note $ walk go bs
589491 where
590− addParens [] = []
591− addParens (Cite (c:cs) ils : zs)
592− | citationMode c == AuthorInText
593− = Cite (c:cs) (concatMap (noteAfterComma (needsPeriod zs)) ils) :
594− addParens zs
595− | otherwise
596− = Cite (c:cs) (concatMap noteInParens ils) : addParens zs
597− addParens (x:xs) = x : addParens xs
598−
599− removeNotes (Span ("",["csl-note"],[]) ils) = Span ("",[],[]) ils
600− removeNotes x = x
601−
602− needsPeriod [] = True
603− needsPeriod (Str t:_) = case T.uncons t of
604− Nothing -> False
605− Just (c,_) -> isUpper c
606− needsPeriod (Space:zs) = needsPeriod zs
607− needsPeriod _ = False
608−
609− noteInParens (Span ("",["csl-note"],[]) ils)
610− = Space : Str "(" :
611− removeFinalPeriod ils ++ [Str ")"]
612− noteInParens x = [x]
613−
614− noteAfterComma needsPer (Span ("",["csl-note"],[]) ils)
615− | not (null ils)
616− = Str "," : Space :
617− if needsPer
618− then ils
619− else removeFinalPeriod ils
620− noteAfterComma _ x = [x]
621−
492+ go (Note bs')
493+ = Span ("",[],[]) (Space : Str "(" :
494+ (removeFinalPeriod
495+ (blocksToInlines bs')) ++ [Str ")"])
496+ go x = x
622497deNote x = x
623498
624−-- Note: we can't use dropTextWhileEnd indiscriminately,
625−-- because this would remove the final period on abbreviations like Ibid.
626−-- But it turns out that when the note citation ends with Ibid.
627−-- (or Ed. etc.), the last inline will be Str "" as a result of
628−-- the punctuation-fixing mechanism that removes the double '.'.
499+-- Note: we can't use dropTextWhileEnd because this would
500+-- remove the final period on abbreviations like Ibid.
501+-- But removing a final Str "." is safe.
629502removeFinalPeriod :: [Inline] -> [Inline]
630503removeFinalPeriod ils =
631504 case lastMay ils of
632− Just (Span attr ils')
633− -> initSafe ils ++ [Span attr (removeFinalPeriod ils')]
634− Just (Emph ils')
635− -> initSafe ils ++ [Emph (removeFinalPeriod ils')]
636− Just (Strong ils')
637− -> initSafe ils ++ [Strong (removeFinalPeriod ils')]
638− Just (SmallCaps ils')
639− -> initSafe ils ++ [SmallCaps (removeFinalPeriod ils')]
640− Just (Str t)
641− | T.takeEnd 1 t == "." -> initSafe ils ++ [Str (T.dropEnd 1 t)]
642− | isRightQuote (T.takeEnd 1 t)
643− -> removeFinalPeriod
644− (initSafe ils ++ [Str tInit | not (T.null tInit)]) ++ [Str tEnd]
645− where
646− tEnd = T.takeEnd 1 t
647− tInit = T.dropEnd 1 t
648− _ -> ils
649− where
650− isRightQuote "\8221" = True
651− isRightQuote "\8217" = True
652− isRightQuote "\187" = True
653− isRightQuote _ = False
654−
655−bcp47LangToIETF :: PandocMonad m => Text -> m (Maybe Lang)
656−bcp47LangToIETF bcplang =
657− case parseLang bcplang of
658− Left _ -> do
659− report $ InvalidLang bcplang
660− return Nothing
661− Right lang -> return $ Just lang
505+ Just (Str ".") -> initSafe ils
506+ _ -> ils
507+
508+
509+
src/Text/Pandoc/Citeproc/BibTeX.hs+73−314
@@ -1,5 +1,4 @@
11{-# LANGUAGE ViewPatterns #-}
2−{-# LANGUAGE LambdaCase #-}
32{-# LANGUAGE OverloadedStrings #-}
43{-# LANGUAGE ScopedTypeVariables #-}
54{-# LANGUAGE FlexibleContexts #-}
@@ -18,7 +17,6 @@
1817module Text.Pandoc.Citeproc.BibTeX
1918 ( Variant(..)
2019 , readBibtexString
21− , writeBibtexString
2220 )
2321 where
2422
@@ -26,11 +24,10 @@ import Text.Pandoc.Definition
2624import Text.Pandoc.Builder as B
2725import Text.Pandoc.Readers.LaTeX (readLaTeX)
2826import Text.Pandoc.Extensions (Extension(..), extensionsFromList)
29−import Text.Pandoc.Options (ReaderOptions(..), WriterOptions)
27+import Text.Pandoc.Options (ReaderOptions(..))
28+import Text.Pandoc.Class (runPure)
3029import Text.Pandoc.Error (PandocError)
3130import Text.Pandoc.Shared (stringify)
32−import Text.Pandoc.Writers.LaTeX (writeLaTeX)
33−import Text.Pandoc.Class (runPure)
3431import qualified Text.Pandoc.Walk as Walk
3532import Citeproc.Types
3633import Citeproc.Pandoc ()
@@ -41,7 +38,7 @@ import Data.Text (Text)
4138import qualified Data.Text as T
4239import qualified Data.Map as Map
4340import Data.Maybe
44−import Text.Pandoc.Parsing hiding ((<|>), many)
41+import Text.Parsec hiding (State, many, (<|>))
4542import Control.Applicative
4643import Data.List.Split (splitOn, splitWhen, wordsBy)
4744import Control.Monad.RWS hiding ((<>))
@@ -49,302 +46,34 @@ import qualified Data.Sequence as Seq
4946import Data.Char (isAlphaNum, isDigit, isLetter,
5047 isUpper, toLower, toUpper,
5148 isLower, isPunctuation)
52−import Data.List (foldl', intercalate, intersperse)
49+import Data.List (foldl', intercalate)
5350import Safe (readMay)
54−import Text.Printf (printf)
55−import Text.DocLayout (literal, hsep, nest, hang, Doc(..),
56− braces, ($$), cr)
5751
5852data Variant = Bibtex | Biblatex
5953 deriving (Show, Eq, Ord)
6054
6155-- | Parse BibTeX or BibLaTeX into a list of 'Reference's.
62−readBibtexString :: ToSources a
63− => Variant -- ^ bibtex or biblatex
56+readBibtexString :: Variant -- ^ bibtex or biblatex
6457 -> Locale -- ^ Locale
6558 -> (Text -> Bool) -- ^ Filter on citation ids
66− -> a -- ^ bibtex/biblatex text
59+ -> Text -- ^ bibtex/biblatex text
6760 -> Either ParseError [Reference Inlines]
6861readBibtexString variant locale idpred contents = do
6962 case runParser (((resolveCrossRefs variant <$> bibEntries) <* eof) >>=
7063 mapM (itemToReference locale variant) .
71− filter (\item -> idpred (identifier item) &&
72− entryType item /= "xdata"))
64+ filter (idpred . identifier))
7365 (fromMaybe defaultLang $ localeLanguage locale, Map.empty)
74− (initialSourceName sources) sources of
66+ "" contents of
7567 Left err -> Left err
7668 Right xs -> return xs
77− where
78− sources = toSources contents
79−
80−-- | Write BibTeX or BibLaTeX given given a 'Reference'.
81−writeBibtexString :: WriterOptions -- ^ options (for writing LaTex)
82− -> Variant -- ^ bibtex or biblatex
83− -> Maybe Lang -- ^ Language
84− -> Reference Inlines -- ^ Reference to write
85− -> Doc Text
86−writeBibtexString opts variant mblang ref =
87− "@" <> bibtexType <> "{" <> literal (unItemId (referenceId ref)) <> ","
88− $$ nest 2 (renderFields fs)
89− $$ "}" <> cr
90−
91− where
92− bibtexType =
93− case referenceType ref of
94− "article-magazine" -> "article"
95− "article-newspaper" -> "article"
96− "article-journal" -> "article"
97− "book" -> "book"
98− "pamphlet" -> "booklet"
99− "dataset" | variant == Biblatex -> "dataset"
100− "webpage" | variant == Biblatex -> "online"
101− "chapter" -> case getVariable "editor" of
102− Just _ -> "incollection"
103− Nothing -> "inbook"
104− "entry-encyclopedia" | variant == Biblatex -> "inreference"
105− | otherwise -> "inbook"
106− "paper-conference" -> "inproceedings"
107− "thesis" -> case getVariableAsText "genre" of
108− Just "mathesis" -> "mastersthesis"
109− _ -> "phdthesis"
110− "patent" | variant == Biblatex -> "patent"
111− "report" | variant == Biblatex -> "report"
112− | otherwise -> "techreport"
113− "speech" -> "unpublished"
114− "manuscript" -> "unpublished"
115− "graphic" | variant == Biblatex -> "artwork"
116− "song" | variant == Biblatex -> "music"
117− "legal_case" | variant == Biblatex -> "jurisdictionN"
118− "legislation" | variant == Biblatex -> "legislation"
119− "treaty" | variant == Biblatex -> "legal"
120− "personal_communication" | variant == Biblatex -> "letter"
121− "motion_picture" | variant == Biblatex -> "movie"
122− "review" | variant == Biblatex -> "review"
123− _ -> "misc"
124−
125− mbSubtype =
126− case referenceType ref of
127− "article-magazine" -> Just "magazine"
128− "article-newspaper" -> Just "newspaper"
129− _ -> Nothing
130−
131− fs =
132− case variant of
133− Biblatex ->
134− [ "author"
135− , "editor"
136− , "translator"
137− , "publisher"
138− , "title"
139− , "booktitle"
140− , "journal"
141− , "series"
142− , "edition"
143− , "volume"
144− , "volumes"
145− , "number"
146− , "pages"
147− , "date"
148− , "eventdate"
149− , "urldate"
150− , "address"
151− , "url"
152− , "doi"
153− , "isbn"
154− , "issn"
155− , "type"
156− , "entrysubtype"
157− , "note"
158− , "langid"
159− , "abstract"
160− , "keywords"
161− , "annote"
162− ]
163− Bibtex ->
164− [ "author"
165− , "editor"
166− , "translator"
167− , "publisher"
168− , "title"
169− , "booktitle"
170− , "journal"
171− , "series"
172− , "edition"
173− , "volume"
174− , "number"
175− , "pages"
176− , "year"
177− , "month"
178− , "address"
179− , "type"
180− , "note"
181− , "annote"
182− ]
183−
184− valToInlines (TextVal t) = B.text t
185− valToInlines (FancyVal ils) = ils
186− valToInlines (NumVal n) = B.text (T.pack $ show n)
187− valToInlines (NamesVal names) =
188− mconcat $ intersperse (B.space <> B.text "and" <> B.space)
189− $ map renderName names
190− valToInlines (DateVal date) = B.text $
191− case dateLiteral date of
192− Just t -> t
193− Nothing -> T.intercalate "/" (map renderDatePart (dateParts date)) <>
194− (if dateCirca date then "~" else mempty)
195−
196− renderDatePart (DateParts xs) = T.intercalate "-" $
197− map (T.pack . printf "%02d") xs
198−
199− renderName name =
200− case nameLiteral name of
201− Just t -> B.text t
202− Nothing -> spacedMaybes
203− [ nameNonDroppingParticle name
204− , nameFamily name
205− , if nameCommaSuffix name
206− then (", " <>) <$> nameSuffix name
207− else nameSuffix name ]
208− <>
209− spacedMaybes
210− [ (", " <>) <$> nameGiven name,
211− nameDroppingParticle name ]
212−
213− mblang' = case getVariableAsText "language" of
214− Just l -> either (const Nothing) Just $ parseLang l
215− Nothing -> mblang
216−
217− titlecase = case mblang' of
218− Just lang | langLanguage lang == "en"
219− -> titlecase'
220− Nothing -> titlecase'
221− _ ->
222− case variant of
223− Bibtex -> B.spanWith nullAttr
224− -- BibTex lacks a language field, so we wrap non-English
225− -- titles in {} to protect case.
226− Biblatex -> id
227−
228− titlecase' = addTextCase mblang' TitleCase .
229− (\ils -> B.fromList
230− (case B.toList ils of
231− Str t : xs -> Str t : Walk.walk spanAroundCapitalizedWords xs
232− xs -> Walk.walk spanAroundCapitalizedWords xs))
233−
234− -- protect capitalized words when we titlecase
235− spanAroundCapitalizedWords (Str t)
236− | not (T.all (\c -> isLower c || not (isLetter c)) t) =
237− Span ("",["nocase"],[]) [Str t]
238− spanAroundCapitalizedWords x = x
239−
240− spacedMaybes = mconcat . intersperse B.space . mapMaybe (fmap B.text)
241−
242− toLaTeX x =
243− case runPure (writeLaTeX opts $ doc (B.plain x)) of
244− Left _ -> Nothing
245− Right t -> Just $ hsep . map literal $ T.words t
246−
247− renderField :: Text -> Maybe (Doc Text)
248− renderField name =
249− (((literal name) <>) . hang 2 " = " . braces)
250− <$> getContentsFor name
251−
252− getVariable v = lookupVariable (toVariable v) ref
253−
254− getVariableAsText v = (stringify . valToInlines) <$> getVariable v
255−
256− getYear val =
257− case val of
258− DateVal date ->
259− case dateLiteral date of
260− Just t -> toLaTeX (B.text t)
261− Nothing ->
262− case dateParts date of
263− [DateParts (y1:_), DateParts (y2:_)] ->
264− Just $ literal (T.pack (printf "%04d" y1) <> "--" <>
265− T.pack (printf "%04d" y2))
266− [DateParts (y1:_)] ->
267− Just $ literal (T.pack (printf "%04d" y1))
268− _ -> Nothing
269− _ -> Nothing
270−
271− toMonth 1 = "jan"
272− toMonth 2 = "feb"
273− toMonth 3 = "mar"
274− toMonth 4 = "apr"
275− toMonth 5 = "may"
276− toMonth 6 = "jun"
277− toMonth 7 = "jul"
278− toMonth 8 = "aug"
279− toMonth 9 = "sep"
280− toMonth 10 = "oct"
281− toMonth 11 = "nov"
282− toMonth 12 = "dec"
283− toMonth x = T.pack $ show x
284−
285− getMonth val =
286− case val of
287− DateVal date ->
288− case dateParts date of
289− [DateParts (_:m1:_), DateParts (_:m2:_)] ->
290− Just $ literal (toMonth m1 <> "--" <> toMonth m2)
291− [DateParts (_:m1:_)] -> Just $ literal (toMonth m1)
292− _ -> Nothing
293− _ -> Nothing
294−
295− getContentsFor :: Text -> Maybe (Doc Text)
296− getContentsFor "type" =
297− getVariableAsText "genre" >>=
298− \case
299− "mathesis" -> Just "mastersthesis"
300− "phdthesis" -> Just "phdthesis"
301− _ -> Nothing
302− getContentsFor "entrysubtype" = literal <$> mbSubtype
303− getContentsFor "journal"
304− | bibtexType `elem` ["article", "periodical", "suppperiodical", "review"]
305− = getVariable "container-title" >>= toLaTeX . valToInlines
306− | otherwise = Nothing
307− getContentsFor "booktitle"
308− | bibtexType `elem`
309− ["inbook","incollection","inproceedings","inreference","bookinbook"]
310− = (getVariable "volume-title" <|> getVariable "container-title")
311− >>= toLaTeX . valToInlines
312− | otherwise = Nothing
313− getContentsFor "series" = getVariable "collection-title"
314− >>= toLaTeX . valToInlines
315− getContentsFor "address" = getVariable "publisher-place"
316− >>= toLaTeX . valToInlines
317− getContentsFor "date" = getVariable "issued" >>= toLaTeX . valToInlines
318− getContentsFor "eventdate" = getVariable "event-date" >>= toLaTeX . valToInlines
319− getContentsFor "urldate" = getVariable "accessed" >>= toLaTeX . valToInlines
320− getContentsFor "year" = getVariable "issued" >>= getYear
321− getContentsFor "month" = getVariable "issued" >>= getMonth
322− getContentsFor "pages" = getVariable "page" >>= toLaTeX . valToInlines
323− getContentsFor "langid" = getVariable "language" >>= toLaTeX . valToInlines
324− getContentsFor "number" = (getVariable "number"
325− <|> getVariable "collection-number"
326− <|> getVariable "issue") >>= toLaTeX . valToInlines
327−
328− getContentsFor x = getVariable x >>=
329− if isURL x
330− then Just . literal . stringify . valToInlines
331− else toLaTeX .
332− (if x == "title"
333− then titlecase
334− else id) .
335− valToInlines
336−
337− isURL x = x `elem` ["url","doi","issn","isbn"]
338−
339− renderFields = mconcat . intersperse ("," <> cr) . mapMaybe renderField
34069
34170defaultLang :: Lang
342−defaultLang = Lang "en" Nothing (Just "US") [] [] []
71+defaultLang = Lang "en" (Just "US")
34372
34473-- a map of bibtex "string" macros
34574type StringMap = Map.Map Text Text
34675
347−type BibParser = Parser Sources (Lang, StringMap)
76+type BibParser = Parsec Text (Lang, StringMap)
34877
34978data Item = Item{ identifier :: Text
35079 , sourcePos :: SourcePos
@@ -359,7 +88,9 @@ itemToReference locale variant item = do
35988 bib item $ do
36089 let lang = fromMaybe defaultLang $ localeLanguage locale
36190 modify $ \st -> st{ localeLang = lang,
362− untitlecase = langLanguage lang == "en" }
91+ untitlecase = case lang of
92+ (Lang "en" _) -> True
93+ _ -> False }
36394
36495 id' <- asks identifier
36596 otherIds <- (Just <$> getRawField "ids")
@@ -583,10 +314,10 @@ itemToReference locale variant item = do
583314 eprint <- getRawField "eprint"
584315 let baseUrl =
585316 case T.toLower etype of
586− "arxiv" -> "https://arxiv.org/abs/"
587− "jstor" -> "https://www.jstor.org/stable/"
588− "pubmed" -> "https://www.ncbi.nlm.nih.gov/pubmed/"
589− "googlebooks" -> "https://books.google.com?id="
317+ "arxiv" -> "http://arxiv.org/abs/"
318+ "jstor" -> "http://www.jstor.org/stable/"
319+ "pubmed" -> "http://www.ncbi.nlm.nih.gov/pubmed/"
320+ "googlebooks" -> "http://books.google.com?id="
590321 _ -> ""
591322 if T.null baseUrl
592323 then mzero
@@ -717,7 +448,7 @@ itemToReference locale variant item = do
717448
718449
719450bib :: Item -> Bib a -> BibParser a
720−bib entry m = fst <$> evalRWST m entry (BibState True defaultLang)
451+bib entry m = fst <$> evalRWST m entry (BibState True (Lang "en" (Just "US")))
721452
722453resolveCrossRefs :: Variant -> [Item] -> [Item]
723454resolveCrossRefs variant entries =
@@ -770,10 +501,41 @@ blocksToInlines bs =
770501 _ -> B.fromList $ Walk.query (:[]) bs
771502
772503adjustSpans :: Lang -> Inline -> Inline
773−adjustSpans lang (Span ("",[],[("bibstring",s)]) _) = Str $ resolveKey' lang s
504+adjustSpans lang (RawInline (Format "latex") s)
505+ | s == "\\hyphen" || s == "\\hyphen " = Str "-"
506+ | otherwise = parseRawLaTeX lang s
774507adjustSpans _ SoftBreak = Space
775508adjustSpans _ x = x
776509
510+parseRawLaTeX :: Lang -> Text -> Inline
511+parseRawLaTeX lang t@(T.stripPrefix "\\" -> Just xs) =
512+ case parseLaTeX lang contents of
513+ Right [Para ys] -> f command ys
514+ Right [Plain ys] -> f command ys
515+ Right [] -> f command []
516+ _ -> RawInline (Format "latex") t
517+ where (command', contents') = T.break (\c -> c =='{' || c =='\\') xs
518+ command = T.strip command'
519+ contents = T.drop 1 $ T.dropEnd 1 contents'
520+ f "mkbibquote" ils = Span nullAttr [Quoted DoubleQuote ils]
521+ f "mkbibemph" ils = Span nullAttr [Emph ils]
522+ f "mkbibitalic" ils = Span nullAttr [Emph ils]
523+ f "mkbibbold" ils = Span nullAttr [Strong ils]
524+ f "mkbibparens" ils = Span nullAttr $
525+ [Str "("] ++ ils ++ [Str ")"]
526+ f "mkbibbrackets" ils = Span nullAttr $
527+ [Str "["] ++ ils ++ [Str "]"]
528+ -- ... both should be nestable & should work in year fields
529+ f "autocap" ils = Span nullAttr ils
530+ -- TODO: should work in year fields
531+ f "textnormal" ils = Span ("",["nodecor"],[]) ils
532+ f "bibstring" [Str s] = Str $ resolveKey' lang s
533+ f "adddot" [] = Str "."
534+ f "adddotspace" [] = Span nullAttr [Str ".", Space]
535+ f "addabbrvspace" [] = Space
536+ f _ ils = Span nullAttr ils
537+parseRawLaTeX _ t = RawInline (Format "latex") t
538+
777539latex' :: Text -> Bib [Block]
778540latex' t = do
779541 lang <- gets localeLang
@@ -834,14 +596,11 @@ bibString = do
834596 updateState (\(l,m) -> (l, Map.insert k v m))
835597 return ()
836598
837−take1WhileP :: Monad m => (Char -> Bool) -> ParserT Sources u m Text
838−take1WhileP f = T.pack <$> many1 (satisfy f)
839−
840599inBraces :: BibParser Text
841−inBraces = do
600+inBraces = try $ do
842601 char '{'
843602 res <- manyTill
844− ( take1WhileP (\c -> c /= '{' && c /= '}' && c /= '\\')
603+ ( (T.pack <$> many1 (noneOf "{}\\"))
845604 <|> (char '\\' >> ( (char '{' >> return "\\{")
846605 <|> (char '}' >> return "\\}")
847606 <|> return "\\"))
@@ -856,36 +615,35 @@ inQuotes :: BibParser Text
856615inQuotes = do
857616 char '"'
858617 T.concat <$> manyTill
859− ( take1WhileP (\c -> c /= '{' && c /= '"' && c /= '\\')
618+ ( (T.pack <$> many1 (noneOf "\"\\{"))
860619 <|> (char '\\' >> T.cons '\\' . T.singleton <$> anyChar)
861620 <|> braced <$> inBraces
862621 ) (char '"')
863622
864623fieldName :: BibParser Text
865−fieldName = resolveAlias . T.toLower
866− <$> take1WhileP (\c ->
867− isAlphaNum c || c == '-' || c == '_' || c == ':' || c == '+')
624+fieldName = resolveAlias . T.toLower . T.pack
625+ <$> many1 (letter <|> digit <|> oneOf "-_:+")
868626
869627isBibtexKeyChar :: Char -> Bool
870628isBibtexKeyChar c =
871− isAlphaNum c || c `elem` (".:;?!`'()$/*@_+=-[]*&" :: [Char])
629+ isAlphaNum c || c `elem` (".:;?!`'()/*@_+=-[]*&" :: [Char])
872630
873631bibItem :: BibParser Item
874632bibItem = do
875633 char '@'
876634 pos <- getPosition
877− enttype <- T.toLower <$> take1WhileP isLetter
635+ enttype <- map toLower <$> many1 letter
878636 spaces
879637 char '{'
880638 spaces
881− entid <- take1WhileP isBibtexKeyChar
639+ entid <- many1 (satisfy isBibtexKeyChar)
882640 spaces
883641 char ','
884642 spaces
885643 entfields <- entField `sepEndBy` (char ',' >> spaces)
886644 spaces
887645 char '}'
888− return $ Item entid pos enttype (Map.fromList entfields)
646+ return $ Item (T.pack entid) pos (T.pack enttype) (Map.fromList entfields)
889647
890648entField :: BibParser (Text, Text)
891649entField = do
@@ -904,7 +662,7 @@ resolveAlias "primaryclass" = "eprintclass"
904662resolveAlias s = s
905663
906664rawWord :: BibParser Text
907−rawWord = take1WhileP isAlphaNum
665+rawWord = T.pack <$> many1 alphaNum
908666
909667expandString :: BibParser Text
910668expandString = do
@@ -1052,21 +810,22 @@ getOldDate prefix = do
1052810 let dateparts = filter (\x -> x /= DateParts [])
1053811 $ map toDateParts [(year',month',day'),
1054812 (endyear',endmonth',endday')]
1055− literal' <- if null dateparts
1056− then Just <$> getRawField (prefix <> "year")
1057− else return Nothing
813+ literal <- if null dateparts
814+ then Just <$> getRawField (prefix <> "year")
815+ else return Nothing
1058816 return $
1059817 Date { dateParts = dateparts
1060818 , dateCirca = False
1061819 , dateSeason = Nothing
1062− , dateLiteral = literal' }
820+ , dateLiteral = literal }
1063821
1064822getRawField :: Text -> Bib Text
1065−getRawField f = do
1066− fs <- asks fields
1067− case Map.lookup f fs of
1068− Just x -> return x
1069− Nothing -> notFound f
823+getRawField f =
824+ (stringify <$> getField f)
825+ <|> do fs <- asks fields
826+ case Map.lookup f fs of
827+ Just x -> return x
828+ Nothing -> notFound f
1070829
1071830getLiteralList :: Text -> Bib [Inlines]
1072831getLiteralList f = do
@@ -1298,6 +1057,7 @@ getTypeAndGenre :: Bib (Text, Maybe Text)
12981057getTypeAndGenre = do
12991058 lang <- gets localeLang
13001059 et <- asks entryType
1060+ guard $ et /= "xdata"
13011061 reftype' <- resolveKey' lang <$> getRawField "type"
13021062 <|> return mempty
13031063 st <- getRawField "entrysubtype" <|> return mempty
@@ -1465,9 +1225,8 @@ resolveKey lang ils = Walk.walk go ils
14651225 go x = x
14661226
14671227resolveKey' :: Lang -> Text -> Text
1468−resolveKey' lang k =
1469− case Map.lookup (langLanguage lang) biblatexStringMap >>=
1470− Map.lookup (T.toLower k) of
1228+resolveKey' lang@(Lang l _) k =
1229+ case Map.lookup l biblatexStringMap >>= Map.lookup (T.toLower k) of
14711230 Nothing -> k
14721231 Just (x, _) -> either (const k) stringify $ parseLaTeX lang x
14731232
src/Text/Pandoc/Citeproc/Data.hs+6−7
@@ -10,7 +10,7 @@ import qualified Data.Text.Encoding as TE
1010import qualified Data.Text as T
1111import Data.Text (Text)
1212import Text.Pandoc.Citeproc.Util (toIETF)
13−import Text.Collate.Lang (Lang(..), parseLang)
13+import Citeproc (Lang(..), parseLang)
1414
1515biblatexLocalizations :: [(FilePath, ByteString)]
1616biblatexLocalizations = $(embedDir "citeproc/biblatex-localization")
@@ -21,12 +21,11 @@ biblatexStringMap :: M.Map Text (M.Map Text (Text, Text))
2121biblatexStringMap = foldr go mempty biblatexLocalizations
2222 where
2323 go (fp, bs) =
24− let ls = T.lines $ TE.decodeUtf8 bs
25− in case parseLang (toIETF $ T.takeWhile (/= '.') $ T.pack fp) of
26− Right lang | length ls > 4
27− -> M.insert (langLanguage lang)
28− (toStringMap $ map (T.splitOn "|") ls)
29− _ -> id
24+ let Lang lang _ = parseLang (toIETF $ T.takeWhile (/= '.') $ T.pack fp)
25+ ls = T.lines $ TE.decodeUtf8 bs
26+ in if length ls > 4
27+ then M.insert lang (toStringMap $ map (T.splitOn "|") ls)
28+ else id
3029 toStringMap = foldr go' mempty
3130 go' [term, x, y] = M.insert term (x, y)
3231 go' _ = id
src/Text/Pandoc/Citeproc/Locator.hs+4−20
@@ -7,7 +7,6 @@ where
77import Citeproc.Types
88import Data.Text (Text)
99import qualified Data.Text as T
10−import Data.List (foldl')
1110import Text.Parsec
1211import Text.Pandoc.Definition
1312import Text.Pandoc.Parsing (romanNumeral)
@@ -20,7 +19,7 @@ parseLocator :: Locale -> [Inline] -> (Maybe (Text, Text), [Inline])
2019parseLocator locale inp =
2120 case parse (pLocatorWords (toLocatorMap locale)) "suffix" $ splitInp inp of
2221 Right r -> r
23− Left _ -> (Nothing, maybeAddComma inp)
22+ Left _ -> (Nothing, inp)
2423
2524splitInp :: [Inline] -> [Inline]
2625splitInp = splitStrWhen (\c -> isSpace c || (isPunctuation c && c /= ':'))
@@ -42,17 +41,9 @@ pLocatorWords locMap = do
4241 -- i.e. the first one will be " 9"
4342 return $
4443 if T.null la && T.null lo
45− then (Nothing, maybeAddComma s)
44+ then (Nothing, s)
4645 else (Just (la, T.strip lo), s)
4746
48−maybeAddComma :: [Inline] -> [Inline]
49−maybeAddComma [] = []
50−maybeAddComma ils@(Space : _) = ils
51−maybeAddComma ils@(Str t : _)
52− | Just (c, _) <- T.uncons t
53− , isPunctuation c = ils
54−maybeAddComma ils = Str "," : Space : ils
55−
5647pLocatorDelimited :: LocatorMap -> LocatorParser (Text, Text)
5748pLocatorDelimited locMap = try $ do
5849 _ <- pMatchChar "{" (== '{')
@@ -105,7 +96,7 @@ pLocatorLabel' locMap lim = go ""
10596 t <- anyToken
10697 ts <- manyTill anyToken (try $ lookAhead lim)
10798 let s = acc <> stringify (t:ts)
108− case M.lookup (T.toCaseFold $ T.strip s) locMap of
99+ case M.lookup (T.strip s) locMap of
109100 -- try to find a longer one, or return this one
110101 Just l -> go s <|> return (l, False)
111102 Nothing -> go s
@@ -148,7 +139,7 @@ pBalancedBraces braces p = try $ do
148139 where
149140 except = notFollowedBy pBraces >> p
150141 -- outer and inner
151− surround = foldl' (\a (open, close) -> sur open close except <|> a)
142+ surround = foldl (\a (open, close) -> sur open close except <|> a)
152143 except
153144 braces
154145
@@ -189,7 +180,6 @@ pPageUnit = roman <|> plainUnit
189180 plainUnit = do
190181 ts <- many1 (notFollowedBy pSpace >>
191182 notFollowedBy pLocatorPunct >>
192− notFollowedBy pMath >>
193183 anyToken)
194184 let s = stringify ts
195185 -- otherwise look for actual digits or -s
@@ -220,12 +210,6 @@ pMatchChar msg f = satisfyTok f' <?> msg
220210pSpace :: LocatorParser Inline
221211pSpace = satisfyTok (\t -> isSpacey t || t == Str "\160") <?> "space"
222212
223−pMath :: LocatorParser Inline
224−pMath = satisfyTok isMath
225− where
226− isMath (Math{}) = True
227− isMath _ = False
228−
229213satisfyTok :: (Inline -> Bool) -> LocatorParser Inline
230214satisfyTok f = tokenPrim show (\sp _ _ -> sp) (\tok -> if f tok
231215 then Just tok
src/Text/Pandoc/Citeproc/MetaValue.hs+6−9
@@ -97,13 +97,11 @@ dateToMetaValue date =
9797 | y < -1 -> printf "%05d-%02d" (y+1) m
9898 | otherwise -> printf "%04d-%02d" y m
9999 (y:[])
100− | y == 0 -> printf "" -- used for open range
101100 | y < -1 -> printf "%05d" (y+1)
102101 | otherwise -> printf "%04d" y
103102 _ -> mempty
104103
105−metaValueToReference :: MetaValue
106− -> Maybe (Reference Inlines)
104+metaValueToReference :: MetaValue -> Maybe (Reference Inlines)
107105metaValueToReference (MetaMap m) = do
108106 let m' = M.mapKeys normalizeKey m
109107 id' <- M.lookup "id" m' >>= metaValueToText
@@ -135,25 +133,23 @@ metaValueToVal k v
135133 MetaMap _ -> TextVal mempty
136134
137135metaValueToDate :: MetaValue -> Date
138−metaValueToDate (MetaMap m) = fromMaybe
139− (Date
136+metaValueToDate (MetaMap m) =
137+ Date
140138 { dateParts = dateparts
141139 , dateCirca = circa
142140 , dateSeason = season
143− , dateLiteral = literal })
144− rawdate
141+ , dateLiteral = literal }
145142 where
146143 dateparts = case M.lookup "date-parts" m of
147144 Just (MetaList xs) ->
148145 mapMaybe metaValueToDateParts xs
149146 Just _ -> []
150147 Nothing ->
151− maybeToList $ metaValueToDateParts (MetaMap m)
148+ maybe [] (:[]) $ metaValueToDateParts (MetaMap m)
152149 circa = fromMaybe False $
153150 M.lookup "circa" m >>= metaValueToBool
154151 season = M.lookup "season" m >>= metaValueToInt
155152 literal = M.lookup "literal" m >>= metaValueToText
156− rawdate = M.lookup "raw" m >>= metaValueToText >>= rawDateEDTF
157153metaValueToDate (MetaList xs) =
158154 Date{ dateParts = mapMaybe metaValueToDateParts xs
159155 , dateCirca = False
@@ -253,3 +249,4 @@ normalizeKey k =
253249 "pmid" -> "PMID"
254250 "url" -> "URL"
255251 x -> x
252+
src/Text/Pandoc/Class/CommonState.hs+1−1
@@ -19,7 +19,7 @@ where
1919
2020import Data.Default (Default (def))
2121import Data.Text (Text)
22−import Text.Collate.Lang (Lang)
22+import Text.Pandoc.BCP47 (Lang)
2323import Text.Pandoc.MediaBag (MediaBag)
2424import Text.Pandoc.Logging (LogMessage, Verbosity (WARNING))
2525import Text.Pandoc.Translations (Translations)
src/Text/Pandoc/Class/IO.hs+24−24
@@ -62,7 +62,7 @@ import Text.Pandoc.Definition (Pandoc, Inline (Image))
6262import Text.Pandoc.Error (PandocError (..))
6363import Text.Pandoc.Logging (LogMessage (..), messageVerbosity, showLogMessage)
6464import Text.Pandoc.MIME (MimeType)
65−import Text.Pandoc.MediaBag (MediaBag, MediaItem(..), lookupMedia, mediaItems)
65+import Text.Pandoc.MediaBag (MediaBag, lookupMedia, mediaDirectory)
6666import Text.Pandoc.Walk (walk)
6767import qualified Control.Exception as E
6868import qualified Data.ByteString as B
@@ -183,7 +183,7 @@ getModificationTime = liftIOError System.Directory.getModificationTime
183183logOutput :: (PandocMonad m, MonadIO m) => LogMessage -> m ()
184184logOutput msg = liftIO $ do
185185 UTF8.hPutStr stderr $
186− "[" <> T.pack (show (messageVerbosity msg)) <> "] "
186+ "[" ++ show (messageVerbosity msg) ++ "] "
187187 alertIndent $ T.lines $ showLogMessage msg
188188
189189-- | Prints the list of lines to @stderr@, indenting every but the first
@@ -191,41 +191,41 @@ logOutput msg = liftIO $ do
191191alertIndent :: [Text] -> IO ()
192192alertIndent [] = return ()
193193alertIndent (l:ls) = do
194− UTF8.hPutStrLn stderr l
194+ UTF8.hPutStrLn stderr $ unpack l
195195 mapM_ go ls
196196 where go l' = do UTF8.hPutStr stderr " "
197− UTF8.hPutStrLn stderr l'
197+ UTF8.hPutStrLn stderr $ unpack l'
198198
199199-- | Extract media from the mediabag into a directory.
200200extractMedia :: (PandocMonad m, MonadIO m) => FilePath -> Pandoc -> m Pandoc
201201extractMedia dir d = do
202202 media <- getMediaBag
203− let items = mediaItems media
204− if null items
205− then return d
206− else do
207− mapM_ (writeMedia dir) items
208− return $ walk (adjustImagePath dir media) d
203+ case [fp | (fp, _, _) <- mediaDirectory media] of
204+ [] -> return d
205+ fps -> do
206+ mapM_ (writeMedia dir media) fps
207+ return $ walk (adjustImagePath dir fps) d
209208
210209-- | Write the contents of a media bag to a path.
211210writeMedia :: (PandocMonad m, MonadIO m)
212− => FilePath
213− -> (FilePath, MimeType, BL.ByteString)
211+ => FilePath -> MediaBag -> FilePath
214212 -> m ()
215−writeMedia dir (fp, _mt, bs) = do
216− -- we normalize to get proper path separators for the platform
217− let fullpath = normalise $ dir </> fp
218− liftIOError (createDirectoryIfMissing True) (takeDirectory fullpath)
219− logIOError $ BL.writeFile fullpath bs
213+writeMedia dir mediabag subpath = do
214+ -- we join and split to convert a/b/c to a\b\c on Windows;
215+ -- in zip containers all paths use /
216+ let fullpath = dir </> unEscapeString (normalise subpath)
217+ let mbcontents = lookupMedia subpath mediabag
218+ case mbcontents of
219+ Nothing -> throwError $ PandocResourceNotFound $ pack subpath
220+ Just (_, bs) -> do
221+ report $ Extracting $ pack fullpath
222+ liftIOError (createDirectoryIfMissing True) (takeDirectory fullpath)
223+ logIOError $ BL.writeFile fullpath bs
220224
221225-- | If the given Inline element is an image with a @src@ path equal to
222226-- one in the list of @paths@, then prepends @dir@ to the image source;
223227-- returns the element unchanged otherwise.
224−adjustImagePath :: FilePath -> MediaBag -> Inline -> Inline
225−adjustImagePath dir mediabag (Image attr lab (src, tit)) =
226− case lookupMedia (T.unpack src) mediabag of
227− Nothing -> Image attr lab (src, tit)
228− Just item ->
229− let fullpath = dir </> mediaPath item
230− in Image attr lab (T.pack fullpath, tit)
228+adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
229+adjustImagePath dir paths (Image attr lab (src, tit))
230+ | unpack src `elem` paths = Image attr lab (pack dir <> "/" <> src, tit)
231231adjustImagePath _ _ x = x
src/Text/Pandoc/Class/PandocMonad.hs+38−45
@@ -1,5 +1,4 @@
11{-# LANGUAGE CPP #-}
2−{-# LANGUAGE TupleSections #-}
32{-# LANGUAGE FlexibleContexts #-}
43{-# LANGUAGE FlexibleInstances #-}
54{-# LANGUAGE MultiParamTypeClasses #-}
@@ -38,6 +37,7 @@ module Text.Pandoc.Class.PandocMonad
3837 , setUserDataDir
3938 , getUserDataDir
4039 , fetchItem
40+ , fetchMediaResource
4141 , getInputFiles
4242 , setInputFiles
4343 , getOutputFile
@@ -51,31 +51,30 @@ module Text.Pandoc.Class.PandocMonad
5151 , setTranslations
5252 , translateTerm
5353 , makeCanonical
54− , getTimestamp
5554 ) where
5655
5756import Codec.Archive.Zip
5857import Control.Monad.Except (MonadError (catchError, throwError),
5958 MonadTrans, lift, when)
60−import Data.List (foldl')
59+import Data.Digest.Pure.SHA (sha1, showDigest)
60+import Data.Maybe (fromMaybe)
6161import Data.Time (UTCTime)
62−import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds,
63− posixSecondsToUTCTime)
62+import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds)
6463import Data.Time.LocalTime (TimeZone, ZonedTime, utcToZonedTime)
6564import Network.URI ( escapeURIString, nonStrictRelativeTo,
6665 unEscapeString, parseURIReference, isAllowedInURI,
6766 parseURI, URI(..) )
68−import System.FilePath ((</>), takeExtension, dropExtension,
69− isRelative, splitDirectories, makeRelative)
67+import System.FilePath ((</>), (<.>), takeExtension, dropExtension,
68+ isRelative, splitDirectories)
7069import System.Random (StdGen)
71−import Text.Collate.Lang (Lang(..), parseLang, renderLang)
70+import Text.Pandoc.BCP47 (Lang(..), parseBCP47, renderLang)
7271import Text.Pandoc.Class.CommonState (CommonState (..))
7372import Text.Pandoc.Definition
7473import Text.Pandoc.Error
7574import Text.Pandoc.Logging
76−import Text.Pandoc.MIME (MimeType, getMimeType)
77−import Text.Pandoc.MediaBag (MediaBag, lookupMedia, MediaItem(..))
78−import Text.Pandoc.Shared (uriPathToPath, safeRead)
75+import Text.Pandoc.MIME (MimeType, getMimeType, extensionFromMimeType)
76+import Text.Pandoc.MediaBag (MediaBag, lookupMedia)
77+import Text.Pandoc.Shared (uriPathToPath)
7978import Text.Pandoc.Translations (Term(..), Translations, lookupTerm,
8079 readTranslations)
8180import Text.Pandoc.Walk (walkM)
@@ -161,7 +160,7 @@ setVerbosity verbosity =
161160getVerbosity :: PandocMonad m => m Verbosity
162161getVerbosity = getsCommonState stVerbosity
163162
164−-- | Get the accumulated log messages (in temporal order).
163+-- | Get the accomulated log messages (in temporal order).
165164getLog :: PandocMonad m => m [LogMessage]
166165getLog = reverse <$> getsCommonState stLog
167166
@@ -176,21 +175,6 @@ report msg = do
176175 when (level <= verbosity) $ logOutput msg
177176 modifyCommonState $ \st -> st{ stLog = msg : stLog st }
178177
179−-- | Get the time from the @SOURCE_DATE_EPOCH@
180−-- environment variable. The variable should contain a
181−-- unix time stamp, the number of seconds since midnight Jan 01
182−-- 1970 UTC. If the variable is not set or cannot be
183−-- parsed as a unix time stamp, the current time is returned.
184−-- This function is designed to make possible reproducible
185−-- builds in formats that include a creation timestamp.
186−getTimestamp :: PandocMonad m => m UTCTime
187−getTimestamp = do
188− mbSourceDateEpoch <- lookupEnv "SOURCE_DATE_EPOCH"
189− case mbSourceDateEpoch >>= safeRead of
190− Just (epoch :: Integer) ->
191− return $ posixSecondsToUTCTime $ fromIntegral epoch
192− Nothing -> getCurrentTime
193−
194178-- | Determine whether tracing is enabled. This affects
195179-- the behavior of 'trace'. If tracing is not enabled,
196180-- 'trace' does nothing.
@@ -283,7 +267,7 @@ readFileFromDirs (d:ds) f = catchError
283267toLang :: PandocMonad m => Maybe T.Text -> m (Maybe Lang)
284268toLang Nothing = return Nothing
285269toLang (Just s) =
286− case parseLang s of
270+ case parseBCP47 s of
287271 Left _ -> do
288272 report $ InvalidLang s
289273 return Nothing
@@ -374,8 +358,7 @@ fetchItem :: PandocMonad m
374358fetchItem s = do
375359 mediabag <- getMediaBag
376360 case lookupMedia (T.unpack s) mediabag of
377− Just item -> return (BL.toStrict (mediaContents item),
378− Just (mediaMimeType item))
361+ Just (mime, bs) -> return (BL.toStrict bs, Just mime)
379362 Nothing -> downloadOrRead s
380363
381364-- | Returns the content and, if available, the MIME type of a resource.
@@ -410,10 +393,9 @@ downloadOrRead s = do
410393 _ -> readLocalFile fp -- get from local file system
411394 where readLocalFile f = do
412395 resourcePath <- getResourcePath
413− (fp', cont) <- if isRelative f
414− then withPaths resourcePath readFileStrict f
415− else (f,) <$> readFileStrict f
416− report $ LoadedResource f (makeRelative "." fp')
396+ cont <- if isRelative f
397+ then withPaths resourcePath readFileStrict f
398+ else readFileStrict f
417399 return (cont, mime)
418400 httpcolon = URI{ uriScheme = "http:",
419401 uriAuthority = Nothing,
@@ -613,23 +595,35 @@ checkExistence fn = do
613595-- | Canonicalizes a file path by removing redundant @.@ and @..@.
614596makeCanonical :: FilePath -> FilePath
615597makeCanonical = Posix.joinPath . transformPathParts . splitDirectories
616− where transformPathParts = reverse . foldl' go []
598+ where transformPathParts = reverse . foldl go []
617599 go as "." = as
618600 go (_:as) ".." = as
619601 go as x = x : as
620602
621−-- | Tries to run an action on a file: for each directory given, a
603+-- | Trys to run an action on a file: for each directory given, a
622604-- filepath is created from the given filename, and the action is run on
623605-- that filepath. Returns the result of the first successful execution
624606-- of the action, or throws a @PandocResourceNotFound@ exception if the
625607-- action errors for all filepaths.
626−withPaths :: PandocMonad m
627− => [FilePath] -> (FilePath -> m a) -> FilePath -> m (FilePath, a)
608+withPaths :: PandocMonad m => [FilePath] -> (FilePath -> m a) -> FilePath -> m a
628609withPaths [] _ fp = throwError $ PandocResourceNotFound $ T.pack fp
629610withPaths (p:ps) action fp =
630− catchError ((p </> fp,) <$> action (p </> fp))
611+ catchError (action (p </> fp))
631612 (\_ -> withPaths ps action fp)
632613
614+-- | Fetch local or remote resource (like an image) and provide data suitable
615+-- for adding it to the MediaBag.
616+fetchMediaResource :: PandocMonad m
617+ => T.Text -> m (FilePath, Maybe MimeType, BL.ByteString)
618+fetchMediaResource src = do
619+ (bs, mt) <- downloadOrRead src
620+ let ext = fromMaybe (T.pack $ takeExtension $ T.unpack src)
621+ (mt >>= extensionFromMimeType)
622+ let bs' = BL.fromChunks [bs]
623+ let basename = showDigest $ sha1 bs'
624+ let fname = basename <.> T.unpack ext
625+ return (fname, mt, bs')
626+
633627-- | Traverse tree, filling media bag for any images that
634628-- aren't already in the media bag.
635629fillMediaBag :: PandocMonad m => Pandoc -> m Pandoc
@@ -637,13 +631,12 @@ fillMediaBag d = walkM handleImage d
637631 where handleImage :: PandocMonad m => Inline -> m Inline
638632 handleImage (Image attr lab (src, tit)) = catchError
639633 (do mediabag <- getMediaBag
640− let fp = T.unpack src
641− case lookupMedia fp mediabag of
642− Just _ -> return ()
634+ case lookupMedia (T.unpack src) mediabag of
635+ Just (_, _) -> return $ Image attr lab (src, tit)
643636 Nothing -> do
644− (bs, mt) <- fetchItem src
645− insertMedia fp mt (BL.fromStrict bs)
646− return $ Image attr lab (src, tit))
637+ (fname, mt, bs) <- fetchMediaResource src
638+ insertMedia fname mt bs
639+ return $ Image attr lab (T.pack fname, tit))
647640 (\e ->
648641 case e of
649642 PandocResourceNotFound _ -> do
src/Text/Pandoc/Data.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE TemplateHaskell #-}
22{- |
33Module : Text.Pandoc.Data
4−Copyright : Copyright (C) 2013-2021 John MacFarlane
4+Copyright : Copyright (C) 2013-2020 John MacFarlane
55License : GNU GPL, version 2 or above
66
77Maintainer : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Error.hs+51−107
@@ -3,54 +3,51 @@
33{-# LANGUAGE OverloadedStrings #-}
44{- |
55 Module : Text.Pandoc.Error
6− Copyright : Copyright (C) 2006-2021 John MacFarlane
6+ Copyright : Copyright (C) 2006-2020 John MacFarlane
77 License : GNU GPL, version 2 or above
88
99 Maintainer : John MacFarlane <jgm@berkeley.edu>
1010 Stability : alpha
1111 Portability : portable
1212
13−This module provides a standard way to deal with possible errors
14−encountered during parsing.
13+This module provides a standard way to deal with possible errors encounted
14+during parsing.
1515
1616-}
1717module Text.Pandoc.Error (
1818 PandocError(..),
19− renderError,
2019 handleError) where
2120
22−import Control.Exception (Exception, displayException)
21+import Control.Exception (Exception)
2322import Data.Typeable (Typeable)
2423import Data.Word (Word8)
2524import Data.Text (Text)
26−import Data.List (sortOn)
2725import qualified Data.Text as T
28−import Data.Ord (Down(..))
2926import GHC.Generics (Generic)
3027import Network.HTTP.Client (HttpException)
3128import System.Exit (ExitCode (..), exitWith)
3229import System.IO (stderr)
3330import qualified Text.Pandoc.UTF8 as UTF8
34−import Text.Pandoc.Sources (Sources(..))
3531import Text.Printf (printf)
3632import Text.Parsec.Error
3733import Text.Parsec.Pos hiding (Line)
3834import Text.Pandoc.Shared (tshow)
3935import Citeproc (CiteprocError, prettyCiteprocError)
4036
37+type Input = Text
38+
4139data PandocError = PandocIOError Text IOError
4240 | PandocHttpError Text HttpException
4341 | PandocShouldNeverHappenError Text
4442 | PandocSomeError Text
4543 | PandocParseError Text
46− | PandocParsecError Sources ParseError
44+ | PandocParsecError Input ParseError
4745 | PandocMakePDFError Text
4846 | PandocOptionError Text
4947 | PandocSyntaxMapError Text
5048 | PandocFailOnWarningError
5149 | PandocPDFProgramNotFoundError Text
5250 | PandocPDFError Text
53− | PandocXMLError Text Text
5451 | PandocFilterError Text Text
5552 | PandocLuaError Text
5653 | PandocCouldNotFindDataFileError Text
@@ -61,80 +58,70 @@ data PandocError = PandocIOError Text IOError
6158 | PandocMacroLoop Text
6259 | PandocUTF8DecodingError Text Int Word8
6360 | PandocIpynbDecodingError Text
64− | PandocUnsupportedCharsetError Text
6561 | PandocUnknownReaderError Text
6662 | PandocUnknownWriterError Text
6763 | PandocUnsupportedExtensionError Text Text
6864 | PandocCiteprocError CiteprocError
69− | PandocBibliographyError Text Text
7065 deriving (Show, Typeable, Generic)
7166
7267instance Exception PandocError
7368
74−renderError :: PandocError -> Text
75−renderError e =
69+-- | Handle PandocError by exiting with an error message.
70+handleError :: Either PandocError a -> IO a
71+handleError (Right r) = return r
72+handleError (Left e) =
7673 case e of
77− PandocIOError _ err' -> T.pack $ displayException err'
78− PandocHttpError u err' ->
74+ PandocIOError _ err' -> ioError err'
75+ PandocHttpError u err' -> err 61 $
7976 "Could not fetch " <> u <> "\n" <> tshow err'
80− PandocShouldNeverHappenError s ->
77+ PandocShouldNeverHappenError s -> err 62 $
8178 "Something we thought was impossible happened!\n" <>
8279 "Please report this to pandoc's developers: " <> s
83− PandocSomeError s -> s
84− PandocParseError s -> s
85− PandocParsecError (Sources inputs) err' ->
80+ PandocSomeError s -> err 63 s
81+ PandocParseError s -> err 64 s
82+ PandocParsecError input err' ->
8683 let errPos = errorPos err'
8784 errLine = sourceLine errPos
8885 errColumn = sourceColumn errPos
89− errFile = sourceName errPos
90− errorInFile =
91− case sortOn (Down . sourceLine . fst)
92− [ (pos,t)
93− | (pos,t) <- inputs
94− , sourceName pos == errFile
95− , sourceLine pos <= errLine
96− ] of
97− [] -> ""
98− ((pos,txt):_) ->
99− let ls = T.lines txt <> [""]
100− ln = (errLine - sourceLine pos) + 1
101− in if length ls > ln && ln >= 1
102− then T.concat ["\n", ls !! (ln - 1)
103− ,"\n", T.replicate (errColumn - 1) " "
104− ,"^"]
105− else ""
106− in "Error at " <> tshow err' <> errorInFile
107− PandocMakePDFError s -> s
108− PandocOptionError s -> s
109− PandocSyntaxMapError s -> s
110− PandocFailOnWarningError -> "Failing because there were warnings."
111− PandocPDFProgramNotFoundError pdfprog ->
86+ ls = T.lines input <> [""]
87+ errorInFile = if length ls > errLine - 1
88+ then T.concat ["\n", ls !! (errLine - 1)
89+ ,"\n", T.replicate (errColumn - 1) " "
90+ ,"^"]
91+ else ""
92+ in err 65 $ "\nError at " <> tshow err' <>
93+ -- if error comes from a chunk or included file,
94+ -- then we won't get the right text this way:
95+ if sourceName errPos == "source"
96+ then errorInFile
97+ else ""
98+ PandocMakePDFError s -> err 66 s
99+ PandocOptionError s -> err 6 s
100+ PandocSyntaxMapError s -> err 67 s
101+ PandocFailOnWarningError -> err 3 "Failing because there were warnings."
102+ PandocPDFProgramNotFoundError pdfprog -> err 47 $
112103 pdfprog <> " not found. Please select a different --pdf-engine or install " <> pdfprog
113− PandocPDFError logmsg -> "Error producing PDF.\n" <> logmsg
114− PandocXMLError fp logmsg -> "Invalid XML" <>
115− (if T.null fp then "" else " in " <> fp) <> ":\n" <> logmsg
116− PandocFilterError filtername msg -> "Error running filter " <>
104+ PandocPDFError logmsg -> err 43 $ "Error producing PDF.\n" <> logmsg
105+ PandocFilterError filtername msg -> err 83 $ "Error running filter " <>
117106 filtername <> ":\n" <> msg
118− PandocLuaError msg -> "Error running Lua:\n" <> msg
119− PandocCouldNotFindDataFileError fn ->
107+ PandocLuaError msg -> err 84 $ "Error running Lua:\n" <> msg
108+ PandocCouldNotFindDataFileError fn -> err 97 $
120109 "Could not find data file " <> fn
121− PandocResourceNotFound fn ->
110+ PandocResourceNotFound fn -> err 99 $
122111 "File " <> fn <> " not found in resource path"
123− PandocTemplateError s -> "Error compiling template " <> s
124− PandocAppError s -> s
125− PandocEpubSubdirectoryError s ->
112+ PandocTemplateError s -> err 5 $ "Error compiling template " <> s
113+ PandocAppError s -> err 4 s
114+ PandocEpubSubdirectoryError s -> err 31 $
126115 "EPUB subdirectory name '" <> s <> "' contains illegal characters"
127− PandocMacroLoop s ->
116+ PandocMacroLoop s -> err 91 $
128117 "Loop encountered in expanding macro " <> s
129− PandocUTF8DecodingError f offset w ->
118+ PandocUTF8DecodingError f offset w -> err 92 $
130119 "UTF-8 decoding error in " <> f <> " at byte offset " <> tshow offset <>
131120 " (" <> T.pack (printf "%2x" w) <> ").\n" <>
132121 "The input must be a UTF-8 encoded text."
133− PandocIpynbDecodingError w ->
122+ PandocIpynbDecodingError w -> err 93 $
134123 "ipynb decoding error: " <> w
135− PandocUnsupportedCharsetError charset ->
136− "Unsupported charset " <> charset
137− PandocUnknownReaderError r ->
124+ PandocUnknownReaderError r -> err 21 $
138125 "Unknown input format " <> r <>
139126 case r of
140127 "doc" -> "\nPandoc can convert from DOCX, but not from DOC." <>
@@ -142,66 +129,23 @@ renderError e =
142129 " and convert that with pandoc."
143130 "pdf" -> "\nPandoc can convert to PDF, but not from PDF."
144131 _ -> ""
145− PandocUnknownWriterError w ->
132+ PandocUnknownWriterError w -> err 22 $
146133 "Unknown output format " <> w <>
147134 case w of
148135 "pdf" -> "To create a pdf using pandoc, use" <>
149136 " -t latex|beamer|context|ms|html5" <>
150137 "\nand specify an output file with " <>
151138 ".pdf extension (-o filename.pdf)."
152− "doc" -> "\nPandoc can convert to DOCX, but not to DOC."
139+ "doc" -> "\nPandoc can convert to DOCX, but not from DOC."
153140 _ -> ""
154− PandocUnsupportedExtensionError ext f ->
141+ PandocUnsupportedExtensionError ext f -> err 23 $
155142 "The extension " <> ext <> " is not supported " <>
156143 "for " <> f
157− PandocCiteprocError e' ->
144+ PandocCiteprocError e' -> err 24 $
158145 prettyCiteprocError e'
159− PandocBibliographyError fp msg ->
160− "Error reading bibliography file " <> fp <> ":\n" <> msg
161−
162−
163−-- | Handle PandocError by exiting with an error message.
164−handleError :: Either PandocError a -> IO a
165−handleError (Right r) = return r
166−handleError (Left e) =
167− case e of
168− PandocIOError _ err' -> ioError err'
169− _ -> err exitCode (renderError e)
170− where
171− exitCode =
172− case e of
173− PandocIOError{} -> 1
174− PandocHttpError{} -> 61
175− PandocShouldNeverHappenError{} -> 62
176− PandocSomeError{} -> 63
177− PandocParseError{} -> 64
178− PandocParsecError{} -> 65
179− PandocMakePDFError{} -> 66
180− PandocOptionError{} -> 6
181− PandocSyntaxMapError{} -> 67
182− PandocFailOnWarningError{} -> 3
183− PandocPDFProgramNotFoundError{} -> 47
184− PandocPDFError{} -> 43
185− PandocXMLError{} -> 44
186− PandocFilterError{} -> 83
187− PandocLuaError{} -> 84
188− PandocCouldNotFindDataFileError{} -> 97
189− PandocResourceNotFound{} -> 99
190− PandocTemplateError{} -> 5
191− PandocAppError{} -> 4
192− PandocEpubSubdirectoryError{} -> 31
193− PandocMacroLoop{} -> 91
194− PandocUTF8DecodingError{} -> 92
195− PandocIpynbDecodingError{} -> 93
196− PandocUnsupportedCharsetError{} -> 94
197− PandocUnknownReaderError{} -> 21
198− PandocUnknownWriterError{} -> 22
199− PandocUnsupportedExtensionError{} -> 23
200− PandocCiteprocError{} -> 24
201− PandocBibliographyError{} -> 25
202146
203147err :: Int -> Text -> IO a
204148err exitCode msg = do
205− UTF8.hPutStrLn stderr msg
149+ UTF8.hPutStrLn stderr (T.unpack msg)
206150 exitWith $ ExitFailure exitCode
207151 return undefined
src/Text/Pandoc/Extensions.hs+7−36
@@ -6,7 +6,7 @@
66{-# LANGUAGE OverloadedStrings #-}
77{- |
88 Module : Text.Pandoc.Extensions
9− Copyright : Copyright (C) 2012-2021 John MacFarlane
9+ Copyright : Copyright (C) 2012-2020 John MacFarlane
1010 License : GNU GPL, version 2 or above
1111
1212 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -34,7 +34,6 @@ module Text.Pandoc.Extensions ( Extension(..)
3434where
3535import Data.Bits (clearBit, setBit, testBit, (.|.))
3636import Data.Data (Data)
37−import Data.List (foldl')
3837import qualified Data.Text as T
3938import Data.Typeable (Typeable)
4039import GHC.Generics (Generic)
@@ -89,7 +88,6 @@ data Extension =
8988 -- does not affect readers/writers directly; it causes
9089 -- the eastAsianLineBreakFilter to be applied after
9190 -- parsing, in Text.Pandoc.App.convertWithOpts.
92− | Ext_element_citations -- ^ Use element-citation elements for JATS citations
9391 | Ext_emoji -- ^ Support emoji like :smile:
9492 | Ext_empty_paragraphs -- ^ Allow empty paragraphs
9593 | Ext_epub_html_exts -- ^ Recognise the EPUB extended version of HTML
@@ -136,8 +134,6 @@ data Extension =
136134 | Ext_raw_html -- ^ Allow raw HTML
137135 | Ext_raw_tex -- ^ Allow raw TeX (other than math)
138136 | Ext_raw_markdown -- ^ Parse markdown in ipynb as raw markdown
139− | Ext_rebase_relative_paths -- ^ Rebase relative image and link paths,
140− -- relative to directory of containing file
141137 | Ext_shortcut_reference_links -- ^ Shortcut reference links
142138 | Ext_simple_tables -- ^ Pandoc-style simple tables
143139 | Ext_smart -- ^ "Smart" quotes, apostrophes, ellipses, dashes
@@ -153,12 +149,9 @@ data Extension =
153149 | Ext_tex_math_dollars -- ^ TeX math between $..$ or $$..$$
154150 | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\]
155151 | Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\]
156− | Ext_xrefs_name -- ^ Use xrefs with names
157− | Ext_xrefs_number -- ^ Use xrefs with numbers
158152 | Ext_yaml_metadata_block -- ^ YAML metadata block
159153 | Ext_gutenberg -- ^ Use Project Gutenberg conventions for plain
160154 | Ext_attributes -- ^ Generic attribute syntax
161− | Ext_sourcepos -- ^ Include source position attributes
162155 deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
163156
164157-- | Extensions to be used with pandoc-flavored markdown.
@@ -356,14 +349,13 @@ getDefaultExtensions "gfm" = extensionsFromList
356349 , Ext_strikeout
357350 , Ext_task_lists
358351 , Ext_emoji
359− , Ext_yaml_metadata_block
360352 ]
361353getDefaultExtensions "commonmark" = extensionsFromList
362354 [Ext_raw_html]
363355getDefaultExtensions "commonmark_x" = extensionsFromList
364356 [ Ext_pipe_tables
365357 , Ext_raw_html
366− , Ext_gfm_auto_identifiers
358+ , Ext_auto_identifiers
367359 , Ext_strikeout
368360 , Ext_task_lists
369361 , Ext_emoji
@@ -382,11 +374,10 @@ getDefaultExtensions "commonmark_x" = extensionsFromList
382374 , Ext_raw_attribute
383375 , Ext_implicit_header_references
384376 , Ext_attributes
385− , Ext_yaml_metadata_block
377+ , Ext_fenced_code_attributes
386378 ]
387379getDefaultExtensions "org" = extensionsFromList
388380 [Ext_citations,
389− Ext_task_lists,
390381 Ext_auto_identifiers]
391382getDefaultExtensions "html" = extensionsFromList
392383 [Ext_auto_identifiers,
@@ -418,11 +409,6 @@ getDefaultExtensions "textile" = extensionsFromList
418409 Ext_smart,
419410 Ext_raw_html,
420411 Ext_auto_identifiers]
421−getDefaultExtensions "jats" = extensionsFromList
422− [Ext_auto_identifiers]
423−getDefaultExtensions "jats_archiving" = getDefaultExtensions "jats"
424−getDefaultExtensions "jats_publishing" = getDefaultExtensions "jats"
425−getDefaultExtensions "jats_articleauthoring" = getDefaultExtensions "jats"
426412getDefaultExtensions "opml" = pandocExtensions -- affects notes
427413getDefaultExtensions _ = extensionsFromList
428414 [Ext_auto_identifiers]
@@ -464,7 +450,6 @@ getAllExtensions f = universalExtensions <> getAll f
464450 , Ext_gutenberg
465451 , Ext_smart
466452 , Ext_literate_haskell
467− , Ext_rebase_relative_paths
468453 ]
469454 getAll "markdown_strict" = allMarkdownExtensions
470455 getAll "markdown_phpextra" = allMarkdownExtensions
@@ -480,8 +465,6 @@ getAllExtensions f = universalExtensions <> getAll f
480465 getAll "opendocument" = extensionsFromList
481466 [ Ext_empty_paragraphs
482467 , Ext_native_numbering
483− , Ext_xrefs_name
484− , Ext_xrefs_number
485468 ]
486469 getAll "odt" = getAll "opendocument" <> autoIdExtensions
487470 getAll "muse" = autoIdExtensions <>
@@ -491,10 +474,9 @@ getAllExtensions f = universalExtensions <> getAll f
491474 getAll "plain" = allMarkdownExtensions
492475 getAll "gfm" = getAll "commonmark"
493476 getAll "commonmark" =
477+ autoIdExtensions <>
494478 extensionsFromList
495− [ Ext_gfm_auto_identifiers
496− , Ext_ascii_identifiers
497− , Ext_pipe_tables
479+ [ Ext_pipe_tables
498480 , Ext_autolink_bare_uris
499481 , Ext_strikeout
500482 , Ext_task_lists
@@ -515,16 +497,13 @@ getAllExtensions f = universalExtensions <> getAll f
515497 , Ext_raw_attribute
516498 , Ext_implicit_header_references
517499 , Ext_attributes
518− , Ext_sourcepos
519− , Ext_yaml_metadata_block
520− , Ext_rebase_relative_paths
500+ , Ext_fenced_code_attributes
521501 ]
522502 getAll "commonmark_x" = getAll "commonmark"
523503 getAll "org" = autoIdExtensions <>
524504 extensionsFromList
525505 [ Ext_citations
526506 , Ext_smart
527− , Ext_task_lists
528507 ]
529508 getAll "html" = autoIdExtensions <>
530509 extensionsFromList
@@ -568,14 +547,6 @@ getAllExtensions f = universalExtensions <> getAll f
568547 , Ext_smart
569548 , Ext_raw_tex
570549 ]
571− getAll "jats" =
572− extensionsFromList
573− [ Ext_auto_identifiers
574− , Ext_element_citations
575− ]
576− getAll "jats_archiving" = getAll "jats"
577− getAll "jats_publishing" = getAll "jats"
578− getAll "jats_articleauthoring" = getAll "jats"
579550 getAll "opml" = allMarkdownExtensions -- affects notes
580551 getAll "twiki" = autoIdExtensions <>
581552 extensionsFromList
@@ -601,7 +572,7 @@ parseFormatSpec :: T.Text
601572parseFormatSpec = parse formatSpec ""
602573 where formatSpec = do
603574 name <- formatName
604− (extsToEnable, extsToDisable) <- foldl' (flip ($)) ([],[]) <$>
575+ (extsToEnable, extsToDisable) <- foldl (flip ($)) ([],[]) <$>
605576 many extMod
606577 return (T.pack name, reverse extsToEnable, reverse extsToDisable)
607578 formatName = many1 $ noneOf "-+"
src/Text/Pandoc/Filter.hs+4−6
@@ -4,7 +4,7 @@
44{-# LANGUAGE OverloadedStrings #-}
55{- |
66 Module : Text.Pandoc.Filter
7− Copyright : Copyright (C) 2006-2021 John MacFarlane
7+ Copyright : Copyright (C) 2006-2020 John MacFarlane
88 License : GNU GPL, version 2 or above
99
1010 Maintainer : John MacFarlane <jgm@berkeley@edu>
@@ -47,13 +47,11 @@ instance FromYAML Filter where
4747 parseYAML node =
4848 (withMap "Filter" $ \m -> do
4949 ty <- m .: "type"
50− fp <- m .:? "path"
51− let missingPath = fail $ "Expected 'path' for filter of type " ++ show ty
52− let filterWithPath constr = maybe missingPath (return . constr . T.unpack)
50+ fp <- m .: "path"
5351 case ty of
5452 "citeproc" -> return CiteprocFilter
55− "lua" -> filterWithPath LuaFilter fp
56− "json" -> filterWithPath JSONFilter fp
53+ "lua" -> return $ LuaFilter $ T.unpack fp
54+ "json" -> return $ JSONFilter $ T.unpack fp
5755 _ -> fail $ "Unknown filter type " ++ show (ty :: T.Text)) node
5856 <|>
5957 (withStr "Filter" $ \t -> do
src/Text/Pandoc/Filter/JSON.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.Filter
4− Copyright : Copyright (C) 2006-2021 John MacFarlane
4+ Copyright : Copyright (C) 2006-2020 John MacFarlane
55 License : GNU GPL, version 2 or above
66
77 Maintainer : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Filter/Lua.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Filter.Lua
3− Copyright : Copyright (C) 2006-2021 John MacFarlane
3+ Copyright : Copyright (C) 2006-2020 John MacFarlane
44 License : GNU GPL, version 2 or above
55
66 Maintainer : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Filter/Path.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Filter.Path
3− Copyright : Copyright (C) 2006-2021 John MacFarlane
3+ Copyright : Copyright (C) 2006-2020 John MacFarlane
44 License : GNU GPL, version 2 or above
55
66 Maintainer : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Highlighting.hs+6−6
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.Highlighting
4− Copyright : Copyright (C) 2008-2021 John MacFarlane
4+ Copyright : Copyright (C) 2008-2020 John MacFarlane
55 License : GNU GPL, version 2 or above
66
77 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -52,12 +52,12 @@ highlightingStyles =
5252 ("breezedark", breezeDark),
5353 ("haddock", haddock)]
5454
55−languages :: SyntaxMap -> [T.Text]
56−languages syntaxmap = [T.toLower (sName s) | s <- M.elems syntaxmap]
55+languages :: [T.Text]
56+languages = [T.toLower (sName s) | s <- M.elems defaultSyntaxMap]
5757
58−languagesByExtension :: SyntaxMap -> T.Text -> [T.Text]
59−languagesByExtension syntaxmap ext =
60− [T.toLower (sName s) | s <- syntaxesByExtension syntaxmap (T.unpack ext)]
58+languagesByExtension :: T.Text -> [T.Text]
59+languagesByExtension ext =
60+ [T.toLower (sName s) | s <- syntaxesByExtension defaultSyntaxMap (T.unpack ext)]
6161
6262highlight :: SyntaxMap
6363 -> (FormatOptions -> [SourceLine] -> a) -- ^ Formatter
src/Text/Pandoc/Image.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, CPP #-}
22{- |
33Module : Text.Pandoc.Image
4−Copyright : Copyright (C) 2020-2021 John MacFarlane
4+Copyright : Copyright (C) 2020 John MacFarlane
55License : GNU GPL, version 2 or above
66
77Maintainer : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/ImageSize.hs+341−61
@@ -1,9 +1,9 @@
1−{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
1+{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, CPP #-}
22{-# LANGUAGE ViewPatterns #-}
33{-# OPTIONS_GHC -fno-warn-type-defaults #-}
44{- |
55Module : Text.Pandoc.ImageSize
6−Copyright : Copyright (C) 2011-2021 John MacFarlane
6+Copyright : Copyright (C) 2011-2020 John MacFarlane
77License : GNU GPL, version 2 or above
88
99Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -32,33 +32,33 @@ module Text.Pandoc.ImageSize ( ImageType(..)
3232 , showInPixel
3333 , showFl
3434 ) where
35−import Data.ByteString (ByteString)
35+import Data.ByteString (ByteString, unpack)
3636import qualified Data.ByteString.Char8 as B
3737import qualified Data.ByteString.Lazy as BL
38−import Data.Binary.Get
3938import Data.Char (isDigit)
4039import Control.Monad
40+import Data.Bits
41+import Data.Binary
42+import Data.Binary.Get
4143import Text.Pandoc.Shared (safeRead)
4244import Data.Default (Default)
4345import Numeric (showFFloat)
4446import Text.Pandoc.Definition
4547import Text.Pandoc.Options
4648import qualified Text.Pandoc.UTF8 as UTF8
47−import Text.Pandoc.XML.Light hiding (Attr)
49+import qualified Text.XML.Light as Xml
50+import qualified Data.Map as M
4851import qualified Data.Text as T
49−import qualified Data.Text.Lazy as TL
5052import qualified Data.Text.Encoding as TE
53+import Control.Monad.Except
5154import Control.Applicative
55+import Data.Maybe (fromMaybe)
5256import qualified Data.Attoparsec.ByteString.Char8 as A
53−import qualified Codec.Picture.Metadata as Metadata
54−import qualified Codec.Picture.Metadata.Exif as Exif
55−import Codec.Picture (decodeImageWithMetadata)
5657
5758-- quick and dirty functions to get image sizes
5859-- algorithms borrowed from wwwis.pl
5960
60−data ImageType = Png | Gif | Jpeg | Svg | Pdf | Eps | Emf | Tiff
61− deriving Show
61+data ImageType = Png | Gif | Jpeg | Svg | Pdf | Eps | Emf deriving Show
6262data Direction = Width | Height
6363instance Show Direction where
6464 show Width = "width"
@@ -101,8 +101,6 @@ imageType :: ByteString -> Maybe ImageType
101101imageType img = case B.take 4 img of
102102 "\x89\x50\x4e\x47" -> return Png
103103 "\x47\x49\x46\x38" -> return Gif
104− "\x49\x49\x2a\x00" -> return Tiff
105− "\x4D\x4D\x00\x2a" -> return Tiff
106104 "\xff\xd8\xff\xe0" -> return Jpeg -- JFIF
107105 "\xff\xd8\xff\xe1" -> return Jpeg -- Exif
108106 "%PDF" -> return Pdf
@@ -122,12 +120,11 @@ findSvgTag :: ByteString -> Bool
122120findSvgTag img = "<svg" `B.isInfixOf` img || "<SVG" `B.isInfixOf` img
123121
124122imageSize :: WriterOptions -> ByteString -> Either T.Text ImageSize
125−imageSize opts img = checkDpi <$>
123+imageSize opts img =
126124 case imageType img of
127− Just Png -> getSize img
128− Just Gif -> getSize img
129− Just Jpeg -> getSize img
130− Just Tiff -> getSize img
125+ Just Png -> mbToEither "could not determine PNG size" $ pngSize img
126+ Just Gif -> mbToEither "could not determine GIF size" $ gifSize img
127+ Just Jpeg -> jpegSize img
131128 Just Svg -> mbToEither "could not determine SVG size" $ svgSize opts img
132129 Just Eps -> mbToEither "could not determine EPS size" $ epsSize img
133130 Just Pdf -> mbToEither "could not determine PDF size" $ pdfSize img
@@ -135,12 +132,9 @@ imageSize opts img = checkDpi <$>
135132 Nothing -> Left "could not determine image type"
136133 where mbToEither msg Nothing = Left msg
137134 mbToEither _ (Just x) = Right x
138− -- see #6880, some defective JPEGs may encode dpi 0, so default to 72
139− -- if that value is 0
140− checkDpi size =
141− size{ dpiX = if dpiX size == 0 then 72 else dpiX size
142− , dpiY = if dpiY size == 0 then 72 else dpiY size }
143135
136+defaultSize :: (Integer, Integer)
137+defaultSize = (72, 72)
144138
145139sizeInPixels :: ImageSize -> (Integer, Integer)
146140sizeInPixels s = (pxX s, pxY s)
@@ -300,50 +294,59 @@ pPdfSize = do
300294 , dpiY = 72 }
301295 ) <|> pPdfSize
302296
303−getSize :: ByteString -> Either T.Text ImageSize
304−getSize img =
305− case decodeImageWithMetadata img of
306− Left e -> Left (T.pack e)
307− Right (_, meta) -> do
308− pxx <- maybe (Left "Could not determine width") Right $
309− -- first look for exif image width, then width
310− (Metadata.lookup
311− (Metadata.Exif (Exif.TagUnknown 0xA002)) meta >>=
312− exifDataToWord) <|>
313− Metadata.lookup Metadata.Width meta
314− pxy <- maybe (Left "Could not determine height") Right $
315− -- first look for exif image height, then height
316− (Metadata.lookup
317− (Metadata.Exif (Exif.TagUnknown 0xA003)) meta >>=
318− exifDataToWord) <|>
319− Metadata.lookup Metadata.Height meta
320− dpix <- maybe (Right 72) Right $ Metadata.lookup Metadata.DpiX meta
321− dpiy <- maybe (Right 72) Right $ Metadata.lookup Metadata.DpiY meta
322− return $ ImageSize
323− { pxX = fromIntegral pxx
324− , pxY = fromIntegral pxy
325− , dpiX = fromIntegral dpix
326− , dpiY = fromIntegral dpiy }
327− where
328− exifDataToWord (Exif.ExifLong x) = Just $ fromIntegral x
329− exifDataToWord (Exif.ExifShort x) = Just $ fromIntegral x
330− exifDataToWord _ = Nothing
331−
297+pngSize :: ByteString -> Maybe ImageSize
298+pngSize img = do
299+ let (h, rest) = B.splitAt 8 img
300+ guard $ h == "\x8a\x4d\x4e\x47\x0d\x0a\x1a\x0a" ||
301+ h == "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"
302+ let (i, rest') = B.splitAt 4 $ B.drop 4 rest
303+ guard $ i == "MHDR" || i == "IHDR"
304+ let (sizes, rest'') = B.splitAt 8 rest'
305+ (x,y) <- case map fromIntegral $unpack sizes of
306+ ([w1,w2,w3,w4,h1,h2,h3,h4] :: [Integer]) -> return
307+ (shift w1 24 + shift w2 16 + shift w3 8 + w4,
308+ shift h1 24 + shift h2 16 + shift h3 8 + h4)
309+ _ -> Nothing -- "PNG parse error"
310+ (dpix, dpiy) <- findpHYs rest''
311+ return ImageSize { pxX = x, pxY = y, dpiX = dpix, dpiY = dpiy }
312+
313+findpHYs :: ByteString -> Maybe (Integer, Integer)
314+findpHYs x
315+ | B.null x || "IDAT" `B.isPrefixOf` x = return (72,72)
316+ | "pHYs" `B.isPrefixOf` x =
317+ case map fromIntegral $ unpack $ B.take 9 $ B.drop 4 x of
318+ [x1,x2,x3,x4,y1,y2,y3,y4,u] -> do
319+ let factor = if u == 1 -- dots per meter
320+ then \z -> z * 254 `div` 10000
321+ else const 72
322+ return
323+ ( factor $ shift x1 24 + shift x2 16 + shift x3 8 + x4,
324+ factor $ shift y1 24 + shift y2 16 + shift y3 8 + y4 )
325+ _ -> mzero
326+ | otherwise = findpHYs $ B.drop 1 x -- read another byte
327+
328+gifSize :: ByteString -> Maybe ImageSize
329+gifSize img = do
330+ let (h, rest) = B.splitAt 6 img
331+ guard $ h == "GIF87a" || h == "GIF89a"
332+ case map fromIntegral $ unpack $ B.take 4 rest of
333+ [w2,w1,h2,h1] -> return ImageSize {
334+ pxX = shift w1 8 + w2,
335+ pxY = shift h1 8 + h2,
336+ dpiX = 72,
337+ dpiY = 72
338+ }
339+ _ -> Nothing -- "GIF parse error"
332340
333341svgSize :: WriterOptions -> ByteString -> Maybe ImageSize
334342svgSize opts img = do
335− doc <- either (const mzero) return $ parseXMLElement
336− $ TL.fromStrict $ UTF8.toText img
337− let viewboxSize = do
338− vb <- findAttrBy (== QName "viewBox" Nothing Nothing) doc
339− [_,_,w,h] <- mapM safeRead (T.words vb)
340− return (w,h)
343+ doc <- Xml.parseXMLDoc $ UTF8.toString img
341344 let dpi = fromIntegral $ writerDpi opts
342345 let dirToInt dir = do
343− dim <- findAttrBy (== QName dir Nothing Nothing) doc >>= lengthToDim
346+ dim <- Xml.findAttrBy (== Xml.QName dir Nothing Nothing) doc >>= lengthToDim . T.pack
344347 return $ inPixel opts dim
345− w <- dirToInt "width" <|> (fst <$> viewboxSize)
346− h <- dirToInt "height" <|> (snd <$> viewboxSize)
348+ w <- dirToInt "width"
349+ h <- dirToInt "height"
347350 return ImageSize {
348351 pxX = w
349352 , pxY = h
@@ -381,3 +384,280 @@ emfSize img =
381384 case parseheader . BL.fromStrict $ img of
382385 Left _ -> Nothing
383386 Right (_, _, size) -> Just size
387+
388+
389+jpegSize :: ByteString -> Either T.Text ImageSize
390+jpegSize img =
391+ let (hdr, rest) = B.splitAt 4 img
392+ in if B.length rest < 14
393+ then Left "unable to determine JPEG size"
394+ else case hdr of
395+ "\xff\xd8\xff\xe0" -> jfifSize rest
396+ "\xff\xd8\xff\xe1" -> exifSize rest
397+ _ -> Left "unable to determine JPEG size"
398+
399+jfifSize :: ByteString -> Either T.Text ImageSize
400+jfifSize rest =
401+ case map fromIntegral $ unpack $ B.take 5 $ B.drop 9 rest of
402+ [dpiDensity,dpix1,dpix2,dpiy1,dpiy2] ->
403+ let factor = case dpiDensity of
404+ 1 -> id
405+ 2 -> \x -> x * 254 `div` 10
406+ _ -> const 72
407+ dpix = factor (shift dpix1 8 + dpix2)
408+ dpiy = factor (shift dpiy1 8 + dpiy2)
409+ in case findJfifSize rest of
410+ Left msg -> Left msg
411+ Right (w,h) -> Right ImageSize { pxX = w
412+ , pxY = h
413+ , dpiX = dpix
414+ , dpiY = dpiy }
415+ _ -> Left "unable to determine JFIF size"
416+
417+findJfifSize :: ByteString -> Either T.Text (Integer,Integer)
418+findJfifSize bs =
419+ let bs' = B.dropWhile (=='\xff') $ B.dropWhile (/='\xff') bs
420+ in case B.uncons bs' of
421+ Just (c,bs'') | c >= '\xc0' && c <= '\xc3' ->
422+ case map fromIntegral $ unpack $ B.take 4 $ B.drop 3 bs'' of
423+ [h1,h2,w1,w2] -> Right (shift w1 8 + w2, shift h1 8 + h2)
424+ _ -> Left "JFIF parse error"
425+ Just (_,bs'') ->
426+ case map fromIntegral $ unpack $ B.take 2 bs'' of
427+ [c1,c2] ->
428+ let len = shift c1 8 + c2
429+ -- skip variables
430+ in findJfifSize $ B.drop len bs''
431+ _ -> Left "JFIF parse error"
432+ Nothing -> Left "Did not find JFIF length record"
433+
434+runGet' :: Get (Either T.Text a) -> BL.ByteString -> Either T.Text a
435+runGet' p bl =
436+#if MIN_VERSION_binary(0,7,0)
437+ case runGetOrFail p bl of
438+ Left (_,_,msg) -> Left $ T.pack msg
439+ Right (_,_,x) -> x
440+#else
441+ runGet p bl
442+#endif
443+
444+exifSize :: ByteString -> Either T.Text ImageSize
445+exifSize bs = runGet' header bl
446+ where bl = BL.fromChunks [bs]
447+ header = runExceptT $ exifHeader bl
448+-- NOTE: It would be nicer to do
449+-- runGet ((Just <$> exifHeader) <|> return Nothing)
450+-- which would prevent pandoc from raising an error when an exif header can't
451+-- be parsed. But we only get an Alternative instance for Get in binary 0.6,
452+-- and binary 0.5 ships with ghc 7.6.
453+
454+exifHeader :: BL.ByteString -> ExceptT T.Text Get ImageSize
455+exifHeader hdr = do
456+ _app1DataSize <- lift getWord16be
457+ exifHdr <- lift getWord32be
458+ unless (exifHdr == 0x45786966) $ throwError "Did not find exif header"
459+ zeros <- lift getWord16be
460+ unless (zeros == 0) $ throwError "Expected zeros after exif header"
461+ -- beginning of tiff header -- we read whole thing to use
462+ -- in getting data from offsets:
463+ let tiffHeader = BL.drop 8 hdr
464+ byteAlign <- lift getWord16be
465+ let bigEndian = byteAlign == 0x4d4d
466+ let (getWord16, getWord32, getWord64) =
467+ if bigEndian
468+ then (getWord16be, getWord32be, getWord64be)
469+ else (getWord16le, getWord32le, getWord64le)
470+ let getRational = do
471+ num <- getWord32
472+ den <- getWord32
473+ return $ fromIntegral num / fromIntegral den
474+ tagmark <- lift getWord16
475+ unless (tagmark == 0x002a) $ throwError "Failed alignment sanity check"
476+ ifdOffset <- lift getWord32
477+ lift $ skip (fromIntegral ifdOffset - 8) -- skip to IDF
478+ numentries <- lift getWord16
479+ let ifdEntry :: ExceptT T.Text Get (TagType, DataFormat)
480+ ifdEntry = do
481+ tag <- fromMaybe UnknownTagType . flip M.lookup tagTypeTable
482+ <$> lift getWord16
483+ dataFormat <- lift getWord16
484+ numComponents <- lift getWord32
485+ (fmt, bytesPerComponent) <-
486+ case dataFormat of
487+ 1 -> return (UnsignedByte <$> getWord8, 1)
488+ 2 -> return (AsciiString <$>
489+ getLazyByteString
490+ (fromIntegral numComponents), 1)
491+ 3 -> return (UnsignedShort <$> getWord16, 2)
492+ 4 -> return (UnsignedLong <$> getWord32, 4)
493+ 5 -> return (UnsignedRational <$> getRational, 8)
494+ 6 -> return (SignedByte <$> getWord8, 1)
495+ 7 -> return (Undefined <$> getLazyByteString
496+ (fromIntegral numComponents), 1)
497+ 8 -> return (SignedShort <$> getWord16, 2)
498+ 9 -> return (SignedLong <$> getWord32, 4)
499+ 10 -> return (SignedRational <$> getRational, 8)
500+ 11 -> return (SingleFloat <$> getWord32 {- TODO -}, 4)
501+ 12 -> return (DoubleFloat <$> getWord64 {- TODO -}, 8)
502+ _ -> throwError $ "Unknown data format " <> T.pack (show dataFormat)
503+ let totalBytes = fromIntegral $ numComponents * bytesPerComponent
504+ payload <- if totalBytes <= 4 -- data is right here
505+ then lift $ fmt <* skip (4 - totalBytes)
506+ else do -- get data from offset
507+ offs <- lift getWord32
508+ let bytesAtOffset =
509+ BL.take (fromIntegral totalBytes)
510+ $ BL.drop (fromIntegral offs) tiffHeader
511+ case runGet' (Right <$> fmt) bytesAtOffset of
512+ Left msg -> throwError msg
513+ Right x -> return x
514+ return (tag, payload)
515+ entries <- replicateM (fromIntegral numentries) ifdEntry
516+ subentries <- case lookup ExifOffset entries of
517+ Just (UnsignedLong offset') -> do
518+ pos <- lift bytesRead
519+ lift $ skip (fromIntegral offset' - (fromIntegral pos - 8))
520+ numsubentries <- lift getWord16
521+ replicateM (fromIntegral numsubentries) ifdEntry
522+ _ -> return []
523+ let allentries = entries ++ subentries
524+ (wdth, hght) <- case (lookup ExifImageWidth allentries,
525+ lookup ExifImageHeight allentries) of
526+ (Just (UnsignedLong w), Just (UnsignedLong h)) ->
527+ return (fromIntegral w, fromIntegral h)
528+ _ -> return defaultSize
529+ -- we return a default width and height when
530+ -- the exif header doesn't contain these
531+ let resfactor = case lookup ResolutionUnit allentries of
532+ Just (UnsignedShort 1) -> 100 / 254
533+ _ -> 1
534+ let xres = case lookup XResolution allentries of
535+ Just (UnsignedRational x) -> floor (x * resfactor)
536+ _ -> 72
537+ let yres = case lookup YResolution allentries of
538+ Just (UnsignedRational y) -> floor (y * resfactor)
539+ _ -> 72
540+ return ImageSize{
541+ pxX = wdth
542+ , pxY = hght
543+ , dpiX = xres
544+ , dpiY = yres }
545+
546+data DataFormat = UnsignedByte Word8
547+ | AsciiString BL.ByteString
548+ | UnsignedShort Word16
549+ | UnsignedLong Word32
550+ | UnsignedRational Rational
551+ | SignedByte Word8
552+ | Undefined BL.ByteString
553+ | SignedShort Word16
554+ | SignedLong Word32
555+ | SignedRational Rational
556+ | SingleFloat Word32
557+ | DoubleFloat Word64
558+ deriving (Show)
559+
560+data TagType = ImageDescription
561+ | Make
562+ | Model
563+ | Orientation
564+ | XResolution
565+ | YResolution
566+ | ResolutionUnit
567+ | Software
568+ | DateTime
569+ | WhitePoint
570+ | PrimaryChromaticities
571+ | YCbCrCoefficients
572+ | YCbCrPositioning
573+ | ReferenceBlackWhite
574+ | Copyright
575+ | ExifOffset
576+ | ExposureTime
577+ | FNumber
578+ | ExposureProgram
579+ | ISOSpeedRatings
580+ | ExifVersion
581+ | DateTimeOriginal
582+ | DateTimeDigitized
583+ | ComponentConfiguration
584+ | CompressedBitsPerPixel
585+ | ShutterSpeedValue
586+ | ApertureValue
587+ | BrightnessValue
588+ | ExposureBiasValue
589+ | MaxApertureValue
590+ | SubjectDistance
591+ | MeteringMode
592+ | LightSource
593+ | Flash
594+ | FocalLength
595+ | MakerNote
596+ | UserComment
597+ | FlashPixVersion
598+ | ColorSpace
599+ | ExifImageWidth
600+ | ExifImageHeight
601+ | RelatedSoundFile
602+ | ExifInteroperabilityOffset
603+ | FocalPlaneXResolution
604+ | FocalPlaneYResolution
605+ | FocalPlaneResolutionUnit
606+ | SensingMethod
607+ | FileSource
608+ | SceneType
609+ | UnknownTagType
610+ deriving (Show, Eq, Ord)
611+
612+tagTypeTable :: M.Map Word16 TagType
613+tagTypeTable = M.fromList
614+ [ (0x010e, ImageDescription)
615+ , (0x010f, Make)
616+ , (0x0110, Model)
617+ , (0x0112, Orientation)
618+ , (0x011a, XResolution)
619+ , (0x011b, YResolution)
620+ , (0x0128, ResolutionUnit)
621+ , (0x0131, Software)
622+ , (0x0132, DateTime)
623+ , (0x013e, WhitePoint)
624+ , (0x013f, PrimaryChromaticities)
625+ , (0x0211, YCbCrCoefficients)
626+ , (0x0213, YCbCrPositioning)
627+ , (0x0214, ReferenceBlackWhite)
628+ , (0x8298, Copyright)
629+ , (0x8769, ExifOffset)
630+ , (0x829a, ExposureTime)
631+ , (0x829d, FNumber)
632+ , (0x8822, ExposureProgram)
633+ , (0x8827, ISOSpeedRatings)
634+ , (0x9000, ExifVersion)
635+ , (0x9003, DateTimeOriginal)
636+ , (0x9004, DateTimeDigitized)
637+ , (0x9101, ComponentConfiguration)
638+ , (0x9102, CompressedBitsPerPixel)
639+ , (0x9201, ShutterSpeedValue)
640+ , (0x9202, ApertureValue)
641+ , (0x9203, BrightnessValue)
642+ , (0x9204, ExposureBiasValue)
643+ , (0x9205, MaxApertureValue)
644+ , (0x9206, SubjectDistance)
645+ , (0x9207, MeteringMode)
646+ , (0x9208, LightSource)
647+ , (0x9209, Flash)
648+ , (0x920a, FocalLength)
649+ , (0x927c, MakerNote)
650+ , (0x9286, UserComment)
651+ , (0xa000, FlashPixVersion)
652+ , (0xa001, ColorSpace)
653+ , (0xa002, ExifImageWidth)
654+ , (0xa003, ExifImageHeight)
655+ , (0xa004, RelatedSoundFile)
656+ , (0xa005, ExifInteroperabilityOffset)
657+ , (0xa20e, FocalPlaneXResolution)
658+ , (0xa20f, FocalPlaneYResolution)
659+ , (0xa210, FocalPlaneResolutionUnit)
660+ , (0xa217, SensingMethod)
661+ , (0xa300, FileSource)
662+ , (0xa301, SceneType)
663+ ]
src/Text/Pandoc/Logging.hs+56−82
@@ -4,7 +4,7 @@
44{-# LANGUAGE OverloadedStrings #-}
55{- |
66 Module : Text.Pandoc.Logging
7− Copyright : Copyright (C) 2006-2021 John MacFarlane
7+ Copyright : Copyright (C) 2006-2020 John MacFarlane
88 License : GNU GPL, version 2 or above
99
1010 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -31,12 +31,10 @@ import Data.Aeson.Encode.Pretty (Config (..), defConfig, encodePretty',
3131import qualified Data.ByteString.Lazy as BL
3232import Data.Data (Data, toConstr)
3333import qualified Data.Text as Text
34−import Data.Text (Text)
3534import Data.Typeable (Typeable)
3635import GHC.Generics (Generic)
3736import Text.Pandoc.Definition
3837import Text.Parsec.Pos
39−import Text.Pandoc.Shared (tshow)
4038
4139-- | Verbosity level.
4240data Verbosity = ERROR | WARNING | INFO
@@ -61,49 +59,46 @@ instance FromYAML Verbosity where
6159 _ -> mzero
6260
6361data LogMessage =
64− SkippedContent Text SourcePos
65− | IgnoredElement Text
66− | DuplicateLinkReference Text SourcePos
67− | DuplicateNoteReference Text SourcePos
68− | NoteDefinedButNotUsed Text SourcePos
69− | DuplicateIdentifier Text SourcePos
70− | ReferenceNotFound Text SourcePos
71− | CircularReference Text SourcePos
72− | UndefinedToggle Text SourcePos
73− | ParsingUnescaped Text SourcePos
74− | CouldNotLoadIncludeFile Text SourcePos
75− | MacroAlreadyDefined Text SourcePos
62+ SkippedContent Text.Text SourcePos
63+ | IgnoredElement Text.Text
64+ | CouldNotParseYamlMetadata Text.Text SourcePos
65+ | DuplicateLinkReference Text.Text SourcePos
66+ | DuplicateNoteReference Text.Text SourcePos
67+ | NoteDefinedButNotUsed Text.Text SourcePos
68+ | DuplicateIdentifier Text.Text SourcePos
69+ | ReferenceNotFound Text.Text SourcePos
70+ | CircularReference Text.Text SourcePos
71+ | UndefinedToggle Text.Text SourcePos
72+ | ParsingUnescaped Text.Text SourcePos
73+ | CouldNotLoadIncludeFile Text.Text SourcePos
74+ | MacroAlreadyDefined Text.Text SourcePos
7675 | InlineNotRendered Inline
7776 | BlockNotRendered Block
78− | DocxParserWarning Text
79− | IgnoredIOError Text
80− | CouldNotFetchResource Text Text
81− | CouldNotDetermineImageSize Text Text
82− | CouldNotConvertImage Text Text
83− | CouldNotDetermineMimeType Text
84− | CouldNotConvertTeXMath Text Text
85− | CouldNotParseCSS Text
86− | Fetching Text
87− | Extracting Text
88− | LoadedResource FilePath FilePath
89− | NoTitleElement Text
77+ | DocxParserWarning Text.Text
78+ | IgnoredIOError Text.Text
79+ | CouldNotFetchResource Text.Text Text.Text
80+ | CouldNotDetermineImageSize Text.Text Text.Text
81+ | CouldNotConvertImage Text.Text Text.Text
82+ | CouldNotDetermineMimeType Text.Text
83+ | CouldNotConvertTeXMath Text.Text Text.Text
84+ | CouldNotParseCSS Text.Text
85+ | Fetching Text.Text
86+ | Extracting Text.Text
87+ | NoTitleElement Text.Text
9088 | NoLangSpecified
91− | InvalidLang Text
92− | CouldNotHighlight Text
93− | MissingCharacter Text
94− | Deprecated Text Text
95− | NoTranslation Text
96− | CouldNotLoadTranslations Text Text
97− | UnusualConversion Text
98− | UnexpectedXmlElement Text Text
99− | UnknownOrgExportOption Text
100− | CouldNotDeduceFormat [Text] Text
89+ | InvalidLang Text.Text
90+ | CouldNotHighlight Text.Text
91+ | MissingCharacter Text.Text
92+ | Deprecated Text.Text Text.Text
93+ | NoTranslation Text.Text
94+ | CouldNotLoadTranslations Text.Text Text.Text
95+ | UnusualConversion Text.Text
96+ | UnexpectedXmlElement Text.Text Text.Text
97+ | UnknownOrgExportOption Text.Text
98+ | CouldNotDeduceFormat [Text.Text] Text.Text
10199 | RunningFilter FilePath
102100 | FilterCompleted FilePath Integer
103− | CiteprocWarning Text
104− | ATXHeadingInLHS Int Text
105− | EnvironmentVariableUndefined Text
106− | DuplicateAttribute Text Text
101+ | CiteprocWarning Text.Text
107102 deriving (Show, Eq, Data, Ord, Typeable, Generic)
108103
109104instance ToJSON LogMessage where
@@ -118,6 +113,11 @@ instance ToJSON LogMessage where
118113 "column" .= sourceColumn pos]
119114 IgnoredElement s ->
120115 ["contents" .= s]
116+ CouldNotParseYamlMetadata s pos ->
117+ ["message" .= s,
118+ "source" .= sourceName pos,
119+ "line" .= toJSON (sourceLine pos),
120+ "column" .= toJSON (sourceColumn pos)]
121121 DuplicateLinkReference s pos ->
122122 ["contents" .= s,
123123 "source" .= sourceName pos,
@@ -196,9 +196,6 @@ instance ToJSON LogMessage where
196196 ["path" .= fp]
197197 Extracting fp ->
198198 ["path" .= fp]
199− LoadedResource orig found ->
200− ["for" .= orig
201− ,"from" .= found]
202199 NoTitleElement fallback ->
203200 ["fallback" .= fallback]
204201 NoLangSpecified -> []
@@ -233,23 +230,13 @@ instance ToJSON LogMessage where
233230 ,"milliseconds" .= Text.pack (show ms) ]
234231 CiteprocWarning msg ->
235232 ["message" .= msg]
236− ATXHeadingInLHS lvl contents ->
237− ["level" .= lvl
238− ,"contents" .= contents]
239− EnvironmentVariableUndefined var ->
240− ["variable" .= var ]
241− DuplicateAttribute attr val ->
242− ["attribute" .= attr
243− ,"value" .= val]
244233
245−showPos :: SourcePos -> Text
234+showPos :: SourcePos -> Text.Text
246235showPos pos = Text.pack $ sn ++ "line " ++
247236 show (sourceLine pos) ++ " column " ++ show (sourceColumn pos)
248− where
249− sn' = sourceName pos
250− sn = if sn' == "source" || sn' == "" || sn' == "-"
251− then ""
252− else sn' ++ " "
237+ where sn = if sourceName pos == "source" || sourceName pos == ""
238+ then ""
239+ else sourceName pos ++ " "
253240
254241encodeLogMessages :: [LogMessage] -> BL.ByteString
255242encodeLogMessages ms =
@@ -257,13 +244,16 @@ encodeLogMessages ms =
257244 keyOrder [ "type", "verbosity", "contents", "message", "path",
258245 "source", "line", "column" ] } ms
259246
260−showLogMessage :: LogMessage -> Text
247+showLogMessage :: LogMessage -> Text.Text
261248showLogMessage msg =
262249 case msg of
263250 SkippedContent s pos ->
264251 "Skipped '" <> s <> "' at " <> showPos pos
265252 IgnoredElement s ->
266253 "Ignored element " <> s
254+ CouldNotParseYamlMetadata s pos ->
255+ "Could not parse YAML metadata at " <> showPos pos <>
256+ if Text.null s then "" else ": " <> s
267257 DuplicateLinkReference s pos ->
268258 "Duplicate link reference '" <> s <> "' at " <> showPos pos
269259 DuplicateNoteReference s pos ->
@@ -282,7 +272,7 @@ showLogMessage msg =
282272 ParsingUnescaped s pos ->
283273 "Parsing unescaped '" <> s <> "' at " <> showPos pos
284274 CouldNotLoadIncludeFile fp pos ->
285− "Could not load include file " <> fp <> " at " <> showPos pos
275+ "Could not load include file '" <> fp <> "' at " <> showPos pos
286276 MacroAlreadyDefined name pos ->
287277 "Macro '" <> name <> "' already defined, ignoring at " <> showPos pos
288278 InlineNotRendered il ->
@@ -294,18 +284,18 @@ showLogMessage msg =
294284 IgnoredIOError s ->
295285 "IO Error (ignored): " <> s
296286 CouldNotFetchResource fp s ->
297− "Could not fetch resource " <> fp <>
287+ "Could not fetch resource '" <> fp <> "'" <>
298288 if Text.null s then "" else ": " <> s
299289 CouldNotDetermineImageSize fp s ->
300− "Could not determine image size for " <> fp <>
290+ "Could not determine image size for '" <> fp <> "'" <>
301291 if Text.null s then "" else ": " <> s
302292 CouldNotConvertImage fp s ->
303− "Could not convert image " <> fp <>
293+ "Could not convert image '" <> fp <> "'" <>
304294 if Text.null s then "" else ": " <> s
305295 CouldNotDetermineMimeType fp ->
306− "Could not determine mime type for " <> fp
296+ "Could not determine mime type for '" <> fp <> "'"
307297 CouldNotConvertTeXMath s m ->
308− "Could not convert TeX math " <> s <> ", rendering as TeX" <>
298+ "Could not convert TeX math '" <> s <> "', rendering as TeX" <>
309299 if Text.null m then "" else ":\n" <> m
310300 CouldNotParseCSS m ->
311301 "Could not parse CSS" <> if Text.null m then "" else ":\n" <> m
@@ -313,8 +303,6 @@ showLogMessage msg =
313303 "Fetching " <> fp <> "..."
314304 Extracting fp ->
315305 "Extracting " <> fp <> "..."
316− LoadedResource orig found ->
317− "Loaded " <> Text.pack orig <> " from " <> Text.pack found
318306 NoTitleElement fallback ->
319307 "This document format requires a nonempty <title> element.\n" <>
320308 "Defaulting to '" <> fallback <> "' as the title.\n" <>
@@ -354,23 +342,13 @@ showLogMessage msg =
354342 FilterCompleted fp ms -> "Completed filter " <> Text.pack fp <>
355343 " in " <> Text.pack (show ms) <> " ms"
356344 CiteprocWarning ms -> "Citeproc: " <> ms
357− ATXHeadingInLHS lvl contents ->
358− "Rendering heading '" <> contents <> "' as a paragraph.\n" <>
359− "ATX headings cannot be used in literate Haskell, because " <>
360− "'#' is not\nallowed in column 1." <>
361− if lvl < 3
362− then " Consider using --markdown-headings=setext."
363− else ""
364− EnvironmentVariableUndefined var ->
365− "Undefined environment variable " <> var <> " in defaults file."
366− DuplicateAttribute attr val ->
367− "Ignoring duplicate attribute " <> attr <> "=" <> tshow val <> "."
368345
369346messageVerbosity :: LogMessage -> Verbosity
370347messageVerbosity msg =
371348 case msg of
372349 SkippedContent{} -> INFO
373350 IgnoredElement{} -> INFO
351+ CouldNotParseYamlMetadata{} -> WARNING
374352 DuplicateLinkReference{} -> WARNING
375353 DuplicateNoteReference{} -> WARNING
376354 NoteDefinedButNotUsed{} -> WARNING
@@ -395,7 +373,6 @@ messageVerbosity msg =
395373 CouldNotParseCSS{} -> WARNING
396374 Fetching{} -> INFO
397375 Extracting{} -> INFO
398− LoadedResource{} -> INFO
399376 NoTitleElement{} -> WARNING
400377 NoLangSpecified -> INFO
401378 InvalidLang{} -> WARNING
@@ -411,6 +388,3 @@ messageVerbosity msg =
411388 RunningFilter{} -> INFO
412389 FilterCompleted{} -> INFO
413390 CiteprocWarning{} -> WARNING
414− ATXHeadingInLHS{} -> WARNING
415− EnvironmentVariableUndefined{}-> WARNING
416− DuplicateAttribute{} -> WARNING
src/Text/Pandoc/Lua.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Lua
3− Copyright : Copyright © 2017-2021 Albert Krewinkel
3+ Copyright : Copyright © 2017–2020 Albert Krewinkel
44 License : GNU GPL, version 2 or above
55
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/ErrorConversion.hs+1−1
@@ -3,7 +3,7 @@
33{-# LANGUAGE ScopedTypeVariables #-}
44{- |
55 Module : Text.Pandoc.Lua.ErrorConversion
6− Copyright : © 2020-2021 Albert Krewinkel
6+ Copyright : © 2020 Albert Krewinkel
77 License : GNU GPL, version 2 or above
88
99 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Filter.hs+4−7
@@ -1,8 +1,8 @@
11{-# LANGUAGE FlexibleContexts #-}
22{- |
33Module : Text.Pandoc.Lua.Filter
4−Copyright : © 2012-2021 John MacFarlane,
5− © 2017-2021 Albert Krewinkel
4+Copyright : © 2012–2020 John MacFarlane,
5+ © 2017-2020 Albert Krewinkel
66License : GNU GPL, version 2 or above
77Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
88Stability : alpha
@@ -13,9 +13,7 @@ module Text.Pandoc.Lua.Filter ( LuaFilterFunction
1313 , LuaFilter
1414 , runFilterFile
1515 , walkInlines
16− , walkInlineLists
1716 , walkBlocks
18− , walkBlockLists
1917 , module Text.Pandoc.Lua.Walk
2018 ) where
2119import Control.Applicative ((<|>))
@@ -24,7 +22,6 @@ import Control.Monad.Catch (finally, try)
2422import Data.Data (Data, DataType, dataTypeConstrs, dataTypeName, dataTypeOf,
2523 showConstr, toConstr, tyconUQname)
2624import Data.Foldable (foldrM)
27−import Data.List (foldl')
2825import Data.Map (Map)
2926import Data.Maybe (fromMaybe)
3027import Foreign.Lua (Lua, Peekable, Pushable, StackIndex)
@@ -163,7 +160,7 @@ mconcatMapM :: (Monad m) => (a -> m [a]) -> [a] -> m [a]
163160mconcatMapM f = fmap mconcat . mapM f
164161
165162hasOneOf :: LuaFilter -> [String] -> Bool
166−hasOneOf (LuaFilter fnMap) = any (`Map.member` fnMap)
163+hasOneOf (LuaFilter fnMap) = any (\k -> Map.member k fnMap)
167164
168165contains :: LuaFilter -> String -> Bool
169166contains (LuaFilter fnMap) = (`Map.member` fnMap)
@@ -207,7 +204,7 @@ walkMeta lf (Pandoc m bs) = do
207204
208205walkPandoc :: LuaFilter -> Pandoc -> Lua Pandoc
209206walkPandoc (LuaFilter fnMap) =
210− case foldl' mplus Nothing (map (`Map.lookup` fnMap) pandocFilterNames) of
207+ case foldl mplus Nothing (map (`Map.lookup` fnMap) pandocFilterNames) of
211208 Just fn -> \x -> runFilterFunction fn x *> singleElement x
212209 Nothing -> return
213210
src/Text/Pandoc/Lua/Global.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22{- |
33 Module : Text.Pandoc.Lua
4− Copyright : Copyright © 2017-2021 Albert Krewinkel
4+ Copyright : Copyright © 2017-2020 Albert Krewinkel
55 License : GNU GPL, version 2 or above
66
77 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Init.hs+5−15
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Lua
3− Copyright : Copyright © 2017-2021 Albert Krewinkel
3+ Copyright : Copyright © 2017-2020 Albert Krewinkel
44 License : GNU GPL, version 2 or above
55
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -12,18 +12,17 @@ module Text.Pandoc.Lua.Init
1212 ( runLua
1313 ) where
1414
15−import Control.Monad (when)
1615import Control.Monad.Catch (try)
1716import Control.Monad.Trans (MonadIO (..))
1817import Data.Data (Data, dataTypeConstrs, dataTypeOf, showConstr)
1918import Foreign.Lua (Lua)
2019import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8)
21−import Text.Pandoc.Class.PandocMonad (readDataFile)
2220import Text.Pandoc.Class.PandocIO (PandocIO)
2321import Text.Pandoc.Error (PandocError)
2422import Text.Pandoc.Lua.Packages (installPandocPackageSearcher)
25−import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua, runPandocLua)
26−import Text.Pandoc.Lua.Util (throwTopMessageAsError')
23+import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua,
24+ loadScriptFromDataDir, runPandocLua)
25+
2726import qualified Foreign.Lua as Lua
2827import qualified Text.Pandoc.Definition as Pandoc
2928import qualified Text.Pandoc.Lua.Module.Pandoc as ModulePandoc
@@ -45,7 +44,7 @@ initLuaState = do
4544 liftPandocLua Lua.openlibs
4645 installPandocPackageSearcher
4746 initPandocModule
48− loadInitScript "init.lua"
47+ loadScriptFromDataDir "init.lua"
4948 where
5049 initPandocModule :: PandocLua ()
5150 initPandocModule = do
@@ -62,15 +61,6 @@ initLuaState = do
6261 -- assign module to global variable
6362 liftPandocLua $ Lua.setglobal "pandoc"
6463
65− loadInitScript :: FilePath -> PandocLua ()
66− loadInitScript scriptFile = do
67− script <- readDataFile scriptFile
68− status <- liftPandocLua $ Lua.dostring script
69− when (status /= Lua.OK) . liftPandocLua $
70− throwTopMessageAsError'
71− (("Couldn't load '" ++ scriptFile ++ "'.\n") ++)
72−
73−
7464-- | AST elements are marshaled via normal constructor functions in the
7565-- @pandoc@ module. However, accessing Lua globals from Haskell is
7666-- expensive (due to error handling). Accessing the Lua registry is much
src/Text/Pandoc/Lua/Marshaling.hs+2−2
@@ -1,7 +1,7 @@
11{- |
22 Module : Text.Pandoc.Lua.Marshaling
3− Copyright : © 2012-2021 John MacFarlane
4− © 2017-2021 Albert Krewinkel
3+ Copyright : © 2012-2020 John MacFarlane
4+ © 2017-2020 Albert Krewinkel
55 License : GNU GPL, version 2 or above
66
77 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/AST.hs+81−79
@@ -1,10 +1,9 @@
11{-# OPTIONS_GHC -fno-warn-orphans #-}
2−{-# LANGUAGE BangPatterns #-}
32{-# LANGUAGE LambdaCase #-}
43{- |
54 Module : Text.Pandoc.Lua.Marshaling.AST
6− Copyright : © 2012-2021 John MacFarlane
7− © 2017-2021 Albert Krewinkel
5+ Copyright : © 2012-2020 John MacFarlane
6+ © 2017-2020 Albert Krewinkel
87 License : GNU GPL, version 2 or above
98
109 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -18,7 +17,6 @@ module Text.Pandoc.Lua.Marshaling.AST
1817 ) where
1918
2019import Control.Applicative ((<|>))
21−import Control.Monad ((<$!>))
2220import Foreign.Lua (Lua, Peekable, Pushable, StackIndex)
2321import Text.Pandoc.Definition
2422import Text.Pandoc.Error (PandocError)
@@ -34,16 +32,17 @@ instance Pushable Pandoc where
3432 pushViaConstructor "Pandoc" blocks meta
3533
3634instance Peekable Pandoc where
37− peek idx = defineHowTo "get Pandoc value" $! Pandoc
38− <$!> LuaUtil.rawField idx "meta"
39− <*> LuaUtil.rawField idx "blocks"
35+ peek idx = defineHowTo "get Pandoc value" $ do
36+ blocks <- LuaUtil.rawField idx "blocks"
37+ meta <- LuaUtil.rawField idx "meta"
38+ return $ Pandoc meta blocks
4039
4140instance Pushable Meta where
4241 push (Meta mmap) =
4342 pushViaConstructor "Meta" mmap
4443instance Peekable Meta where
45− peek idx = defineHowTo "get Meta value" $!
46− Meta <$!> Lua.peek idx
44+ peek idx = defineHowTo "get Meta value" $
45+ Meta <$> Lua.peek idx
4746
4847instance Pushable MetaValue where
4948 push = pushMetaValue
@@ -69,13 +68,14 @@ instance Pushable Citation where
6968 pushViaConstructor "Citation" cid mode prefix suffix noteNum hash
7069
7170instance Peekable Citation where
72− peek idx = Citation
73− <$!> LuaUtil.rawField idx "id"
74− <*> LuaUtil.rawField idx "prefix"
75− <*> LuaUtil.rawField idx "suffix"
76− <*> LuaUtil.rawField idx "mode"
77− <*> LuaUtil.rawField idx "note_num"
78− <*> LuaUtil.rawField idx "hash"
71+ peek idx = do
72+ id' <- LuaUtil.rawField idx "id"
73+ prefix <- LuaUtil.rawField idx "prefix"
74+ suffix <- LuaUtil.rawField idx "suffix"
75+ mode <- LuaUtil.rawField idx "mode"
76+ num <- LuaUtil.rawField idx "note_num"
77+ hash <- LuaUtil.rawField idx "hash"
78+ return $ Citation id' prefix suffix mode num hash
7979
8080instance Pushable Alignment where
8181 push = Lua.push . show
@@ -90,7 +90,7 @@ instance Peekable CitationMode where
9090instance Pushable Format where
9191 push (Format f) = Lua.push f
9292instance Peekable Format where
93− peek idx = Format <$!> Lua.peek idx
93+ peek idx = Format <$> Lua.peek idx
9494
9595instance Pushable ListNumberDelim where
9696 push = Lua.push . show
@@ -130,26 +130,26 @@ peekMetaValue idx = defineHowTo "get MetaValue" $ do
130130 elementContent = Lua.peek idx
131131 luatype <- Lua.ltype idx
132132 case luatype of
133− Lua.TypeBoolean -> MetaBool <$!> Lua.peek idx
134− Lua.TypeString -> MetaString <$!> Lua.peek idx
133+ Lua.TypeBoolean -> MetaBool <$> Lua.peek idx
134+ Lua.TypeString -> MetaString <$> Lua.peek idx
135135 Lua.TypeTable -> do
136136 tag <- try $ LuaUtil.getTag idx
137137 case tag of
138− Right "MetaBlocks" -> MetaBlocks <$!> elementContent
139− Right "MetaBool" -> MetaBool <$!> elementContent
140− Right "MetaMap" -> MetaMap <$!> elementContent
141− Right "MetaInlines" -> MetaInlines <$!> elementContent
142− Right "MetaList" -> MetaList <$!> elementContent
143− Right "MetaString" -> MetaString <$!> elementContent
138+ Right "MetaBlocks" -> MetaBlocks <$> elementContent
139+ Right "MetaBool" -> MetaBool <$> elementContent
140+ Right "MetaMap" -> MetaMap <$> elementContent
141+ Right "MetaInlines" -> MetaInlines <$> elementContent
142+ Right "MetaList" -> MetaList <$> elementContent
143+ Right "MetaString" -> MetaString <$> elementContent
144144 Right t -> Lua.throwMessage ("Unknown meta tag: " <> t)
145145 Left _ -> do
146146 -- no meta value tag given, try to guess.
147147 len <- Lua.rawlen idx
148148 if len <= 0
149− then MetaMap <$!> Lua.peek idx
150− else (MetaInlines <$!> Lua.peek idx)
151− <|> (MetaBlocks <$!> Lua.peek idx)
152− <|> (MetaList <$!> Lua.peek idx)
149+ then MetaMap <$> Lua.peek idx
150+ else (MetaInlines <$> Lua.peek idx)
151+ <|> (MetaBlocks <$> Lua.peek idx)
152+ <|> (MetaList <$> Lua.peek idx)
153153 _ -> Lua.throwMessage "could not get meta value"
154154
155155-- | Push a block element to the top of the Lua stack.
@@ -174,25 +174,25 @@ pushBlock = \case
174174
175175-- | Return the value at the given index as block if possible.
176176peekBlock :: StackIndex -> Lua Block
177−peekBlock idx = defineHowTo "get Block value" $! do
177+peekBlock idx = defineHowTo "get Block value" $ do
178178 tag <- LuaUtil.getTag idx
179179 case tag of
180− "BlockQuote" -> BlockQuote <$!> elementContent
181− "BulletList" -> BulletList <$!> elementContent
182− "CodeBlock" -> withAttr CodeBlock <$!> elementContent
183− "DefinitionList" -> DefinitionList <$!> elementContent
184− "Div" -> withAttr Div <$!> elementContent
180+ "BlockQuote" -> BlockQuote <$> elementContent
181+ "BulletList" -> BulletList <$> elementContent
182+ "CodeBlock" -> withAttr CodeBlock <$> elementContent
183+ "DefinitionList" -> DefinitionList <$> elementContent
184+ "Div" -> withAttr Div <$> elementContent
185185 "Header" -> (\(lvl, LuaAttr attr, lst) -> Header lvl attr lst)
186− <$!> elementContent
186+ <$> elementContent
187187 "HorizontalRule" -> return HorizontalRule
188− "LineBlock" -> LineBlock <$!> elementContent
188+ "LineBlock" -> LineBlock <$> elementContent
189189 "OrderedList" -> (\(LuaListAttributes lstAttr, lst) ->
190190 OrderedList lstAttr lst)
191− <$!> elementContent
191+ <$> elementContent
192192 "Null" -> return Null
193− "Para" -> Para <$!> elementContent
194− "Plain" -> Plain <$!> elementContent
195− "RawBlock" -> uncurry RawBlock <$!> elementContent
193+ "Para" -> Para <$> elementContent
194+ "Plain" -> Plain <$> elementContent
195+ "RawBlock" -> uncurry RawBlock <$> elementContent
196196 "Table" -> (\(attr, capt, colSpecs, thead, tbodies, tfoot) ->
197197 Table (fromLuaAttr attr)
198198 capt
@@ -200,7 +200,7 @@ peekBlock idx = defineHowTo "get Block value" $! do
200200 thead
201201 tbodies
202202 tfoot)
203− <$!> elementContent
203+ <$> elementContent
204204 _ -> Lua.throwMessage ("Unknown block type: " <> tag)
205205 where
206206 -- Get the contents of an AST element.
@@ -222,14 +222,15 @@ pushCaption (Caption shortCaption longCaption) = do
222222
223223-- | Peek Caption element
224224peekCaption :: StackIndex -> Lua Caption
225−peekCaption idx = Caption
226− <$!> (Lua.fromOptional <$!> LuaUtil.rawField idx "short")
227− <*> LuaUtil.rawField idx "long"
225+peekCaption idx = do
226+ short <- Lua.fromOptional <$> LuaUtil.rawField idx "short"
227+ long <- LuaUtil.rawField idx "long"
228+ return $ Caption short long
228229
229230instance Peekable ColWidth where
230231 peek idx = do
231− width <- Lua.fromOptional <$!> Lua.peek idx
232− return $! maybe ColWidthDefault ColWidth width
232+ width <- Lua.fromOptional <$> Lua.peek idx
233+ return $ maybe ColWidthDefault ColWidth width
233234
234235instance Pushable ColWidth where
235236 push = \case
@@ -251,11 +252,12 @@ instance Pushable TableBody where
251252 LuaUtil.addField "body" body
252253
253254instance Peekable TableBody where
254− peek idx = TableBody
255− <$!> LuaUtil.rawField idx "attr"
256− <*> (RowHeadColumns <$!> LuaUtil.rawField idx "row_head_columns")
257− <*> LuaUtil.rawField idx "head"
258− <*> LuaUtil.rawField idx "body"
255+ peek idx = do
256+ attr <- LuaUtil.rawField idx "attr"
257+ rowHeadColumns <- LuaUtil.rawField idx "row_head_columns"
258+ head' <- LuaUtil.rawField idx "head"
259+ body <- LuaUtil.rawField idx "body"
260+ return $ TableBody attr (RowHeadColumns rowHeadColumns) head' body
259261
260262instance Pushable TableHead where
261263 push (TableHead attr rows) = Lua.push (attr, rows)
@@ -285,12 +287,13 @@ pushCell (Cell attr align (RowSpan rowSpan) (ColSpan colSpan) contents) = do
285287 LuaUtil.addField "contents" contents
286288
287289peekCell :: StackIndex -> Lua Cell
288−peekCell idx = Cell
289− <$!> (fromLuaAttr <$!> LuaUtil.rawField idx "attr")
290− <*> LuaUtil.rawField idx "alignment"
291− <*> (RowSpan <$!> LuaUtil.rawField idx "row_span")
292− <*> (ColSpan <$!> LuaUtil.rawField idx "col_span")
293− <*> LuaUtil.rawField idx "contents"
290+peekCell idx = do
291+ attr <- fromLuaAttr <$> LuaUtil.rawField idx "attr"
292+ align <- LuaUtil.rawField idx "alignment"
293+ rowSpan <- LuaUtil.rawField idx "row_span"
294+ colSpan <- LuaUtil.rawField idx "col_span"
295+ contents <- LuaUtil.rawField idx "contents"
296+ return $ Cell attr align (RowSpan rowSpan) (ColSpan colSpan) contents
294297
295298-- | Push an inline element to the top of the lua stack.
296299pushInline :: Inline -> Lua ()
@@ -321,29 +324,28 @@ peekInline :: StackIndex -> Lua Inline
321324peekInline idx = defineHowTo "get Inline value" $ do
322325 tag <- LuaUtil.getTag idx
323326 case tag of
324− "Cite" -> uncurry Cite <$!> elementContent
325− "Code" -> withAttr Code <$!> elementContent
326− "Emph" -> Emph <$!> elementContent
327− "Underline" -> Underline <$!> elementContent
328− "Image" -> (\(LuaAttr !attr, !lst, !tgt) -> Image attr lst tgt)
329− <$!> elementContent
330− "Link" -> (\(LuaAttr !attr, !lst, !tgt) -> Link attr lst tgt)
331− <$!> elementContent
327+ "Cite" -> uncurry Cite <$> elementContent
328+ "Code" -> withAttr Code <$> elementContent
329+ "Emph" -> Emph <$> elementContent
330+ "Underline" -> Underline <$> elementContent
331+ "Image" -> (\(LuaAttr attr, lst, tgt) -> Image attr lst tgt)
332+ <$> elementContent
333+ "Link" -> (\(LuaAttr attr, lst, tgt) -> Link attr lst tgt)
334+ <$> elementContent
332335 "LineBreak" -> return LineBreak
333− "Note" -> Note <$!> elementContent
334− "Math" -> uncurry Math <$!> elementContent
335− "Quoted" -> uncurry Quoted <$!> elementContent
336− "RawInline" -> uncurry RawInline <$!> elementContent
337− "SmallCaps" -> SmallCaps <$!> elementContent
336+ "Note" -> Note <$> elementContent
337+ "Math" -> uncurry Math <$> elementContent
338+ "Quoted" -> uncurry Quoted <$> elementContent
339+ "RawInline" -> uncurry RawInline <$> elementContent
340+ "SmallCaps" -> SmallCaps <$> elementContent
338341 "SoftBreak" -> return SoftBreak
339342 "Space" -> return Space
340− "Span" -> withAttr Span <$!> elementContent
341− -- strict to Lua string is copied before gc
342− "Str" -> Str <$!> elementContent
343− "Strikeout" -> Strikeout <$!> elementContent
344− "Strong" -> Strong <$!> elementContent
345− "Subscript" -> Subscript <$!> elementContent
346− "Superscript"-> Superscript <$!> elementContent
343+ "Span" -> withAttr Span <$> elementContent
344+ "Str" -> Str <$> elementContent
345+ "Strikeout" -> Strikeout <$> elementContent
346+ "Strong" -> Strong <$> elementContent
347+ "Subscript" -> Subscript <$> elementContent
348+ "Superscript"-> Superscript <$> elementContent
347349 _ -> Lua.throwMessage ("Unknown inline type: " <> tag)
348350 where
349351 -- Get the contents of an AST element.
@@ -364,7 +366,7 @@ instance Pushable LuaAttr where
364366 pushViaConstructor "Attr" id' classes kv
365367
366368instance Peekable LuaAttr where
367− peek idx = defineHowTo "get Attr value" $! (LuaAttr <$!> Lua.peek idx)
369+ peek idx = defineHowTo "get Attr value" (LuaAttr <$> Lua.peek idx)
368370
369371-- | Wrapper for ListAttributes
370372newtype LuaListAttributes = LuaListAttributes ListAttributes
src/Text/Pandoc/Lua/Marshaling/AnyValue.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Lua.Marshaling.AnyValue
3− Copyright : © 2017-2021 Albert Krewinkel
3+ Copyright : © 2017-2020 Albert Krewinkel
44 License : GNU GPL, version 2 or above
55
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/CommonState.hs+2−2
@@ -3,8 +3,8 @@
33{-# LANGUAGE OverloadedStrings #-}
44{- |
55 Module : Text.Pandoc.Lua.Marshaling.CommonState
6− Copyright : © 2012-2021 John MacFarlane
7− © 2017-2021 Albert Krewinkel
6+ Copyright : © 2012-2020 John MacFarlane
7+ © 2017-2020 Albert Krewinkel
88 License : GNU GPL, version 2 or above
99 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
1010 Stability : alpha
src/Text/Pandoc/Lua/Marshaling/Context.hs+2−3
@@ -1,8 +1,8 @@
11{-# OPTIONS_GHC -fno-warn-orphans #-}
22{- |
33 Module : Text.Pandoc.Lua.Marshaling.Context
4− Copyright : © 2012-2021 John MacFarlane
5− © 2017-2021 Albert Krewinkel
4+ Copyright : © 2012-2020 John MacFarlane
5+ © 2017-2020 Albert Krewinkel
66 License : GNU GPL, version 2 or above
77
88 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -22,7 +22,6 @@ instance (TemplateTarget a, Pushable a) => Pushable (Context a) where
2222
2323instance (TemplateTarget a, Pushable a) => Pushable (Val a) where
2424 push NullVal = Lua.push ()
25− push (BoolVal b) = Lua.push b
2625 push (MapVal ctx) = Lua.push ctx
2726 push (ListVal xs) = Lua.push xs
2827 push (SimpleVal d) = Lua.push $ render Nothing d
src/Text/Pandoc/Lua/Marshaling/List.hs+2−2
@@ -4,8 +4,8 @@
44{-# LANGUAGE UndecidableInstances #-}
55{- |
66Module : Text.Pandoc.Lua.Marshaling.List
7−Copyright : © 2012-2021 John MacFarlane
8− © 2017-2021 Albert Krewinkel
7+Copyright : © 2012-2020 John MacFarlane
8+ © 2017-2020 Albert Krewinkel
99License : GNU GPL, version 2 or above
1010Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
1111Stability : alpha
src/Text/Pandoc/Lua/Marshaling/MediaBag.hs+3−3
@@ -1,7 +1,7 @@
11{- |
22 Module : Text.Pandoc.Lua.Marshaling.MediaBag
3− Copyright : © 2012-2021 John MacFarlane
4− © 2017-2021 Albert Krewinkel
3+ Copyright : © 2012-2020 John MacFarlane
4+ © 2017-2020 Albert Krewinkel
55 License : GNU GPL, version 2 or above
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
77 Stability : alpha
@@ -34,7 +34,7 @@ instance Peekable MediaItems where
3434 peek = peekMediaItems
3535
3636-- | Push an iterator triple to be used with Lua's @for@ loop construct.
37−-- Each iterator invocation returns a triple containing the item's
37+-- Each iterator invokation returns a tripple consisting of an item's
3838-- filename, MIME type, and content.
3939pushIterator :: MediaBag -> Lua NumResults
4040pushIterator mb = do
src/Text/Pandoc/Lua/Marshaling/PandocError.hs+1−1
@@ -4,7 +4,7 @@
44{-# LANGUAGE ScopedTypeVariables #-}
55{- |
66 Module : Text.Pandoc.Lua.Marshaling.PandocError
7− Copyright : © 2020-2021 Albert Krewinkel
7+ Copyright : © 2020 Albert Krewinkel
88 License : GNU GPL, version 2 or above
99
1010 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs+2−2
@@ -4,8 +4,8 @@
44{-# OPTIONS_GHC -fno-warn-orphans #-}
55{- |
66 Module : Text.Pandoc.Lua.Marshaling.ReaderOptions
7− Copyright : © 2012-2021 John MacFarlane
8− © 2017-2021 Albert Krewinkel
7+ Copyright : © 2012-2020 John MacFarlane
8+ © 2017-2020 Albert Krewinkel
99 License : GNU GPL, version 2 or above
1010
1111 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Lua.Marshaling.SimpleTable
3− Copyright : © 2020-2021 Albert Krewinkel
3+ Copyright : © 2020 Albert Krewinkel
44 License : GNU GPL, version 2 or above
55
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/Version.hs+1−1
@@ -4,7 +4,7 @@
44{-# LANGUAGE ScopedTypeVariables #-}
55{- |
66 Module : Text.Pandoc.Lua.Marshaling.Version
7− Copyright : © 2019-2021 Albert Krewinkel
7+ Copyright : © 2019-2020 Albert Krewinkel
88 License : GNU GPL, version 2 or above
99
1010 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/MediaBag.hs+17−18
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.Lua.Module.MediaBag
4− Copyright : Copyright © 2017-2021 Albert Krewinkel
4+ Copyright : Copyright © 2017-2020 Albert Krewinkel
55 License : GNU GPL, version 2 or above
66
77 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -13,7 +13,6 @@ module Text.Pandoc.Lua.Module.MediaBag
1313 ( pushModule
1414 ) where
1515
16−import Prelude hiding (lookup)
1716import Control.Monad (zipWithM_)
1817import Foreign.Lua (Lua, NumResults, Optional)
1918import Text.Pandoc.Class.CommonState (CommonState (..))
@@ -37,10 +36,10 @@ pushModule = do
3736 liftPandocLua Lua.newtable
3837 addFunction "delete" delete
3938 addFunction "empty" empty
40− addFunction "insert" insert
39+ addFunction "insert" insertMediaFn
4140 addFunction "items" items
42− addFunction "lookup" lookup
43− addFunction "list" list
41+ addFunction "lookup" lookupMediaFn
42+ addFunction "list" mediaDirectoryFn
4443 addFunction "fetch" fetch
4544 return 1
4645
@@ -54,11 +53,11 @@ empty :: PandocLua NumResults
5453empty = 0 <$ modifyCommonState (\st -> st { stMediaBag = mempty })
5554
5655-- | Insert a new item into the media bag.
57−insert :: FilePath
58− -> Optional MimeType
59− -> BL.ByteString
60− -> PandocLua NumResults
61−insert fp optionalMime contents = do
56+insertMediaFn :: FilePath
57+ -> Optional MimeType
58+ -> BL.ByteString
59+ -> PandocLua NumResults
60+insertMediaFn fp optionalMime contents = do
6261 mb <- getMediaBag
6362 setMediaBag $ MB.insertMedia fp (Lua.fromOptional optionalMime) contents mb
6463 return (Lua.NumResults 0)
@@ -67,19 +66,19 @@ insert fp optionalMime contents = do
6766items :: PandocLua NumResults
6867items = getMediaBag >>= liftPandocLua . pushIterator
6968
70−lookup :: FilePath
71− -> PandocLua NumResults
72−lookup fp = do
69+lookupMediaFn :: FilePath
70+ -> PandocLua NumResults
71+lookupMediaFn fp = do
7372 res <- MB.lookupMedia fp <$> getMediaBag
7473 liftPandocLua $ case res of
7574 Nothing -> 1 <$ Lua.pushnil
76− Just item -> do
77− Lua.push $ MB.mediaMimeType item
78− Lua.push $ MB.mediaContents item
75+ Just (mimeType, contents) -> do
76+ Lua.push mimeType
77+ Lua.push contents
7978 return 2
8079
81−list :: PandocLua NumResults
82−list = do
80+mediaDirectoryFn :: PandocLua NumResults
81+mediaDirectoryFn = do
8382 dirContents <- MB.mediaDirectory <$> getMediaBag
8483 liftPandocLua $ do
8584 Lua.newtable
src/Text/Pandoc/Lua/Module/Pandoc.hs+23−29
@@ -2,7 +2,7 @@
22{-# LANGUAGE OverloadedStrings #-}
33{- |
44 Module : Text.Pandoc.Lua.Module.Pandoc
5− Copyright : Copyright © 2017-2021 Albert Krewinkel
5+ Copyright : Copyright © 2017-2020 Albert Krewinkel
66 License : GNU GPL, version 2 or above
77
88 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -14,7 +14,6 @@ module Text.Pandoc.Lua.Module.Pandoc
1414 ( pushModule
1515 ) where
1616
17−import Prelude hiding (read)
1817import Control.Monad (when)
1918import Control.Monad.Except (throwError)
2019import Data.Default (Default (..))
@@ -23,12 +22,10 @@ import Foreign.Lua (Lua, NumResults, Optional, Peekable, Pushable)
2322import System.Exit (ExitCode (..))
2423import Text.Pandoc.Class.PandocIO (runIO)
2524import Text.Pandoc.Definition (Block, Inline)
26−import Text.Pandoc.Lua.Filter (LuaFilter, SingletonsList (..), walkInlines,
27− walkInlineLists, walkBlocks, walkBlockLists)
25+import Text.Pandoc.Lua.Filter (walkInlines, walkBlocks, LuaFilter, SingletonsList (..))
2826import Text.Pandoc.Lua.Marshaling ()
29−import Text.Pandoc.Lua.Marshaling.List (List (..))
3027import Text.Pandoc.Lua.PandocLua (PandocLua, addFunction, liftPandocLua,
31− loadDefaultModule)
28+ loadScriptFromDataDir)
3229import Text.Pandoc.Walk (Walkable)
3330import Text.Pandoc.Options (ReaderOptions (readerExtensions))
3431import Text.Pandoc.Process (pipeProcess)
@@ -41,33 +38,30 @@ import qualified Foreign.Lua as Lua
4138import qualified Text.Pandoc.Lua.Util as LuaUtil
4239import Text.Pandoc.Error
4340
44−-- | Push the "pandoc" package to the Lua stack. Requires the `List`
45−-- module to be loadable.
41+-- | Push the "pandoc" on the lua stack. Requires the `list` module to be
42+-- loaded.
4643pushModule :: PandocLua NumResults
4744pushModule = do
48− loadDefaultModule "pandoc"
49− addFunction "read" read
50− addFunction "pipe" pipe
51− addFunction "walk_block" walk_block
52− addFunction "walk_inline" walk_inline
45+ loadScriptFromDataDir "pandoc.lua"
46+ addFunction "read" readDoc
47+ addFunction "pipe" pipeFn
48+ addFunction "walk_block" walkBlock
49+ addFunction "walk_inline" walkInline
5350 return 1
5451
5552walkElement :: (Walkable (SingletonsList Inline) a,
56− Walkable (SingletonsList Block) a,
57− Walkable (List Inline) a,
58− Walkable (List Block) a)
53+ Walkable (SingletonsList Block) a)
5954 => a -> LuaFilter -> PandocLua a
60−walkElement x f = liftPandocLua $
61− walkInlines f x >>= walkInlineLists f >>= walkBlocks f >>= walkBlockLists f
55+walkElement x f = liftPandocLua $ walkInlines f x >>= walkBlocks f
6256
63−walk_inline :: Inline -> LuaFilter -> PandocLua Inline
64−walk_inline = walkElement
57+walkInline :: Inline -> LuaFilter -> PandocLua Inline
58+walkInline = walkElement
6559
66−walk_block :: Block -> LuaFilter -> PandocLua Block
67−walk_block = walkElement
60+walkBlock :: Block -> LuaFilter -> PandocLua Block
61+walkBlock = walkElement
6862
69−read :: T.Text -> Optional T.Text -> PandocLua NumResults
70−read content formatSpecOrNil = liftPandocLua $ do
63+readDoc :: T.Text -> Optional T.Text -> PandocLua NumResults
64+readDoc content formatSpecOrNil = liftPandocLua $ do
7165 let formatSpec = fromMaybe "markdown" (Lua.fromOptional formatSpecOrNil)
7266 res <- Lua.liftIO . runIO $
7367 getReader formatSpec >>= \(rdr,es) ->
@@ -85,11 +79,11 @@ read content formatSpecOrNil = liftPandocLua $ do
8579 Left e -> Lua.raiseError $ show e
8680
8781-- | Pipes input through a command.
88−pipe :: String -- ^ path to executable
89− -> [String] -- ^ list of arguments
90− -> BL.ByteString -- ^ input passed to process via stdin
91− -> PandocLua NumResults
92−pipe command args input = liftPandocLua $ do
82+pipeFn :: String
83+ -> [String]
84+ -> BL.ByteString
85+ -> PandocLua NumResults
86+pipeFn command args input = liftPandocLua $ do
9387 (ec, output) <- Lua.liftIO $ pipeProcess Nothing command args input
9488 case ec of
9589 ExitSuccess -> 1 <$ Lua.push output
src/Text/Pandoc/Lua/Module/System.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Lua.Module.System
3− Copyright : © 2019-2021 Albert Krewinkel
3+ Copyright : © 2019-2020 Albert Krewinkel
44 License : GNU GPL, version 2 or above
55
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/Types.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Lua.Module.Types
3− Copyright : © 2019-2021 Albert Krewinkel
3+ Copyright : © 2019-2020 Albert Krewinkel
44 License : GNU GPL, version 2 or above
55
66 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/Utils.hs+2−2
@@ -2,7 +2,7 @@
22{-# LANGUAGE ScopedTypeVariables #-}
33{- |
44 Module : Text.Pandoc.Lua.Module.Utils
5− Copyright : Copyright © 2017-2021 Albert Krewinkel
5+ Copyright : Copyright © 2017-2020 Albert Krewinkel
66 License : GNU GPL, version 2 or above
77
88 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -146,7 +146,7 @@ from_simple_table (SimpleTable capt aligns widths head' body) = do
146146 nullAttr
147147 (Caption Nothing [Plain capt])
148148 (zipWith (\a w -> (a, toColWidth w)) aligns widths)
149− (TableHead nullAttr [blockListToRow head' | not (null head') ])
149+ (TableHead nullAttr [blockListToRow head'])
150150 [TableBody nullAttr 0 [] $ map blockListToRow body]
151151 (TableFoot nullAttr [])
152152 return (NumResults 1)
src/Text/Pandoc/Lua/Packages.hs+27−10
@@ -1,6 +1,9 @@
1+{-# LANGUAGE FlexibleContexts #-}
2+{-# LANGUAGE LambdaCase #-}
3+{-# LANGUAGE ScopedTypeVariables #-}
14{- |
25 Module : Text.Pandoc.Lua.Packages
3− Copyright : Copyright © 2017-2021 Albert Krewinkel
6+ Copyright : Copyright © 2017-2020 Albert Krewinkel
47 License : GNU GPL, version 2 or above
58
69 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -12,12 +15,15 @@ module Text.Pandoc.Lua.Packages
1215 ( installPandocPackageSearcher
1316 ) where
1417
18+import Control.Monad.Catch (try)
1519import Control.Monad (forM_)
16−import Foreign.Lua (NumResults)
17−import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua, loadDefaultModule)
20+import Data.ByteString (ByteString)
21+import Foreign.Lua (Lua, NumResults)
22+import Text.Pandoc.Error (PandocError)
23+import Text.Pandoc.Class.PandocMonad (readDataFile)
24+import Text.Pandoc.Lua.PandocLua (PandocLua, liftPandocLua)
1825
1926import qualified Foreign.Lua as Lua
20−import qualified Foreign.Lua.Module.Path as Path
2127import qualified Foreign.Lua.Module.Text as Text
2228import qualified Text.Pandoc.Lua.Module.Pandoc as Pandoc
2329import qualified Text.Pandoc.Lua.Module.MediaBag as MediaBag
@@ -44,17 +50,28 @@ pandocPackageSearcher pkgName =
4450 case pkgName of
4551 "pandoc" -> pushWrappedHsFun Pandoc.pushModule
4652 "pandoc.mediabag" -> pushWrappedHsFun MediaBag.pushModule
47− "pandoc.path" -> pushWrappedHsFun Path.pushModule
4853 "pandoc.system" -> pushWrappedHsFun System.pushModule
4954 "pandoc.types" -> pushWrappedHsFun Types.pushModule
5055 "pandoc.utils" -> pushWrappedHsFun Utils.pushModule
5156 "text" -> pushWrappedHsFun Text.pushModule
52− "pandoc.List" -> pushWrappedHsFun (loadDefaultModule pkgName)
53− _ -> reportPandocSearcherFailure
57+ _ -> searchPureLuaLoader
5458 where
5559 pushWrappedHsFun f = liftPandocLua $ do
5660 Lua.pushHaskellFunction f
5761 return 1
58− reportPandocSearcherFailure = liftPandocLua $ do
59− Lua.push ("\n\t" <> pkgName <> "is not one of pandoc's default packages")
60− return (1 :: NumResults)
62+ searchPureLuaLoader = do
63+ let filename = pkgName ++ ".lua"
64+ try (readDataFile filename) >>= \case
65+ Right script -> pushWrappedHsFun (loadStringAsPackage pkgName script)
66+ Left (_ :: PandocError) -> liftPandocLua $ do
67+ Lua.push ("\n\tno file '" ++ filename ++ "' in pandoc's datadir")
68+ return (1 :: NumResults)
69+
70+loadStringAsPackage :: String -> ByteString -> Lua NumResults
71+loadStringAsPackage pkgName script = do
72+ status <- Lua.dostring script
73+ if status == Lua.OK
74+ then return (1 :: NumResults)
75+ else do
76+ msg <- Lua.popValue
77+ Lua.raiseError ("Error while loading `" <> pkgName <> "`.\n" <> msg)
src/Text/Pandoc/Lua/PandocLua.hs+13−20
@@ -9,7 +9,7 @@
99{-# OPTIONS_GHC -fno-warn-orphans #-}
1010{- |
1111 Module : Text.Pandoc.Lua.PandocLua
12− Copyright : Copyright © 2020-2021 Albert Krewinkel
12+ Copyright : Copyright © 2020 Albert Krewinkel
1313 License : GNU GPL, version 2 or above
1414
1515 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
@@ -23,23 +23,24 @@ module Text.Pandoc.Lua.PandocLua
2323 , runPandocLua
2424 , liftPandocLua
2525 , addFunction
26− , loadDefaultModule
26+ , loadScriptFromDataDir
2727 ) where
2828
29+import Control.Monad (when)
2930import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow)
3031import Control.Monad.Except (MonadError (catchError, throwError))
3132import Control.Monad.IO.Class (MonadIO (liftIO))
3233import Foreign.Lua (Lua (..), NumResults, Pushable, ToHaskellFunction)
3334import Text.Pandoc.Class.PandocIO (PandocIO)
34−import Text.Pandoc.Class.PandocMonad (PandocMonad (..), readDefaultDataFile)
35−import Text.Pandoc.Error (PandocError (PandocLuaError))
35+import Text.Pandoc.Class.PandocMonad (PandocMonad (..), readDataFile)
36+import Text.Pandoc.Error (PandocError)
3637import Text.Pandoc.Lua.Global (Global (..), setGlobals)
3738import Text.Pandoc.Lua.ErrorConversion (errorConversion)
3839
3940import qualified Control.Monad.Catch as Catch
40−import qualified Data.Text as T
4141import qualified Foreign.Lua as Lua
4242import qualified Text.Pandoc.Class.IO as IO
43+import qualified Text.Pandoc.Lua.Util as LuaUtil
4344
4445-- | Type providing access to both, pandoc and Lua operations.
4546newtype PandocLua a = PandocLua { unPandocLua :: Lua a }
@@ -85,22 +86,14 @@ addFunction name fn = liftPandocLua $ do
8586 Lua.pushHaskellFunction fn
8687 Lua.rawset (-3)
8788
88−-- | Load a pure Lua module included with pandoc. Leaves the result on
89−-- the stack and returns @NumResults 1@.
90−--
91−-- The script is loaded from the default data directory. We do not load
92−-- from data directories supplied via command line, as this could cause
93−-- scripts to be executed even though they had not been passed explicitly.
94−loadDefaultModule :: String -> PandocLua NumResults
95−loadDefaultModule name = do
96− script <- readDefaultDataFile (name <> ".lua")
89+-- | Load a file from pandoc's data directory.
90+loadScriptFromDataDir :: FilePath -> PandocLua ()
91+loadScriptFromDataDir scriptFile = do
92+ script <- readDataFile scriptFile
9793 status <- liftPandocLua $ Lua.dostring script
98− if status == Lua.OK
99− then return (1 :: NumResults)
100− else do
101− msg <- liftPandocLua Lua.popValue
102− let err = "Error while loading `" <> name <> "`.\n" <> msg
103− throwError $ PandocLuaError (T.pack err)
94+ when (status /= Lua.OK) . liftPandocLua $
95+ LuaUtil.throwTopMessageAsError'
96+ (("Couldn't load '" ++ scriptFile ++ "'.\n") ++)
10497
10598-- | Global variables which should always be set.
10699defaultGlobals :: PandocIO [Global]
src/Text/Pandoc/Lua/Util.hs+2−2
@@ -3,8 +3,8 @@
33{-# LANGUAGE OverloadedStrings #-}
44{- |
55 Module : Text.Pandoc.Lua.Util
6− Copyright : © 2012-2021 John MacFarlane,
7− © 2017-2021 Albert Krewinkel
6+ Copyright : © 2012–2020 John MacFarlane,
7+ © 2017-2020 Albert Krewinkel
88 License : GNU GPL, version 2 or above
99
1010 Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Walk.hs+2−2
@@ -4,8 +4,8 @@
44{-# LANGUAGE MultiParamTypeClasses #-}
55{- |
66Module : Text.Pandoc.Lua.Walk
7−Copyright : © 2012-2021 John MacFarlane,
8− © 2017-2021 Albert Krewinkel
7+Copyright : © 2012–2020 John MacFarlane,
8+ © 2017-2020 Albert Krewinkel
99License : GNU GPL, version 2 or above
1010Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
1111Stability : alpha
src/Text/Pandoc/MIME.hs+3−26
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.MIME
4− Copyright : Copyright (C) 2011-2021 John MacFarlane
4+ Copyright : Copyright (C) 2011-2020 John MacFarlane
55 License : GNU GPL, version 2 or above
66
77 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -10,13 +10,8 @@
1010
1111Mime type lookup.
1212-}
13−module Text.Pandoc.MIME (
14− MimeType,
15− getMimeType,
16− getMimeTypeDef,
17− getCharset,
18− extensionFromMimeType,
19− mediaCategory ) where
13+module Text.Pandoc.MIME ( MimeType, getMimeType, getMimeTypeDef,
14+ extensionFromMimeType, mediaCategory ) where
2015import Data.List (isPrefixOf, isSuffixOf)
2116import qualified Data.Map as M
2217import qualified Data.Text as T
@@ -43,16 +38,6 @@ getMimeTypeDef :: FilePath -> MimeType
4338getMimeTypeDef = fromMaybe "application/octet-stream" . getMimeType
4439
4540extensionFromMimeType :: MimeType -> Maybe T.Text
46−-- few special cases, where there are multiple options:
47−extensionFromMimeType "text/plain" = Just "txt"
48−extensionFromMimeType "video/quicktime" = Just "mov"
49−extensionFromMimeType "video/mpeg" = Just "mpeg"
50−extensionFromMimeType "video/dv" = Just "dv"
51−extensionFromMimeType "image/vnd.djvu" = Just "djvu"
52−extensionFromMimeType "image/tiff" = Just "tiff"
53−extensionFromMimeType "image/jpeg" = Just "jpg"
54−extensionFromMimeType "application/xml" = Just "xml"
55−extensionFromMimeType "application/ogg" = Just "ogg"
5641extensionFromMimeType mimetype =
5742 M.lookup (T.takeWhile (/=';') mimetype) reverseMimeTypes
5843 -- note: we just look up the basic mime type, dropping the content-encoding etc.
@@ -69,14 +54,6 @@ reverseMimeTypes = M.fromList $ map swap mimeTypesList
6954mimeTypes :: M.Map T.Text MimeType
7055mimeTypes = M.fromList mimeTypesList
7156
72−-- | Get the charset from a mime type, if one is present.
73−getCharset :: MimeType -> Maybe T.Text
74−getCharset mt =
75− let (_,y) = T.breakOn "charset=" mt
76− in if T.null y
77− then Nothing
78− else Just $ T.toUpper $ T.takeWhile (/= ';') $ T.drop 8 y
79−
8057-- | Collection of common mime types.
8158-- Except for first entry, list borrowed from
8259-- <https://github.com/Happstack/happstack-server/blob/master/src/Happstack/Server/FileServe/BuildingBlocks.hs happstack-server>
src/Text/Pandoc/MediaBag.hs+15−46
@@ -1,10 +1,9 @@
11{-# LANGUAGE CPP #-}
2−{-# LANGUAGE OverloadedStrings #-}
32{-# LANGUAGE DeriveDataTypeable #-}
43{-# LANGUAGE GeneralizedNewtypeDeriving #-}
54{- |
65 Module : Text.Pandoc.MediaBag
7− Copyright : Copyright (C) 2014-2015, 2017-2021 John MacFarlane
6+ Copyright : Copyright (C) 2014-2015, 2017–2020 John MacFarlane
87 License : GNU GPL, version 2 or above
98
109 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -15,7 +14,6 @@ Definition of a MediaBag object to hold binary resources, and an
1514interface for interacting with it.
1615-}
1716module Text.Pandoc.MediaBag (
18− MediaItem(..),
1917 MediaBag,
2018 deleteMedia,
2119 lookupMedia,
@@ -26,43 +24,29 @@ module Text.Pandoc.MediaBag (
2624import qualified Data.ByteString.Lazy as BL
2725import Data.Data (Data)
2826import qualified Data.Map as M
29−import Data.Maybe (fromMaybe, isNothing)
27+import Data.Maybe (fromMaybe)
3028import Data.Typeable (Typeable)
3129import System.FilePath
32−import Text.Pandoc.MIME (MimeType, getMimeTypeDef, extensionFromMimeType)
33−import Data.Text (Text)
34−import qualified Data.Text as T
35−import Data.Digest.Pure.SHA (sha1, showDigest)
36−import Network.URI (URI (..), parseURI)
37−
38−data MediaItem =
39− MediaItem
40− { mediaMimeType :: MimeType
41− , mediaPath :: FilePath
42− , mediaContents :: BL.ByteString
43− } deriving (Eq, Ord, Show, Data, Typeable)
30+import qualified System.FilePath.Posix as Posix
31+import Text.Pandoc.MIME (MimeType, getMimeTypeDef)
4432
4533-- | A container for a collection of binary resources, with names and
4634-- mime types. Note that a 'MediaBag' is a Monoid, so 'mempty'
4735-- can be used for an empty 'MediaBag', and '<>' can be used to append
4836-- two 'MediaBag's.
49−newtype MediaBag = MediaBag (M.Map Text MediaItem)
37+newtype MediaBag = MediaBag (M.Map [FilePath] (MimeType, BL.ByteString))
5038 deriving (Semigroup, Monoid, Data, Typeable)
5139
5240instance Show MediaBag where
5341 show bag = "MediaBag " ++ show (mediaDirectory bag)
5442
55−-- | We represent paths with /, in normalized form.
56−canonicalize :: FilePath -> Text
57−canonicalize = T.replace "\\" "/" . T.pack . normalise
58−
5943-- | Delete a media item from a 'MediaBag', or do nothing if no item corresponds
6044-- to the given path.
6145deleteMedia :: FilePath -- ^ relative path and canonical name of resource
6246 -> MediaBag
6347 -> MediaBag
6448deleteMedia fp (MediaBag mediamap) =
65− MediaBag $ M.delete (canonicalize fp) mediamap
49+ MediaBag $ M.delete (splitDirectories fp) mediamap
6650
6751-- | Insert a media item into a 'MediaBag', replacing any existing
6852-- value with the same name.
@@ -72,41 +56,26 @@ insertMedia :: FilePath -- ^ relative path and canonical name of resource
7256 -> MediaBag
7357 -> MediaBag
7458insertMedia fp mbMime contents (MediaBag mediamap) =
75− MediaBag (M.insert fp' mediaItem mediamap)
76− where mediaItem = MediaItem{ mediaPath = newpath
77− , mediaContents = contents
78− , mediaMimeType = mt }
79− fp' = canonicalize fp
80− uri = parseURI fp
81− newpath = if isRelative fp
82− && isNothing uri
83− && ".." `notElem` splitPath fp
84− then T.unpack fp'
85− else showDigest (sha1 contents) <> "." <> ext
59+ MediaBag (M.insert (splitDirectories fp) (mime, contents) mediamap)
60+ where mime = fromMaybe fallback mbMime
8661 fallback = case takeExtension fp of
8762 ".gz" -> getMimeTypeDef $ dropExtension fp
8863 _ -> getMimeTypeDef fp
89− mt = fromMaybe fallback mbMime
90− path = maybe fp uriPath uri
91− ext = case takeExtension path of
92− '.':e -> e
93− _ -> maybe "" T.unpack $ extensionFromMimeType mt
94−
9564
9665-- | Lookup a media item in a 'MediaBag', returning mime type and contents.
9766lookupMedia :: FilePath
9867 -> MediaBag
99− -> Maybe MediaItem
100−lookupMedia fp (MediaBag mediamap) = M.lookup (canonicalize fp) mediamap
68+ -> Maybe (MimeType, BL.ByteString)
69+lookupMedia fp (MediaBag mediamap) = M.lookup (splitDirectories fp) mediamap
10170
10271-- | Get a list of the file paths stored in a 'MediaBag', with
10372-- their corresponding mime types and the lengths in bytes of the contents.
10473mediaDirectory :: MediaBag -> [(FilePath, MimeType, Int)]
105−mediaDirectory mediabag =
106− map (\(fp, mt, bs) -> (fp, mt, fromIntegral (BL.length bs)))
107− (mediaItems mediabag)
74+mediaDirectory (MediaBag mediamap) =
75+ M.foldrWithKey (\fp (mime,contents) ->
76+ ((Posix.joinPath fp, mime, fromIntegral $ BL.length contents):)) [] mediamap
10877
10978mediaItems :: MediaBag -> [(FilePath, MimeType, BL.ByteString)]
11079mediaItems (MediaBag mediamap) =
111− map (\item -> (mediaPath item, mediaMimeType item, mediaContents item))
112− (M.elems mediamap)
80+ M.foldrWithKey (\fp (mime,contents) ->
81+ ((Posix.joinPath fp, mime, contents):)) [] mediamap
src/Text/Pandoc/Options.hs+19−22
@@ -6,7 +6,7 @@
66{-# LANGUAGE TemplateHaskell #-}
77{- |
88 Module : Text.Pandoc.Options
9− Copyright : Copyright (C) 2012-2021 John MacFarlane
9+ Copyright : Copyright (C) 2012-2020 John MacFarlane
1010 License : GNU GPL, version 2 or above
1111
1212 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -65,7 +65,6 @@ data ReaderOptions = ReaderOptions{
6565 , readerDefaultImageExtension :: Text -- ^ Default extension for images
6666 , readerTrackChanges :: TrackChanges -- ^ Track changes setting for docx
6767 , readerStripComments :: Bool -- ^ Strip HTML comments instead of parsing as raw HTML
68− -- (only implemented in commonmark)
6968} deriving (Show, Read, Data, Typeable, Generic)
7069
7170instance HasSyntaxExtensions ReaderOptions where
@@ -290,7 +289,7 @@ instance Default WriterOptions where
290289 , writerTopLevelDivision = TopLevelDefault
291290 , writerListings = False
292291 , writerHighlightStyle = Just pygments
293− , writerSetextHeaders = False
292+ , writerSetextHeaders = True
294293 , writerEpubSubdirectory = "EPUB"
295294 , writerEpubMetadata = Nothing
296295 , writerEpubFonts = []
@@ -310,29 +309,11 @@ isEnabled :: HasSyntaxExtensions a => Extension -> a -> Bool
310309isEnabled ext opts = ext `extensionEnabled` getExtensions opts
311310
312311defaultMathJaxURL :: Text
313−defaultMathJaxURL = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js"
312+defaultMathJaxURL = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
314313
315314defaultKaTeXURL :: Text
316315defaultKaTeXURL = "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/"
317316
318−-- Update documentation in doc/filters.md if this is changed.
319−$(deriveJSON defaultOptions{ constructorTagModifier =
320− camelCaseStrToHyphenated
321− } ''TrackChanges)
322−
323−$(deriveJSON defaultOptions{ constructorTagModifier =
324− camelCaseStrToHyphenated
325− } ''WrapOption)
326−
327−$(deriveJSON defaultOptions{ constructorTagModifier =
328− camelCaseStrToHyphenated . drop 8
329− } ''TopLevelDivision)
330−
331−$(deriveJSON defaultOptions{ constructorTagModifier =
332− camelCaseStrToHyphenated
333− } ''ReferenceLocation)
334−
335−-- Update documentation in doc/filters.md if this is changed.
336317$(deriveJSON defaultOptions ''ReaderOptions)
337318
338319$(deriveJSON defaultOptions{
@@ -355,3 +336,19 @@ $(deriveJSON defaultOptions{ constructorTagModifier =
355336 } ''ObfuscationMethod)
356337
357338$(deriveJSON defaultOptions ''HTMLSlideVariant)
339+
340+$(deriveJSON defaultOptions{ constructorTagModifier =
341+ camelCaseStrToHyphenated
342+ } ''TrackChanges)
343+
344+$(deriveJSON defaultOptions{ constructorTagModifier =
345+ camelCaseStrToHyphenated
346+ } ''WrapOption)
347+
348+$(deriveJSON defaultOptions{ constructorTagModifier =
349+ camelCaseStrToHyphenated . drop 8
350+ } ''TopLevelDivision)
351+
352+$(deriveJSON defaultOptions{ constructorTagModifier =
353+ camelCaseStrToHyphenated
354+ } ''ReferenceLocation)
src/Text/Pandoc/PDF.hs+17−38
@@ -4,7 +4,7 @@
44{-# LANGUAGE ScopedTypeVariables #-}
55{- |
66 Module : Text.Pandoc.PDF
7− Copyright : Copyright (C) 2012-2021 John MacFarlane
7+ Copyright : Copyright (C) 2012-2020 John MacFarlane
88 License : GNU GPL, version 2 or above
99
1010 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -43,7 +43,6 @@ import Text.Pandoc.Definition
4343import Text.Pandoc.Error (PandocError (PandocPDFProgramNotFoundError))
4444import Text.Pandoc.MIME (getMimeType)
4545import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..))
46−import Text.Pandoc.Extensions (disableExtension, Extension(Ext_smart))
4746import Text.Pandoc.Process (pipeProcess)
4847import System.Process (readProcessWithExitCode)
4948import Text.Pandoc.Shared (inDirectory, stringify, tshow)
@@ -61,10 +60,7 @@ import Text.Pandoc.Logging
6160
6261#ifdef _WINDOWS
6362changePathSeparators :: FilePath -> FilePath
64−changePathSeparators =
65− -- We filter out backslashes because an initial `C:\` gets
66− -- retained by `splitDirectories`, see #6173:
67− intercalate "/" . map (filter (/='\\')) . splitDirectories
63+changePathSeparators = intercalate "/" . splitDirectories
6864#endif
6965
7066makePDF :: String -- ^ pdf creator (pdflatex, lualatex, xelatex,
@@ -115,10 +111,7 @@ makePDF program pdfargs writer opts doc =
115111 runIOorExplode $ do
116112 putCommonState commonState
117113 doc' <- handleImages opts tmpdir doc
118− source <- writer opts{ writerExtensions = -- disable use of quote
119− -- ligatures to avoid bad ligatures like ?`
120− disableExtension Ext_smart
121− (writerExtensions opts) } doc'
114+ source <- writer opts doc'
122115 res <- case baseProg of
123116 "context" -> context2pdf verbosity program pdfargs tmpdir source
124117 "tectonic" -> tectonic2pdf verbosity program pdfargs tmpdir source
@@ -202,7 +195,7 @@ convertImage opts tmpdir fname = do
202195 Just "image/svg+xml" -> E.catch (do
203196 (exit, _) <- pipeProcess Nothing "rsvg-convert"
204197 ["-f","pdf","-a","--dpi-x",dpi,"--dpi-y",dpi,
205− "-o",pdfOut,svgIn] BL.empty
198+ "-o",pdfOut,fname] BL.empty
206199 if exit == ExitSuccess
207200 then return $ Right pdfOut
208201 else return $ Left "conversion from SVG failed")
@@ -217,7 +210,6 @@ convertImage opts tmpdir fname = do
217210 where
218211 pngOut = replaceDirectory (replaceExtension fname ".png") tmpdir
219212 pdfOut = replaceDirectory (replaceExtension fname ".pdf") tmpdir
220− svgIn = tmpdir </> fname
221213 mime = getMimeType fname
222214 doNothing = return (Right fname)
223215
@@ -271,7 +263,7 @@ missingCharacterWarnings verbosity log' = do
271263 | isAscii c = T.singleton c
272264 | otherwise = T.pack $ c : " (U+" ++ printf "%04X" (ord c) ++ ")"
273265 let addCodePoint = T.concatMap toCodePoint
274− let warnings = [ addCodePoint (utf8ToText (BC.drop 19 l))
266+ let warnings = [ addCodePoint (T.pack $ utf8ToString (BC.drop 19 l))
275267 | l <- ls
276268 , isMissingCharacterWarning l
277269 ]
@@ -315,7 +307,7 @@ runTectonic verbosity program args' tmpDir' source = do
315307 env <- liftIO getEnvironment
316308 when (verbosity >= INFO) $ liftIO $
317309 showVerboseInfo (Just tmpDir) program programArgs env
318− (utf8ToText sourceBL)
310+ (utf8ToString sourceBL)
319311 (exit, out) <- liftIO $ E.catch
320312 (pipeProcess (Just env) program programArgs sourceBL)
321313 (handlePDFProgramNotFound program)
@@ -386,7 +378,7 @@ runTeXProgram verbosity program args numRuns tmpDir' source = do
386378 (pipeProcess (Just env'') program programArgs BL.empty)
387379 (handlePDFProgramNotFound program)
388380 when (verbosity >= INFO) $ liftIO $ do
389− UTF8.hPutStrLn stderr $ "[makePDF] Run #" <> tshow runNumber
381+ UTF8.hPutStrLn stderr $ "[makePDF] Run #" ++ show runNumber
390382 BL.hPutStr stderr out
391383 UTF8.hPutStr stderr "\n"
392384 if runNumber < numRuns
@@ -406,7 +398,7 @@ generic2pdf :: Verbosity
406398generic2pdf verbosity program args source = do
407399 env' <- getEnvironment
408400 when (verbosity >= INFO) $
409− showVerboseInfo Nothing program args env' source
401+ showVerboseInfo Nothing program args env' (T.unpack source)
410402 (exit, out) <- E.catch
411403 (pipeProcess (Just env') program args
412404 (BL.fromStrict $ UTF8.fromText source))
@@ -495,32 +487,19 @@ showVerboseInfo :: Maybe FilePath
495487 -> String
496488 -> [String]
497489 -> [(String, String)]
498− -> Text
490+ -> String
499491 -> IO ()
500492showVerboseInfo mbTmpDir program programArgs env source = do
501493 case mbTmpDir of
502494 Just tmpDir -> do
503495 UTF8.hPutStrLn stderr "[makePDF] temp dir:"
504− UTF8.hPutStrLn stderr (T.pack tmpDir)
496+ UTF8.hPutStrLn stderr tmpDir
505497 Nothing -> return ()
506498 UTF8.hPutStrLn stderr "[makePDF] Command line:"
507− UTF8.hPutStrLn stderr $
508− T.pack program <> " " <> T.pack (unwords (map show programArgs))
499+ UTF8.hPutStrLn stderr $ program ++ " " ++ unwords (map show programArgs)
509500 UTF8.hPutStr stderr "\n"
510− UTF8.hPutStrLn stderr "[makePDF] Relevant environment variables:"
511− -- we filter out irrelevant stuff to avoid leaking passwords and keys!
512− let isRelevant ("PATH",_) = True
513− isRelevant ("TMPDIR",_) = True
514− isRelevant ("PWD",_) = True
515− isRelevant ("LANG",_) = True
516− isRelevant ("HOME",_) = True
517− isRelevant ("LUA_PATH",_) = True
518− isRelevant ("LUA_CPATH",_) = True
519− isRelevant ("SHELL",_) = True
520− isRelevant ("TEXINPUTS",_) = True
521− isRelevant ("TEXMFOUTPUT",_) = True
522− isRelevant _ = False
523− mapM_ (UTF8.hPutStrLn stderr . tshow) (filter isRelevant env)
501+ UTF8.hPutStrLn stderr "[makePDF] Environment:"
502+ mapM_ (UTF8.hPutStrLn stderr . show) env
524503 UTF8.hPutStr stderr "\n"
525504 UTF8.hPutStrLn stderr "[makePDF] Source:"
526505 UTF8.hPutStrLn stderr source
@@ -531,8 +510,8 @@ handlePDFProgramNotFound program e
531510 E.throwIO $ PandocPDFProgramNotFoundError $ T.pack program
532511 | otherwise = E.throwIO e
533512
534−utf8ToText :: ByteString -> Text
535−utf8ToText lbs =
513+utf8ToString :: ByteString -> String
514+utf8ToString lbs =
536515 case decodeUtf8' lbs of
537− Left _ -> T.pack $ BC.unpack lbs -- if decoding fails, treat as latin1
538− Right t -> TL.toStrict t
516+ Left _ -> BC.unpack lbs -- if decoding fails, treat as latin1
517+ Right t -> TL.unpack t
src/Text/Pandoc/Parsing.hs+266−414
@@ -5,10 +5,11 @@
55{-# LANGUAGE GeneralizedNewtypeDeriving #-}
66{-# LANGUAGE IncoherentInstances #-}
77{-# LANGUAGE MultiParamTypeClasses #-}
8+{-# LANGUAGE ViewPatterns #-}
89{-# LANGUAGE OverloadedStrings #-}
910{- |
1011 Module : Text.Pandoc.Parsing
11− Copyright : Copyright (C) 2006-2021 John MacFarlane
12+ Copyright : Copyright (C) 2006-2020 John MacFarlane
1213 License : GNU GPL, version 2 or above
1314
1415 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -18,7 +19,8 @@
1819A utility library with parsers used in pandoc readers.
1920-}
2021
21−module Text.Pandoc.Parsing ( module Text.Pandoc.Sources,
22+module Text.Pandoc.Parsing ( take1WhileP,
23+ takeP,
2224 countChar,
2325 textStr,
2426 anyLine,
@@ -103,14 +105,14 @@ module Text.Pandoc.Parsing ( module Text.Pandoc.Sources,
103105 singleQuoteEnd,
104106 doubleQuoteStart,
105107 doubleQuoteEnd,
106− apostrophe,
107− doubleCloseQuote,
108108 ellipses,
109+ apostrophe,
109110 dash,
110111 nested,
111112 citeKey,
112113 Parser,
113114 ParserT,
115+ F,
114116 Future(..),
115117 runF,
116118 askF,
@@ -121,6 +123,7 @@ module Text.Pandoc.Parsing ( module Text.Pandoc.Sources,
121123 (<+?>),
122124 extractIdClass,
123125 insertIncludedFile,
126+ insertIncludedFileF,
124127 -- * Re-exports from Text.Parsec
125128 Stream,
126129 runParser,
@@ -131,10 +134,22 @@ module Text.Pandoc.Parsing ( module Text.Pandoc.Sources,
131134 getInput,
132135 setInput,
133136 unexpected,
137+ char,
138+ letter,
139+ digit,
140+ alphaNum,
134141 skipMany,
135142 skipMany1,
143+ spaces,
144+ space,
145+ anyChar,
146+ satisfy,
147+ newline,
148+ string,
136149 count,
137150 eof,
151+ noneOf,
152+ oneOf,
138153 lookAhead,
139154 notFollowedBy,
140155 many,
@@ -159,158 +174,60 @@ module Text.Pandoc.Parsing ( module Text.Pandoc.Sources,
159174 SourcePos,
160175 getPosition,
161176 setPosition,
162− sourceName,
163− setSourceName,
164177 sourceColumn,
165178 sourceLine,
166179 setSourceColumn,
167180 setSourceLine,
168181 incSourceColumn,
169− incSourceLine,
170182 newPos,
171− initialPos,
172183 Line,
173− Column,
174− ParseError
184+ Column
175185 )
176186where
177187
178188import Control.Monad.Identity
179− ( guard,
180− join,
181− unless,
182− when,
183− void,
184− liftM2,
185− liftM,
186− Identity(..),
187− MonadPlus(mzero) )
188189import Control.Monad.Reader
189− ( asks, runReader, MonadReader(ask), Reader, ReaderT(ReaderT) )
190−import Data.Char (chr, isAlphaNum, isAscii, isAsciiUpper, isAsciiLower,
191− isSpace, ord, toLower, toUpper)
192−import Data.Default ( Default(..) )
190+import Data.Char (chr, isAlphaNum, isAscii, isAsciiUpper,
191+ isPunctuation, isSpace, ord, toLower, toUpper)
192+import Data.Default
193193import Data.Functor (($>))
194194import Data.List (intercalate, transpose)
195195import qualified Data.Map as M
196−import Data.Maybe (fromMaybe)
196+import Data.Maybe (mapMaybe, fromMaybe)
197197import qualified Data.Set as Set
198+import Data.String
198199import Data.Text (Text)
199200import qualified Data.Text as T
200201import Text.HTML.TagSoup.Entity (lookupEntity)
201−import Text.Pandoc.Asciify (toAsciiText)
202+import Text.Pandoc.Asciify (toAsciiChar)
202203import Text.Pandoc.Builder (Blocks, HasMeta (..), Inlines, trimInlines)
203204import qualified Text.Pandoc.Builder as B
204205import Text.Pandoc.Class.PandocMonad (PandocMonad, readFileFromDirs, report)
205206import Text.Pandoc.Definition
206− ( Target,
207− nullMeta,
208− nullAttr,
209− Meta,
210− ColWidth(ColWidthDefault, ColWidth),
211− TableFoot(TableFoot),
212− TableBody(TableBody),
213− Attr,
214− TableHead(TableHead),
215− Row(..),
216− Alignment(..),
217− Inline(Str),
218− ListNumberDelim(..),
219− ListAttributes,
220− ListNumberStyle(..) )
221207import Text.Pandoc.Logging
222− ( LogMessage(CouldNotLoadIncludeFile, DuplicateIdentifier) )
223208import Text.Pandoc.Options
224− ( extensionEnabled,
225− Extension(Ext_old_dashes, Ext_tex_math_dollars,
226− Ext_tex_math_single_backslash, Ext_tex_math_double_backslash,
227− Ext_auto_identifiers, Ext_ascii_identifiers, Ext_smart),
228− ReaderOptions(readerTabStop, readerColumns, readerExtensions) )
229209import Text.Pandoc.Readers.LaTeX.Types (Macro)
230210import Text.Pandoc.Shared
231− ( uniqueIdent,
232− tshow,
233− mapLeft,
234− compactify,
235− trim,
236− trimr,
237− splitTextByIndices,
238− safeRead,
239− trimMath,
240− schemes,
241− escapeURI )
242−import Text.Pandoc.Sources
243211import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn)
244212import Text.Pandoc.XML (fromEntities)
245−import Text.Parsec
246− ( between,
247− setSourceName,
248− Parsec,
249− Column,
250− Line,
251− incSourceLine,
252− incSourceColumn,
253− setSourceLine,
254− setSourceColumn,
255− sourceLine,
256− sourceColumn,
257− sourceName,
258− setSourceName,
259− setPosition,
260− getPosition,
261− updateState,
262− setState,
263− getState,
264− optionMaybe,
265− optional,
266− option,
267− endBy1,
268− endBy,
269− sepEndBy1,
270− sepEndBy,
271− sepBy1,
272− sepBy,
273− try,
274− choice,
275− (<?>),
276− (<|>),
277− manyTill,
278− many1,
279− many,
280− notFollowedBy,
281− lookAhead,
282− eof,
283− count,
284− skipMany1,
285− skipMany,
286− unexpected,
287− setInput,
288− getInput,
289− anyToken,
290− tokenPrim,
291− parse,
292− runParserT,
293− runParser,
294− ParseError,
295− ParsecT,
296− SourcePos,
297− Stream(..) )
298−import Text.Parsec.Pos (initialPos, newPos)
299−import Control.Monad.Except ( MonadError(throwError) )
213+import Text.Parsec hiding (token)
214+import Text.Parsec.Pos (initialPos, newPos, updatePosString)
215+
216+import Control.Monad.Except
300217import Text.Pandoc.Error
301− ( PandocError(PandocParseError, PandocParsecError) )
302218
303219type Parser t s = Parsec t s
304220
305221type ParserT = ParsecT
306222
307−
308223-- | Reader monad wrapping the parser state. This is used to possibly delay
309224-- evaluation until all relevant information has been parsed and made available
310225-- in the parser state.
311226newtype Future s a = Future { runDelayed :: Reader s a }
312227 deriving (Monad, Applicative, Functor)
313228
229+type F = Future ParserState
230+
314231runF :: Future s a -> s -> a
315232runF = runReader . runDelayed
316233
@@ -333,48 +250,70 @@ instance (Semigroup a, Monoid a) => Monoid (Future s a) where
333250 mappend = (<>)
334251
335252-- | Like @count@, but packs its result
336−countChar :: (Stream s m Char, UpdateSourcePos s Char, Monad m)
253+countChar :: (Stream s m Char, Monad m)
337254 => Int
338255 -> ParsecT s st m Char
339256 -> ParsecT s st m Text
340257countChar n = fmap T.pack . count n
341258
342259-- | Like @string@, but uses @Text@.
343−textStr :: (Stream s m Char, UpdateSourcePos s Char)
344− => Text -> ParsecT s u m Text
260+textStr :: Stream s m Char => Text -> ParsecT s u m Text
345261textStr t = string (T.unpack t) $> t
346262
347−
348−-- | Parse any line of text, returning the contents without the
349−-- final newline.
350−anyLine :: Monad m => ParserT Sources st m Text
263+-- | Parse characters while a predicate is true.
264+take1WhileP :: Monad m
265+ => (Char -> Bool)
266+ -> ParserT Text st m Text
267+take1WhileP f = do
268+ -- needed to persuade parsec that this won't match an empty string:
269+ c <- satisfy f
270+ inp <- getInput
271+ pos <- getPosition
272+ let (t, rest) = T.span f inp
273+ setInput rest
274+ setPosition $
275+ if f '\t' || f '\n'
276+ then updatePosString pos $ T.unpack t
277+ else incSourceColumn pos (T.length t)
278+ return $ T.singleton c <> t
279+
280+-- Parse n characters of input (or the rest of the input if
281+-- there aren't n characters).
282+takeP :: Monad m => Int -> ParserT Text st m Text
283+takeP n = do
284+ guard (n > 0)
285+ -- faster than 'count n anyChar'
286+ inp <- getInput
287+ pos <- getPosition
288+ let (xs, rest) = T.splitAt n inp
289+ -- needed to persuade parsec that this won't match an empty string:
290+ anyChar
291+ setInput rest
292+ setPosition $ updatePosString pos $ T.unpack xs
293+ return xs
294+
295+-- | Parse any line of text
296+anyLine :: Monad m => ParserT Text st m Text
351297anyLine = do
352298 -- This is much faster than:
353299 -- manyTill anyChar newline
354300 inp <- getInput
355− case inp of
356− Sources [] -> mzero
357− Sources ((fp,t):inps) ->
358− -- we assume that lines don't span different input files
359− case T.break (=='\n') t of
360− (this, rest)
361− | T.null rest
362− , not (null inps) ->
363− -- line may span different input files, so do it
364− -- character by character
365− T.pack <$> manyTill anyChar newline
366− | otherwise -> do -- either end of inputs or newline in rest
367− setInput $ Sources ((fp, rest):inps)
368− char '\n' -- needed so parsec knows we won't match empty string
369− -- and so source pos is updated
370− return this
301+ pos <- getPosition
302+ case T.break (=='\n') inp of
303+ (this, T.uncons -> Just ('\n', rest)) -> do
304+ -- needed to persuade parsec that this won't match an empty string:
305+ anyChar
306+ setInput rest
307+ setPosition $ incSourceLine (setSourceColumn pos 1) 1
308+ return this
309+ _ -> mzero
371310
372311-- | Parse any line, include the final newline in the output
373−anyLineNewline :: Monad m => ParserT Sources st m Text
312+anyLineNewline :: Monad m => ParserT Text st m Text
374313anyLineNewline = (<> "\n") <$> anyLine
375314
376315-- | Parse indent by specified number of spaces (or equiv. tabs)
377−indentWith :: (Stream s m Char, UpdateSourcePos s Char)
316+indentWith :: Stream s m Char
378317 => HasReaderOptions st
379318 => Int -> ParserT s st m Text
380319indentWith num = do
@@ -459,13 +398,11 @@ notFollowedBy' p = try $ join $ do a <- try p
459398 return (return ())
460399-- (This version due to Andrew Pimlott on the Haskell mailing list.)
461400
462−oneOfStrings' :: (Stream s m Char, UpdateSourcePos s Char)
463− => (Char -> Char -> Bool) -> [Text] -> ParserT s st m Text
401+oneOfStrings' :: Stream s m Char => (Char -> Char -> Bool) -> [Text] -> ParserT s st m Text
464402oneOfStrings' f = fmap T.pack . oneOfStrings'' f . fmap T.unpack
465403
466404-- TODO: This should be re-implemented in a Text-aware way
467−oneOfStrings'' :: (Stream s m Char, UpdateSourcePos s Char)
468− => (Char -> Char -> Bool) -> [String] -> ParserT s st m String
405+oneOfStrings'' :: Stream s m Char => (Char -> Char -> Bool) -> [String] -> ParserT s st m String
469406oneOfStrings'' _ [] = Prelude.fail "no strings"
470407oneOfStrings'' matches strs = try $ do
471408 c <- anyChar
@@ -480,16 +417,14 @@ oneOfStrings'' matches strs = try $ do
480417-- | Parses one of a list of strings. If the list contains
481418-- two strings one of which is a prefix of the other, the longer
482419-- string will be matched if possible.
483−oneOfStrings :: (Stream s m Char, UpdateSourcePos s Char)
484− => [Text] -> ParserT s st m Text
420+oneOfStrings :: Stream s m Char => [Text] -> ParserT s st m Text
485421oneOfStrings = oneOfStrings' (==)
486422
487423-- | Parses one of a list of strings (tried in order), case insensitive.
488424
489425-- TODO: This will not be accurate with general Unicode (neither
490426-- Text.toLower nor Text.toCaseFold can be implemented with a map)
491−oneOfStringsCI :: (Stream s m Char, UpdateSourcePos s Char)
492− => [Text] -> ParserT s st m Text
427+oneOfStringsCI :: Stream s m Char => [Text] -> ParserT s st m Text
493428oneOfStringsCI = oneOfStrings' ciMatch
494429 where ciMatch x y = toLower' x == toLower' y
495430 -- this optimizes toLower by checking common ASCII case
@@ -500,41 +435,29 @@ oneOfStringsCI = oneOfStrings' ciMatch
500435 | otherwise = toLower c
501436
502437-- | Parses a space or tab.
503−spaceChar :: (Stream s m Char, UpdateSourcePos s Char)
504− => ParserT s st m Char
438+spaceChar :: Stream s m Char => ParserT s st m Char
505439spaceChar = satisfy $ \c -> c == ' ' || c == '\t'
506440
507441-- | Parses a nonspace, nonnewline character.
508−nonspaceChar :: (Stream s m Char, UpdateSourcePos s Char)
509− => ParserT s st m Char
510−nonspaceChar = satisfy (not . isSpaceChar)
511−
512−isSpaceChar :: Char -> Bool
513−isSpaceChar ' ' = True
514−isSpaceChar '\t' = True
515−isSpaceChar '\n' = True
516−isSpaceChar '\r' = True
517−isSpaceChar _ = False
442+nonspaceChar :: Stream s m Char => ParserT s st m Char
443+nonspaceChar = noneOf ['\t', '\n', ' ', '\r']
518444
519445-- | Skips zero or more spaces or tabs.
520−skipSpaces :: (Stream s m Char, UpdateSourcePos s Char)
521− => ParserT s st m ()
446+skipSpaces :: Stream s m Char => ParserT s st m ()
522447skipSpaces = skipMany spaceChar
523448
524449-- | Skips zero or more spaces or tabs, then reads a newline.
525−blankline :: (Stream s m Char, UpdateSourcePos s Char)
526− => ParserT s st m Char
450+blankline :: Stream s m Char => ParserT s st m Char
527451blankline = try $ skipSpaces >> newline
528452
529453-- | Parses one or more blank lines and returns a string of newlines.
530−blanklines :: (Stream s m Char, UpdateSourcePos s Char)
531− => ParserT s st m Text
454+blanklines :: Stream s m Char => ParserT s st m Text
532455blanklines = T.pack <$> many1 blankline
533456
534457-- | Gobble n spaces; if tabs are encountered, expand them
535458-- and gobble some or all of their spaces, leaving the rest.
536459gobbleSpaces :: (HasReaderOptions st, Monad m)
537− => Int -> ParserT Sources st m ()
460+ => Int -> ParserT Text st m ()
538461gobbleSpaces 0 = return ()
539462gobbleSpaces n
540463 | n < 0 = error "gobbleSpaces called with negative number"
@@ -542,26 +465,18 @@ gobbleSpaces n
542465 char ' ' <|> eatOneSpaceOfTab
543466 gobbleSpaces (n - 1)
544467
545−eatOneSpaceOfTab :: (HasReaderOptions st, Monad m) => ParserT Sources st m Char
468+eatOneSpaceOfTab :: (HasReaderOptions st, Monad m) => ParserT Text st m Char
546469eatOneSpaceOfTab = do
547− lookAhead (char '\t')
548− pos <- getPosition
470+ char '\t'
549471 tabstop <- getOption readerTabStop
550− -- replace the tab on the input stream with spaces
551− let numSpaces = tabstop - ((sourceColumn pos - 1) `mod` tabstop)
552472 inp <- getInput
553− setInput $
554− case inp of
555− Sources [] -> error "eatOneSpaceOfTab - empty Sources list"
556− Sources ((fp,t):rest) ->
557− -- drop the tab and add spaces
558− Sources ((fp, T.replicate numSpaces " " <> T.drop 1 t):rest)
559− char ' '
473+ setInput $ T.replicate (tabstop - 1) " " <> inp
474+ return ' '
560475
561476-- | Gobble up to n spaces; if tabs are encountered, expand them
562477-- and gobble some or all of their spaces, leaving the rest.
563478gobbleAtMostSpaces :: (HasReaderOptions st, Monad m)
564− => Int -> ParserT Sources st m Int
479+ => Int -> ParserT Text st m Int
565480gobbleAtMostSpaces 0 = return 0
566481gobbleAtMostSpaces n
567482 | n < 0 = error "gobbleAtMostSpaces called with negative number"
@@ -570,8 +485,7 @@ gobbleAtMostSpaces n
570485 (+ 1) <$> gobbleAtMostSpaces (n - 1)
571486
572487-- | Parses material enclosed between start and end parsers.
573−enclosed :: (Show end, Stream s m Char, UpdateSourcePos s Char)
574− => ParserT s st m t -- ^ start parser
488+enclosed :: (Show end, Stream s m Char) => ParserT s st m t -- ^ start parser
575489 -> ParserT s st m end -- ^ end parser
576490 -> ParserT s st m a -- ^ content parser (to be used repeatedly)
577491 -> ParserT s st m [a]
@@ -579,41 +493,39 @@ enclosed start end parser = try $
579493 start >> notFollowedBy space >> many1Till parser end
580494
581495-- | Parse string, case insensitive.
582−stringAnyCase :: (Stream s m Char, UpdateSourcePos s Char)
583− => Text -> ParserT s st m Text
496+stringAnyCase :: Stream s m Char => Text -> ParserT s st m Text
584497stringAnyCase = fmap T.pack . stringAnyCase' . T.unpack
585498
586−stringAnyCase' :: (Stream s m Char, UpdateSourcePos s Char)
587− => String -> ParserT s st m String
499+stringAnyCase' :: Stream s m Char => String -> ParserT s st m String
588500stringAnyCase' [] = string ""
589501stringAnyCase' (x:xs) = do
590502 firstChar <- char (toUpper x) <|> char (toLower x)
591503 rest <- stringAnyCase' xs
592504 return (firstChar:rest)
593505
594−-- TODO rewrite by just adding to Sources stream?
595506-- | Parse contents of 'str' using 'parser' and return result.
596−parseFromString :: Monad m
597− => ParserT Sources st m r
507+parseFromString :: (Stream s m Char, IsString s)
508+ => ParserT s st m r
598509 -> Text
599− -> ParserT Sources st m r
510+ -> ParserT s st m r
600511parseFromString parser str = do
601512 oldPos <- getPosition
602513 setPosition $ initialPos "chunk"
603514 oldInput <- getInput
604− setInput $ toSources str
515+ setInput $ fromString $ T.unpack str
605516 result <- parser
606517 spaces
518+ eof
607519 setInput oldInput
608520 setPosition oldPos
609521 return result
610522
611523-- | Like 'parseFromString' but specialized for 'ParserState'.
612524-- This resets 'stateLastStrPos', which is almost always what we want.
613−parseFromString' :: (Monad m, HasLastStrPosition u)
614− => ParserT Sources u m a
525+parseFromString' :: (Stream s m Char, IsString s, HasLastStrPosition u)
526+ => ParserT s u m a
615527 -> Text
616− -> ParserT Sources u m a
528+ -> ParserT s u m a
617529parseFromString' parser str = do
618530 oldLastStrPos <- getLastStrPos <$> getState
619531 updateState $ setLastStrPos Nothing
@@ -622,7 +534,7 @@ parseFromString' parser str = do
622534 return res
623535
624536-- | Parse raw line block up to and including blank lines.
625−lineClump :: Monad m => ParserT Sources st m Text
537+lineClump :: Monad m => ParserT Text st m Text
626538lineClump = blanklines
627539 <|> (T.unlines <$> many1 (notFollowedBy blankline >> anyLine))
628540
@@ -631,7 +543,7 @@ lineClump = blanklines
631543-- pairs of open and close, which must be different. For example,
632544-- @charsInBalanced '(' ')' anyChar@ will parse "(hello (there))"
633545-- and return "hello (there)".
634−charsInBalanced :: (Stream s m Char, UpdateSourcePos s Char) => Char -> Char -> ParserT s st m Char
546+charsInBalanced :: Stream s m Char => Char -> Char -> ParserT s st m Char
635547 -> ParserT s st m Text
636548charsInBalanced open close parser = try $ do
637549 char open
@@ -650,7 +562,7 @@ charsInBalanced open close parser = try $ do
650562-- Auxiliary functions for romanNumeral:
651563
652564-- | Parses a roman numeral (uppercase or lowercase), returns number.
653−romanNumeral :: (Stream s m Char, UpdateSourcePos s Char) => Bool -- ^ Uppercase if true
565+romanNumeral :: Stream s m Char => Bool -- ^ Uppercase if true
654566 -> ParserT s st m Int
655567romanNumeral upperCase = do
656568 let rchar uc = char $ if upperCase then uc else toLower uc
@@ -686,19 +598,20 @@ romanNumeral upperCase = do
686598
687599-- | Parses an email address; returns original and corresponding
688600-- escaped mailto: URI.
689−emailAddress :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (Text, Text)
601+emailAddress :: Stream s m Char => ParserT s st m (Text, Text)
690602emailAddress = try $ toResult <$> mailbox <*> (char '@' *> domain)
691603 where toResult mbox dom = let full = fromEntities $ T.pack $ mbox ++ '@':dom
692604 in (full, escapeURI $ "mailto:" <> full)
693605 mailbox = intercalate "." <$> (emailWord `sepBy1'` dot)
694606 domain = intercalate "." <$> (subdomain `sepBy1'` dot)
695607 dot = char '.'
696− subdomain = many1 $ alphaNum <|> innerPunct (=='-')
608+ subdomain = many1 $ alphaNum <|> innerPunct
697609 -- this excludes some valid email addresses, since an
698610 -- email could contain e.g. '__', but gives better results
699611 -- for our purposes, when combined with markdown parsing:
700− innerPunct f = try (satisfy f
701− <* notFollowedBy (satisfy (not . isAlphaNum)))
612+ innerPunct = try (satisfy (\c -> isEmailPunct c || c == '@')
613+ <* notFollowedBy space
614+ <* notFollowedBy (satisfy isPunctuation))
702615 -- technically an email address could begin with a symbol,
703616 -- but allowing this creates too many problems.
704617 -- See e.g. https://github.com/jgm/pandoc/issues/2940
@@ -709,16 +622,16 @@ emailAddress = try $ toResult <$> mailbox <*> (char '@' *> domain)
709622 isEmailPunct c = T.any (== c) "!\"#$%&'*+-/=?^_{|}~;"
710623
711624
712−uriScheme :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m Text
625+uriScheme :: Stream s m Char => ParserT s st m Text
713626uriScheme = oneOfStringsCI (Set.toList schemes)
714627
715628-- | Parses a URI. Returns pair of original and URI-escaped version.
716−uri :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (Text, Text)
629+uri :: Stream s m Char => ParserT s st m (Text, Text)
717630uri = try $ do
718631 scheme <- uriScheme
719632 char ':'
720633 -- Avoid parsing e.g. "**Notes:**" as a raw URI:
721− notFollowedBy $ satisfy (\c -> c == '*' || c == '_' || c == ']')
634+ notFollowedBy (oneOf "*_]")
722635 -- We allow sentence punctuation except at the end, since
723636 -- we don't want the trailing '.' in 'http://google.com.' We want to allow
724637 -- http://en.wikipedia.org/wiki/State_of_emergency_(disambiguation)
@@ -732,20 +645,7 @@ uri = try $ do
732645 let uri' = scheme <> ":" <> fromEntities str'
733646 return (uri', escapeURI uri')
734647 where
735− isWordChar '#' = True
736− isWordChar '$' = True
737− isWordChar '%' = True
738− isWordChar '+' = True
739− isWordChar '/' = True
740− isWordChar '@' = True
741− isWordChar '\\' = True
742− isWordChar '_' = True
743− isWordChar '-' = True
744− isWordChar '&' = True
745− isWordChar '=' = True
746− isWordChar c = isAlphaNum c
747−
748− wordChar = satisfy isWordChar
648+ wordChar = alphaNum <|> oneOf "#$%+/@\\_-&="
749649 percentEscaped = try $ (:) <$> char '%' <*> many1 hexDigit
750650 entity = try $ pure <$> characterReference
751651 punct = try $ many1 (char ',') <|> fmap pure (satisfy (\c -> not (isSpace c) && c /= '<' && c /= '>'))
@@ -756,13 +656,11 @@ uri = try $ do
756656 uriChunkBetween l r = try $ do chunk <- between (char l) (char r) uriChunk
757657 return (T.pack $ [l] ++ chunk ++ [r])
758658
759−mathInlineWith :: (Stream s m Char, UpdateSourcePos s Char) => Text -> Text -> ParserT s st m Text
659+mathInlineWith :: Stream s m Char => Text -> Text -> ParserT s st m Text
760660mathInlineWith op cl = try $ do
761661 textStr op
762662 when (op == "$") $ notFollowedBy space
763− words' <- many1Till (
764− (T.singleton <$>
765− satisfy (\c -> not (isSpaceChar c || c == '\\')))
663+ words' <- many1Till (countChar 1 (noneOf " \t\n\\")
766664 <|> (char '\\' >>
767665 -- This next clause is needed because \text{..} can
768666 -- contain $, \(\), etc.
@@ -770,17 +668,17 @@ mathInlineWith op cl = try $ do
770668 (("\\text" <>) <$> inBalancedBraces 0 ""))
771669 <|> (\c -> T.pack ['\\',c]) <$> anyChar))
772670 <|> do (blankline <* notFollowedBy' blankline) <|>
773− (spaceChar <* skipMany spaceChar)
671+ (oneOf " \t" <* skipMany (oneOf " \t"))
774672 notFollowedBy (char '$')
775673 return " "
776674 ) (try $ textStr cl)
777675 notFollowedBy digit -- to prevent capture of $5
778676 return $ trimMath $ T.concat words'
779677 where
780− inBalancedBraces :: (Stream s m Char, UpdateSourcePos s Char) => Int -> Text -> ParserT s st m Text
678+ inBalancedBraces :: Stream s m Char => Int -> Text -> ParserT s st m Text
781679 inBalancedBraces n = fmap T.pack . inBalancedBraces' n . T.unpack
782680
783− inBalancedBraces' :: (Stream s m Char, UpdateSourcePos s Char) => Int -> String -> ParserT s st m String
681+ inBalancedBraces' :: Stream s m Char => Int -> String -> ParserT s st m String
784682 inBalancedBraces' 0 "" = do
785683 c <- anyChar
786684 if c == '{'
@@ -797,13 +695,12 @@ mathInlineWith op cl = try $ do
797695 '{' -> inBalancedBraces' (numOpen + 1) (c:xs)
798696 _ -> inBalancedBraces' numOpen (c:xs)
799697
800−mathDisplayWith :: (Stream s m Char, UpdateSourcePos s Char) => Text -> Text -> ParserT s st m Text
698+mathDisplayWith :: Stream s m Char => Text -> Text -> ParserT s st m Text
801699mathDisplayWith op cl = try $ fmap T.pack $ do
802700 textStr op
803− many1Till (satisfy (/= '\n') <|> (newline <* notFollowedBy' blankline))
804− (try $ textStr cl)
701+ many1Till (noneOf "\n" <|> (newline <* notFollowedBy' blankline)) (try $ textStr cl)
805702
806−mathDisplay :: (HasReaderOptions st, Stream s m Char, UpdateSourcePos s Char)
703+mathDisplay :: (HasReaderOptions st, Stream s m Char)
807704 => ParserT s st m Text
808705mathDisplay =
809706 (guardEnabled Ext_tex_math_dollars >> mathDisplayWith "$$" "$$")
@@ -812,7 +709,7 @@ mathDisplay =
812709 <|> (guardEnabled Ext_tex_math_double_backslash >>
813710 mathDisplayWith "\\\\[" "\\\\]")
814711
815−mathInline :: (HasReaderOptions st, Stream s m Char, UpdateSourcePos s Char)
712+mathInline :: (HasReaderOptions st , Stream s m Char)
816713 => ParserT s st m Text
817714mathInline =
818715 (guardEnabled Ext_tex_math_dollars >> mathInlineWith "$" "$")
@@ -825,7 +722,7 @@ mathInline =
825722-- displacement (the difference between the source column at the end
826723-- and the source column at the beginning). Vertical displacement
827724-- (source row) is ignored.
828−withHorizDisplacement :: (Stream s m Char, UpdateSourcePos s Char)
725+withHorizDisplacement :: Stream s m Char
829726 => ParserT s st m a -- ^ Parser to apply
830727 -> ParserT s st m (a, Int) -- ^ (result, displacement)
831728withHorizDisplacement parser = do
@@ -837,37 +734,30 @@ withHorizDisplacement parser = do
837734-- | Applies a parser and returns the raw string that was parsed,
838735-- along with the value produced by the parser.
839736withRaw :: Monad m
840− => ParsecT Sources st m a
841− -> ParsecT Sources st m (a, Text)
737+ => ParsecT Text st m a
738+ -> ParsecT Text st m (a, Text)
842739withRaw parser = do
843− inps1 <- getInput
740+ pos1 <- getPosition
741+ inp <- getInput
844742 result <- parser
845− inps2 <- getInput
846− -- 'raw' is the difference between inps1 and inps2
847− return (result, sourcesDifference inps1 inps2)
848−
849−sourcesDifference :: Sources -> Sources -> Text
850−sourcesDifference (Sources is1) (Sources is2) = go is1 is2
851− where
852− go inps1 inps2 =
853− case (inps1, inps2) of
854− ([], _) -> mempty
855− (_, []) -> mconcat $ map snd inps1
856− ((p1,t1):rest1, (p2, t2):rest2)
857− | p1 == p2
858− , t1 == t2 -> go rest1 rest2
859− | p1 == p2
860− , t1 /= t2 -> fromMaybe mempty $ T.stripSuffix t2 t1
861− | otherwise -> t1 <> go rest1 inps2
743+ pos2 <- getPosition
744+ let (l1,c1) = (sourceLine pos1, sourceColumn pos1)
745+ let (l2,c2) = (sourceLine pos2, sourceColumn pos2)
746+ let inplines = take ((l2 - l1) + 1) $ T.lines inp
747+ let raw = case inplines of
748+ [] -> ""
749+ [l] -> T.take (c2 - c1) l
750+ ls -> T.unlines (init ls) <> T.take (c2 - 1) (last ls)
751+ return (result, raw)
862752
863753-- | Parses backslash, then applies character parser.
864−escaped :: (Stream s m Char, UpdateSourcePos s Char)
754+escaped :: Stream s m Char
865755 => ParserT s st m Char -- ^ Parser for character to escape
866756 -> ParserT s st m Char
867757escaped parser = try $ char '\\' >> parser
868758
869759-- | Parse character entity.
870−characterReference :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m Char
760+characterReference :: Stream s m Char => ParserT s st m Char
871761characterReference = try $ do
872762 char '&'
873763 ent <- many1Till nonspaceChar (char ';')
@@ -880,19 +770,19 @@ characterReference = try $ do
880770 _ -> Prelude.fail "entity not found"
881771
882772-- | Parses an uppercase roman numeral and returns (UpperRoman, number).
883−upperRoman :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
773+upperRoman :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
884774upperRoman = do
885775 num <- romanNumeral True
886776 return (UpperRoman, num)
887777
888778-- | Parses a lowercase roman numeral and returns (LowerRoman, number).
889−lowerRoman :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
779+lowerRoman :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
890780lowerRoman = do
891781 num <- romanNumeral False
892782 return (LowerRoman, num)
893783
894784-- | Parses a decimal numeral and returns (Decimal, number).
895−decimal :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
785+decimal :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
896786decimal = do
897787 num <- many1 digit
898788 return (Decimal, fromMaybe 1 $ safeRead $ T.pack num)
@@ -901,15 +791,11 @@ decimal = do
901791-- returns (DefaultStyle, [next example number]). The next
902792-- example number is incremented in parser state, and the label
903793-- (if present) is added to the label table.
904−exampleNum :: (Stream s m Char, UpdateSourcePos s Char)
794+exampleNum :: Stream s m Char
905795 => ParserT s ParserState m (ListNumberStyle, Int)
906796exampleNum = do
907797 char '@'
908− lab <- mconcat . map T.pack <$>
909− many (many1 alphaNum <|>
910− try (do c <- char '_' <|> char '-'
911− cs <- many1 alphaNum
912− return (c:cs)))
798+ lab <- T.pack <$> many (alphaNum <|> satisfy (\c -> c == '_' || c == '-'))
913799 st <- getState
914800 let num = stateNextExample st
915801 let newlabels = if T.null lab
@@ -920,37 +806,37 @@ exampleNum = do
920806 return (Example, num)
921807
922808-- | Parses a '#' returns (DefaultStyle, 1).
923−defaultNum :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
809+defaultNum :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
924810defaultNum = do
925811 char '#'
926812 return (DefaultStyle, 1)
927813
928814-- | Parses a lowercase letter and returns (LowerAlpha, number).
929−lowerAlpha :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
815+lowerAlpha :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
930816lowerAlpha = do
931− ch <- satisfy isAsciiLower
817+ ch <- oneOf ['a'..'z']
932818 return (LowerAlpha, ord ch - ord 'a' + 1)
933819
934820-- | Parses an uppercase letter and returns (UpperAlpha, number).
935−upperAlpha :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
821+upperAlpha :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
936822upperAlpha = do
937− ch <- satisfy isAsciiUpper
823+ ch <- oneOf ['A'..'Z']
938824 return (UpperAlpha, ord ch - ord 'A' + 1)
939825
940826-- | Parses a roman numeral i or I
941−romanOne :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m (ListNumberStyle, Int)
827+romanOne :: Stream s m Char => ParserT s st m (ListNumberStyle, Int)
942828romanOne = (char 'i' >> return (LowerRoman, 1)) <|>
943829 (char 'I' >> return (UpperRoman, 1))
944830
945831-- | Parses an ordered list marker and returns list attributes.
946−anyOrderedListMarker :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s ParserState m ListAttributes
832+anyOrderedListMarker :: Stream s m Char => ParserT s ParserState m ListAttributes
947833anyOrderedListMarker = choice
948834 [delimParser numParser | delimParser <- [inPeriod, inOneParen, inTwoParens],
949835 numParser <- [decimal, exampleNum, defaultNum, romanOne,
950836 lowerAlpha, lowerRoman, upperAlpha, upperRoman]]
951837
952838-- | Parses a list number (num) followed by a period, returns list attributes.
953−inPeriod :: (Stream s m Char, UpdateSourcePos s Char)
839+inPeriod :: Stream s m Char
954840 => ParserT s st m (ListNumberStyle, Int)
955841 -> ParserT s st m ListAttributes
956842inPeriod num = try $ do
@@ -962,7 +848,7 @@ inPeriod num = try $ do
962848 return (start, style, delim)
963849
964850-- | Parses a list number (num) followed by a paren, returns list attributes.
965−inOneParen :: (Stream s m Char, UpdateSourcePos s Char)
851+inOneParen :: Stream s m Char
966852 => ParserT s st m (ListNumberStyle, Int)
967853 -> ParserT s st m ListAttributes
968854inOneParen num = try $ do
@@ -971,7 +857,7 @@ inOneParen num = try $ do
971857 return (start, style, OneParen)
972858
973859-- | Parses a list number (num) enclosed in parens, returns list attributes.
974−inTwoParens :: (Stream s m Char, UpdateSourcePos s Char)
860+inTwoParens :: Stream s m Char
975861 => ParserT s st m (ListNumberStyle, Int)
976862 -> ParserT s st m ListAttributes
977863inTwoParens num = try $ do
@@ -982,7 +868,7 @@ inTwoParens num = try $ do
982868
983869-- | Parses an ordered list marker with a given style and delimiter,
984870-- returns number.
985−orderedListMarker :: (Stream s m Char, UpdateSourcePos s Char)
871+orderedListMarker :: Stream s m Char
986872 => ListNumberStyle
987873 -> ListNumberDelim
988874 -> ParserT s ParserState m Int
@@ -1005,10 +891,10 @@ orderedListMarker style delim = do
1005891 return start
1006892
1007893-- | Parses a character reference and returns a Str element.
1008−charRef :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m Inline
894+charRef :: Stream s m Char => ParserT s st m Inline
1009895charRef = Str . T.singleton <$> characterReference
1010896
1011−lineBlockLine :: Monad m => ParserT Sources st m Text
897+lineBlockLine :: Monad m => ParserT Text st m Text
1012898lineBlockLine = try $ do
1013899 char '|'
1014900 char ' '
@@ -1018,11 +904,11 @@ lineBlockLine = try $ do
1018904 continuations <- many (try $ char ' ' >> anyLine)
1019905 return $ white <> T.unwords (line : continuations)
1020906
1021−blankLineBlockLine :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m Char
907+blankLineBlockLine :: Stream s m Char => ParserT s st m Char
1022908blankLineBlockLine = try (char '|' >> blankline)
1023909
1024910-- | Parses an RST-style line block and returns a list of strings.
1025−lineBlockLines :: Monad m => ParserT Sources st m [Text]
911+lineBlockLines :: Monad m => ParserT Text st m [Text]
1026912lineBlockLines = try $ do
1027913 lines' <- many1 (lineBlockLine <|> (T.singleton <$> blankLineBlockLine))
1028914 skipMany blankline
@@ -1030,8 +916,7 @@ lineBlockLines = try $ do
1030916
1031917-- | Parse a table using 'headerParser', 'rowParser',
1032918-- 'lineParser', and 'footerParser'.
1033−tableWith :: (Stream s m Char, UpdateSourcePos s Char,
1034− HasReaderOptions st, Monad mf)
919+tableWith :: (Stream s m Char, HasReaderOptions st, Monad mf)
1035920 => ParserT s st m (mf [Blocks], [Alignment], [Int])
1036921 -> ([Int] -> ParserT s st m (mf [Blocks]))
1037922 -> ParserT s st m sep
@@ -1051,8 +936,7 @@ tableWith headerParser rowParser lineParser footerParser = try $ do
1051936
1052937type TableComponents mf = ([Alignment], [Double], mf [Row], mf [Row])
1053938
1054−tableWith' :: (Stream s m Char, UpdateSourcePos s Char,
1055− HasReaderOptions st, Monad mf)
939+tableWith' :: (Stream s m Char, HasReaderOptions st, Monad mf)
1056940 => ParserT s st m (mf [Blocks], [Alignment], [Int])
1057941 -> ([Int] -> ParserT s st m (mf [Blocks]))
1058942 -> ParserT s st m sep
@@ -1101,19 +985,20 @@ widthsFromIndices numColumns' indices =
1101985-- (which may be grid), then the rows,
1102986-- which may be grid, separated by blank lines, and
1103987-- ending with a footer (dashed line followed by blank line).
1104−gridTableWith :: (Monad m, HasReaderOptions st, HasLastStrPosition st, Monad mf)
1105− => ParserT Sources st m (mf Blocks) -- ^ Block list parser
988+gridTableWith :: (Stream s m Char, HasReaderOptions st, HasLastStrPosition st,
989+ Monad mf, IsString s)
990+ => ParserT s st m (mf Blocks) -- ^ Block list parser
1106991 -> Bool -- ^ Headerless table
1107− -> ParserT Sources st m (mf Blocks)
992+ -> ParserT s st m (mf Blocks)
1108993gridTableWith blocks headless =
1109994 tableWith (gridTableHeader headless blocks) (gridTableRow blocks)
1110995 (gridTableSep '-') gridTableFooter
1111996
1112−gridTableWith' :: (Monad m, HasReaderOptions st, HasLastStrPosition st,
1113− Monad mf)
1114− => ParserT Sources st m (mf Blocks) -- ^ Block list parser
997+gridTableWith' :: (Stream s m Char, HasReaderOptions st, HasLastStrPosition st,
998+ Monad mf, IsString s)
999+ => ParserT s st m (mf Blocks) -- ^ Block list parser
11151000 -> Bool -- ^ Headerless table
1116− -> ParserT Sources st m (TableComponents mf)
1001+ -> ParserT s st m (TableComponents mf)
11171002gridTableWith' blocks headless =
11181003 tableWith' (gridTableHeader headless blocks) (gridTableRow blocks)
11191004 (gridTableSep '-') gridTableFooter
@@ -1122,7 +1007,7 @@ gridTableSplitLine :: [Int] -> Text -> [Text]
11221007gridTableSplitLine indices line = map removeFinalBar $ tail $
11231008 splitTextByIndices (init indices) $ trimr line
11241009
1125−gridPart :: Monad m => Char -> ParserT Sources st m ((Int, Int), Alignment)
1010+gridPart :: Stream s m Char => Char -> ParserT s st m ((Int, Int), Alignment)
11261011gridPart ch = do
11271012 leftColon <- option False (True <$ char ':')
11281013 dashes <- many1 (char ch)
@@ -1137,7 +1022,7 @@ gridPart ch = do
11371022 (False, False) -> AlignDefault
11381023 return ((lengthDashes, lengthDashes + 1), alignment)
11391024
1140−gridDashedLines :: Monad m => Char -> ParserT Sources st m [((Int, Int), Alignment)]
1025+gridDashedLines :: Stream s m Char => Char -> ParserT s st m [((Int, Int), Alignment)]
11411026gridDashedLines ch = try $ char '+' >> many1 (gridPart ch) <* blankline
11421027
11431028removeFinalBar :: Text -> Text
@@ -1146,47 +1031,47 @@ removeFinalBar = T.dropWhileEnd go . T.dropWhileEnd (=='|')
11461031 go c = T.any (== c) " \t"
11471032
11481033-- | Separator between rows of grid table.
1149−gridTableSep :: Monad m => Char -> ParserT Sources st m Char
1034+gridTableSep :: Stream s m Char => Char -> ParserT s st m Char
11501035gridTableSep ch = try $ gridDashedLines ch >> return '\n'
11511036
11521037-- | Parse header for a grid table.
1153−gridTableHeader :: (Monad m, Monad mf, HasLastStrPosition st)
1038+gridTableHeader :: (Stream s m Char, Monad mf, IsString s, HasLastStrPosition st)
11541039 => Bool -- ^ Headerless table
1155− -> ParserT Sources st m (mf Blocks)
1156− -> ParserT Sources st m (mf [Blocks], [Alignment], [Int])
1157−gridTableHeader True _ = do
1158− optional blanklines
1159− dashes <- gridDashedLines '-'
1160− let aligns = map snd dashes
1161− let lines' = map (snd . fst) dashes
1162− let indices = scanl (+) 0 lines'
1163− return (return [], aligns, indices)
1164−gridTableHeader False blocks = try $ do
1040+ -> ParserT s st m (mf Blocks)
1041+ -> ParserT s st m (mf [Blocks], [Alignment], [Int])
1042+gridTableHeader headless blocks = try $ do
11651043 optional blanklines
11661044 dashes <- gridDashedLines '-'
1167− rawContent <- many1 (notFollowedBy (gridTableSep '=') >> char '|' >>
1045+ rawContent <- if headless
1046+ then return $ repeat ""
1047+ else many1
1048+ (notFollowedBy (gridTableSep '=') >> char '|' >>
11681049 T.pack <$> many1Till anyChar newline)
1169− underDashes <- gridDashedLines '='
1050+ underDashes <- if headless
1051+ then return dashes
1052+ else gridDashedLines '='
11701053 guard $ length dashes == length underDashes
11711054 let lines' = map (snd . fst) underDashes
11721055 let indices = scanl (+) 0 lines'
11731056 let aligns = map snd underDashes
1174− let rawHeads = map (T.unlines . map trim) $ transpose
1057+ let rawHeads = if headless
1058+ then replicate (length underDashes) ""
1059+ else map (T.unlines . map trim) $ transpose
11751060 $ map (gridTableSplitLine indices) rawContent
11761061 heads <- sequence <$> mapM (parseFromString' blocks . trim) rawHeads
11771062 return (heads, aligns, indices)
11781063
1179−gridTableRawLine :: (Stream s m Char, UpdateSourcePos s Char) => [Int] -> ParserT s st m [Text]
1064+gridTableRawLine :: Stream s m Char => [Int] -> ParserT s st m [Text]
11801065gridTableRawLine indices = do
11811066 char '|'
11821067 line <- many1Till anyChar newline
11831068 return (gridTableSplitLine indices $ T.pack line)
11841069
11851070-- | Parse row of grid table.
1186−gridTableRow :: (Monad m, Monad mf, HasLastStrPosition st)
1187− => ParserT Sources st m (mf Blocks)
1071+gridTableRow :: (Stream s m Char, Monad mf, IsString s, HasLastStrPosition st)
1072+ => ParserT s st m (mf Blocks)
11881073 -> [Int]
1189− -> ParserT Sources st m (mf [Blocks])
1074+ -> ParserT s st m (mf [Blocks])
11901075gridTableRow blocks indices = do
11911076 colLines <- many1 (gridTableRawLine indices)
11921077 let cols = map ((<> "\n") . T.unlines . removeOneLeadingSpace) $
@@ -1207,38 +1092,34 @@ removeOneLeadingSpace xs =
12071092 Just (c, _) -> c == ' '
12081093
12091094-- | Parse footer for a grid table.
1210−gridTableFooter :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m ()
1095+gridTableFooter :: Stream s m Char => ParserT s st m ()
12111096gridTableFooter = optional blanklines
12121097
12131098---
12141099
12151100-- | Removes the ParsecT layer from the monad transformer stack
1216−readWithM :: (Monad m, ToSources t)
1217− => ParserT Sources st m a -- ^ parser
1218− -> st -- ^ initial state
1219− -> t -- ^ input
1101+readWithM :: (Stream s m Char, ToText s)
1102+ => ParserT s st m a -- ^ parser
1103+ -> st -- ^ initial state
1104+ -> s -- ^ input
12201105 -> m (Either PandocError a)
12211106readWithM parser state input =
1222− mapLeft (PandocParsecError sources)
1223− <$> runParserT parser state (initialSourceName sources) sources
1224− where
1225− sources = toSources input
1107+ mapLeft (PandocParsecError $ toText input) `liftM` runParserT parser state "source" input
12261108
12271109-- | Parse a string with a given parser and state
1228−readWith :: ToSources t
1229− => Parser Sources st a
1110+readWith :: Parser Text st a
12301111 -> st
1231− -> t
1112+ -> Text
12321113 -> Either PandocError a
12331114readWith p t inp = runIdentity $ readWithM p t inp
12341115
12351116-- | Parse a string with @parser@ (for testing).
12361117testStringWith :: Show a
1237− => ParserT Sources ParserState Identity a
1118+ => ParserT Text ParserState Identity a
12381119 -> Text
12391120 -> IO ()
1240−testStringWith parser str = UTF8.putStrLn $ tshow $
1241− readWith parser defaultParserState (toSources str)
1121+testStringWith parser str = UTF8.putStrLn $ show $
1122+ readWith parser defaultParserState str
12421123
12431124-- | Parsing options.
12441125data ParserState = ParserState
@@ -1258,7 +1139,7 @@ data ParserState = ParserState
12581139 stateInNote :: Bool, -- ^ True if parsing note contents
12591140 stateNoteNumber :: Int, -- ^ Last note number for citations
12601141 stateMeta :: Meta, -- ^ Document metadata
1261− stateMeta' :: Future ParserState Meta, -- ^ Document metadata
1142+ stateMeta' :: F Meta, -- ^ Document metadata
12621143 stateCitations :: M.Map Text Text, -- ^ RST-style citations
12631144 stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used
12641145 stateIdentifiers :: Set.Set Text, -- ^ Header identifiers used
@@ -1437,7 +1318,7 @@ data QuoteContext
14371318
14381319type NoteTable = [(Text, Text)]
14391320
1440−type NoteTable' = M.Map Text (SourcePos, Future ParserState Blocks)
1321+type NoteTable' = M.Map Text (SourcePos, F Blocks)
14411322-- used in markdown reader
14421323
14431324newtype Key = Key Text deriving (Show, Read, Eq, Ord)
@@ -1472,7 +1353,7 @@ registerHeader (ident,classes,kvs) header' = do
14721353 then do
14731354 let id' = uniqueIdent exts (B.toList header') ids
14741355 let id'' = if Ext_ascii_identifiers `extensionEnabled` exts
1475− then toAsciiText id'
1356+ then T.pack $ mapMaybe toAsciiChar $ T.unpack id'
14761357 else id'
14771358 updateState $ updateIdentifierList $ Set.insert id'
14781359 updateState $ updateIdentifierList $ Set.insert id''
@@ -1485,42 +1366,34 @@ registerHeader (ident,classes,kvs) header' = do
14851366 updateState $ updateIdentifierList $ Set.insert ident
14861367 return (ident,classes,kvs)
14871368
1488−smartPunctuation :: (HasReaderOptions st, HasLastStrPosition st,
1489− HasQuoteContext st m,
1490− Stream s m Char, UpdateSourcePos s Char)
1369+smartPunctuation :: (HasReaderOptions st, HasLastStrPosition st, HasQuoteContext st m, Stream s m Char)
14911370 => ParserT s st m Inlines
14921371 -> ParserT s st m Inlines
14931372smartPunctuation inlineParser = do
14941373 guardEnabled Ext_smart
1495− choice [ quoted inlineParser, apostrophe, doubleCloseQuote, dash, ellipses ]
1374+ choice [ quoted inlineParser, apostrophe, dash, ellipses ]
1375+
1376+apostrophe :: Stream s m Char => ParserT s st m Inlines
1377+apostrophe = (char '\'' <|> char '\8217') >> return (B.str "\x2019")
14961378
1497−quoted :: (HasLastStrPosition st, HasQuoteContext st m,
1498− Stream s m Char, UpdateSourcePos s Char)
1379+quoted :: (HasLastStrPosition st, HasQuoteContext st m, Stream s m Char)
14991380 => ParserT s st m Inlines
15001381 -> ParserT s st m Inlines
15011382quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
15021383
1503−singleQuoted :: (HasLastStrPosition st, HasQuoteContext st m,
1504− Stream s m Char, UpdateSourcePos s Char)
1384+singleQuoted :: (HasLastStrPosition st, HasQuoteContext st m, Stream s m Char)
15051385 => ParserT s st m Inlines
15061386 -> ParserT s st m Inlines
1507−singleQuoted inlineParser = do
1508− singleQuoteStart
1509− (B.singleQuoted . mconcat <$>
1510− try
1511− (withQuoteContext InSingleQuote (many1Till inlineParser singleQuoteEnd)))
1512− <|> pure "\8217"
1513−
1514−doubleQuoted :: (HasQuoteContext st m, HasLastStrPosition st,
1515− Stream s m Char, UpdateSourcePos s Char)
1387+singleQuoted inlineParser = try $ B.singleQuoted . mconcat
1388+ <$ singleQuoteStart
1389+ <*> withQuoteContext InSingleQuote (many1Till inlineParser singleQuoteEnd)
1390+
1391+doubleQuoted :: (HasQuoteContext st m, Stream s m Char)
15161392 => ParserT s st m Inlines
15171393 -> ParserT s st m Inlines
1518−doubleQuoted inlineParser = do
1519− doubleQuoteStart
1520− (B.doubleQuoted . mconcat <$>
1521− try
1522− (withQuoteContext InDoubleQuote (manyTill inlineParser doubleQuoteEnd)))
1523− <|> pure (B.str "\8220")
1394+doubleQuoted inlineParser = try $ B.doubleQuoted . mconcat
1395+ <$ doubleQuoteStart
1396+ <*> withQuoteContext InDoubleQuote (manyTill inlineParser doubleQuoteEnd)
15241397
15251398failIfInQuoteContext :: (HasQuoteContext st m, Stream s m t)
15261399 => QuoteContext
@@ -1529,14 +1402,13 @@ failIfInQuoteContext context = do
15291402 context' <- getQuoteContext
15301403 when (context' == context) $ Prelude.fail "already inside quotes"
15311404
1532−charOrRef :: (Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParserT s st m Char
1405+charOrRef :: Stream s m Char => [Char] -> ParserT s st m Char
15331406charOrRef cs =
15341407 oneOf cs <|> try (do c <- characterReference
15351408 guard (c `elem` cs)
15361409 return c)
15371410
1538−singleQuoteStart :: (HasLastStrPosition st, HasQuoteContext st m,
1539− Stream s m Char, UpdateSourcePos s Char)
1411+singleQuoteStart :: (HasLastStrPosition st, HasQuoteContext st m, Stream s m Char)
15401412 => ParserT s st m ()
15411413singleQuoteStart = do
15421414 failIfInQuoteContext InSingleQuote
@@ -1544,39 +1416,30 @@ singleQuoteStart = do
15441416 guard =<< notAfterString
15451417 try $ do
15461418 charOrRef "'\8216\145"
1547− void $ lookAhead (satisfy (not . isSpaceChar))
1419+ notFollowedBy (oneOf [' ', '\t', '\n'])
15481420
1549−singleQuoteEnd :: (Stream s m Char, UpdateSourcePos s Char)
1421+singleQuoteEnd :: Stream s m Char
15501422 => ParserT s st m ()
15511423singleQuoteEnd = try $ do
15521424 charOrRef "'\8217\146"
15531425 notFollowedBy alphaNum
15541426
1555−doubleQuoteStart :: (HasLastStrPosition st,
1556− HasQuoteContext st m,
1557− Stream s m Char, UpdateSourcePos s Char)
1427+doubleQuoteStart :: (HasQuoteContext st m, Stream s m Char)
15581428 => ParserT s st m ()
15591429doubleQuoteStart = do
15601430 failIfInQuoteContext InDoubleQuote
1561− guard =<< notAfterString
15621431 try $ do charOrRef "\"\8220\147"
1563− void $ lookAhead (satisfy (not . isSpaceChar))
1432+ notFollowedBy (oneOf [' ', '\t', '\n'])
15641433
1565−doubleQuoteEnd :: (Stream s m Char, UpdateSourcePos s Char)
1434+doubleQuoteEnd :: Stream s m Char
15661435 => ParserT s st m ()
15671436doubleQuoteEnd = void (charOrRef "\"\8221\148")
15681437
1569−apostrophe :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m Inlines
1570−apostrophe = (char '\'' <|> char '\8217') >> return (B.str "\8217")
1571−
1572−doubleCloseQuote :: (Stream s m Char, UpdateSourcePos s Char) => ParserT s st m Inlines
1573−doubleCloseQuote = B.str "\8221" <$ char '"'
1574−
1575−ellipses :: (Stream s m Char, UpdateSourcePos s Char)
1438+ellipses :: Stream s m Char
15761439 => ParserT s st m Inlines
15771440ellipses = try (string "..." >> return (B.str "\8230"))
15781441
1579−dash :: (HasReaderOptions st, Stream s m Char, UpdateSourcePos s Char)
1442+dash :: (HasReaderOptions st, Stream s m Char)
15801443 => ParserT s st m Inlines
15811444dash = try $ do
15821445 oldDashes <- extensionEnabled Ext_old_dashes <$> getOption readerExtensions
@@ -1603,28 +1466,20 @@ nested p = do
16031466 updateState $ \st -> st{ stateMaxNestingLevel = nestlevel }
16041467 return res
16051468
1606−citeKey :: (Stream s m Char, UpdateSourcePos s Char, HasLastStrPosition st)
1607− => Bool -- ^ If True, allow expanded @{..} syntax.
1608− -> ParserT s st m (Bool, Text)
1609−citeKey allowBraced = try $ do
1469+citeKey :: (Stream s m Char, HasLastStrPosition st)
1470+ => ParserT s st m (Bool, Text)
1471+citeKey = try $ do
16101472 guard =<< notAfterString
16111473 suppress_author <- option False (True <$ char '-')
16121474 char '@'
1613− key <- simpleCiteIdentifier
1614− <|> if allowBraced
1615− then charsInBalanced '{' '}' (satisfy (not . isSpace))
1616− else mzero
1617− return (suppress_author, key)
1618−
1619−simpleCiteIdentifier :: (Stream s m Char, UpdateSourcePos s Char)
1620− => ParserT s st m Text
1621−simpleCiteIdentifier = do
16221475 firstChar <- alphaNum <|> char '_' <|> char '*' -- @* for wildcard in nocite
16231476 let regchar = satisfy (\c -> isAlphaNum c || c == '_')
16241477 let internal p = try $ p <* lookAhead regchar
16251478 rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/") <|>
16261479 try (oneOf ":/" <* lookAhead (char '/'))
1627− return $ T.pack $ firstChar:rest
1480+ let key = firstChar:rest
1481+ return (suppress_author, T.pack key)
1482+
16281483
16291484token :: (Stream s m t)
16301485 => (t -> Text)
@@ -1644,15 +1499,12 @@ extractIdClass (ident, cls, kvs) = (ident', cls', kvs')
16441499 cls' = maybe cls T.words $ lookup "class" kvs
16451500 kvs' = filter (\(k,_) -> k /= "id" || k /= "class") kvs
16461501
1647−insertIncludedFile :: (PandocMonad m, HasIncludeFiles st)
1648− => ParserT a st m b -- ^ parser to apply
1649− -> (Text -> a) -- ^ convert Text to stream type
1650− -> [FilePath] -- ^ search path (directories)
1651− -> FilePath -- ^ path of file to include
1652− -> Maybe Int -- ^ start line (negative counts from end)
1653− -> Maybe Int -- ^ end line (negative counts from end)
1654− -> ParserT a st m b
1655−insertIncludedFile parser toStream dirs f mbstartline mbendline = do
1502+insertIncludedFile' :: (PandocMonad m, HasIncludeFiles st)
1503+ => ParserT a st m (mf Blocks)
1504+ -> (Text -> a)
1505+ -> [FilePath] -> FilePath
1506+ -> ParserT a st m (mf Blocks)
1507+insertIncludedFile' blocks totoks dirs f = do
16561508 oldPos <- getPosition
16571509 oldInput <- getInput
16581510 containers <- getIncludeFiles <$> getState
@@ -1661,32 +1513,32 @@ insertIncludedFile parser toStream dirs f mbstartline mbendline = do
16611513 updateState $ addIncludeFile $ T.pack f
16621514 mbcontents <- readFileFromDirs dirs f
16631515 contents <- case mbcontents of
1664− Just s -> return $ exciseLines mbstartline mbendline s
1516+ Just s -> return s
16651517 Nothing -> do
16661518 report $ CouldNotLoadIncludeFile (T.pack f) oldPos
16671519 return ""
1668− setInput $ toStream contents
1669− setPosition $ newPos f (fromMaybe 1 mbstartline) 1
1670− result <- parser
1520+ setPosition $ newPos f 1 1
1521+ setInput $ totoks contents
1522+ bs <- blocks
16711523 setInput oldInput
16721524 setPosition oldPos
16731525 updateState dropLatestIncludeFile
1674− return result
1675−
1676−exciseLines :: Maybe Int -> Maybe Int -> Text -> Text
1677−exciseLines Nothing Nothing t = t
1678−exciseLines mbstartline mbendline t =
1679− T.unlines $ take (endline' - (startline' - 1))
1680− $ drop (startline' - 1) contentLines
1681− where
1682− contentLines = T.lines t
1683− numLines = length contentLines
1684− startline' = case mbstartline of
1685− Nothing -> 1
1686− Just x | x >= 0 -> x
1687− | otherwise -> numLines + x -- negative from end
1688− endline' = case mbendline of
1689− Nothing -> numLines
1690− Just x | x >= 0 -> x
1691− | otherwise -> numLines + x -- negative from end
1526+ return bs
16921527
1528+-- | Parse content of include file as blocks. Circular includes result in an
1529+-- @PandocParseError@.
1530+insertIncludedFile :: (PandocMonad m, HasIncludeFiles st)
1531+ => ParserT [a] st m Blocks
1532+ -> (Text -> [a])
1533+ -> [FilePath] -> FilePath
1534+ -> ParserT [a] st m Blocks
1535+insertIncludedFile blocks totoks dirs f =
1536+ runIdentity <$> insertIncludedFile' (Identity <$> blocks) totoks dirs f
1537+
1538+-- | Parse content of include file as future blocks. Circular includes result in
1539+-- an @PandocParseError@.
1540+insertIncludedFileF :: (PandocMonad m, HasIncludeFiles st)
1541+ => ParserT Text st m (Future st Blocks)
1542+ -> [FilePath] -> FilePath
1543+ -> ParserT Text st m (Future st Blocks)
1544+insertIncludedFileF p = insertIncludedFile' p id
src/Text/Pandoc/Process.hs+1−1
@@ -1,6 +1,6 @@
11{- |
22 Module : Text.Pandoc.Process
3− Copyright : Copyright (C) 2013-2021 John MacFarlane
3+ Copyright : Copyright (C) 2013-2020 John MacFarlane
44 License : GNU GPL, version 2 or above
55
66 Maintainer : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers.hs+49−56
@@ -1,10 +1,9 @@
11{-# LANGUAGE MonoLocalBinds #-}
2−{-# LANGUAGE RankNTypes #-}
32{-# LANGUAGE ScopedTypeVariables #-}
43{-# LANGUAGE OverloadedStrings #-}
54{- |
65 Module : Text.Pandoc.Readers
7− Copyright : Copyright (C) 2006-2021 John MacFarlane
6+ Copyright : Copyright (C) 2006-2020 John MacFarlane
87 License : GNU GPL, version 2 or above
98
109 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -66,14 +65,12 @@ import Data.Aeson
6665import qualified Data.ByteString.Lazy as BL
6766import Data.Text (Text)
6867import qualified Data.Text as T
69−import Text.Pandoc.Shared (tshow)
7068import Text.Pandoc.Class
7169import Text.Pandoc.Definition
7270import Text.Pandoc.Error
7371import Text.Pandoc.Extensions
7472import Text.Pandoc.Options
7573import Text.Pandoc.Readers.CommonMark
76−import Text.Pandoc.Readers.Markdown
7774import Text.Pandoc.Readers.Creole
7875import Text.Pandoc.Readers.DocBook
7976import Text.Pandoc.Readers.Docx
@@ -86,6 +83,7 @@ import Text.Pandoc.Readers.HTML (readHtml)
8683import Text.Pandoc.Readers.JATS (readJATS)
8784import Text.Pandoc.Readers.Jira (readJira)
8885import Text.Pandoc.Readers.LaTeX
86+import Text.Pandoc.Readers.Markdown
8987import Text.Pandoc.Readers.MediaWiki
9088import Text.Pandoc.Readers.Muse
9189import Text.Pandoc.Readers.Native
@@ -103,60 +101,59 @@ import Text.Pandoc.Readers.CSV
103101import Text.Pandoc.Readers.CslJson
104102import Text.Pandoc.Readers.BibTeX
105103import qualified Text.Pandoc.UTF8 as UTF8
106−import Text.Pandoc.Sources (ToSources(..), sourcesToText)
104+import Text.Parsec.Error
107105
108−data Reader m = TextReader (forall a . ToSources a =>
109− ReaderOptions -> a -> m Pandoc)
106+data Reader m = TextReader (ReaderOptions -> Text -> m Pandoc)
110107 | ByteStringReader (ReaderOptions -> BL.ByteString -> m Pandoc)
111108
112109-- | Association list of formats and readers.
113110readers :: PandocMonad m => [(Text, Reader m)]
114−readers = [("native" , TextReader readNative)
115− ,("json" , TextReader readJSON)
116− ,("markdown" , TextReader readMarkdown)
117− ,("markdown_strict" , TextReader readMarkdown)
118− ,("markdown_phpextra" , TextReader readMarkdown)
119− ,("markdown_github" , TextReader readMarkdown)
120− ,("markdown_mmd", TextReader readMarkdown)
121− ,("commonmark" , TextReader readCommonMark)
122− ,("commonmark_x" , TextReader readCommonMark)
123− ,("creole" , TextReader readCreole)
124− ,("dokuwiki" , TextReader readDokuWiki)
125− ,("gfm" , TextReader readCommonMark)
126− ,("rst" , TextReader readRST)
127− ,("mediawiki" , TextReader readMediaWiki)
128− ,("vimwiki" , TextReader readVimwiki)
129− ,("docbook" , TextReader readDocBook)
130− ,("opml" , TextReader readOPML)
131− ,("org" , TextReader readOrg)
132− ,("textile" , TextReader readTextile) -- TODO : textile+lhs
133− ,("html" , TextReader readHtml)
134− ,("jats" , TextReader readJATS)
135− ,("jira" , TextReader readJira)
136− ,("latex" , TextReader readLaTeX)
137− ,("haddock" , TextReader readHaddock)
138− ,("twiki" , TextReader readTWiki)
139− ,("tikiwiki" , TextReader readTikiWiki)
140− ,("docx" , ByteStringReader readDocx)
141− ,("odt" , ByteStringReader readOdt)
142− ,("t2t" , TextReader readTxt2Tags)
143− ,("epub" , ByteStringReader readEPUB)
144− ,("muse" , TextReader readMuse)
145− ,("man" , TextReader readMan)
146− ,("fb2" , TextReader readFB2)
147− ,("ipynb" , TextReader readIpynb)
148− ,("csv" , TextReader readCSV)
149− ,("csljson" , TextReader readCslJson)
150− ,("bibtex" , TextReader readBibTeX)
151− ,("biblatex" , TextReader readBibLaTeX)
111+readers = [ ("native" , TextReader readNative)
112+ ,("json" , TextReader readJSON)
113+ ,("markdown" , TextReader readMarkdown)
114+ ,("markdown_strict" , TextReader readMarkdown)
115+ ,("markdown_phpextra" , TextReader readMarkdown)
116+ ,("markdown_github" , TextReader readMarkdown)
117+ ,("markdown_mmd", TextReader readMarkdown)
118+ ,("commonmark" , TextReader readCommonMark)
119+ ,("commonmark_x" , TextReader readCommonMark)
120+ ,("creole" , TextReader readCreole)
121+ ,("dokuwiki" , TextReader readDokuWiki)
122+ ,("gfm" , TextReader readCommonMark)
123+ ,("rst" , TextReader readRST)
124+ ,("mediawiki" , TextReader readMediaWiki)
125+ ,("vimwiki" , TextReader readVimwiki)
126+ ,("docbook" , TextReader readDocBook)
127+ ,("opml" , TextReader readOPML)
128+ ,("org" , TextReader readOrg)
129+ ,("textile" , TextReader readTextile) -- TODO : textile+lhs
130+ ,("html" , TextReader readHtml)
131+ ,("jats" , TextReader readJATS)
132+ ,("jira" , TextReader readJira)
133+ ,("latex" , TextReader readLaTeX)
134+ ,("haddock" , TextReader readHaddock)
135+ ,("twiki" , TextReader readTWiki)
136+ ,("tikiwiki" , TextReader readTikiWiki)
137+ ,("docx" , ByteStringReader readDocx)
138+ ,("odt" , ByteStringReader readOdt)
139+ ,("t2t" , TextReader readTxt2Tags)
140+ ,("epub" , ByteStringReader readEPUB)
141+ ,("muse" , TextReader readMuse)
142+ ,("man" , TextReader readMan)
143+ ,("fb2" , TextReader readFB2)
144+ ,("ipynb" , TextReader readIpynb)
145+ ,("csv" , TextReader readCSV)
146+ ,("csljson" , TextReader readCslJson)
147+ ,("bibtex" , TextReader readBibTeX)
148+ ,("biblatex" , TextReader readBibLaTeX)
152149 ]
153150
154151-- | Retrieve reader, extensions based on formatSpec (format+extensions).
155152getReader :: PandocMonad m => Text -> m (Reader m, Extensions)
156153getReader s =
157154 case parseFormatSpec s of
158− Left e -> throwError $ PandocAppError $
159− "Error parsing reader format " <> tshow s <> ": " <> tshow e
155+ Left e -> throwError $ PandocAppError
156+ $ T.intercalate "\n" [T.pack m | Message m <- errorMessages e]
160157 Right (readerName, extsToEnable, extsToDisable) ->
161158 case lookup readerName readers of
162159 Nothing -> throwError $ PandocUnknownReaderError
@@ -176,13 +173,9 @@ getReader s =
176173 return (r, exts)
177174
178175-- | Read pandoc document from JSON format.
179−readJSON :: (PandocMonad m, ToSources a)
180− => ReaderOptions
181− -> a
182− -> m Pandoc
183−readJSON _ s =
184− case eitherDecode' . BL.fromStrict . UTF8.fromText
185− . sourcesToText . toSources $ s of
176+readJSON :: PandocMonad m
177+ => ReaderOptions -> Text -> m Pandoc
178+readJSON _ t =
179+ case eitherDecode' . BL.fromStrict . UTF8.fromText $ t of
186180 Right doc -> return doc
187− Left e -> throwError $ PandocParseError ("JSON parse error: "
188− <> T.pack e)
181+ Left e -> throwError $ PandocParseError ("JSON parse error: " <> T.pack e)
src/Text/Pandoc/Readers/BibTeX.hs+11−18
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.Readers.BibTeX
4− Copyright : Copyright (C) 2020-2021 John MacFarlane
4+ Copyright : Copyright (C) 2020 John MacFarlane
55 License : GNU GPL, version 2 or above
66
77 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -23,47 +23,39 @@ where
2323import Text.Pandoc.Options
2424import Text.Pandoc.Definition
2525import Text.Pandoc.Builder (setMeta, cite, str)
26+import Data.Text (Text)
2627import Citeproc (Lang(..), parseLang)
2728import Citeproc.Locale (getLocale)
29+import Data.Maybe (fromMaybe)
2830import Text.Pandoc.Error (PandocError(..))
2931import Text.Pandoc.Class (PandocMonad, lookupEnv)
3032import Text.Pandoc.Citeproc.BibTeX as BibTeX
3133import Text.Pandoc.Citeproc.MetaValue (referenceToMetaValue)
32−import Text.Pandoc.Sources (ToSources(..))
3334import Control.Monad.Except (throwError)
3435
3536-- | Read BibTeX from an input string and return a Pandoc document.
3637-- The document will have only metadata, with an empty body.
3738-- The metadata will contain a `references` field with the
3839-- bibliography entries, and a `nocite` field with the wildcard `[@*]`.
39−readBibTeX :: (PandocMonad m, ToSources a)
40− => ReaderOptions -> a -> m Pandoc
40+readBibTeX :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
4141readBibTeX = readBibTeX' BibTeX.Bibtex
4242
4343-- | Read BibLaTeX from an input string and return a Pandoc document.
4444-- The document will have only metadata, with an empty body.
4545-- The metadata will contain a `references` field with the
4646-- bibliography entries, and a `nocite` field with the wildcard `[@*]`.
47−readBibLaTeX :: (PandocMonad m, ToSources a)
48− => ReaderOptions -> a -> m Pandoc
47+readBibLaTeX :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
4948readBibLaTeX = readBibTeX' BibTeX.Biblatex
5049
51−readBibTeX' :: (PandocMonad m, ToSources a)
52− => Variant -> ReaderOptions -> a -> m Pandoc
50+readBibTeX' :: PandocMonad m => Variant -> ReaderOptions -> Text -> m Pandoc
5351readBibTeX' variant _opts t = do
54− mblangEnv <- lookupEnv "LANG"
55− let defaultLang = Lang "en" Nothing (Just "US") [] [] []
56− let lang = case mblangEnv of
57− Nothing -> defaultLang
58− Just l -> either (const defaultLang) id $ parseLang l
52+ lang <- fromMaybe (Lang "en" (Just "US")) . fmap parseLang
53+ <$> lookupEnv "LANG"
5954 locale <- case getLocale lang of
60− Left e ->
61− case getLocale (Lang "en" Nothing (Just "US") [] [] []) of
62− Right l -> return l
63− Left _ -> throwError $ PandocCiteprocError e
55+ Left e -> throwError $ PandocCiteprocError e
6456 Right l -> return l
6557 case BibTeX.readBibtexString variant locale (const True) t of
66− Left e -> throwError $ PandocParsecError (toSources t) e
58+ Left e -> throwError $ PandocParsecError t e
6759 Right refs -> return $ setMeta "references"
6860 (map referenceToMetaValue refs)
6961 . setMeta "nocite"
@@ -75,3 +67,4 @@ readBibTeX' variant _opts t = do
7567 , citationHash = 0}]
7668 (str "[@*]"))
7769 $ Pandoc nullMeta []
70+
src/Text/Pandoc/Readers/CSV.hs+9−9
@@ -2,8 +2,8 @@
22
33{-# LANGUAGE ScopedTypeVariables #-}
44{- |
5− Module : Text.Pandoc.Readers.CSV
6− Copyright : Copyright (C) 2006-2021 John MacFarlane
5+ Module : Text.Pandoc.Readers.RST
6+ Copyright : Copyright (C) 2006-2020 John MacFarlane
77 License : GNU GPL, version 2 or above
88
99 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -13,23 +13,23 @@
1313Conversion from CSV to a 'Pandoc' table.
1414-}
1515module Text.Pandoc.Readers.CSV ( readCSV ) where
16+import Data.Text (Text)
1617import qualified Data.Text as T
1718import Text.Pandoc.CSV (parseCSV, defaultCSVOptions)
1819import Text.Pandoc.Definition
1920import qualified Text.Pandoc.Builder as B
2021import Text.Pandoc.Class (PandocMonad)
22+import Text.Pandoc.Shared (crFilter)
2123import Text.Pandoc.Error
22−import Text.Pandoc.Sources (ToSources(..), sourcesToText)
2324import Text.Pandoc.Options (ReaderOptions)
2425import Control.Monad.Except (throwError)
2526
26−readCSV :: (PandocMonad m, ToSources a)
27+readCSV :: PandocMonad m
2728 => ReaderOptions -- ^ Reader options
28− -> a
29+ -> Text -- ^ Text to parse (assuming @'\n'@ line endings)
2930 -> m Pandoc
30−readCSV _opts s = do
31− let txt = sourcesToText $ toSources s
32− case parseCSV defaultCSVOptions txt of
31+readCSV _opts s =
32+ case parseCSV defaultCSVOptions (crFilter s) of
3333 Right (r:rs) -> return $ B.doc $ B.table capt
3434 (zip aligns widths)
3535 (TableHead nullAttr hdrs)
@@ -45,4 +45,4 @@ readCSV _opts s = do
4545 aligns = replicate numcols AlignDefault
4646 widths = replicate numcols ColWidthDefault
4747 Right [] -> return $ B.doc mempty
48− Left e -> throwError $ PandocParsecError (toSources [("",txt)]) e
48+ Left e -> throwError $ PandocParsecError s e
src/Text/Pandoc/Readers/CommonMark.hs+28−81
@@ -1,9 +1,8 @@
11{-# LANGUAGE OverloadedStrings #-}
2−{-# LANGUAGE FlexibleContexts #-}
32{-# LANGUAGE ScopedTypeVariables #-}
43{- |
54 Module : Text.Pandoc.Readers.CommonMark
6− Copyright : Copyright (C) 2015-2021 John MacFarlane
5+ Copyright : Copyright (C) 2015-2020 John MacFarlane
76 License : GNU GPL, version 2 or above
87
98 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -26,93 +25,41 @@ import Text.Pandoc.Definition
2625import Text.Pandoc.Builder as B
2726import Text.Pandoc.Options
2827import Text.Pandoc.Error
29−import Text.Pandoc.Readers.Metadata (yamlMetaBlock)
3028import Control.Monad.Except
3129import Data.Functor.Identity (runIdentity)
32−import Data.Typeable
33−import Text.Pandoc.Parsing (runParserT, getInput,
34− runF, defaultParserState, option, many1, anyChar,
35− Sources(..), ToSources(..), ParserT, Future,
36− sourceName)
37−import qualified Data.Text as T
3830
3931-- | Parse a CommonMark formatted string into a 'Pandoc' structure.
40−readCommonMark :: (PandocMonad m, ToSources a)
41− => ReaderOptions -> a -> m Pandoc
42−readCommonMark opts s
43− | isEnabled Ext_yaml_metadata_block opts = do
44− let sources = toSources s
45− let toks = concatMap sourceToToks (unSources sources)
46− res <- runParserT (do meta <- yamlMetaBlock (metaValueParser opts)
47− rest <- getInput
48− return (meta, rest))
49− defaultParserState "YAML metadata" (toSources s)
50− case res of
51− Left _ -> readCommonMarkBody opts sources toks
52− Right (meta, rest) -> do
53− -- strip off metadata section and parse body
54− let body = concatMap sourceToToks (unSources rest)
55− Pandoc _ bs <- readCommonMarkBody opts sources body
56− return $ Pandoc (runF meta defaultParserState) bs
57− | otherwise = do
58− let sources = toSources s
59− let toks = concatMap sourceToToks (unSources sources)
60− readCommonMarkBody opts sources toks
61−
62−sourceToToks :: (SourcePos, Text) -> [Tok]
63−sourceToToks (pos, s) = tokenize (sourceName pos) s
64−
65−metaValueParser :: Monad m
66− => ReaderOptions -> ParserT Sources st m (Future st MetaValue)
67−metaValueParser opts = do
68− inp <- option "" $ T.pack <$> many1 anyChar
69− let toks = concatMap sourceToToks (unSources (toSources inp))
70− case runIdentity (parseCommonmarkWith (specFor opts) toks) of
71− Left _ -> mzero
72− Right (Cm bls :: Cm () Blocks) -> return $ return $ B.toMetaValue bls
73−
74−readCommonMarkBody :: PandocMonad m => ReaderOptions -> Sources -> [Tok] -> m Pandoc
75−readCommonMarkBody opts s toks
76− | isEnabled Ext_sourcepos opts =
77− case runIdentity (parseCommonmarkWith (specFor opts) toks) of
78− Left err -> throwError $ PandocParsecError s err
79− Right (Cm bls :: Cm SourceRange Blocks) -> return $ B.doc bls
80− | otherwise =
81− case runIdentity (parseCommonmarkWith (specFor opts) toks) of
82− Left err -> throwError $ PandocParsecError s err
83− Right (Cm bls :: Cm () Blocks) -> return $ B.doc bls
84−
85−specFor :: (Monad m, Typeable m, Typeable a,
86− Rangeable (Cm a Inlines), Rangeable (Cm a Blocks))
87− => ReaderOptions -> SyntaxSpec m (Cm a Inlines) (Cm a Blocks)
88−specFor opts = foldr ($) defaultSyntaxSpec exts
32+readCommonMark :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
33+readCommonMark opts s = do
34+ let res = runIdentity $
35+ commonmarkWith (foldr (<>) defaultSyntaxSpec exts) "input" s
36+ case res of
37+ Left err -> throwError $ PandocParsecError s err
38+ Right (Cm bls :: Cm () Blocks) -> return $ B.doc bls
8939 where
90− exts = [ (hardLineBreaksSpec <>) | isEnabled Ext_hard_line_breaks opts ] ++
91− [ (smartPunctuationSpec <>) | isEnabled Ext_smart opts ] ++
92− [ (strikethroughSpec <>) | isEnabled Ext_strikeout opts ] ++
93− [ (superscriptSpec <>) | isEnabled Ext_superscript opts ] ++
94− [ (subscriptSpec <>) | isEnabled Ext_subscript opts ] ++
95− [ (mathSpec <>) | isEnabled Ext_tex_math_dollars opts ] ++
96− [ (fancyListSpec <>) | isEnabled Ext_fancy_lists opts ] ++
97− [ (fencedDivSpec <>) | isEnabled Ext_fenced_divs opts ] ++
98− [ (bracketedSpanSpec <>) | isEnabled Ext_bracketed_spans opts ] ++
99− [ (rawAttributeSpec <>) | isEnabled Ext_raw_attribute opts ] ++
100− [ (attributesSpec <>) | isEnabled Ext_attributes opts ] ++
101− [ (<> pipeTableSpec) | isEnabled Ext_pipe_tables opts ] ++
102− -- see #6739
103− [ (autolinkSpec <>) | isEnabled Ext_autolink_bare_uris opts ] ++
104− [ (emojiSpec <>) | isEnabled Ext_emoji opts ] ++
105− [ (autoIdentifiersSpec <>)
40+ exts = [ hardLineBreaksSpec | isEnabled Ext_hard_line_breaks opts ] ++
41+ [ smartPunctuationSpec | isEnabled Ext_smart opts ] ++
42+ [ strikethroughSpec | isEnabled Ext_strikeout opts ] ++
43+ [ superscriptSpec | isEnabled Ext_superscript opts ] ++
44+ [ subscriptSpec | isEnabled Ext_subscript opts ] ++
45+ [ mathSpec | isEnabled Ext_tex_math_dollars opts ] ++
46+ [ fancyListSpec | isEnabled Ext_fancy_lists opts ] ++
47+ [ fencedDivSpec | isEnabled Ext_fenced_divs opts ] ++
48+ [ bracketedSpanSpec | isEnabled Ext_bracketed_spans opts ] ++
49+ [ rawAttributeSpec | isEnabled Ext_raw_attribute opts ] ++
50+ [ attributesSpec | isEnabled Ext_attributes opts ] ++
51+ [ pipeTableSpec | isEnabled Ext_pipe_tables opts ] ++
52+ [ autolinkSpec | isEnabled Ext_autolink_bare_uris opts ] ++
53+ [ emojiSpec | isEnabled Ext_emoji opts ] ++
54+ [ autoIdentifiersSpec
10655 | isEnabled Ext_gfm_auto_identifiers opts
10756 , not (isEnabled Ext_ascii_identifiers opts) ] ++
108− [ (autoIdentifiersAsciiSpec <>)
57+ [ autoIdentifiersAsciiSpec
10958 | isEnabled Ext_gfm_auto_identifiers opts
11059 , isEnabled Ext_ascii_identifiers opts ] ++
111− [ (implicitHeadingReferencesSpec <>)
60+ [ implicitHeadingReferencesSpec
11261 | isEnabled Ext_implicit_header_references opts ] ++
113− [ (footnoteSpec <>) | isEnabled Ext_footnotes opts ] ++
114− [ (definitionListSpec <>) | isEnabled Ext_definition_lists opts ] ++
115− [ (taskListSpec <>) | isEnabled Ext_task_lists opts ] ++
116− [ (rebaseRelativePathsSpec <>)
117− | isEnabled Ext_rebase_relative_paths opts ]
62+ [ footnoteSpec | isEnabled Ext_footnotes opts ] ++
63+ [ definitionListSpec | isEnabled Ext_definition_lists opts ] ++
64+ [ taskListSpec | isEnabled Ext_task_lists opts ]
11865
src/Text/Pandoc/Readers/Creole.hs+7−6
@@ -23,20 +23,21 @@ import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
2323import Text.Pandoc.Definition
2424import Text.Pandoc.Options
2525import Text.Pandoc.Parsing hiding (enclosed)
26+import Text.Pandoc.Shared (crFilter)
27+
2628
2729-- | Read creole from an input string and return a Pandoc document.
28−readCreole :: (PandocMonad m, ToSources a)
30+readCreole :: PandocMonad m
2931 => ReaderOptions
30− -> a
32+ -> Text
3133 -> m Pandoc
3234readCreole opts s = do
33− let sources = ensureFinalNewlines 2 (toSources s)
34− res <- readWithM parseCreole def{ stateOptions = opts } sources
35+ res <- readWithM parseCreole def{ stateOptions = opts } $ crFilter s <> "\n\n"
3536 case res of
3637 Left e -> throwError e
3738 Right d -> return d
3839
39−type CRLParser = ParserT Sources ParserState
40+type CRLParser = ParserT Text ParserState
4041
4142--
4243-- Utility functions
@@ -251,7 +252,7 @@ inlineNowiki = B.code <$> (start >> manyTillChar (noneOf "\n\r") end)
251252 end = try $ string "}}}" >> lookAhead (noneOf "}")
252253
253254placeholder :: PandocMonad m => CRLParser m B.Inlines
254−-- The semantics of the placeholder is basically implementation
255+-- The semantics of the placeholder is basicallly implementation
255256-- dependent, so there is no way to DTRT for all cases.
256257-- So for now we just drop them.
257258placeholder = B.text <$> try (string "<<<" >> manyTill anyChar (string ">>>")
src/Text/Pandoc/Readers/CslJson.hs+5−6
@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{- |
33 Module : Text.Pandoc.Readers.CslJson
4− Copyright : Copyright (C) 2020-2021 John MacFarlane
4+ Copyright : Copyright (C) 2020 John MacFarlane
55 License : GNU GPL, version 2 or above
66
77 Maintainer : John MacFarlane <jgm@berkeley.edu>
@@ -24,22 +24,21 @@ import Text.Pandoc.Options
2424import Text.Pandoc.Definition
2525import Text.Pandoc.Builder (setMeta, cite, str)
2626import qualified Text.Pandoc.UTF8 as UTF8
27+import Data.Text (Text)
2728import qualified Data.Text as T
2829import Text.Pandoc.Error (PandocError(..))
2930import Text.Pandoc.Class (PandocMonad)
3031import Text.Pandoc.Citeproc.CslJson (cslJsonToReferences)
3132import Text.Pandoc.Citeproc.MetaValue (referenceToMetaValue)
3233import Control.Monad.Except (throwError)
33−import Text.Pandoc.Sources (ToSources(..), sourcesToText)
3434
3535-- | Read CSL JSON from an input string and return a Pandoc document.
3636-- The document will have only metadata, with an empty body.
3737-- The metadata will contain a `references` field with the
3838-- bibliography entries, and a `nocite` field with the wildcard `[@*]`.
39−readCslJson :: (PandocMonad m, ToSources a)
40− => ReaderOptions -> a -> m Pandoc
41−readCslJson _opts x =
42− case cslJsonToReferences (UTF8.fromText $ sourcesToText $ toSources x) of
39+readCslJson :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
40+readCslJson _opts t =
41+ case cslJsonToReferences (UTF8.fromText t) of
4342 Left e -> throwError $ PandocParseError $ T.pack e
4443 Right refs -> return $ setMeta "references"
4544 (map referenceToMetaValue refs)
src/Text/Pandoc/Readers/DocBook.hs+104−134

This diff is too big to show here.

src/Text/Pandoc/Readers/Docx.hs+51−71

This diff is too big to show here.

src/Text/Pandoc/Readers/Docx/Combine.hs+7−7

This diff is too big to show here.

src/Text/Pandoc/Readers/Docx/Parse.hs+124−218

This diff is too big to show here.

src/Text/Pandoc/Readers/Docx/Parse/Styles.hs+25−32

This diff is too big to show here.

src/Text/Pandoc/Readers/Docx/Util.hs+26−28

This diff is too big to show here.

src/Text/Pandoc/Readers/DokuWiki.hs+9−10

This diff is too big to show here.

src/Text/Pandoc/Readers/EPUB.hs+39−46

This diff is too big to show here.

src/Text/Pandoc/Readers/FB2.hs+51−57

This diff is too big to show here.

src/Text/Pandoc/Readers/HTML.hs+561−264

This diff is too big to show here.

src/Text/Pandoc/Readers/HTML/Parsing.hsdeleted−225

This diff is too big to show here.

src/Text/Pandoc/Readers/HTML/Table.hsdeleted−283

This diff is too big to show here.

src/Text/Pandoc/Readers/HTML/TagCategories.hsdeleted−78

This diff is too big to show here.

src/Text/Pandoc/Readers/HTML/Types.hsdeleted−97

This diff is too big to show here.

src/Text/Pandoc/Readers/Haddock.hs+7−11

This diff is too big to show here.

src/Text/Pandoc/Readers/Ipynb.hs+4−6

This diff is too big to show here.

src/Text/Pandoc/Readers/JATS.hs+63−49

This diff is too big to show here.

src/Text/Pandoc/Readers/Jira.hs+10−14

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX.hs+1434−274

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Citation.hsdeleted−210

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Inline.hsdeleted−397

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Lang.hs+121−200

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Macro.hsdeleted−184

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Math.hsdeleted−221

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Parsing.hs+56−214

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/SIunitx.hs+70−153

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Table.hsdeleted−378

This diff is too big to show here.

src/Text/Pandoc/Readers/LaTeX/Types.hs+2−15

This diff is too big to show here.

src/Text/Pandoc/Readers/Man.hs+17−38

This diff is too big to show here.

src/Text/Pandoc/Readers/Markdown.hs+260−362

This diff is too big to show here.

src/Text/Pandoc/Readers/MediaWiki.hs+14−21

This diff is too big to show here.

src/Text/Pandoc/Readers/Metadata.hs+34−115

This diff is too big to show here.

src/Text/Pandoc/Readers/Muse.hs+9−10

This diff is too big to show here.

src/Text/Pandoc/Readers/Native.hs+6−8

This diff is too big to show here.

src/Text/Pandoc/Readers/OPML.hs+36−22

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt.hs+25−28

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/Arrows/State.hs+2−2

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/ContentReader.hs+15−22

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/Generic/Namespaces.hs+1−2

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/Generic/Utils.hs+26−10

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs+14−13

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/Namespaces.hs+5−6

This diff is too big to show here.

src/Text/Pandoc/Readers/Odt/StyleReader.hs+17−21

This diff is too big to show here.

src/Text/Pandoc/Readers/Org.hs+8−5

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/BlockStarts.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/Blocks.hs+33−71

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/DocumentTree.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/ExportSettings.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/Inlines.hs+13−13

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/Meta.hs+5−13

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/ParserState.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/Parsing.hs+6−6

This diff is too big to show here.

src/Text/Pandoc/Readers/Org/Shared.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Readers/RST.hs+116−85

This diff is too big to show here.

src/Text/Pandoc/Readers/Roff.hs+18−16

This diff is too big to show here.

src/Text/Pandoc/Readers/TWiki.hs+27−7

This diff is too big to show here.

src/Text/Pandoc/Readers/Textile.hs+90−96

This diff is too big to show here.

src/Text/Pandoc/Readers/TikiWiki.hs+6−6

This diff is too big to show here.

src/Text/Pandoc/Readers/Txt2Tags.hs+23−49

This diff is too big to show here.

src/Text/Pandoc/Readers/Vimwiki.hs+7−12

This diff is too big to show here.

src/Text/Pandoc/RoffChar.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/SelfContained.hs+12−16

This diff is too big to show here.

src/Text/Pandoc/Shared.hs+101−52

This diff is too big to show here.

src/Text/Pandoc/Slides.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Sources.hsdeleted−195

This diff is too big to show here.

src/Text/Pandoc/Templates.hs+1−5

This diff is too big to show here.

src/Text/Pandoc/Translations.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/UTF8.hs+24−21

This diff is too big to show here.

src/Text/Pandoc/UUID.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers.hs+4−9

This diff is too big to show here.

src/Text/Pandoc/Writers/AnnotatedTable.hs−23

This diff is too big to show here.

src/Text/Pandoc/Writers/AsciiDoc.hs+12−43

This diff is too big to show here.

src/Text/Pandoc/Writers/BibTeX.hsdeleted−61

This diff is too big to show here.

src/Text/Pandoc/Writers/CommonMark.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/ConTeXt.hs+39−45

This diff is too big to show here.

src/Text/Pandoc/Writers/CslJson.hs+10−14

This diff is too big to show here.

src/Text/Pandoc/Writers/Custom.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/Docbook.hs+33−114

This diff is too big to show here.

src/Text/Pandoc/Writers/Docx.hs+405−254

This diff is too big to show here.

src/Text/Pandoc/Writers/Docx/StyleMap.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/Docx/Table.hsdeleted−227

This diff is too big to show here.

src/Text/Pandoc/Writers/Docx/Types.hsdeleted−185

This diff is too big to show here.

src/Text/Pandoc/Writers/DokuWiki.hs+16−29

This diff is too big to show here.

src/Text/Pandoc/Writers/EPUB.hs+212−269

This diff is too big to show here.

src/Text/Pandoc/Writers/FB2.hs+78−62

This diff is too big to show here.

src/Text/Pandoc/Writers/GridTable.hsdeleted−157

This diff is too big to show here.

src/Text/Pandoc/Writers/HTML.hs+64−144

This diff is too big to show here.

src/Text/Pandoc/Writers/Haddock.hs+2−13

This diff is too big to show here.

src/Text/Pandoc/Writers/ICML.hs+1−6

This diff is too big to show here.

src/Text/Pandoc/Writers/Ipynb.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/JATS.hs+120−113

This diff is too big to show here.

src/Text/Pandoc/Writers/JATS/References.hsdeleted−164

This diff is too big to show here.

src/Text/Pandoc/Writers/JATS/Table.hsdeleted−268

This diff is too big to show here.

src/Text/Pandoc/Writers/JATS/Types.hsdeleted−57

This diff is too big to show here.

src/Text/Pandoc/Writers/Jira.hs+18−43

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX.hs+815−100

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Caption.hsdeleted−47

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Citation.hsdeleted−181

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Lang.hsdeleted−192

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Notes.hsdeleted−34

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Table.hsdeleted−307

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Types.hsdeleted−83

This diff is too big to show here.

src/Text/Pandoc/Writers/LaTeX/Util.hsdeleted−275

This diff is too big to show here.

src/Text/Pandoc/Writers/Man.hs+3−3

This diff is too big to show here.

src/Text/Pandoc/Writers/Markdown.hs+661−102

This diff is too big to show here.

src/Text/Pandoc/Writers/Markdown/Inline.hsdeleted−616

This diff is too big to show here.

src/Text/Pandoc/Writers/Markdown/Types.hsdeleted−81

This diff is too big to show here.

src/Text/Pandoc/Writers/MediaWiki.hs+3−10

This diff is too big to show here.

src/Text/Pandoc/Writers/Ms.hs+12−30

This diff is too big to show here.

src/Text/Pandoc/Writers/Muse.hs+3−6

This diff is too big to show here.

src/Text/Pandoc/Writers/Native.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/ODT.hs+22−28

This diff is too big to show here.

src/Text/Pandoc/Writers/OOXML.hs+22−22

This diff is too big to show here.

src/Text/Pandoc/Writers/OPML.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/OpenDocument.hs+88−183

This diff is too big to show here.

src/Text/Pandoc/Writers/Org.hs+42−66

This diff is too big to show here.

src/Text/Pandoc/Writers/Powerpoint.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/Powerpoint/Output.hs+148−172

This diff is too big to show here.

src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+3−2

This diff is too big to show here.

src/Text/Pandoc/Writers/RST.hs+22−38

This diff is too big to show here.

src/Text/Pandoc/Writers/RTF.hs+11−17

This diff is too big to show here.

src/Text/Pandoc/Writers/Roff.hs+2−2

This diff is too big to show here.

src/Text/Pandoc/Writers/Shared.hs+6−20

This diff is too big to show here.

src/Text/Pandoc/Writers/TEI.hs+4−5

This diff is too big to show here.

src/Text/Pandoc/Writers/Texinfo.hs+16−23

This diff is too big to show here.

src/Text/Pandoc/Writers/Textile.hs+1−1

This diff is too big to show here.

src/Text/Pandoc/Writers/ZimWiki.hs+3−5

This diff is too big to show here.

src/Text/Pandoc/XML.hs+20−42

This diff is too big to show here.

src/Text/Pandoc/XML/Light.hsdeleted−89

This diff is too big to show here.

src/Text/Pandoc/XML/Light/Output.hsdeleted−234

This diff is too big to show here.

src/Text/Pandoc/XML/Light/Proc.hsdeleted−139

This diff is too big to show here.

src/Text/Pandoc/XML/Light/Types.hsdeleted−193

This diff is too big to show here.

stack.yaml+21−10

This diff is too big to show here.

test/Tests/Command.hs+47−74

This diff is too big to show here.

test/Tests/Helpers.hs+36−25

This diff is too big to show here.

test/Tests/Lua.hs+4−2

This diff is too big to show here.

test/Tests/Lua/Module.hs+1−3

This diff is too big to show here.

test/Tests/Old.hs+30−18

This diff is too big to show here.

test/Tests/Readers/Creole.hs+3−1

This diff is too big to show here.

test/Tests/Readers/Docx.hs+7−29

This diff is too big to show here.

test/Tests/Readers/DokuWiki.hs+2

This diff is too big to show here.

test/Tests/Readers/EPUB.hs+4−2

This diff is too big to show here.

test/Tests/Readers/FB2.hs+2

This diff is too big to show here.

test/Tests/Readers/HTML.hs+19−24

This diff is too big to show here.

test/Tests/Readers/JATS.hs+2−1

This diff is too big to show here.

test/Tests/Readers/Jira.hs+2−22

This diff is too big to show here.

test/Tests/Readers/LaTeX.hs+21−2

This diff is too big to show here.

test/Tests/Readers/Man.hs+2−1

This diff is too big to show here.

test/Tests/Readers/Markdown.hs+6−4

This diff is too big to show here.

test/Tests/Readers/Muse.hs+2

This diff is too big to show here.

test/Tests/Readers/Odt.hs+3−2

This diff is too big to show here.

test/Tests/Readers/Org.hs+1−1

This diff is too big to show here.

test/Tests/Readers/Org/Block.hs+24−22

This diff is too big to show here.

test/Tests/Readers/Org/Block/CodeBlock.hs+38−36

This diff is too big to show here.

test/Tests/Readers/Org/Block/Figure.hs+11−9

This diff is too big to show here.

test/Tests/Readers/Org/Block/Header.hs+6−4

This diff is too big to show here.

test/Tests/Readers/Org/Block/List.hs+3−14

This diff is too big to show here.

test/Tests/Readers/Org/Block/Table.hs+5−3

This diff is too big to show here.

test/Tests/Readers/Org/Directive.hs+3−1

This diff is too big to show here.

test/Tests/Readers/Org/Inline.hs+7−5

This diff is too big to show here.

test/Tests/Readers/Org/Inline/Citation.hs+3−41

This diff is too big to show here.

test/Tests/Readers/Org/Inline/Note.hs+3−1

This diff is too big to show here.

test/Tests/Readers/Org/Inline/Smart.hs+3−1

This diff is too big to show here.

test/Tests/Readers/Org/Meta.hs+30−44

This diff is too big to show here.

test/Tests/Readers/Org/Shared.hs+3−1

This diff is too big to show here.

test/Tests/Readers/RST.hs+3−1

This diff is too big to show here.

test/Tests/Readers/Txt2Tags.hs+3−1

This diff is too big to show here.

test/Tests/Shared.hs+3−1

This diff is too big to show here.

test/Tests/Writers/AnnotatedTable.hs+1

This diff is too big to show here.

test/Tests/Writers/AsciiDoc.hs+2

This diff is too big to show here.

test/Tests/Writers/ConTeXt.hs+115−122

This diff is too big to show here.

test/Tests/Writers/Docbook.hs+2−103

This diff is too big to show here.

test/Tests/Writers/Docx.hs+2−25

This diff is too big to show here.

test/Tests/Writers/FB2.hs+2

This diff is too big to show here.

test/Tests/Writers/HTML.hs+54−57

This diff is too big to show here.

test/Tests/Writers/JATS.hs+93−135

This diff is too big to show here.

test/Tests/Writers/Jira.hs+1−60

This diff is too big to show here.

test/Tests/Writers/LaTeX.hs+2

This diff is too big to show here.

test/Tests/Writers/Markdown.hs+3−3

This diff is too big to show here.

test/Tests/Writers/Ms.hs+2

This diff is too big to show here.

test/Tests/Writers/Muse.hs+1

This diff is too big to show here.

test/Tests/Writers/Native.hs+2

This diff is too big to show here.

test/Tests/Writers/OOXML.hs+4−5

This diff is too big to show here.

test/Tests/Writers/Org.hs+13−46

This diff is too big to show here.

test/Tests/Writers/Plain.hs+2

This diff is too big to show here.

test/Tests/Writers/Powerpoint.hs+2

This diff is too big to show here.

test/Tests/Writers/RST.hs+2

This diff is too big to show here.

test/Tests/Writers/TEI.hs+2

This diff is too big to show here.

test/command/1279.md+1−1

This diff is too big to show here.

test/command/1608.md+1−1

This diff is too big to show here.

test/command/1881.md+13−13

This diff is too big to show here.

test/command/2103.mddeleted−8

This diff is too big to show here.

test/command/2378.md+3−3

This diff is too big to show here.

test/command/2874.md+2−2

This diff is too big to show here.

test/command/3516.md+5−1

This diff is too big to show here.

test/command/3674.md+1−1

This diff is too big to show here.

test/command/3706.md+8−8

This diff is too big to show here.

test/command/3736.md+6−3

This diff is too big to show here.

test/command/3752.mddeleted−60

This diff is too big to show here.

test/command/3792.md+1−1

This diff is too big to show here.

test/command/3824.md−1

This diff is too big to show here.

test/command/4038.md+1−1

This diff is too big to show here.

test/command/4063.mddeleted−29

This diff is too big to show here.

test/command/4164.md+9−5

This diff is too big to show here.

test/command/4186.md+8−8

This diff is too big to show here.

test/command/4420.md+11

This diff is too big to show here.

test/command/4442.md+1−1

This diff is too big to show here.

test/command/4465.mddeleted−15

This diff is too big to show here.

test/command/4742.md+2−2

This diff is too big to show here.

test/command/5121.md+2−1

This diff is too big to show here.

test/command/5178.md+10−10

This diff is too big to show here.

test/command/5304.md+1−1

This diff is too big to show here.

test/command/5321.md+2−2

This diff is too big to show here.

test/command/5367.md+10−9

This diff is too big to show here.

test/command/5519.md+1−1

This diff is too big to show here.

test/command/5541-nesting.md−1

This diff is too big to show here.

test/command/5686.md+1−1

This diff is too big to show here.

test/command/5708.md+5−1

This diff is too big to show here.

test/command/5986.md+2−3

This diff is too big to show here.

test/command/6026.mddeleted−19

This diff is too big to show here.

test/command/6324.mddeleted−17

This diff is too big to show here.

test/command/6388.mddeleted−16

This diff is too big to show here.

test/command/6541.mddeleted−27

This diff is too big to show here.

test/command/6620.md−3

This diff is too big to show here.

test/command/6658.mddeleted−75

This diff is too big to show here.

test/command/6709.mddeleted−11

This diff is too big to show here.

test/command/6719.mddeleted−18

This diff is too big to show here.

test/command/6723.mddeleted−32

This diff is too big to show here.

test/command/6739.mddeleted−21

This diff is too big to show here.

test/command/6740.mddeleted−7

This diff is too big to show here.

test/command/6741.mddeleted−145

This diff is too big to show here.

test/command/6752.mddeleted−36

This diff is too big to show here.

test/command/6755.mddeleted−11

This diff is too big to show here.

test/command/6765.mddeleted−31

This diff is too big to show here.

test/command/6768.mddeleted−21

This diff is too big to show here.

test/command/6774.mddeleted−63

This diff is too big to show here.

test/command/6783.mddeleted−26

This diff is too big to show here.

test/command/6791.mddeleted−32

This diff is too big to show here.

test/command/6792.mddeleted−66

This diff is too big to show here.

test/command/6796.mddeleted−16

This diff is too big to show here.

test/command/6802.mddeleted−9

This diff is too big to show here.

test/command/6836.mddeleted−17

This diff is too big to show here.

test/command/6837.mddeleted−29

This diff is too big to show here.

test/command/6844.mddeleted−27

This diff is too big to show here.

test/command/6855.mddeleted−12

This diff is too big to show here.

test/command/6858.mddeleted−52

This diff is too big to show here.

test/command/6869.mddeleted−6

This diff is too big to show here.

test/command/6873.mddeleted−7

This diff is too big to show here.

test/command/6890.mddeleted−36

This diff is too big to show here.

test/command/6925.mddeleted−34

This diff is too big to show here.

test/command/6948.mddeleted−31

This diff is too big to show here.

test/command/6951.mddeleted−18

This diff is too big to show here.

test/command/6958.mddeleted−10

This diff is too big to show here.

test/command/6993.mddeleted−21

This diff is too big to show here.

test/command/7003.mddeleted−37

This diff is too big to show here.

test/command/7006.mddeleted−20

This diff is too big to show here.

test/command/7009.mddeleted−8

This diff is too big to show here.

test/command/7016.mddeleted−48

This diff is too big to show here.

test/command/7041.mddeleted−23

This diff is too big to show here.

test/command/7042.mddeleted−146

This diff is too big to show here.

test/command/7058.mddeleted−6

This diff is too big to show here.

test/command/7064.mddeleted−32

This diff is too big to show here.

test/command/7067.mddeleted−90

This diff is too big to show here.

test/command/7080.mddeleted−8

This diff is too big to show here.

test/command/7092.mddeleted−8

This diff is too big to show here.

test/command/7099.mddeleted−18

This diff is too big to show here.

test/command/7112.mddeleted−15

This diff is too big to show here.

test/command/7129.mddeleted−27

This diff is too big to show here.

test/command/7132.mddeleted−10

This diff is too big to show here.

test/command/7134.mddeleted−16

This diff is too big to show here.

test/command/7145.mddeleted−12

This diff is too big to show here.

test/command/7155.mddeleted−15

This diff is too big to show here.

test/command/7173.mddeleted−137

This diff is too big to show here.

test/command/7208.mddeleted−6

This diff is too big to show here.

test/command/7214.mddeleted−28

This diff is too big to show here.

test/command/7216.mddeleted−19

This diff is too big to show here.

test/command/7266.mddeleted−10

This diff is too big to show here.

test/command/7272.mddeleted−27

This diff is too big to show here.

test/command/7278.mddeleted−38

This diff is too big to show here.

test/command/7282.mddeleted−7

This diff is too big to show here.

test/command/7288.mddeleted−40

This diff is too big to show here.

test/command/7299.mddeleted−23

This diff is too big to show here.

test/command/7321.mddeleted−24

This diff is too big to show here.

test/command/7323.mddeleted−29

This diff is too big to show here.

test/command/7324.mddeleted−25

This diff is too big to show here.

test/command/7339.mddeleted−11

This diff is too big to show here.

test/command/7340.mddeleted−6

This diff is too big to show here.

test/command/7376.mddeleted−16

This diff is too big to show here.

test/command/7394.mddeleted−85

This diff is too big to show here.

test/command/7397.mddeleted−14

This diff is too big to show here.

test/command/7400.mddeleted−9

This diff is too big to show here.

test/command/7416.mddeleted−19

This diff is too big to show here.

test/command/averroes.bibdeleted−95

This diff is too big to show here.

test/command/biblatex-266.md+2−2

This diff is too big to show here.

test/command/biblatex-aksin.md+5−5

This diff is too big to show here.

test/command/biblatex-almendro.md+5−5

This diff is too big to show here.

test/command/biblatex-angenendt.md+9−9

This diff is too big to show here.

test/command/biblatex-aristotle-anima.md+3−3

This diff is too big to show here.

test/command/biblatex-aristotle-physics.md+3−3

This diff is too big to show here.

test/command/biblatex-aristotle-poetics.md+3−3

This diff is too big to show here.

test/command/biblatex-aristotle-rhetoric.md+5−5

This diff is too big to show here.

test/command/biblatex-article.md+15−15

This diff is too big to show here.

test/command/biblatex-augustine.md+2−2

This diff is too big to show here.

test/command/biblatex-averroes-bland.md+5−5

This diff is too big to show here.

test/command/biblatex-averroes-hannes.md+7−7

This diff is too big to show here.

test/command/biblatex-averroes-hercz.md+5−5

This diff is too big to show here.

test/command/biblatex-baez-article.md+10−10

This diff is too big to show here.

test/command/biblatex-baez-online.md+7−7

This diff is too big to show here.

test/command/biblatex-basic.md+3−5

This diff is too big to show here.

test/command/biblatex-bertram.md+4−4

This diff is too big to show here.

test/command/biblatex-bibstring-resolution.md+3−3

This diff is too big to show here.

test/command/biblatex-book-averroes.md+13−14

This diff is too big to show here.

test/command/biblatex-book-coleridge.md+4−4

This diff is too big to show here.

test/command/biblatex-book-title-maintitle-series.md+4−4

This diff is too big to show here.

test/command/biblatex-book-vazques-de-parga.md+6−6

This diff is too big to show here.

test/command/biblatex-brandt.md+7−7

This diff is too big to show here.

test/command/biblatex-britannica.md+6−6

This diff is too big to show here.

test/command/biblatex-chiu.md+3−3

This diff is too big to show here.

test/command/biblatex-cicero.md+6−6

This diff is too big to show here.

test/command/biblatex-cms.md+9−9

This diff is too big to show here.

test/command/biblatex-coleridge.md+4−4

This diff is too big to show here.

test/command/biblatex-companion.md+6−6

This diff is too big to show here.

test/command/biblatex-cotton.md+5−5

This diff is too big to show here.

test/command/biblatex-crossref-inbook-mvbook.md+7−7

This diff is too big to show here.

test/command/biblatex-crossref-nested.md+16−16

This diff is too big to show here.

test/command/biblatex-ctan.md+11−11

This diff is too big to show here.

test/command/biblatex-dates.md+44−44

This diff is too big to show here.

test/command/biblatex-doody.md+8−8

This diff is too big to show here.

test/command/biblatex-edtf-date.md+37−36

This diff is too big to show here.

test/command/biblatex-escapedquotes.md+5−5

This diff is too big to show here.

test/command/biblatex-examples.bibnew file+1674

This diff is too big to show here.

test/command/biblatex-formatting.md+4−4

This diff is too big to show here.

test/command/biblatex-gaonkar-in.md+4−4

This diff is too big to show here.

test/command/biblatex-gaonkar.md+3−3

This diff is too big to show here.

test/command/biblatex-geer.md+5−5

This diff is too big to show here.

test/command/biblatex-gerhardt.md+4−4

This diff is too big to show here.

test/command/biblatex-gillies.md+6−5

This diff is too big to show here.

test/command/biblatex-glashow.md+3−3

This diff is too big to show here.

test/command/biblatex-gonzalez.md+6−6

This diff is too big to show here.

test/command/biblatex-hammond.md+2−2

This diff is too big to show here.

test/command/biblatex-herrmann.md+5−5

This diff is too big to show here.

test/command/biblatex-hyman.md+8−8

This diff is too big to show here.

test/command/biblatex-iliad.md+5−5

This diff is too big to show here.

test/command/biblatex-inbook-title-booktitle-maintitle-series-2.md+5−5

This diff is too big to show here.

test/command/biblatex-inbook-title-booktitle-maintitle-series.md+5−5

This diff is too big to show here.

test/command/biblatex-inbook.md+25−25

This diff is too big to show here.

test/command/biblatex-incollection-2.md+18−18

This diff is too big to show here.

test/command/biblatex-incollection.md+19−19

This diff is too big to show here.

test/command/biblatex-inproceedings.md+16−16

This diff is too big to show here.

test/command/biblatex-issue288.md+6−6

This diff is too big to show here.

test/command/biblatex-itzhaki.md+8−7

This diff is too big to show here.

test/command/biblatex-jaffe.md+3−3

This diff is too big to show here.

test/command/biblatex-jcg.md+3−3

This diff is too big to show here.

test/command/biblatex-kant-kpv.md+6−6

This diff is too big to show here.

test/command/biblatex-kant-ku.md+6−6

This diff is too big to show here.

test/command/biblatex-kastenholz.md+11−11

This diff is too big to show here.

test/command/biblatex-knuth-ct-a.md+12−12

This diff is too big to show here.

test/command/biblatex-knuth-ct-b.md+9−9

This diff is too big to show here.

test/command/biblatex-knuth-ct-c.md+8−8

This diff is too big to show here.

test/command/biblatex-knuth-ct-d.md+9−9

This diff is too big to show here.

test/command/biblatex-knuth-ct-e.md+8−8

This diff is too big to show here.

test/command/biblatex-knuth-ct-related.md+8−8

This diff is too big to show here.

test/command/biblatex-knuth-ct.md+8−8

This diff is too big to show here.

test/command/biblatex-kowalik.md+9−9

This diff is too big to show here.

test/command/biblatex-kullback-related.md+3−3

This diff is too big to show here.

test/command/biblatex-kullback-reprint.md+4−4

This diff is too big to show here.

test/command/biblatex-kullback.md+3−3

This diff is too big to show here.

test/command/biblatex-laufenberg.md+9−9

This diff is too big to show here.

test/command/biblatex-loh.md+5−5

This diff is too big to show here.

test/command/biblatex-malinowski.md+4−4

This diff is too big to show here.

test/command/biblatex-manual.md+9−9

This diff is too big to show here.

test/command/biblatex-markey.md+8−8

This diff is too big to show here.

test/command/biblatex-maron.md+4−4

This diff is too big to show here.

test/command/biblatex-massa.md+2−2

This diff is too big to show here.

test/command/biblatex-moore-related.md+7−7

This diff is too big to show here.

test/command/biblatex-moore.md+4−4

This diff is too big to show here.

test/command/biblatex-moraux.md+9−9

This diff is too big to show here.

test/command/biblatex-murray.md+9−10

This diff is too big to show here.

test/command/biblatex-nietzsche-historie.md+15−15

This diff is too big to show here.

test/command/biblatex-nietzsche-ksa.md+7−7

This diff is too big to show here.

test/command/biblatex-nietzsche-ksa1.md+9−9

This diff is too big to show here.

test/command/biblatex-nussbaum.mdnew file+63

This diff is too big to show here.

test/command/biblatex-online.md+18−18

This diff is too big to show here.

test/command/biblatex-options-url-false-doi-false.md+5−5

This diff is too big to show here.

test/command/biblatex-padhye.md+6−6

This diff is too big to show here.

test/command/biblatex-patent.md+27−27

This diff is too big to show here.

test/command/biblatex-periodical.md+4−5

This diff is too big to show here.

test/command/biblatex-piccato.md+3−3

This diff is too big to show here.

test/command/biblatex-pines.md+6−6

This diff is too big to show here.

test/command/biblatex-quotes.md+3−3

This diff is too big to show here.

test/command/biblatex-reese.md+7−7

This diff is too big to show here.

test/command/biblatex-report.md+8−8

This diff is too big to show here.

test/command/biblatex-salam.md+8−8

This diff is too big to show here.

test/command/biblatex-sarfraz.md+6−6

This diff is too big to show here.

test/command/biblatex-shore.md+9−9

This diff is too big to show here.

test/command/biblatex-sigfridsson.md+9−9

This diff is too big to show here.

test/command/biblatex-sorace.md+7−7

This diff is too big to show here.

test/command/biblatex-spiegelberg.md+6−6

This diff is too big to show here.

test/command/biblatex-springer.md+4−4

This diff is too big to show here.

test/command/biblatex-strings.md+6−6

This diff is too big to show here.

test/command/biblatex-test-case-conversion.md+5−5

This diff is too big to show here.

test/command/biblatex-textnormal.md+2−2

This diff is too big to show here.

test/command/biblatex-thesis.md+10−10

This diff is too big to show here.

test/command/biblatex-title-and-shorttitle.md+11−11

This diff is too big to show here.

test/command/biblatex-vangennep-related.md+3−3

This diff is too big to show here.

test/command/biblatex-vangennep-trans.md+5−5

This diff is too big to show here.

test/command/biblatex-vangennep.md+2−2

This diff is too big to show here.

test/command/biblatex-vazques-de-parga-mvbook.md+6−6

This diff is too big to show here.

test/command/biblatex-vazques-de-parga.md+6−6

This diff is too big to show here.

test/command/biblatex-video.md+1−1

This diff is too big to show here.

test/command/biblatex-vizedom-related.md+3−3

This diff is too big to show here.

test/command/biblatex-wassenberg.md+10−10

This diff is too big to show here.

test/command/biblatex-weinberg.md+3−3

This diff is too big to show here.

test/command/biblatex-westfahl-frontier.md+5−5

This diff is too big to show here.

test/command/biblatex-westfahl-space.md+15−15

This diff is too big to show here.

test/command/biblatex-wilde.md+4−4

This diff is too big to show here.

test/command/biblatex-worman.md+3−3

This diff is too big to show here.

test/command/biblatex-yoon.md+5−5

This diff is too big to show here.

test/command/bibtex-basic.md+3−3

This diff is too big to show here.

test/command/chap1/spider.pngdeleted

Binary file not shown.

test/command/chap1/text.mddeleted−17

This diff is too big to show here.

test/command/chap2/spider.pngdeleted

Binary file not shown.

test/command/chap2/text.mddeleted−5

This diff is too big to show here.

test/command/chicago-fullnote-bibliography.csl+108−356

This diff is too big to show here.

test/command/citeproc-17.mddeleted−17

This diff is too big to show here.

test/command/citeproc-20.mddeleted−25

This diff is too big to show here.

test/command/citeproc-7a.md+1−1

This diff is too big to show here.

test/command/citeproc-author-in-text-suffix.mddeleted−6

This diff is too big to show here.

test/command/custom-attributes.htmlnew file+16

This diff is too big to show here.

test/command/defaults-inheritance-1.mddeleted−6

This diff is too big to show here.

test/command/defaults-inheritance-2.mddeleted−5

This diff is too big to show here.

test/command/defaults-inheritance-3.mddeleted−6

This diff is too big to show here.

test/command/defaults3.yamldeleted−4

This diff is too big to show here.

test/command/defaults4.yamldeleted−3

This diff is too big to show here.

test/command/defaults5.yamldeleted−2

This diff is too big to show here.

test/command/defaults6.yamldeleted−2

This diff is too big to show here.

test/command/defaults7.yamldeleted−2

This diff is too big to show here.

test/command/defaults8.yamldeleted−2

This diff is too big to show here.

test/command/defaults9.yamldeleted−1

This diff is too big to show here.

test/command/docbook-bibliography.mddeleted−20

This diff is too big to show here.

test/command/duplicate_attributes.mddeleted−7

This diff is too big to show here.

test/command/empty-inline-code.txtnew file+6

This diff is too big to show here.

test/command/latex-center.mddeleted−13

This diff is too big to show here.

test/command/mmd-metadata.mddeleted−20

This diff is too big to show here.

test/command/nested-table-to-asciidoc-6942.mddeleted−82

This diff is too big to show here.

test/command/newif.mddeleted−55

This diff is too big to show here.

test/command/pandoc-citeproc-119.md+3−2

This diff is too big to show here.

test/command/pandoc-citeproc-14.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-152.md+4−2

This diff is too big to show here.

test/command/pandoc-citeproc-160.md+4−2

This diff is too big to show here.

test/command/pandoc-citeproc-175.md+4−2

This diff is too big to show here.

test/command/pandoc-citeproc-213.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-25.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-27.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-320a.md+3−3

This diff is too big to show here.

test/command/pandoc-citeproc-322.md+1−1

This diff is too big to show here.

test/command/pandoc-citeproc-356.md+7−2

This diff is too big to show here.

test/command/pandoc-citeproc-360.md+4−4

This diff is too big to show here.

test/command/pandoc-citeproc-371.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-416.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-47.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-53.md+2−4

This diff is too big to show here.

test/command/pandoc-citeproc-57.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-58.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-61.md+4−2

This diff is too big to show here.

test/command/pandoc-citeproc-65.md+1−1

This diff is too big to show here.

test/command/pandoc-citeproc-68.md+2−2

This diff is too big to show here.

test/command/pandoc-citeproc-70.md+2−2

This diff is too big to show here.

test/command/pandoc-citeproc-77.md+4−4

This diff is too big to show here.

test/command/pandoc-citeproc-82.md+4−3

This diff is too big to show here.

test/command/pandoc-citeproc-87.md+2−1

This diff is too big to show here.

test/command/pandoc-citeproc-chicago-author-date.md+13−11

This diff is too big to show here.

test/command/pandoc-citeproc-chicago-fullnote-bibliography.md+30−26

This diff is too big to show here.

test/command/pandoc-citeproc-ieee.md+4−2

This diff is too big to show here.

test/command/pandoc-citeproc-locators-integrated.md+2−2

This diff is too big to show here.

test/command/pandoc-citeproc-move-period-inside-quote.md+3−2

This diff is too big to show here.

test/command/pandoc-citeproc-page-range.md+3−3

This diff is too big to show here.

test/command/svg.md+15−17

This diff is too big to show here.

test/command/toc.md+20−11

This diff is too big to show here.

test/command/unicode-collation.mddeleted−130

This diff is too big to show here.

test/command/yaml-metadata-blocks.md+3−3

This diff is too big to show here.

test/docbook-reader.docbook+2−9

This diff is too big to show here.

test/docx/0_level_headers.native+2−2

This diff is too big to show here.

test/docx/golden/block_quotes.docx

Binary file not shown.

test/docx/golden/codeblock.docx

Binary file not shown.

test/docx/golden/comments.docx

Binary file not shown.

test/docx/golden/custom_style_no_reference.docx

Binary file not shown.

test/docx/golden/custom_style_preserve.docx

Binary file not shown.

test/docx/golden/custom_style_reference.docx

Binary file not shown.

test/docx/golden/definition_list.docx

Binary file not shown.

test/docx/golden/document-properties-short-desc.docx

Binary file not shown.

test/docx/golden/document-properties.docx

Binary file not shown.

test/docx/golden/headers.docx

Binary file not shown.

test/docx/golden/image.docx

Binary file not shown.

test/docx/golden/inline_code.docx

Binary file not shown.

test/docx/golden/inline_formatting.docx

Binary file not shown.

test/docx/golden/inline_images.docx

Binary file not shown.

test/docx/golden/link_in_notes.docx

Binary file not shown.

test/docx/golden/links.docx

Binary file not shown.

test/docx/golden/lists.docx

Binary file not shown.

test/docx/golden/lists_continuing.docx

Binary file not shown.

test/docx/golden/lists_multiple_initial.docxdeleted

Binary file not shown.

test/docx/golden/lists_restarting.docx

Binary file not shown.

test/docx/golden/nested_anchors_in_header.docx

Binary file not shown.

test/docx/golden/notes.docx

Binary file not shown.

test/docx/golden/raw-blocks.docxdeleted

Binary file not shown.

test/docx/golden/raw-bookmarks.docxdeleted

Binary file not shown.

test/docx/golden/table_one_row.docx

Binary file not shown.

test/docx/golden/table_with_list_cell.docx

Binary file not shown.

test/docx/golden/tables-default-widths.docxdeleted

Binary file not shown.

test/docx/golden/tables.docx

Binary file not shown.

test/docx/golden/track_changes_deletion.docx

Binary file not shown.

test/docx/golden/track_changes_insertion.docx

Binary file not shown.

test/docx/golden/track_changes_move.docx

Binary file not shown.

test/docx/golden/track_changes_scrubbed_metadata.docxdeleted

Binary file not shown.

test/docx/golden/unicode.docx

Binary file not shown.

test/docx/golden/verbatim_subsuper.docx

Binary file not shown.

test/docx/image_vml_as_object.docxdeleted

Binary file not shown.

test/docx/image_vml_as_object.nativedeleted−2

This diff is too big to show here.

test/docx/lists_multiple_initial.nativedeleted−8

This diff is too big to show here.

test/docx/raw-blocks.nativedeleted−6

This diff is too big to show here.

test/docx/raw-bookmarks.nativedeleted−3

This diff is too big to show here.

test/docx/sdt_elements.native+10−9

This diff is too big to show here.

test/docx/table_captions_no_field.docxdeleted

Binary file not shown.

test/docx/table_captions_no_field.nativedeleted−34

This diff is too big to show here.

test/docx/table_captions_with_field.docxdeleted

Binary file not shown.

test/docx/table_captions_with_field.nativedeleted−54

This diff is too big to show here.

test/docx/table_header_rowspan.docxdeleted

Binary file not shown.

test/docx/table_header_rowspan.nativedeleted−189

This diff is too big to show here.

test/docx/table_one_header_row.docxdeleted

Binary file not shown.

test/docx/table_one_header_row.nativedeleted−18

This diff is too big to show here.

test/docx/table_one_row.docx

Binary file not shown.

test/docx/table_one_row.native+4−4

This diff is too big to show here.

test/docx/table_variable_width.native+17−12

This diff is too big to show here.

test/docx/table_with_list_cell.native+3−3

This diff is too big to show here.

test/docx/tables-default-widths.nativedeleted−92

This diff is too big to show here.

test/docx/tables.native+9−9

This diff is too big to show here.

test/docx/track_changes_scrubbed_metadata.docxdeleted

Binary file not shown.

test/docx/track_changes_scrubbed_metadata.nativedeleted−9

This diff is too big to show here.

test/epub/features.epub

Binary file not shown.

test/epub/features.native+3−3

This diff is too big to show here.

test/epub/wasteland.epub

Binary file not shown.

test/epub/wasteland.native+4−4

This diff is too big to show here.

test/fb2/images.fb2+1−1

This diff is too big to show here.

test/fb2/test.jpg

Binary file not shown.

test/grofftest.shnew file+26

This diff is too big to show here.

test/html-reader.html−76

This diff is too big to show here.

test/html-reader.native+37−148

This diff is too big to show here.

test/jats-reader.native+1−1

This diff is too big to show here.

test/jats-reader.xml−1

This diff is too big to show here.

test/jira-reader.native+1−1

This diff is too big to show here.

test/latex-reader.native+13−26

This diff is too big to show here.

test/lhs-test.html+19−45

This diff is too big to show here.

test/lhs-test.html+lhs+19−45

This diff is too big to show here.

test/lhs-test.latex+4−4

This diff is too big to show here.

test/lhs-test.latex+lhs+4−4

This diff is too big to show here.

test/lua/module/pandoc-path.luadeleted−44

This diff is too big to show here.

test/markdown-reader-more.native+34−6

This diff is too big to show here.

test/odt/native/tab.nativedeleted−1

This diff is too big to show here.

test/odt/odt/tab.odtdeleted

Binary file not shown.

test/org-select-tags.org+2−2

This diff is too big to show here.

test/pipe-tables.native+10−2

This diff is too big to show here.

test/pptx/code-custom.pptx

Binary file not shown.

test/pptx/code-custom_templated.pptx

Binary file not shown.

test/pptx/code.pptx

Binary file not shown.

test/pptx/code_templated.pptx

Binary file not shown.

test/pptx/document-properties-short-desc.pptx

Binary file not shown.

test/pptx/document-properties-short-desc_templated.pptx

Binary file not shown.

test/pptx/document-properties.pptx

Binary file not shown.

test/pptx/document-properties_templated.pptx

Binary file not shown.

test/pptx/endnotes.pptx

Binary file not shown.

test/pptx/endnotes_templated.pptx

Binary file not shown.

test/pptx/endnotes_toc.pptx

Binary file not shown.

test/pptx/endnotes_toc_templated.pptx

Binary file not shown.

test/pptx/images.pptx

Binary file not shown.

test/pptx/images_templated.pptx

Binary file not shown.

test/pptx/inline_formatting.pptx

Binary file not shown.

test/pptx/inline_formatting_templated.pptx

Binary file not shown.

test/pptx/lists.pptx

Binary file not shown.

test/pptx/lists_templated.pptx

Binary file not shown.

test/pptx/raw_ooxml.native+1−1

This diff is too big to show here.

test/pptx/raw_ooxml.pptx

Binary file not shown.

test/pptx/raw_ooxml_templated.pptx

Binary file not shown.

test/pptx/reference_depth.pptx

Binary file not shown.

test/pptx/remove_empty_slides.pptx

Binary file not shown.

test/pptx/remove_empty_slides_templated.pptx

Binary file not shown.

test/pptx/slide_breaks.pptx

Binary file not shown.

test/pptx/slide_breaks_slide_level_1.pptx

Binary file not shown.

test/pptx/slide_breaks_slide_level_1_templated.pptx

Binary file not shown.

test/pptx/slide_breaks_templated.pptx

Binary file not shown.

test/pptx/slide_breaks_toc.pptx

Binary file not shown.

test/pptx/slide_breaks_toc_templated.pptx

Binary file not shown.

test/pptx/speaker_notes.pptx

Binary file not shown.

test/pptx/speaker_notes_after_metadata.pptx

Binary file not shown.

test/pptx/speaker_notes_after_metadata_templated.pptx

Binary file not shown.

test/pptx/speaker_notes_afterheader.pptx

Binary file not shown.

test/pptx/speaker_notes_afterheader_templated.pptx

Binary file not shown.

test/pptx/speaker_notes_afterseps.pptx

Binary file not shown.

test/pptx/speaker_notes_afterseps_templated.pptx

Binary file not shown.

test/pptx/speaker_notes_templated.pptx

Binary file not shown.

test/pptx/start_numbering_at.pptx

Binary file not shown.

test/pptx/start_numbering_at_templated.pptx

Binary file not shown.

test/pptx/tables.pptx

Binary file not shown.

test/pptx/tables_templated.pptx

Binary file not shown.

test/pptx/two_column.pptx

Binary file not shown.

test/pptx/two_column_templated.pptx

Binary file not shown.

test/rst-reader.native+21−3

This diff is too big to show here.

test/s5-fancy.html+1−1

This diff is too big to show here.

test/tables-rstsubset.native+9−1

This diff is too big to show here.

test/tables.jats_archiving+156−156

This diff is too big to show here.

test/tables.jats_articleauthoring+156−156

This diff is too big to show here.

test/tables.jats_publishing+156−156

This diff is too big to show here.

test/tables.latex+101−65

This diff is too big to show here.

test/tables.ms−44

This diff is too big to show here.

test/tables.org+3−3

This diff is too big to show here.

test/tables/nordics.html4+6−6

This diff is too big to show here.

test/tables/nordics.html5+6−6

This diff is too big to show here.

test/tables/nordics.jats_archivingdeleted−58

This diff is too big to show here.

test/tables/nordics.latexdeleted−42

This diff is too big to show here.

test/tables/nordics.native+33−60

This diff is too big to show here.

test/tables/planets.html4+1−1

This diff is too big to show here.

test/tables/planets.html5+1−1

This diff is too big to show here.

test/tables/planets.jats_archivingdeleted−128

This diff is too big to show here.

test/tables/planets.latexdeleted−30

This diff is too big to show here.

test/tables/planets.native+112−215

This diff is too big to show here.

test/tables/students.jats_archivingdeleted−56

This diff is too big to show here.

test/tables/students.latexdeleted−31

This diff is too big to show here.

test/tables/students.native+32−49

This diff is too big to show here.

test/test-pandoc.hs+8−18

This diff is too big to show here.

test/textile-reader.native+1−1

This diff is too big to show here.

test/textile-reader.textile+1−1

This diff is too big to show here.

test/txt2tags.native+1−1

This diff is too big to show here.

test/txt2tags.t2t+1−1

This diff is too big to show here.

test/writer.context+43−45

This diff is too big to show here.

test/writer.custom+2−2

This diff is too big to show here.

test/writer.dokuwiki−11

This diff is too big to show here.

test/writer.html4+19−44

This diff is too big to show here.

test/writer.html5+19−44

This diff is too big to show here.

test/writer.icml−2

This diff is too big to show here.

test/writer.jats_archiving+8−12

This diff is too big to show here.

test/writer.jats_articleauthoring+1−1

This diff is too big to show here.

test/writer.jats_publishing+8−12

This diff is too big to show here.

test/writer.jira+35−23

This diff is too big to show here.

test/writer.latex+4−4

This diff is too big to show here.

test/writer.markdown+55−28

This diff is too big to show here.

test/writer.ms+1−1

This diff is too big to show here.

test/writer.opml+1−1

This diff is too big to show here.

test/writer.org+91−91

This diff is too big to show here.

test/writer.zimwiki+3−3

This diff is too big to show here.

test/writers-lang-and-dir.context+5−7

This diff is too big to show here.

test/writers-lang-and-dir.latex+8−11

This diff is too big to show here.

tools/build-arm.shdeleted−110

This diff is too big to show here.

tools/changelog-helper.sh+4−11

This diff is too big to show here.

tools/parseTimings.pldeleted−33

This diff is too big to show here.

trypandoc/index.html+1−1

This diff is too big to show here.

trypandoc/trypandoc.hs+8−3

This diff is too big to show here.

windows/Makefile+1−1

This diff is too big to show here.

windows/pandoc.wxs+2−2

This diff is too big to show here.