packages feed

pandoc 2.11.3.2 → 2.11.4

raw patch · 255 files changed

+2076/−1018 lines, 255 filesdep ~citeprocdep ~commonmarkPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: citeproc, commonmark

API changes (from Hackage documentation)

+ Text.Pandoc.Citeproc: getReferences :: PandocMonad m => Maybe Locale -> Pandoc -> m [Reference Inlines]
+ Text.Pandoc.Citeproc: getStyle :: PandocMonad m => Pandoc -> m (Style Inlines)
+ Text.Pandoc.Extensions: Ext_element_citations :: Extension
+ Text.Pandoc.Writers: writeBibLaTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text
+ Text.Pandoc.Writers: writeBibTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text
+ Text.Pandoc.Writers.BibTeX: writeBibLaTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text
+ Text.Pandoc.Writers.BibTeX: writeBibTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text

Files

CONTRIBUTING.md view
@@ -291,6 +291,9 @@     git diff --diff-filter=MA --cached --name-only | grep '\.hs$' | \       xargs hlint --hint .hlint.yaml +(If you are using GNU `xargs`, add the `-r` option immediately+after `xargs`.)+ Saving this to `.git/hooks/pre-commit`, and making the script executable, will prevent accidental introduction of potentially problematic code.
@@ -1,5 +1,5 @@ Pandoc-Copyright (C) 2006-2020 John MacFarlane <jgm at berkeley dot edu>+Copyright (C) 2006-2021 John MacFarlane <jgm at berkeley dot edu>  With the exceptions noted below, this code is released under the [GPL], version 2 or later:@@ -37,7 +37,7 @@ Text.Pandoc.Builder, Text.Pandoc.Generics, Text.Pandoc.JSON, Text.Pandoc.Walk) are licensed under the BSD 3-clause license: -Copyright (c) 2006-2020, John MacFarlane+Copyright (c) 2006-2021, John MacFarlane  All rights reserved. @@ -73,7 +73,7 @@ GPL (v2 or higher, same as pandoc) or (at your option) the BSD 3-clause license. -Copyright (c) 2014--2020, John MacFarlane+Copyright (c) 2014--2021, John MacFarlane  ---------------------------------------------------------------------- src/Text/Pandoc/Writers/Muse.hs@@ -83,19 +83,19 @@  ---------------------------------------------------------------------- src/Text/Pandoc/Writers/Texinfo.hs-Copyright (C) 2008-2020 John MacFarlane and Peter Wang+Copyright (C) 2008-2021 John MacFarlane and Peter Wang  Released under the GNU General Public License version 2 or later.  ---------------------------------------------------------------------- src/Text/Pandoc/Writers/OpenDocument.hs-Copyright (C) 2008-2020 Andrea Rossato and John MacFarlane+Copyright (C) 2008-2021 Andrea Rossato and John MacFarlane  Released under the GNU General Public License version 2 or later.  ---------------------------------------------------------------------- src/Text/Pandoc/Writers/Org.hs-Copyright (C) 2010-2020 Puneeth Chaganti, John MacFarlane, and+Copyright (C) 2010-2021 Puneeth Chaganti, John MacFarlane, and                         Albert Krewinkel  Released under the GNU General Public License version 2 or later.@@ -115,7 +115,7 @@  ---------------------------------------------------------------------- src/Text/Pandoc/Readers/Textile.hs-Copyright (C) 2010-2020 Paul Rivier and John MacFarlane+Copyright (C) 2010-2021 Paul Rivier and John MacFarlane  Released under the GNU General Public License version 2 or later. @@ -133,7 +133,7 @@  ---------------------------------------------------------------------- src/Text/Pandoc/Readers/EPUB.hs-Copyright (C) 2014-2020 Matthew Pickering and John MacFarlane+Copyright (C) 2014-2021 Matthew Pickering and John MacFarlane  Released under the GNU General Public License version 2 or later. @@ -141,7 +141,7 @@ src/Text/Pandoc/Readers/Org.hs src/Text/Pandoc/Readers/Org/* test/Tests/Readers/Org/*-Copyright (C) 2014-2020 Albert Krewinkel+Copyright (C) 2014-2021 Albert Krewinkel  Released under the GNU General Public License version 2 or later. @@ -149,7 +149,7 @@ src/Text/Pandoc/Lua.hs src/Text/Pandoc/Lua/* test/lua/*-Copyright (C) 2017--2020 Albert Krewinkel and John MacFarlane+Copyright (C) 2017--2021 Albert Krewinkel and John MacFarlane  Released under the GNU General Public License version 2 or later. @@ -157,7 +157,7 @@ src/Text/Pandoc/Readers/Jira.hs src/Text/Pandoc/Writers/Jira.hs test/Tests/Readers/Jira.hs-Copyright (C) 2019--2020 Albert Krewinkel+Copyright (C) 2019--2021 Albert Krewinkel  Released under the GNU General Public License version 2 or later. @@ -169,7 +169,7 @@  ---------------------------------------------------------------------- data/pandoc.lua-Copyright (C) 2017-2020 Albert Krewinkel+Copyright (C) 2017-2021 Albert Krewinkel  Released under the GNU General Public License version 2 or later. @@ -181,9 +181,9 @@ Released under the Do What the Fuck You Want To Public License.  -------------------------------------------------------------------------Pandoc embeds a lua interpreter (via hslua).+Pandoc embeds a Lua interpreter (via hslua). -Copyright © 1994–2019 Lua.org, PUC-Rio.+Copyright © 1994–2020 Lua.org, PUC-Rio.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the@@ -203,12 +203,3 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.---------------------------------------------------------------------------The template pandoc.jats is Copyright 2013--2015 Martin Fenner,-released under GPL version 2 or later.--The file data/jats.csl is derived from a csl file by Martin Fenner,-revised by Martin Paul Eve and then John MacFarlane.-"This work is licensed under a Creative Commons Attribution-ShareAlike 3.0-License. Originally by Martin Fenner."
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: December 29, 2020+date: January 21, 2021 ---  # Synopsis@@ -281,6 +281,8 @@     ::: {#output-formats}     - `asciidoc` ([AsciiDoc]) or `asciidoctor` ([AsciiDoctor])     - `beamer` ([LaTeX beamer][`beamer`] slide show)+    - `bibtex` ([BibTeX] bibliography)+    - `biblatex` ([BibLaTeX] bibliography)     - `commonmark` ([CommonMark] Markdown)     - `commonmark_x` ([CommonMark] Markdown with extensions)     - `context` ([ConTeXt])@@ -588,8 +590,8 @@       3. `$PATH` (executable only) -    Filters and Lua-filters are applied in the order specified-    on the command line.+    Filters, Lua-filters, and citeproc processing are applied in+    the order specified on the command line.  `-L` *SCRIPT*, `--lua-filter=`*SCRIPT* @@ -603,27 +605,18 @@     The `pandoc` Lua module provides helper functions for element     creation.  It is always loaded into the script's Lua environment. -    The following is an example Lua script for macro-expansion:--        function expand_hello_world(inline)-          if inline.c == '{{helloworld}}' then-            return pandoc.Emph{ pandoc.Str "Hello, World" }-          else-            return inline-          end-        end--        return {{Str = expand_hello_world}}+    See the [Lua filters documentation] for further details.      In order of preference, pandoc will look for Lua filters in -     1. a specified full or relative path (executable or-     non-executable)+     1. a specified full or relative path -     2. `$DATADIR/filters` (executable or non-executable)-     where `$DATADIR` is the user data directory (see-     `--data-dir`, above).+     2. `$DATADIR/filters` where `$DATADIR` is the user data+     directory (see `--data-dir`, above). +    Filters, Lua filters, and citeproc processing are applied in+    the order specified on the command line.+ `-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]  :   Set the metadata field *KEY* to the value *VAL*.  A value specified@@ -707,6 +700,7 @@ [PHP]: https://github.com/vinai/pandocfilters-php [perl]: https://metacpan.org/pod/Pandoc::Filter [JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node+[Lua filters documentation]: https://pandoc.org/lua-filters.html  ## General writer options {.options} @@ -1507,6 +1501,16 @@ - content.md # or you may use input-file: with a single value +# Include options from the specified defaults files.+# The files will be searched for first in the working directory+# and then in the defaults subdirectory of the user data directory.+# The files are included in the same order in which they appear in+# the list. Options specified in this defaults file always have+# priority over the included ones.+defaults:+- defsA+- defsB+ template: letter standalone: true self-contained: false@@ -3091,6 +3095,13 @@ Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted in `org` input. +#### Extension: `element_citations` ####++In the `jats` output formats, this causes reference items to+be replaced with `<element-citation>` elements. These+elements are not influenced by CSL styles, but all information+on the item is included in tags.+ #### Extension: `ntb` ####  In the `context` output format this enables the use of [Natural Tables@@ -5256,11 +5267,11 @@     pandoc chem.bib -s -f biblatex -t markdown     pandoc chem.json -s -f csljson -t markdown -`pandoc` can also be used to produce CSL JSON bibliography-from BibTeX, BibLaTeX, or markdown YAML:+Indeed, `pandoc` can convert between any of these+citation formats:      pandoc chem.bib -s -f biblatex -t csljson-    pandoc chem.yaml -s -f markdown -t csljson+    pandoc chem.yaml -s -f markdown -t biblatex  Running pandoc on a bibliography file with the `--citeproc` option will create a formatted bibliography in the format@@ -5359,6 +5370,34 @@       }     } ++## Citations in note styles++Pandoc's citation processing is designed to allow you to+move between author-date, numerical, and note styles without+modifying the markdown source.  When you're using a note+style, avoid inserting footnotes manually. Instead, insert+citations just as you would in an author-date style---for+example,++    Blah blah [@foo, p. 33].++The footnote will be created automatically. Pandoc will take+care of removing the space and moving the note before or+after the period, depending on the setting of+`notes-after-punctuation`, as described below in [Other relevant+metadata fields].++In some cases you may need to put a citation inside a regular+footnote.  Normal citations in footnotes (such as `[@foo, p.+33]`) will be rendered in parentheses.  In-text citations (such+as `@foo [p. 33]`) will be rendered without parentheses. (A+comma will be added if appropriate.)  Thus:++    [^1]:  Some studies [@foo; @bar, p. 33] show that+    frubulicious zoosnaps are quantical.  For a survey+    of the literature, see @baz [chap. 1].+ ## Raw content in a style  To include raw content in a prefix, suffix, delimiter, or term,@@ -6291,7 +6330,7 @@  # Authors -Copyright 2006--2020 John MacFarlane (jgm@berkeley.edu). Released+Copyright 2006--2021 John MacFarlane (jgm@berkeley.edu). Released under the [GPL], version 2 or greater.  This software carries no warranty of any kind.  (See COPYRIGHT for full copyright and warranty notices.) For a full list of contributors, see the file
README.md view
@@ -95,6 +95,8 @@ -   `asciidoc` ([AsciiDoc](https://www.methods.co.nz/asciidoc/)) or     `asciidoctor` ([AsciiDoctor](https://asciidoctor.org/)) -   `beamer` ([LaTeX beamer](https://ctan.org/pkg/beamer) slide show)+-   `bibtex` ([BibTeX](https://ctan.org/pkg/bibtex) bibliography)+-   `biblatex` ([BibLaTeX](https://ctan.org/pkg/biblatex) bibliography) -   `commonmark` ([CommonMark](https://commonmark.org) Markdown) -   `commonmark_x` ([CommonMark](https://commonmark.org) Markdown with     extensions)@@ -236,7 +238,7 @@  ## License -© 2006-2020 John MacFarlane (jgm@berkeley.edu). Released under the+© 2006-2021 John MacFarlane (jgm@berkeley.edu). Released under the [GPL](http://www.gnu.org/copyleft/gpl.html "GNU General Public License"), version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.)
app/pandoc.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {- |    Module      : Main-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
benchmark/benchmark-pandoc.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {--Copyright (C) 2012-2019 John MacFarlane <jgm@berkeley.edu>+Copyright (C) 2012-2021 John MacFarlane <jgm@berkeley.edu>  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
benchmark/weigh-pandoc.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Main-   Copyright   : © 2016-2019 John MacFarlane <jgm@berkeley.edu>+   Copyright   : © 2016-2021 John MacFarlane <jgm@berkeley.edu>    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
cabal.project view
@@ -6,3 +6,7 @@   flags: +embed_data_files -trypandoc   ghc-options: -j +RTS -A64m -RTS +-- source-repository-package+--  type: git+--  location: https://github.com/jgm/citeproc+--  tag: d44e24696ab444090d0e63e321c3a573f68b2e74
changelog.md view
@@ -1,5 +1,154 @@ # Revision history for pandoc +## pandoc 2.11.4 (2021-01-22)++  * Add `biblatex`, `bibtex` as output formats (closes #7040).++  * Recognize more extensions as markdown by default (#7034):+    `mkdn`, `mkd`, `mdwn`, `mdown`, `Rmd`.++  * Implement defaults file inheritance (#6924, David Martschenko).+    Allow defaults files to inherit options from other defaults files by+    specifying them with the following syntax:+    `defaults: [list of defaults files or single defaults file]`.++  * Fix infinite HTTP requests when writing epubs from URL source (#7013).+    Due to a bug in code added to avoid overwriting the cover image+    if it had the form `fileX.YYY`, pandoc made an endless sequence+    of HTTP requests when writing epub with input from a URL.++  * Org reader:++    + Allow multiple pipe chars in todo sequences (Albert Krewinkel, #7014).+      Additional pipe chars, used to separate "action" state from "no further+      action" states, are ignored. E.g., for the following sequence, both+      `DONE` and `FINISHED` are states with no further action required:+      `#+TODO: UNFINISHED | DONE | FINISHED`.+    + Restructure output of captioned code blocks (Albert Krewinkel, #6977).+      The Div wrapper of code blocks with captions now has the class+      "captioned-content". The caption itself is added as a Plain block+      inside a Div of class "caption". This makes it easier to write filters+      which match on captioned code blocks. Existing filters will need to be+      updated.+    + Mark verbatim code with class `verbatim` (Dimitri Sabadie, #6998).++  * LaTeX reader:++    + Handle `filecontents` environment (#7003).+    + Put contents of unknown environments in a Div when `raw_tex` is not+      enabled (#6997). (When `raw_tex` is enabled, the whole environment is+      parsed as a raw block.) The class name is the name of the environment.+      Previously, we just included the contents without the surrounding Div,+      but having a record of the environment's boundaries and name can be+      useful.++  * Mediawiki reader:++    + Allow space around storng/emph delimiters (#6993).++  * New module Text.Pandoc.Writers.BibTeX, exporting+    writeBibTeX and writeBibLaTeX. [API change]++  * LaTeX writer:++    + Revert table line height increase in 2.11.3 (#6996).+      In 2.11.3 we started adding `\addlinespace`, which produced less dense+      tables.  This wasn't an intentional change; I misunderstood a comment in+      the discussion leading up to the change. This commit restores the earlier+      default table appearance.  Note that if you want a less dense table, you+      can use something like `\def\arraystretch{1.5}` in your header.++  * EPUB writer:++    + Adjust internal links to identifiers defined in raw HTML sections+      after splitting into chapters (#7000).+    + Recognize `Format "html4"`, `Format "html5"` as raw HTML.+    + Adjust internal links to images, links, and tables after splitting into+      chapters. Previously we only did this for Div and Span and Header+      elements (see #7000).++  * Ms writer:++    + Don't justify text inside table cells.++  * JATS writer:++    + Use `<element-citation>` if `element_citations`+      extension is enabled (Albert Krewinkel).+    + Fix citations (Albert Krewinkel, #7018).  By default+      we use formatted citations.+    + Ensure that `<disp-quote>` is always wrapped in `<p>` (#7041).++  * Markdown writer:++    + Cleaned up raw formats.  We now react appropriately+      to `gfm`, `commonmark`, and `commonmark_x` as raw formats.++  * RST writer:++    + Fix bug with dropped content from inside spans with a class in+      some cases (#7039).++  * Docx writer:++    + Handle table header using styles (#7008).  Instead of hard-coding+      the border and header cell vertical alignment, we now let this+      be determined by the Table style, making use of Word's+      "conditional formatting" for the table's first row.  For+      headerless tables, we use the tblLook element to tell Word+      not to apply conditional first-row formatting.++  * Commonmark writer:++    + Implement start number on ordered lists (#7009).  Previously they always+      started at 1, but according to the spec the start number is respected.++  * HTML writer:++    + Fix implicit_figure at end of footnotes (#7006).++  * ConTeXt template: Remove `\setupthinrules` from default template.+    The width parameter this used is not actually supported,+    and the command didn't do anything.++  * Text.Pandoc.Extensions:++    + Add `Ext_element_citations` constructor (Albert Krewinkel).++  * Text.Pandoc.Citeproc.BibTeX: New unexported function+    `writeBibtexString`.++  * Text.Pandoc.Citeproc:++    + Use finer grained imports (Albert Krewinkel).+    + Factor out and export `getStyle` [API change].+    + Export `getReferences` [API change, #7106].+    + Factor out getLang.++  * Text.Pandoc.Parsing: modify `gridTableWith'` for headerless tables.+    If the table lacks a header, the header row should be an empty+    list. Previously we got a list of empty cells, which caused+    an empty header to be emitted instead of no header.  In LaTeX/PDF+    output that meant we got a double top line with space between.++  * ImageSize:  use `viewBox` for SVG if no length, width attributes (#7045).+    This change allows pandoc to extract size information from more SVGs.++  * Add simple default.nix.++  * Use commonmark 0.1.1.3.++  * Use citeproc 0.3.0.5.++  * Update default CSL to use latest chicago-author-date.csl.++  * CONTRIBUTING.md: add note on GNU xargs.++  * MANUAL.txt:++    + Update description of `-L`/`--lua-filter`.+    + Document use of citations in note styles (#6828).+ ## pandoc 2.11.3.2 (2020-12-29)    * HTML reader: use renderTags' from Text.Pandoc.Shared (Albert Krewinkel).
data/default.csl view
@@ -27,6 +27,9 @@       <email>matthew.g.roth@yale.edu</email>       <uri> https://orcid.org/0000-0001-7902-6331</uri>     </contributor>+    <contributor>+      <name>Brenton M. Wiernik</name>+    </contributor>     <category citation-format="author-date"/>     <category field="generic-base"/>     <summary>The author-date variant of the Chicago style</summary>@@ -509,8 +512,15 @@     </choose>   </macro>   <macro name="event">-    <group>-      <text term="presented at" suffix=" "/>+    <group delimiter=" ">+      <choose>+        <if variable="genre">+          <text term="presented at"/>+        </if>+        <else>+          <text term="presented at" text-case="capitalize-first"/>+        </else>+      </choose>       <text variable="event"/>     </group>   </macro>
data/docx/word/styles.xml view
@@ -350,6 +350,21 @@         <w:right w:w="108" w:type="dxa" />       </w:tblCellMar>     </w:tblPr>+    <w:tblStylePr w:type="firstRow">+      <w:tblPr>+        <w:jc w:val="left"/>+        <w:tblInd w:w="0" w:type="dxa"/>+      </w:tblPr>+      <w:trPr>+        <w:jc w:val="left"/>+      </w:trPr>+      <w:tcPr>+        <w:vAlign w:val="bottom"/>+        <w:tcBorders>+          <w:bottom w:val="single"/>+        </w:tcBorders>+      </w:tcPr>+    </w:tblStylePr>   </w:style>   <w:style w:type="paragraph" w:customStyle="1" w:styleId="DefinitionTerm">     <w:name w:val="Definition Term" />
− data/jats.csl
@@ -1,203 +0,0 @@-<?xml version="1.0" encoding="utf-8"?>-<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" default-locale="en-US">-  <info>-    <title>Journal Article Tag Suite</title>-    <title-short>JATS</title-short>-    <id>http://www.zotero.org/styles/journal-article-tag-suite</id>-    <link href="https://github.com/MartinPaulEve/JATS-CSL/blob/master/jats.csl" rel="self"/>-    <link rel="documentation" href="http://jats.nlm.nih.gov/archiving/tag-library/1.0/index.html"/>-    <author>-      <name>Martin Paul Eve</name>-      <email>martin@martineve.com</email>-    </author>-    <category citation-format="numeric"/>-    <category field="medicine"/>-    <category field="biology"/>-    <summary>Use this style to generate bibliographic data in Journal Article Tagging Suite (JATS) 1.0 XML format</summary>-    <updated>2014-06-21T17:41:26+00:00</updated>-    <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>-  </info>-  <locale xml:lang="en">-    <terms>-        <term name="et-al">{{jats}}&lt;etal/&gt;{{/jats}}</term>-    </terms>-  </locale>-  <macro name="citation-number">-    <text variable="citation-number" prefix="{{jats}}id=&quot;ref-{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}"/>-  </macro>-  <macro name="author">-    <names variable="author" delimiter=" ">-        <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator=" ">-            <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>-            <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;/given-names&gt;{{/jats}}"/>-      </name>-      <substitute>-        <names variable="editor"/>-      </substitute>-    </names>-  </macro>--  <macro name="editor" delimiter=" ">-    <names variable="editor" prefix="{{jats}}&lt;person-group person-group-type=&quot;editor&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/person-group&gt;{{/jats}}">-      <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator=" ">-        <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>-        <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;/given-names&gt;{{/jats}}"/>-      </name>-      <substitute>-        <names variable="editor"/>-      </substitute>-    </names>-  </macro>--  <macro name="editor">-    <group delimiter=": ">-      <names variable="editor">-        <name prefix="{{jats}}&lt;name&gt;{{/jats}}" suffix="{{jats}}&lt;/name&gt;{{/jats}}" name-as-sort-order="all" sort-separator="">-          <name-part name="family" text-case="capitalize-first" prefix="{{jats}}&lt;surname&gt;{{/jats}}" suffix="{{jats}}&lt;/surname&gt;{{/jats}}"/>-          <name-part name="given" text-case="capitalize-first" prefix="{{jats}}&lt;given-names&gt;{{/jats}}" suffix="{{jats}}&lt;given-names&gt;{{/jats}}"/>-        </name>-      </names>-    </group>-  </macro>-  <macro name="title">-    <choose>-      <if type="book" match="any">-        <group prefix="{{jats}}&lt;source&gt;{{/jats}}" suffix="{{jats}}&lt;/source&gt;{{/jats}}">-	        <text variable="title"/>-				</group>-			</if>-      <else>-        <group prefix="{{jats}}&lt;article-title&gt;{{/jats}}" suffix="{{jats}}&lt;/article-title&gt;{{/jats}}">-	        <text variable="title"/>-				</group>-      </else>-    </choose>-  </macro>-  <macro name="container-title">-    <text variable="container-title" form="short" prefix="{{jats}}&lt;source&gt;{{/jats}}" suffix="{{jats}}&lt;/source&gt;{{/jats}}"/>-  </macro>-  <macro name="publisher">-    <text variable="publisher" prefix="{{jats}}&lt;publisher-name&gt;{{/jats}}" suffix="{{jats}}&lt;/publisher-name&gt;{{/jats}}"/>-    <text variable="publisher-place" prefix="{{jats}}&lt;publisher-loc&gt;{{/jats}}" suffix="{{jats}}&lt;/publisher-loc&gt;{{/jats}}"/>-  </macro>-  <macro name="link">-    <choose>-      <if match="any" variable="DOI">-        <group prefix="{{jats}}&lt;pub-id pub-id-type=&quot;doi&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/pub-id&gt;{{/jats}}">-          <text variable="DOI"/>-        </group>-      </if>-    </choose>-    <choose>-      <if match="any" variable="PMID">-        <group prefix="{{jats}}&lt;pub-id pub-id-type=&quot;pmid&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/pub-id&gt;{{/jats}}">-          <text variable="PMID"/>-        </group>-      </if>-    </choose>-    <choose>-      <if variable="URL" match="any">-        <text variable="URL" />-      </if>-    </choose>-  </macro>-  <macro name="date">-    <choose>-      <if type="article-journal article-magazine article-newspaper report patent book" match="any">-        <group prefix="{{jats}}&lt;date&gt;{{/jats}}" suffix="{{jats}}&lt;/date&gt;{{/jats}}">-          <date variable="issued">-            <date-part name="day" form="numeric-leading-zeros" prefix="{{jats}}&lt;day&gt;{{/jats}}" suffix="{{jats}}&lt;/day&gt;{{/jats}}"/>-            <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}&lt;month&gt;{{/jats}}" suffix="{{jats}}&lt;/month&gt;{{/jats}}"/>-            <date-part name="year" prefix="{{jats}}&lt;year&gt;{{/jats}}" suffix="{{jats}}&lt;/year&gt;{{/jats}}"/>-          </date>-        </group>-      </if>-      <else>-        <group prefix="{{jats}}&lt;date-in-citation content-type=&quot;access-date&quot;{{/jats}}" suffix="{{jats}}&lt;/date-in-citation&gt;{{/jats}}">-          <date variable="accessed" prefix="{{jats}} iso-8601-date=&quot;{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}">-            <date-part name="year"/>-            <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}-{{/jats}}"/>-            <date-part name="day" form="numeric-leading-zeros" prefix="{{jats}}-{{/jats}}"/>-          </date>-          <date variable="accessed">-            <date-part name="day" prefix="{{jats}}&lt;day&gt;{{/jats}}" suffix="{{jats}}&lt;/day&gt;{{/jats}}"/>-            <date-part name="month" form="numeric-leading-zeros" prefix="{{jats}}&lt;month&gt;{{/jats}}" suffix="{{jats}}&lt;/month&gt;{{/jats}}"/>-            <date-part name="year" prefix="{{jats}}&lt;year&gt;{{/jats}}" suffix="{{jats}}&lt;/year&gt;{{/jats}}"/>-          </date>-        </group>-      </else>-    </choose>-  </macro>-  <macro name="location">-    <choose>-      <if type="article-journal article-magazine" match="any">-        <text variable="volume" prefix="{{jats}}&lt;volume&gt;{{/jats}}" suffix="{{jats}}&lt;/volume&gt;{{/jats}}"/>-        <text variable="issue" prefix="{{jats}}&lt;issue&gt;{{/jats}}" suffix="{{jats}}&lt;/issue&gt;{{/jats}}"/>-      </if>-    </choose>-    <choose>-      <if type="article-journal article-magazine article-newspaper chapter" match="any">-        <text variable="page-first" prefix="{{jats}}&lt;fpage&gt;{{/jats}}" suffix="{{jats}}&lt;/fpage&gt;{{/jats}}"/>-      </if>-    </choose>-  </macro>-  <macro name="publication-type">-    <group prefix="{{jats}} publication-type=&quot;{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}">-      <choose>-        <if type="article-journal article-magazine article-newspaper" match="any">-          <text value="journal"/>-        </if>-        <else-if type="book" match="any">-          <text value="book"/>-        </else-if>-        <else-if type="chapter" match="any">-          <text value="bookchapter"/>-        </else-if>-        <else-if type="dataset" match="any">-          <text value="dataset"/>-        </else-if>-        <else-if type="patent" match="any">-          <text value="patent"/>-        </else-if>-        <else-if type="report" match="any">-          <text value="report"/>-        </else-if>-        <else-if type="review" match="any">-          <text value="review"/>-        </else-if>-        <else>-          <text value="standard"/>-        </else>-      </choose>-    </group>-  </macro>-  <citation collapse="citation-number">-    <sort>-      <key variable="citation-number"/>-    </sort>-    <layout delimiter=",">-      <group prefix="{{jats}}&lt;xref ref-type=&quot;bibr&quot; rid=&quot;{{/jats}}" suffix="{{jats}}&lt;/xref&gt;{{/jats}}">-        <text variable="citation-number" prefix="{{jats}}ref-{{/jats}}" suffix="{{jats}}&quot;&gt;{{/jats}}"/>-        <text variable="citation-number"/>-      </group>-    </layout>-  </citation>-  <bibliography sort-separator="">-    <layout>-      <group prefix="{{jats}}&lt;ref {{/jats}}" suffix="{{jats}}&lt;/ref&gt;{{/jats}}">-        <text macro="citation-number"/>-        <group prefix="{{jats}}&lt;element-citation{{/jats}}" suffix="{{jats}}&lt;/element-citation&gt;{{/jats}}">-          <text macro="publication-type"/>-          <text macro="author" prefix="{{jats}}&lt;person-group person-group-type=&quot;author&quot;&gt;{{/jats}}" suffix="{{jats}}&lt;/person-group&gt;{{/jats}}"/>-          <text macro="title" />-          <text macro="container-title"/>-          <text macro="editor"/>-          <text macro="publisher"/>-          <text macro="date"/>-          <text macro="location"/>-          <text macro="link"/>-        </group>-      </group>-    </layout>-  </bibliography>-</style>
data/templates/default.context view
@@ -100,8 +100,6 @@ \setupfloat[figure][default={here,nonumber}] \setupfloat[table][default={here,nonumber}] -\setupthinrules[width=15em] % width of horizontal rules- \setupxtable[frame=off] \setupxtable[head][topframe=on,bottomframe=on] \setupxtable[body][]
man/pandoc.1 view
@@ -1,7 +1,7 @@ '\" t-.\" Automatically generated by Pandoc 2.11.3.1+.\" Automatically generated by Pandoc 2.11.4 .\"-.TH "Pandoc User\[cq]s Guide" "" "December 29, 2020" "pandoc 2.11.3.2" ""+.TH "Pandoc User\[cq]s Guide" "" "January 21, 2021" "pandoc 2.11.4" "" .hy .SH NAME pandoc - general markup converter@@ -320,6 +320,10 @@ .IP \[bu] 2 \f[C]beamer\f[R] (LaTeX beamer slide show) .IP \[bu] 2+\f[C]bibtex\f[R] (BibTeX bibliography)+.IP \[bu] 2+\f[C]biblatex\f[R] (BibLaTeX bibliography)+.IP \[bu] 2 \f[C]commonmark\f[R] (CommonMark Markdown) .IP \[bu] 2 \f[C]commonmark_x\f[R] (CommonMark Markdown with extensions)@@ -623,8 +627,8 @@ .IP "3." 3 \f[C]$PATH\f[R] (executable only) .PP-Filters and Lua-filters are applied in the order specified on the-command line.+Filters, Lua-filters, and citeproc processing are applied in the order+specified on the command line. .RE .TP \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]@@ -641,29 +645,17 @@ creation. It is always loaded into the script\[cq]s Lua environment. .PP-The following is an example Lua script for macro-expansion:-.IP-.nf-\f[C]-function expand_hello_world(inline)-  if inline.c == \[aq]{{helloworld}}\[aq] then-    return pandoc.Emph{ pandoc.Str \[dq]Hello, World\[dq] }-  else-    return inline-  end-end--return {{Str = expand_hello_world}}-\f[R]-.fi+See the Lua filters documentation for further details. .PP In order of preference, pandoc will look for Lua filters in .IP "1." 3-a specified full or relative path (executable or non-executable)+a specified full or relative path .IP "2." 3-\f[C]$DATADIR/filters\f[R] (executable or non-executable) where-\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],-above).+\f[C]$DATADIR/filters\f[R] where \f[C]$DATADIR\f[R] is the user data+directory (see \f[C]--data-dir\f[R], above).+.PP+Filters, Lua filters, and citeproc processing are applied in the order+specified on the command line. .RE .TP \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]]@@ -1714,6 +1706,16 @@ - content.md # or you may use input-file: with a single value +# Include options from the specified defaults files.+# The files will be searched for first in the working directory+# and then in the defaults subdirectory of the user data directory.+# The files are included in the same order in which they appear in+# the list. Options specified in this defaults file always have+# priority over the included ones.+defaults:+- defsA+- defsB+ template: letter standalone: true self-contained: false@@ -3437,6 +3439,12 @@ .PP Some aspects of Pandoc\[cq]s Markdown citation syntax are also accepted in \f[C]org\f[R] input.+.SS Extension: \f[C]element_citations\f[R]+.PP+In the \f[C]jats\f[R] output formats, this causes reference items to be+replaced with \f[C]<element-citation>\f[R] elements.+These elements are not influenced by CSL styles, but all information on+the item is included in tags. .SS Extension: \f[C]ntb\f[R] .PP In the \f[C]context\f[R] output format this enables the use of Natural@@ -6137,13 +6145,13 @@ \f[R] .fi .PP-\f[C]pandoc\f[R] can also be used to produce CSL JSON bibliography from-BibTeX, BibLaTeX, or markdown YAML:+Indeed, \f[C]pandoc\f[R] can convert between any of these citation+formats: .IP .nf \f[C] pandoc chem.bib -s -f biblatex -t csljson-pandoc chem.yaml -s -f markdown -t csljson+pandoc chem.yaml -s -f markdown -t biblatex \f[R] .fi .PP@@ -6272,6 +6280,41 @@ } \f[R] .fi+.SS Citations in note styles+.PP+Pandoc\[cq]s citation processing is designed to allow you to move+between author-date, numerical, and note styles without modifying the+markdown source.+When you\[cq]re using a note style, avoid inserting footnotes manually.+Instead, insert citations just as you would in an author-date+style\[em]for example,+.IP+.nf+\f[C]+Blah blah [\[at]foo, p. 33].+\f[R]+.fi+.PP+The footnote will be created automatically.+Pandoc will take care of removing the space and moving the note before+or after the period, depending on the setting of+\f[C]notes-after-punctuation\f[R], as described below in Other relevant+metadata fields.+.PP+In some cases you may need to put a citation inside a regular footnote.+Normal citations in footnotes (such as \f[C][\[at]foo, p. 33]\f[R]) will+be rendered in parentheses.+In-text citations (such as \f[C]\[at]foo [p. 33]\f[R]) will be rendered+without parentheses.+(A comma will be added if appropriate.) Thus:+.IP+.nf+\f[C]+[\[ha]1]:  Some studies [\[at]foo; \[at]bar, p. 33] show that+frubulicious zoosnaps are quantical.  For a survey+of the literature, see \[at]baz [chap. 1].+\f[R]+.fi .SS Raw content in a style .PP To include raw content in a prefix, suffix, delimiter, or term, surround@@ -7445,7 +7488,7 @@ sanitizer. .SH AUTHORS .PP-Copyright 2006\[en]2020 John MacFarlane (jgm\[at]berkeley.edu).+Copyright 2006\[en]2021 John MacFarlane (jgm\[at]berkeley.edu). Released under the GPL, version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.) For a full list
pandoc.cabal view
@@ -1,10 +1,10 @@ cabal-version:   2.2 name:            pandoc-version:         2.11.3.2+version:         2.11.4 build-type:      Simple license:         GPL-2.0-or-later license-file:    COPYING.md-copyright:       (c) 2006-2020 John MacFarlane+copyright:       (c) 2006-2021 John MacFarlane author:          John MacFarlane <jgm@berkeley.edu> maintainer:      John MacFarlane <jgm@berkeley.edu> bug-reports:     https://github.com/jgm/pandoc/issues@@ -180,8 +180,6 @@                  data/pandoc.List.lua                  -- bash completion template                  data/bash_completion.tpl-                 -- jats csl-                 data/jats.csl                  -- citeproc                  data/default.csl                  citeproc/biblatex-localization/*.lbx.strings@@ -216,6 +214,13 @@                  test/command/01.csv                  test/command/defaults1.yaml                  test/command/defaults2.yaml+                 test/command/defaults3.yaml+                 test/command/defaults4.yaml+                 test/command/defaults5.yaml+                 test/command/defaults6.yaml+                 test/command/defaults7.yaml+                 test/command/defaults8.yaml+                 test/command/defaults9.yaml                  test/command/3533-rst-csv-tables.csv                  test/command/3880.txt                  test/command/5182.txt@@ -405,8 +410,8 @@                  blaze-markup          >= 0.8      && < 0.9,                  bytestring            >= 0.9      && < 0.12,                  case-insensitive      >= 1.2      && < 1.3,-                 citeproc              >= 0.3.0.3  && < 0.4,-                 commonmark            >= 0.1.1.2  && < 0.2,+                 citeproc              >= 0.3.0.5  && < 0.4,+                 commonmark            >= 0.1.1.3  && < 0.2,                  commonmark-extensions >= 0.2.0.4  && < 0.3,                  commonmark-pandoc     >= 0.2      && < 0.3,                  connection            >= 0.3.1,@@ -568,6 +573,7 @@                    Text.Pandoc.Writers.Shared,                    Text.Pandoc.Writers.OOXML,                    Text.Pandoc.Writers.AnnotatedTable,+                   Text.Pandoc.Writers.BibTeX,                    Text.Pandoc.Lua,                    Text.Pandoc.PDF,                    Text.Pandoc.UTF8,@@ -633,6 +639,7 @@                    Text.Pandoc.Readers.Metadata,                    Text.Pandoc.Readers.Roff,                    Text.Pandoc.Writers.Docx.StyleMap,+                   Text.Pandoc.Writers.JATS.References,                    Text.Pandoc.Writers.JATS.Table,                    Text.Pandoc.Writers.JATS.Types,                    Text.Pandoc.Writers.LaTeX.Caption,
src/Text/Pandoc.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/App.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.App-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>@@ -50,10 +50,9 @@ import Text.Pandoc.App.CommandLineOptions (parseOptions, options) import Text.Pandoc.App.OutputSettings (OutputSettings (..), optToOutputSettings) import Text.Pandoc.BCP47 (Lang (..), parseBCP47)-import Text.Pandoc.Builder (setMeta) import Text.Pandoc.Filter (Filter (JSONFilter, LuaFilter), applyFilters) import Text.Pandoc.PDF (makePDF)-import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)+import Text.Pandoc.SelfContained (makeSelfContained) import Text.Pandoc.Shared (eastAsianLineBreakFilter, stripEmptyParagraphs,          headerShift, isURI, tabFilter, uriPathToPath, filterIpynbOutput,          defaultUserDataDirs, tshow, findM)@@ -190,17 +189,6 @@                     Nothing -> readDataFile "abbreviations"                     Just f  -> readFileStrict f -    metadata <- if format == "jats" &&-                   isNothing (lookupMeta "csl" (optMetadata opts)) &&-                   isNothing (lookupMeta "citation-style"-                                               (optMetadata opts))-                   then do-                     jatsCSL <- readDataFile "jats.csl"-                     let jatsEncoded = makeDataURI-                                         ("application/xml", jatsCSL)-                     return $ setMeta "csl" jatsEncoded $ optMetadata opts-                   else return $ optMetadata opts-     case lookupMetaString "lang" (optMetadata opts) of            ""      -> setTranslations $ Lang "en" "" "US" []            l       -> case parseBCP47 l of@@ -286,7 +274,7 @@                       then fillMediaBag                       else return)               >=> return . adjustMetadata (metadataFromFile <>)-              >=> return . adjustMetadata (<> metadata)+              >=> return . adjustMetadata (<> optMetadata opts)               >=> applyTransforms transforms               >=> applyFilters readerOpts filters [T.unpack format]               >=> maybe return extractMedia (optExtractMedia opts)
src/Text/Pandoc/App/CommandLineOptions.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE FlexibleContexts    #-} {- |    Module      : Text.Pandoc.App.CommandLineOptions-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>@@ -25,6 +25,7 @@ import Control.Monad import Control.Monad.Trans import Control.Monad.Except (throwError)+import Control.Monad.State.Strict import Data.Aeson.Encode.Pretty (encodePretty', Config(..), keyOrder,          defConfig, Indent(..), NumberFormat(..)) import Data.Bifunctor (second)@@ -46,10 +47,12 @@ import System.IO (stdout) import Text.DocTemplates (Context (..), ToContext (toVal), Val (..)) import Text.Pandoc-import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..), addMeta)+import Text.Pandoc.App.Opt (Opt (..), LineEnding (..), IpynbOutput (..),+                            DefaultsState (..), addMeta, applyDefaults,+                            fullDefaultsPath) import Text.Pandoc.Filter (Filter (..)) import Text.Pandoc.Highlighting (highlightingStyles)-import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDirs, findM)+import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDirs) import Text.Printf  #ifdef EMBED_DATA_FILES@@ -64,7 +67,6 @@ import qualified Data.ByteString.Lazy as B import qualified Data.Map as M import qualified Data.Text as T-import qualified Data.YAML as Y import qualified Text.Pandoc.UTF8 as UTF8  parseOptions :: [OptDescr (Opt -> IO Opt)] -> Opt -> IO Opt@@ -166,7 +168,11 @@      , Option "d" ["defaults"]                  (ReqArg-                  (\arg opt -> applyDefaults opt arg+                  (\arg opt -> runIOorExplode $ do+                     let defsState = DefaultsState { curDefaults = Nothing,+                                                     inheritanceGraph = [] }+                     fp <- fullDefaultsPath (optDataDir opt) arg+                     evalStateT (applyDefaults opt fp) defsState                   )                   "FILE")                 ""@@ -962,7 +968,7 @@  copyrightMessage :: String copyrightMessage = intercalate "\n" [- "Copyright (C) 2006-2020 John MacFarlane. Web:  https://pandoc.org",+ "Copyright (C) 2006-2021 John MacFarlane. Web:  https://pandoc.org",  "This is free software; see the source for copying conditions. There is no",  "warranty, not even for merchantability or fitness for a particular purpose." ] @@ -1011,28 +1017,6 @@  splitField :: String -> (String, String) splitField = second (tailDef "true") . break (`elemText` ":=")---- | Apply defaults from --defaults file.-applyDefaults :: Opt -> FilePath -> IO Opt-applyDefaults opt file = runIOorExplode $ do-  let fp = if null (takeExtension file)-              then addExtension file "yaml"-              else file-  setVerbosity $ optVerbosity opt-  dataDirs <- liftIO defaultUserDataDirs-  let fps = fp : case optDataDir opt of-              Nothing -> map (</> ("defaults" </> fp))-                               dataDirs-              Just dd -> [dd </> "defaults" </> fp]-  fp' <- fromMaybe fp <$> findM fileExists fps-  inp <- readFileLazy fp'-  case Y.decode1 inp of-      Right (f :: Opt -> Opt) -> return $ f opt-      Left (errpos, errmsg)  -> throwError $-         PandocParseError $ T.pack $-         "Error parsing " ++ fp' ++ " line " ++-          show (Y.posLine errpos) ++ " column " ++-          show (Y.posColumn errpos) ++ ":\n" ++ errmsg  lookupHighlightStyle :: PandocMonad m => String -> m Style lookupHighlightStyle s
src/Text/Pandoc/App/FormatHeuristics.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.App.FormatHeuristics-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>@@ -48,6 +48,11 @@     ".lhs"      -> Just "markdown+lhs"     ".ltx"      -> Just "latex"     ".markdown" -> Just "markdown"+    ".mkdn"     -> Just "markdown"+    ".mkd"      -> Just "markdown"+    ".mdwn"     -> Just "markdown"+    ".mdown"    -> Just "markdown"+    ".Rmd"      -> Just "markdown"     ".md"       -> Just "markdown"     ".ms"       -> Just "ms"     ".muse"     -> Just "muse"
src/Text/Pandoc/App/Opt.hs view
@@ -7,7 +7,7 @@ {-# LANGUAGE FlexibleContexts    #-} {- |    Module      : Text.Pandoc.App.Opt-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>@@ -20,10 +20,17 @@             Opt(..)           , LineEnding (..)           , IpynbOutput (..)+          , DefaultsState (..)           , defaultOpts           , addMeta+          , applyDefaults+          , fullDefaultsPath           ) where+import Control.Monad.Except (MonadIO, liftIO, throwError, (>=>), foldM)+import Control.Monad.State.Strict (StateT, modify, gets)+import System.FilePath ( addExtension, (</>), takeExtension ) import Data.Char (isLower, toLower)+import Data.Maybe (fromMaybe) import GHC.Generics hiding (Meta) import Text.Pandoc.Builder (setMeta) import Text.Pandoc.Filter (Filter (..))@@ -34,7 +41,9 @@                             ReferenceLocation (EndOfDocument),                             ObfuscationMethod (NoObfuscation),                             CiteMethod (Citeproc))-import Text.Pandoc.Shared (camelCaseStrToHyphenated)+import Text.Pandoc.Class (readFileLazy, fileExists, setVerbosity, PandocMonad)+import Text.Pandoc.Error (PandocError (PandocParseError, PandocSomeError))+import Text.Pandoc.Shared (camelCaseStrToHyphenated, defaultUserDataDirs, findM, ordNub) import qualified Text.Pandoc.Parsing as P import Text.Pandoc.Readers.Metadata (yamlMap) import Text.Pandoc.Class.PandocPure@@ -150,16 +159,77 @@     } deriving (Generic, Show)  instance FromYAML (Opt -> Opt) where-  parseYAML (Mapping _ _ m) =-    foldr (.) id <$> mapM doOpt (M.toList m)+  parseYAML (Mapping _ _ m) = chain doOpt (M.toList m)   parseYAML n = failAtNode n "Expected a mapping" +data DefaultsState = DefaultsState+    {+      curDefaults      :: Maybe FilePath -- currently parsed file+    , inheritanceGraph :: [[FilePath]]   -- defaults file inheritance graph+    } deriving (Show)++instance (PandocMonad m, MonadIO m)+      => FromYAML (Opt -> StateT DefaultsState m Opt) where+  parseYAML (Mapping _ _ m) = do+    let opts = M.mapKeys toText m+    dataDir <- case M.lookup "data-dir" opts of+      Nothing -> return Nothing+      Just v -> Just . unpack <$> parseYAML v+    f <- parseOptions $ M.toList m+    case M.lookup "defaults" opts of+      Just v -> do+        g <- parseDefaults v dataDir+        return  $ g >=> f+      Nothing -> return f+    where+      toText (Scalar _ (SStr s)) = s+      toText _ = ""+  parseYAML n = failAtNode n "Expected a mapping"++parseDefaults :: (PandocMonad m, MonadIO m)+              => Node Pos+              -> Maybe FilePath+              -> Parser (Opt -> StateT DefaultsState m Opt)+parseDefaults n dataDir = parseDefsNames n >>= \ds -> return $ \o -> do+  -- get parent defaults:+  defsParent <- gets $ fromMaybe "" . curDefaults+  -- get child defaults:+  defsChildren <- mapM (fullDefaultsPath dataDir) ds+  -- expand parent in defaults inheritance graph by children:+  defsGraph <- gets inheritanceGraph+  let defsGraphExp = expand defsGraph defsChildren defsParent+  modify $ \defsState -> defsState{ inheritanceGraph = defsGraphExp }+  -- check for cyclic inheritance:+  if cyclic defsGraphExp+    then throwError $+      PandocSomeError $ T.pack $+        "Error: Circular defaults file reference in " +++        "'" ++ defsParent ++ "'"+    else foldM applyDefaults o defsChildren+  where parseDefsNames x = (parseYAML x >>= \xs -> return $ map unpack xs)+                       <|> (parseYAML x >>= \x' -> return [unpack x'])++parseOptions :: Monad m+             => [(Node Pos, Node Pos)]+             -> Parser (Opt -> StateT DefaultsState m Opt)+parseOptions ns = do+  f <- chain doOpt' ns+  return $ return . f++chain :: Monad m => (a -> m (b -> b)) -> [a] -> m (b -> b)+chain f = foldM g id+  where g o n = f n >>= \o' -> return $ o' . o++doOpt' :: (Node Pos, Node Pos) -> Parser (Opt -> Opt)+doOpt' (k',v) = do+  k <- parseStringKey k'+  case k of+    "defaults" -> return id+    _ -> doOpt (k',v)+ doOpt :: (Node Pos, Node Pos) -> Parser (Opt -> Opt) doOpt (k',v) = do-  k <- case k' of-         Scalar _ (SStr t) -> return t-         Scalar _ _ -> failAtNode k' "Non-string key"-         _ -> failAtNode k' "Non-scalar key"+  k <- parseStringKey k'   case k of     "tab-stop" ->       parseYAML v >>= \x -> return (\o -> o{ optTabStop = x })@@ -494,6 +564,12 @@     , optStripComments         = False     } +parseStringKey ::  Node Pos -> Parser Text+parseStringKey k = case k of+  Scalar _ (SStr t) -> return t+  Scalar _ _ -> failAtNode k "Non-string key"+  _ -> failAtNode k "Non-scalar key"+ yamlToMeta :: Node Pos -> Parser Meta yamlToMeta (Mapping _ _ m) =     either (fail . show) return $ runEverything (yamlMap pMetaString m)@@ -524,6 +600,52 @@   | s == "FALSE" = MetaBool False   | otherwise    = MetaString $ T.pack s +-- | Apply defaults from --defaults file.+applyDefaults :: (PandocMonad m, MonadIO m)+              => Opt+              -> FilePath+              -> StateT DefaultsState m Opt+applyDefaults opt file = do+  setVerbosity $ optVerbosity opt+  modify $ \defsState -> defsState{ curDefaults = Just file }+  inp <- readFileLazy file+  case decode1 inp of+      Right f -> f opt+      Left (errpos, errmsg)  -> throwError $+         PandocParseError $ T.pack $+         "Error parsing " ++ file ++ " line " +++          show (posLine errpos) ++ " column " +++          show (posColumn errpos) ++ ":\n" ++ errmsg++fullDefaultsPath :: (PandocMonad m, MonadIO m)+                 => Maybe FilePath+                 -> FilePath+                 -> m FilePath+fullDefaultsPath dataDir file = do+  let fp = if null (takeExtension file)+              then addExtension file "yaml"+              else file+  dataDirs <- liftIO defaultUserDataDirs+  let fps = fp : case dataDir of+                   Nothing -> map (</> ("defaults" </> fp))+                                    dataDirs+                   Just dd -> [dd </> "defaults" </> fp]+  fromMaybe fp <$> findM fileExists fps++-- | In a list of lists, append another list in front of every list which+-- starts with specific element.+expand :: Ord a => [[a]] -> [a] -> a -> [[a]]+expand [] ns n = fmap (\x -> x : [n]) ns+expand ps ns n = concatMap (ext n ns) ps+  where+    ext x xs p = case p of+      (l : _) | x == l -> fmap (: p) xs+      _ -> [p]++cyclic :: Ord a => [[a]] -> Bool+cyclic = any hasDuplicate+  where+    hasDuplicate xs = length (ordNub xs) /= length xs  -- see https://github.com/jgm/pandoc/pull/4083 -- using generic deriving caused long compilation times
src/Text/Pandoc/App/OutputSettings.hs view
@@ -5,7 +5,7 @@ {-# LANGUAGE TupleSections       #-} {- |    Module      : Text.Pandoc.App-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Asciify.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Asciify-   Copyright   : Copyright (C) 2013-2020 John MacFarlane+   Copyright   : Copyright (C) 2013-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/BCP47.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.BCP47-   Copyright   : Copyright (C) 2017–2020 John MacFarlane+   Copyright   : Copyright (C) 2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/CSS.hs view
@@ -1,6 +1,6 @@ {- | Module      : Text.Pandoc.CSS-Copyright   : © 2006-2020 John MacFarlane <jgm@berkeley.edu>,+Copyright   : © 2006-2021 John MacFarlane <jgm@berkeley.edu>,                 2015-2016 Mauro Bieg,                 2015      Ophir Lifshitz <hangfromthefloor@gmail.com> License     : GNU GPL, version 2 or above
src/Text/Pandoc/CSV.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.CSV-   Copyright   : Copyright (C) 2017–2020 John MacFarlane <jgm@berkeley.edu>+   Copyright   : Copyright (C) 2017-2021 John MacFarlane <jgm@berkeley.edu>    License     : GNU GPL, version 2 or above    Maintainer  : John MacFarlane <jgm@berkeley.edu>    Stability   : alpha
src/Text/Pandoc/Citeproc.hs view
@@ -5,7 +5,10 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} module Text.Pandoc.Citeproc-  ( processCitations )+  ( processCitations,+    getReferences,+    getStyle+  ) where  import Citeproc@@ -15,39 +18,110 @@ import Text.Pandoc.Citeproc.BibTeX (readBibtexString, Variant(..)) import Text.Pandoc.Citeproc.MetaValue (metaValueToReference, metaValueToText) import Text.Pandoc.Readers.Markdown (yamlToRefs)-import Text.Pandoc.Class (setResourcePath, getResourcePath, getUserDataDir) import qualified Text.Pandoc.BCP47 as BCP47-import Data.ByteString (ByteString)-import qualified Data.ByteString.Lazy as L+import Text.Pandoc.Builder (Inlines, Many(..), deleteMeta, setMeta)+import qualified Text.Pandoc.Builder as B import Text.Pandoc.Definition as Pandoc-import Text.Pandoc.Walk-import Text.Pandoc.Builder as B-import Text.Pandoc (PandocMonad(..), PandocError(..),-                    readDataFile, ReaderOptions(..), pandocExtensions,-                    report, LogMessage(..), fetchItem)+import Text.Pandoc.Class (PandocMonad(..), getResourcePath, getUserDataDir,+                          fetchItem, readDataFile, report, setResourcePath)+import Text.Pandoc.Error (PandocError(..))+import Text.Pandoc.Extensions (pandocExtensions)+import Text.Pandoc.Logging (LogMessage(..))+import Text.Pandoc.Options (ReaderOptions(..)) import Text.Pandoc.Shared (stringify, ordNub, blocksToInlines, tshow) import qualified Text.Pandoc.UTF8 as UTF8+import Text.Pandoc.Walk (query, walk, walkM)+import Control.Applicative ((<|>))+import Control.Monad.Except (catchError, throwError)+import Control.Monad.State (State, evalState, get, put, runState) import Data.Aeson (eitherDecode)-import Data.Default-import Data.Ord ()+import Data.ByteString (ByteString)+import qualified Data.ByteString.Lazy as L+import Data.Char (isPunctuation, isUpper)+import Data.Default (Default(def))+import qualified Data.Foldable as Foldable import qualified Data.Map as M+import Data.Maybe (mapMaybe, fromMaybe)+import Data.Ord ()+import qualified Data.Sequence as Seq import qualified Data.Set as Set-import Data.Char (isPunctuation, isUpper) import Data.Text (Text) import qualified Data.Text as T-import Control.Monad.State-import qualified Data.Sequence as Seq-import qualified Data.Foldable as Foldable-import System.FilePath-import Control.Applicative-import Control.Monad.Except-import Data.Maybe (mapMaybe, fromMaybe)+import System.FilePath (takeExtension) import Safe (lastMay, initSafe) -- import Debug.Trace as Trace (trace, traceShowId)  -processCitations :: PandocMonad m => Pandoc -> m Pandoc+processCitations  :: PandocMonad m => Pandoc -> m Pandoc processCitations (Pandoc meta bs) = do+  style <- getStyle (Pandoc meta bs)++  mblang <- getLang meta+  let locale = Citeproc.mergeLocales mblang style++  refs <- getReferences (Just locale) (Pandoc meta bs)++  let otherIdsMap = foldr (\ref m ->+                             case T.words . extractText <$>+                                  M.lookup "other-ids"+                                      (referenceVariables ref) of+                                Nothing  -> m+                                Just ids -> foldr+                                  (\id' ->+                                    M.insert id' (referenceId ref)) m ids)+                          M.empty refs+  let meta' = deleteMeta "nocite" meta+  let citations = getCitations locale otherIdsMap $ Pandoc meta' bs+++  let linkCites = maybe False truish $ lookupMeta "link-citations" meta+  let opts = defaultCiteprocOptions{ linkCitations = linkCites }+  let result = Citeproc.citeproc opts style (localeLanguage locale)+                  refs citations+  mapM_ (report . CiteprocWarning) (resultWarnings result)+  let sopts = styleOptions style+  let classes = "references" : -- TODO remove this or keep for compatibility?+                "csl-bib-body" :+                ["hanging-indent" | styleHangingIndent sopts]+  let refkvs = (case styleEntrySpacing sopts of+                   Just es | es > 0 -> (("entry-spacing",T.pack $ show es):)+                   _ -> id) .+               (case styleLineSpacing sopts of+                   Just ls | ls > 1 -> (("line-spacing",T.pack $ show ls):)+                   _ -> id) $ []+  let bibs = mconcat $ map (\(ident, out) ->+                     B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para .+                       walk (convertQuotes locale) .  insertSpace $ out)+                      (resultBibliography result)+  let moveNotes = maybe True truish $+                        lookupMeta "notes-after-punctuation" meta+  let cits = map (walk fixLinks . walk (convertQuotes locale)) $+               resultCitations result++  let fixQuotes = case localePunctuationInQuote locale of+                    Just True ->+                      B.toList . movePunctuationInsideQuotes .  B.fromList+                    _ -> id++  let metanocites = lookupMeta "nocite" meta+  let Pandoc meta'' bs' =+         maybe id (setMeta "nocite") metanocites .+         walk (map capitalizeNoteCitation .+                fixQuotes .  mvPunct moveNotes locale) .+         walk deNote .+         evalState (walkM insertResolvedCitations $ Pandoc meta' bs)+         $ cits+  return $ Pandoc meta''+         $ insertRefs refkvs classes meta''+            (walk fixLinks $ B.toList bibs) bs'++-- | Retrieve the CSL style specified by the csl or citation-style+-- metadata field in a pandoc document, or the default CSL style+-- if none is specified.  Retrieve the parent style+-- if the style is a dependent style.  Add abbreviations defined+-- in an abbreviation file if one has been specified.+getStyle :: PandocMonad m => Pandoc -> m (Style Inlines)+getStyle (Pandoc meta _) = do   let cslfile = (lookupMeta "csl" meta <|> lookupMeta "citation-style" meta)                 >>= metaValueToText @@ -88,18 +162,35 @@           catchError (getFile ".csl" basename) (\_ -> fst <$> fetchItem url)    styleRes <- Citeproc.parseStyle getParentStyle cslContents-  style <--    case styleRes of-       Left err    -> throwError $ PandocAppError $ prettyCiteprocError err-       Right style -> return style{ styleAbbreviations = mbAbbrevs }-  mblang <- maybe (return Nothing) bcp47LangToIETF-               ((lookupMeta "lang" meta <|> lookupMeta "locale" meta) >>=-                 metaValueToText)-  let locale = Citeproc.mergeLocales mblang style+  case styleRes of+     Left err    -> throwError $ PandocAppError $ prettyCiteprocError err+     Right style -> return style{ styleAbbreviations = mbAbbrevs }+++-- Retrieve citeproc lang based on metadata.+getLang :: PandocMonad m => Meta -> m (Maybe Lang)+getLang meta = maybe (return Nothing) bcp47LangToIETF+                 ((lookupMeta "lang" meta <|> lookupMeta "locale" meta) >>=+                   metaValueToText)++-- | Get references defined inline in the metadata and via an external+-- bibliography.  Only references that are actually cited in the document+-- (either with a genuine citation or with `nocite`) are returned.+-- URL variables are converted to links.+getReferences :: PandocMonad m+              => Maybe Locale -> Pandoc -> m [Reference Inlines]+getReferences mblocale (Pandoc meta bs) = do+  locale <- case mblocale of+                Just l  -> return l+                Nothing -> do+                  mblang <- getLang meta+                  case mblang of+                    Just lang -> return $ either mempty id $ getLocale lang+                    Nothing   -> return mempty+   let getCiteId (Cite cs _) = Set.fromList $ map B.citationId cs       getCiteId _ = mempty   let metanocites = lookupMeta "nocite" meta-  let meta' = deleteMeta "nocite" meta   let nocites = maybe mempty (query getCiteId) metanocites   let citeIds = query getCiteId (Pandoc meta bs)   let idpred = if "*" `Set.member` nocites@@ -118,59 +209,11 @@                         Just fp -> getRefsFromBib locale idpred fp                         Nothing -> return []                     Nothing -> return []-  let refs = map (linkifyVariables . legacyDateRanges)-                 (externalRefs ++ inlineRefs)-                 -- note that inlineRefs can override externalRefs-  let otherIdsMap = foldr (\ref m ->-                             case T.words . extractText <$>-                                  M.lookup "other-ids"-                                      (referenceVariables ref) of-                                Nothing  -> m-                                Just ids -> foldr-                                  (\id' ->-                                    M.insert id' (referenceId ref)) m ids)-                          M.empty refs-  -- TODO: issue warning if no refs defined-  let citations = getCitations locale otherIdsMap $ Pandoc meta' bs-  let linkCites = maybe False truish $ lookupMeta "link-citations" meta-  let opts = defaultCiteprocOptions{ linkCitations = linkCites }-  let result = Citeproc.citeproc opts style (localeLanguage locale)-                  refs citations-  mapM_ (report . CiteprocWarning) (resultWarnings result)-  let sopts = styleOptions style-  let classes = "references" : -- TODO remove this or keep for compatibility?-                "csl-bib-body" :-                ["hanging-indent" | styleHangingIndent sopts]-  let refkvs = (case styleEntrySpacing sopts of-                   Just es | es > 0 -> (("entry-spacing",T.pack $ show es):)-                   _ -> id) .-               (case styleLineSpacing sopts of-                   Just ls | ls > 1 -> (("line-spacing",T.pack $ show ls):)-                   _ -> id) $ []-  let bibs = mconcat $ map (\(ident, out) ->-                     B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para .-                       walk (convertQuotes locale) .  insertSpace $ out)-                      (resultBibliography result)-  let moveNotes = maybe True truish $-                        lookupMeta "notes-after-punctuation" meta-  let cits = map (walk fixLinks . walk (convertQuotes locale)) $-               resultCitations result+  return $ map (linkifyVariables . legacyDateRanges)+               (externalRefs ++ inlineRefs)+            -- note that inlineRefs can override externalRefs -  let fixQuotes = case localePunctuationInQuote locale of-                    Just True ->-                      B.toList . movePunctuationInsideQuotes .  B.fromList-                    _ -> id -  let Pandoc meta'' bs' =-         maybe id (setMeta "nocite") metanocites .-         walk (map capitalizeNoteCitation .-                fixQuotes .  mvPunct moveNotes locale) .-         walk deNote .-         evalState (walkM insertResolvedCitations $ Pandoc meta' bs)-         $ cits-  return $ Pandoc meta''-         $ insertRefs refkvs classes meta''-            (walk fixLinks $ B.toList bibs) bs'  -- If we have a span.csl-left-margin followed by span.csl-right-inline, -- we insert a space. This ensures that they will be separated by a space,
src/Text/Pandoc/Citeproc/BibTeX.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ViewPatterns      #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-}@@ -17,6 +18,7 @@ module Text.Pandoc.Citeproc.BibTeX     ( Variant(..)     , readBibtexString+    , writeBibtexString     )     where @@ -24,10 +26,11 @@ import Text.Pandoc.Builder as B import Text.Pandoc.Readers.LaTeX (readLaTeX) import Text.Pandoc.Extensions (Extension(..), extensionsFromList)-import Text.Pandoc.Options (ReaderOptions(..))-import Text.Pandoc.Class (runPure)+import Text.Pandoc.Options (ReaderOptions(..), WriterOptions) import Text.Pandoc.Error (PandocError) import Text.Pandoc.Shared (stringify)+import Text.Pandoc.Writers.LaTeX (writeLaTeX)+import Text.Pandoc.Class (runPure) import qualified Text.Pandoc.Walk       as Walk import Citeproc.Types import Citeproc.Pandoc ()@@ -46,8 +49,9 @@ import           Data.Char              (isAlphaNum, isDigit, isLetter,                                          isUpper, toLower, toUpper,                                          isLower, isPunctuation)-import           Data.List              (foldl', intercalate)+import           Data.List              (foldl', intercalate, intersperse) import           Safe                   (readMay)+import           Text.Printf            (printf)  data Variant = Bibtex | Biblatex   deriving (Show, Eq, Ord)@@ -67,6 +71,250 @@            "" contents of           Left err -> Left err           Right xs -> return xs++-- | Write BibTeX or BibLaTeX given given a 'Reference'.+writeBibtexString :: WriterOptions       -- ^ options (for writing LaTex)+                  -> Variant             -- ^ bibtex or biblatex+                  -> Maybe Lang          -- ^ Language+                  -> Reference Inlines   -- ^ Reference to write+                  -> Text+writeBibtexString opts variant mblang ref =+  "@" <> bibtexType <> "{" <> unItemId (referenceId ref) <> ",\n  " <>+  renderFields fs <> "\n}\n"++ where+  bibtexType =+    case referenceType ref of+      "article-magazine"  -> "article"+      "article-newspaper" -> "article"+      "article-journal"   -> "article"+      "book"              -> "book"+      "pamphlet"          -> "booklet"+      "dataset" | variant == Biblatex -> "dataset"+      "webpage" | variant == Biblatex -> "online"+      "chapter"           -> case getVariable "editor" of+                                Just _  -> "incollection"+                                Nothing -> "inbook"+      "entry-encyclopedia" | variant == Biblatex -> "inreference"+                           | otherwise -> "inbook"+      "paper-conference"  -> "inproceedings"+      "thesis" -> case getVariableAsText "genre" of+                    Just "mathesis" -> "mastersthesis"+                    _               -> "phdthesis"+      "patent"            | variant == Biblatex -> "patent"+      "report"            | variant == Biblatex -> "report"+                          | otherwise -> "techreport"+      "speech"            -> "unpublished"+      "manuscript"        -> "unpublished"+      "graphic"           | variant == Biblatex -> "artwork"+      "song"              | variant == Biblatex -> "music"+      "legal_case"        | variant == Biblatex -> "jurisdictionN"+      "legislation"       | variant == Biblatex -> "legislation"+      "treaty"            | variant == Biblatex -> "legal"+      "personal_communication" | variant == Biblatex -> "letter"+      "motion_picture"    | variant == Biblatex -> "movie"+      "review"             | variant == Biblatex -> "review"+      _                   -> "misc"+  +  mbSubtype =+    case referenceType ref of+      "article-magazine"  -> Just "magazine"+      "article-newspaper" -> Just "newspaper"+      _ -> Nothing++  fs =+    case variant of+      Biblatex ->+           [ "author"+           , "editor"+           , "translator"+           , "publisher"+           , "title"+           , "booktitle"+           , "journal"+           , "series"+           , "edition"+           , "volume"+           , "volumes"+           , "number"+           , "pages"+           , "date"+           , "eventdate"+           , "urldate"+           , "address"+           , "url"+           , "doi"+           , "isbn"+           , "issn"+           , "type"+           , "entrysubtype"+           , "note"+           , "language"+           , "abstract"+           , "keywords"+           ]+      Bibtex ->+           [ "author"+           , "editor"+           , "translator"+           , "publisher"+           , "title"+           , "booktitle"+           , "journal"+           , "series"+           , "edition"+           , "volume"+           , "number"+           , "pages"+           , "year"+           , "month"+           , "address"+           , "type"+           , "note"+           ]++  valToInlines (TextVal t) = B.text t+  valToInlines (FancyVal ils) = ils+  valToInlines (NumVal n) = B.text (T.pack $ show n)+  valToInlines (NamesVal names) =+    mconcat $ intersperse (B.space <> B.text "and" <> B.space)+            $ map renderName names+  valToInlines (DateVal date) = B.text $+    case dateLiteral date of+      Just t  -> t+      Nothing -> T.intercalate "/" (map renderDatePart (dateParts date)) <>+                    (if dateCirca date then "~" else mempty)++  renderDatePart (DateParts xs) = T.intercalate "-" $+                                    map (T.pack . printf "%02d") xs++  renderName name =+    case nameLiteral name of+      Just t  -> B.text t+      Nothing -> spacedMaybes+                  [ nameNonDroppingParticle name+                  , nameFamily name+                  , if nameCommaSuffix name+                        then (", " <>) <$> nameSuffix name+                        else nameSuffix name ]+                  <>+                  spacedMaybes+                   [ (", " <>) <$> nameGiven name,+                     nameDroppingParticle name ]++  titlecase = case mblang of+                Just (Lang "en" _) -> titlecase'+                Nothing            -> titlecase'+                _                  -> id++  titlecase' = addTextCase mblang TitleCase .+    (\ils -> B.fromList+               (case B.toList ils of+                  Str t : xs -> Str t : Walk.walk spanAroundCapitalizedWords xs+                  xs         -> Walk.walk spanAroundCapitalizedWords xs))++  -- protect capitalized words when we titlecase+  spanAroundCapitalizedWords (Str t)+    | not (T.all (\c -> isLower c || not (isLetter c)) t) =+       Span ("",["nocase"],[]) [Str t]+  spanAroundCapitalizedWords x = x++  spacedMaybes = mconcat . intersperse B.space . mapMaybe (fmap B.text)++  toLaTeX x =+    case runPure (writeLaTeX opts $ doc (B.plain x)) of+           Left _  -> Nothing+           Right t -> Just t++  renderField name = (\contents -> name <> " = {" <> contents <> "}")+                      <$> getContentsFor name++  getVariable v = lookupVariable (toVariable v) ref++  getVariableAsText v = (stringify . valToInlines) <$> getVariable v++  getYear val =+    case val of+       DateVal date ->+         case dateLiteral date of+           Just t -> toLaTeX (B.text t)+           Nothing ->+             case dateParts date of+               [DateParts (y1:_), DateParts (y2:_)] ->+                 Just (T.pack (printf "%04d" y1) <> "--" <>+                        T.pack (printf "%04d" y2))+               [DateParts (y1:_)] ->+                 Just (T.pack (printf "%04d" y1))+               _ -> Nothing+       _ -> Nothing++  toMonth 1 = "jan"+  toMonth 2 = "feb"+  toMonth 3 = "mar"+  toMonth 4 = "apr"+  toMonth 5 = "may"+  toMonth 6 = "jun"+  toMonth 7 = "jul"+  toMonth 8 = "aug"+  toMonth 9 = "sep"+  toMonth 10 = "oct"+  toMonth 11 = "nov"+  toMonth 12 = "dec"+  toMonth x  = T.pack $ show x++  getMonth val =+    case val of+       DateVal date ->+         case dateParts date of+           [DateParts (_:m1:_), DateParts (_:m2:_)] ->+             Just (toMonth m1 <> "--" <> toMonth m2)+           [DateParts (_:m1:_)] -> Just (toMonth m1)+           _ -> Nothing+       _ -> Nothing++  getContentsFor :: Text -> Maybe Text+  getContentsFor "type" =+    getVariableAsText "genre" >>=+       \case+          "mathesis"  -> Just "mastersthesis"+          "phdthesis" -> Just "phdthesis"+          _           -> Nothing+  getContentsFor "entrysubtype" = mbSubtype+  getContentsFor "journal"+    | bibtexType `elem` ["article", "periodical", "suppperiodical", "review"]+      = getVariable "container-title" >>= toLaTeX . valToInlines+    | otherwise = Nothing+  getContentsFor "booktitle"+    | bibtexType `elem`+       ["inbook","incollection","inproceedings","inreference","bookinbook"]+    = (getVariable "volume-title" <|> getVariable "container-title")+                               >>= toLaTeX . valToInlines+    | otherwise = Nothing+  getContentsFor "series" = getVariable "collection-title"+                               >>= toLaTeX . valToInlines+  getContentsFor "address" = getVariable "publisher-place"+                               >>= toLaTeX . valToInlines+  getContentsFor "date"  = getVariable "issued" >>= toLaTeX . valToInlines+  getContentsFor "eventdate" = getVariable "event-date" >>= toLaTeX . valToInlines+  getContentsFor "urldate"  = getVariable "accessed" >>= toLaTeX . valToInlines+  getContentsFor "year"  = getVariable "issued" >>= getYear+  getContentsFor "month"  = getVariable "issued" >>= getMonth+  getContentsFor "number" = (getVariable "number"+                         <|> getVariable "collection-number"+                         <|> getVariable "issue") >>= toLaTeX . valToInlines++  getContentsFor x = getVariable x >>=+    if isURL x+       then Just . stringify . valToInlines+       else toLaTeX .+            (if x == "title"+                then titlecase+                else id) .+            valToInlines++  isURL x = x `elem` ["url","doi","issn","isbn"]++  renderFields = T.intercalate ",\n  " . mapMaybe renderField  defaultLang :: Lang defaultLang = Lang "en" (Just "US")
src/Text/Pandoc/Data.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE TemplateHaskell #-} {- | Module      : Text.Pandoc.Data-Copyright   : Copyright (C) 2013-2020 John MacFarlane+Copyright   : Copyright (C) 2013-2021 John MacFarlane License     : GNU GPL, version 2 or above  Maintainer  : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Error.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings  #-} {- |    Module      : Text.Pandoc.Error-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Extensions.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE OverloadedStrings          #-} {- |    Module      : Text.Pandoc.Extensions-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -88,6 +88,7 @@                                   --   does not affect readers/writers directly; it causes                                   --   the eastAsianLineBreakFilter to be applied after                                   --   parsing, in Text.Pandoc.App.convertWithOpts.+    | Ext_element_citations   -- ^ Use element-citation elements for JATS citations     | Ext_emoji               -- ^ Support emoji like :smile:     | Ext_empty_paragraphs -- ^ Allow empty paragraphs     | Ext_epub_html_exts      -- ^ Recognise the EPUB extended version of HTML@@ -412,6 +413,11 @@                                            Ext_smart,                                            Ext_raw_html,                                            Ext_auto_identifiers]+getDefaultExtensions "jats"            = extensionsFromList+                                          [Ext_auto_identifiers]+getDefaultExtensions "jats_archiving"  = getDefaultExtensions "jats"+getDefaultExtensions "jats_publishing" = getDefaultExtensions "jats"+getDefaultExtensions "jats_articleauthoring" = getDefaultExtensions "jats" getDefaultExtensions "opml"            = pandocExtensions -- affects notes getDefaultExtensions _                 = extensionsFromList                                           [Ext_auto_identifiers]@@ -554,6 +560,14 @@     , Ext_smart     , Ext_raw_tex     ]+  getAll "jats"            =+    extensionsFromList+    [ Ext_auto_identifiers+    , Ext_element_citations+    ]+  getAll "jats_archiving"  = getAll "jats"+  getAll "jats_publishing" = getAll "jats"+  getAll "jats_articleauthoring" = getAll "jats"   getAll "opml"            = allMarkdownExtensions -- affects notes   getAll "twiki"           = autoIdExtensions <>     extensionsFromList
src/Text/Pandoc/Filter.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Filter-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Filter/JSON.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Filter-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Filter/Lua.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Filter.Lua-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Filter/Path.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Filter.Path-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
src/Text/Pandoc/Highlighting.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Highlighting-   Copyright   : Copyright (C) 2008-2020 John MacFarlane+   Copyright   : Copyright (C) 2008-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Image.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings, ScopedTypeVariables, CPP #-} {- | Module      : Text.Pandoc.Image-Copyright   : Copyright (C) 2020 John MacFarlane+Copyright   : Copyright (C) 2020-2021 John MacFarlane License     : GNU GPL, version 2 or above  Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/ImageSize.hs view
@@ -3,7 +3,7 @@ {-# OPTIONS_GHC -fno-warn-type-defaults #-} {- | Module      : Text.Pandoc.ImageSize-Copyright   : Copyright (C) 2011-2020 John MacFarlane+Copyright   : Copyright (C) 2011-2021 John MacFarlane License     : GNU GPL, version 2 or above  Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -328,12 +328,16 @@ svgSize :: WriterOptions -> ByteString -> Maybe ImageSize svgSize opts img = do   doc <- Xml.parseXMLDoc $ UTF8.toString img+  let viewboxSize = do+        vb <- Xml.findAttrBy (== Xml.QName "viewBox" Nothing Nothing) doc+        [_,_,w,h] <- mapM safeRead (T.words (T.pack vb))+        return (w,h)   let dpi = fromIntegral $ writerDpi opts   let dirToInt dir = do         dim <- Xml.findAttrBy (== Xml.QName dir Nothing Nothing) doc >>= lengthToDim . T.pack         return $ inPixel opts dim-  w <- dirToInt "width"-  h <- dirToInt "height"+  w <- dirToInt "width" <|> (fst <$> viewboxSize)+  h <- dirToInt "height" <|> (snd <$> viewboxSize)   return ImageSize {     pxX  = w   , pxY  = h
src/Text/Pandoc/Logging.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings  #-} {- |    Module      : Text.Pandoc.Logging-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Lua.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Lua-   Copyright   : Copyright © 2017–2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/ErrorConversion.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Lua.ErrorConversion-   Copyright   : © 2020 Albert Krewinkel+   Copyright   : © 2020-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Filter.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE FlexibleContexts  #-} {- | Module      : Text.Pandoc.Lua.Filter-Copyright   : © 2012–2020 John MacFarlane,-              © 2017-2020 Albert Krewinkel+Copyright   : © 2012-2021 John MacFarlane,+              © 2017-2021 Albert Krewinkel License     : GNU GPL, version 2 or above Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de> Stability   : alpha
src/Text/Pandoc/Lua/Global.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {- |    Module      : Text.Pandoc.Lua-   Copyright   : Copyright © 2017-2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Init.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Lua-   Copyright   : Copyright © 2017-2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling.hs view
@@ -1,7 +1,7 @@ {- |    Module      : Text.Pandoc.Lua.Marshaling-   Copyright   : © 2012-2020 John MacFarlane-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/AST.hs view
@@ -2,8 +2,8 @@ {-# LANGUAGE LambdaCase           #-} {- |    Module      : Text.Pandoc.Lua.Marshaling.AST-   Copyright   : © 2012-2020 John MacFarlane-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/AnyValue.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Lua.Marshaling.AnyValue-   Copyright   : © 2017-2020 Albert Krewinkel+   Copyright   : © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/CommonState.hs view
@@ -3,8 +3,8 @@ {-# LANGUAGE OverloadedStrings    #-} {- |    Module      : Text.Pandoc.Lua.Marshaling.CommonState-   Copyright   : © 2012-2020 John MacFarlane-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above    Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>    Stability   : alpha
src/Text/Pandoc/Lua/Marshaling/Context.hs view
@@ -1,8 +1,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {- |    Module      : Text.Pandoc.Lua.Marshaling.Context-   Copyright   : © 2012-2020 John MacFarlane-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/List.hs view
@@ -4,8 +4,8 @@ {-# LANGUAGE UndecidableInstances #-} {- | Module      : Text.Pandoc.Lua.Marshaling.List-Copyright   : © 2012-2020 John MacFarlane-              © 2017-2020 Albert Krewinkel+Copyright   : © 2012-2021 John MacFarlane+              © 2017-2021 Albert Krewinkel License     : GNU GPL, version 2 or above Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de> Stability   : alpha
src/Text/Pandoc/Lua/Marshaling/MediaBag.hs view
@@ -1,7 +1,7 @@ {- |    Module      : Text.Pandoc.Lua.Marshaling.MediaBag-   Copyright   : © 2012-2020 John MacFarlane-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above    Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>    Stability   : alpha
src/Text/Pandoc/Lua/Marshaling/PandocError.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE ScopedTypeVariables  #-} {- |    Module      : Text.Pandoc.Lua.Marshaling.PandocError-   Copyright   : © 2020 Albert Krewinkel+   Copyright   : © 2020-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/ReaderOptions.hs view
@@ -4,8 +4,8 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {- |    Module      : Text.Pandoc.Lua.Marshaling.ReaderOptions-   Copyright   : © 2012-2020 John MacFarlane-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/SimpleTable.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Lua.Marshaling.SimpleTable-   Copyright   : © 2020 Albert Krewinkel+   Copyright   : © 2020-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Marshaling/Version.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE ScopedTypeVariables  #-} {- |    Module      : Text.Pandoc.Lua.Marshaling.Version-   Copyright   : © 2019-2020 Albert Krewinkel+   Copyright   : © 2019-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/MediaBag.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Lua.Module.MediaBag-   Copyright   : Copyright © 2017-2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/Pandoc.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Lua.Module.Pandoc-   Copyright   : Copyright © 2017-2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/System.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Lua.Module.System-   Copyright   : © 2019-2020 Albert Krewinkel+   Copyright   : © 2019-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/Types.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Lua.Module.Types-   Copyright   : © 2019-2020 Albert Krewinkel+   Copyright   : © 2019-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Module/Utils.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Lua.Module.Utils-   Copyright   : Copyright © 2017-2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Packages.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Lua.Packages-   Copyright   : Copyright © 2017-2020 Albert Krewinkel+   Copyright   : Copyright © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/PandocLua.hs view
@@ -9,7 +9,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {- |    Module      : Text.Pandoc.Lua.PandocLua-   Copyright   : Copyright © 2020 Albert Krewinkel+   Copyright   : Copyright © 2020-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Util.hs view
@@ -3,8 +3,8 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Lua.Util-   Copyright   : © 2012–2020 John MacFarlane,-                 © 2017-2020 Albert Krewinkel+   Copyright   : © 2012-2021 John MacFarlane,+                 © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Lua/Walk.hs view
@@ -4,8 +4,8 @@ {-# LANGUAGE MultiParamTypeClasses #-} {- | Module      : Text.Pandoc.Lua.Walk-Copyright   : © 2012–2020 John MacFarlane,-              © 2017-2020 Albert Krewinkel+Copyright   : © 2012-2021 John MacFarlane,+              © 2017-2021 Albert Krewinkel License     : GNU GPL, version 2 or above Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de> Stability   : alpha
src/Text/Pandoc/MIME.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.MIME-   Copyright   : Copyright (C) 2011-2020 John MacFarlane+   Copyright   : Copyright (C) 2011-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/MediaBag.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {- |    Module      : Text.Pandoc.MediaBag-   Copyright   : Copyright (C) 2014-2015, 2017–2020 John MacFarlane+   Copyright   : Copyright (C) 2014-2015, 2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Options.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE TemplateHaskell    #-} {- |    Module      : Text.Pandoc.Options-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/PDF.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.PDF-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Parsing.hs view
@@ -9,7 +9,7 @@ {-# LANGUAGE OverloadedStrings          #-} {- |    Module      : Text.Pandoc.Parsing-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -1069,24 +1069,24 @@                 => Bool -- ^ Headerless table                 -> ParserT s st m (mf Blocks)                 -> ParserT s st m (mf [Blocks], [Alignment], [Int])-gridTableHeader headless blocks = try $ do+gridTableHeader True _ = do   optional blanklines   dashes <- gridDashedLines '-'-  rawContent  <- if headless-                    then return $ repeat ""-                    else many1-                         (notFollowedBy (gridTableSep '=') >> char '|' >>+  let aligns = map snd dashes+  let lines'   = map (snd . fst) dashes+  let indices  = scanl (+) 0 lines'+  return (return [], aligns, indices)+gridTableHeader False blocks = try $ do+  optional blanklines+  dashes <- gridDashedLines '-'+  rawContent  <- many1 (notFollowedBy (gridTableSep '=') >> char '|' >>                            T.pack <$> many1Till anyChar newline)-  underDashes <- if headless-                    then return dashes-                    else gridDashedLines '='+  underDashes <- gridDashedLines '='   guard $ length dashes == length underDashes   let lines'   = map (snd . fst) underDashes   let indices  = scanl (+) 0 lines'   let aligns   = map snd underDashes-  let rawHeads = if headless-                    then replicate (length underDashes) ""-                    else map (T.unlines . map trim) $ transpose+  let rawHeads = map (T.unlines . map trim) $ transpose                        $ map (gridTableSplitLine indices) rawContent   heads <- sequence <$> mapM (parseFromString' blocks . trim) rawHeads   return (heads, aligns, indices)
src/Text/Pandoc/Process.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Process-   Copyright   : Copyright (C) 2013-2020 John MacFarlane+   Copyright   : Copyright (C) 2013-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings   #-} {- |    Module      : Text.Pandoc.Readers-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/BibTeX.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.BibTeX-   Copyright   : Copyright (C) 2020 John MacFarlane+   Copyright   : Copyright (C) 2020-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/CSV.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Readers.CSV-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/CommonMark.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Readers.CommonMark-   Copyright   : Copyright (C) 2015-2020 John MacFarlane+   Copyright   : Copyright (C) 2015-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/CslJson.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.CslJson-   Copyright   : Copyright (C) 2020 John MacFarlane+   Copyright   : Copyright (C) 2020-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/DocBook.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.DocBook-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Docx/Combine.hs view
@@ -2,7 +2,7 @@ {- |    Module      : Text.Pandoc.Readers.Docx.Combine    Copyright   : © 2014-2020 Jesse Rosenthal <jrosenthal@jhu.edu>,-                   2014-2020 John MacFarlane <jgm@berkeley.edu>,+                   2014-2021 John MacFarlane <jgm@berkeley.edu>,                    2020 Nikolay Yakimov <root@livid.pp.ru>    License     : GNU GPL, version 2 or above 
src/Text/Pandoc/Readers/Docx/Util.hs view
@@ -1,7 +1,7 @@ {- |    Module      : Text.Pandoc.Readers.Docx.StyleMaps    Copyright   : © 2014-2020 Jesse Rosenthal <jrosenthal@jhu.edu>,-                   2014-2020 John MacFarlane <jgm@berkeley.edu>,+                   2014-2021 John MacFarlane <jgm@berkeley.edu>,                    2015 Nikolay Yakimov <root@livid.pp.ru>    License     : GNU GPL, version 2 or above 
src/Text/Pandoc/Readers/HTML.hs view
@@ -5,7 +5,7 @@ {-# LANGUAGE ViewPatterns          #-} {- |    Module      : Text.Pandoc.Readers.HTML-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/HTML/Parsing.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings     #-} {- |    Module      : Text.Pandoc.Readers.HTML.Parsing-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/HTML/Table.hs view
@@ -3,8 +3,8 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Readers.HTML.Table-   Copyright   : © 2006-2020 John MacFarlane,-                   2020 Albert Krewinkel+   Copyright   : © 2006-2021 John MacFarlane,+                   2020-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
src/Text/Pandoc/Readers/HTML/TagCategories.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings     #-} {- |    Module      : Text.Pandoc.Readers.HTML.TagCategories-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/HTML/Types.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {- |    Module      : Text.Pandoc.Readers.HTML.Types-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Ipynb.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Readers.Ipynb-   Copyright   : Copyright (C) 2019-2020 John MacFarlane+   Copyright   : Copyright (C) 2019-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Jira.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org-   Copyright   : © 2019-2020 Albert Krewinkel+   Copyright   : © 2019-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -8,7 +8,7 @@ {-# LANGUAGE ViewPatterns          #-} {- |    Module      : Text.Pandoc.Readers.LaTeX-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -1219,6 +1219,7 @@ preamble = mconcat <$> many preambleBlock   where preambleBlock =  (mempty <$ spaces1)                      <|> macroDef (rawBlock "latex")+                     <|> filecontents                      <|> (mempty <$ blockCommand)                      <|> (mempty <$ braced)                      <|> (do notFollowedBy (begin_ "document")@@ -1272,6 +1273,16 @@   mapM_ (insertIncluded defaultExt) fs   return mempty +readFileFromTexinputs :: PandocMonad m => FilePath -> LP m (Maybe Text)+readFileFromTexinputs fp = do+  fileContentsMap <- sFileContents <$> getState+  case M.lookup (T.pack fp) fileContentsMap of+    Just t -> return (Just t)+    Nothing -> do+      dirs <- map T.unpack . splitTextBy (==':') . fromMaybe "."+               <$> lookupEnv "TEXINPUTS"+      readFileFromDirs dirs fp+ insertIncluded :: PandocMonad m                => FilePath                -> FilePath@@ -1281,13 +1292,12 @@                 ".tex" -> f'                 ".sty" -> f'                 _      -> addExtension f' defaultExtension-  dirs <- map T.unpack . splitTextBy (==':') . fromMaybe "." <$> lookupEnv "TEXINPUTS"   pos <- getPosition   containers <- getIncludeFiles <$> getState   when (T.pack f `elem` containers) $     throwError $ PandocParseError $ T.pack $ "Include file loop at " ++ show pos   updateState $ addIncludeFile $ T.pack f-  mbcontents <- readFileFromDirs dirs f+  mbcontents <- readFileFromTexinputs f   contents <- case mbcontents of                    Just s -> return s                    Nothing -> do@@ -1695,6 +1705,18 @@    , ("iftoggle", try $ ifToggle >> block)    ] +filecontents :: PandocMonad m => LP m Blocks+filecontents = try $ do+  controlSeq "begin"+  name <- untokenize <$> braced+  guard $ name == "filecontents" || name == "filecontents*"+  skipopts+  fp <- untokenize <$> braced+  txt <- verbEnv name+  updateState $ \st ->+    st{ sFileContents = M.insert fp txt (sFileContents st) }+  return mempty+ theoremstyle :: PandocMonad m => LP m Blocks theoremstyle = do   stylename <- untokenize <$> braced@@ -1835,7 +1857,7 @@        report $ SkippedContent beginCommand pos1        pos2 <- getPosition        report $ SkippedContent ("\\end{" <> name <> "}") pos2-       return bs+       return $ divWith ("",[name],[]) bs  rawVerbEnv :: PandocMonad m => Text -> LP m Blocks rawVerbEnv name = do@@ -1894,8 +1916,7 @@   pos <- getPosition   attr <- mintedAttr   f <- T.filter (/='"') . untokenize <$> braced-  dirs <- map T.unpack . splitTextBy (==':') . fromMaybe "." <$> lookupEnv "TEXINPUTS"-  mbCode <- readFileFromDirs dirs (T.unpack f)+  mbCode <- readFileFromTexinputs (T.unpack f)   rawcode <- case mbCode of                   Just s -> return s                   Nothing -> do@@ -1981,8 +2002,7 @@   pos <- getPosition   options <- option [] keyvals   f <- T.filter (/='"') . untokenize <$> braced-  dirs <- map T.unpack . splitTextBy (==':') . fromMaybe "." <$> lookupEnv "TEXINPUTS"-  mbCode <- readFileFromDirs dirs (T.unpack f)+  mbCode <- readFileFromTexinputs (T.unpack f)   codeLines <- case mbCode of                       Just s -> return $ T.lines s                       Nothing -> do
src/Text/Pandoc/Readers/LaTeX/Lang.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.LaTeX.Lang-   Copyright   : Copyright (C) 2018-2020 John MacFarlane+   Copyright   : Copyright (C) 2018-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/LaTeX/Parsing.hs view
@@ -5,7 +5,7 @@ {-# LANGUAGE ScopedTypeVariables   #-} {- |    Module      : Text.Pandoc.Readers.LaTeX.Parsing-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -152,6 +152,7 @@                             , sHasChapters   :: Bool                             , sToggles       :: M.Map Text Bool                             , sExpanded      :: Bool+                            , sFileContents  :: M.Map Text Text                             }      deriving Show @@ -177,6 +178,7 @@                               , sHasChapters   = False                               , sToggles       = M.empty                               , sExpanded      = False+                              , sFileContents  = M.empty                               }  instance PandocMonad m => HasQuoteContext LaTeXState m where
src/Text/Pandoc/Readers/LaTeX/Types.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Readers.LaTeX.Types-   Copyright   : Copyright (C) 2017-2020 John MacFarlane+   Copyright   : Copyright (C) 2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Markdown.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE ViewPatterns        #-} {- |    Module      : Text.Pandoc.Readers.Markdown-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/MediaWiki.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.MediaWiki-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -678,19 +678,17 @@ -- | Parses a list of inlines between start and end delimiters. inlinesBetween :: (PandocMonad m, Show b) => MWParser m a -> MWParser m b -> MWParser m Inlines inlinesBetween start end =-  trimInlines . mconcat <$> try (start >> many1Till inner end)-    where inner      = innerSpace <|> (notFollowedBy' (() <$ whitespace) >> inline)-          innerSpace = try $ whitespace <* notFollowedBy' end+  trimInlines . mconcat <$> try (start >> many1Till inline end)  emph :: PandocMonad m => MWParser m Inlines emph = B.emph <$> nested (inlinesBetween start end)-    where start = sym "''" >> lookAhead nonspaceChar+    where start = sym "''"           end   = try $ notFollowedBy' (() <$ strong) >> sym "''"  strong :: PandocMonad m => MWParser m Inlines strong = B.strong <$> nested (inlinesBetween start end)-    where start = sym "'''" >> lookAhead nonspaceChar-          end   = try $ sym "'''"+    where start = sym "'''"+          end   = sym "'''"  doubleQuotes :: PandocMonad m => MWParser m Inlines doubleQuotes = do
src/Text/Pandoc/Readers/Metadata.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Readers.Metadata-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Native.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Native-   Copyright   : Copyright (C) 2011-2020 John MacFarlane+   Copyright   : Copyright (C) 2011-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/OPML.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.OPML-   Copyright   : Copyright (C) 2013-2020 John MacFarlane+   Copyright   : Copyright (C) 2013-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Org.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/Org/BlockStarts.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org.BlockStarts-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/Org/Blocks.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org.Blocks-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>@@ -294,24 +294,22 @@ codeBlock :: PandocMonad m => BlockAttributes -> Text -> OrgParser m (F Blocks) codeBlock blockAttrs blockType = do   skipSpaces-  (classes, kv)     <- codeHeaderArgs <|> (mempty <$ ignHeaders)-  content           <- rawBlockContent blockType-  resultsContent    <- option mempty babelResultsBlock-  let id'            = fromMaybe mempty $ blockAttrName blockAttrs-  let codeBlck       = B.codeBlockWith ( id', classes, kv ) content-  let labelledBlck   = maybe (pure codeBlck)-                             (labelDiv codeBlck)-                             (blockAttrCaption blockAttrs)+  (classes, kv)  <- codeHeaderArgs <|> (mempty <$ ignHeaders)+  content        <- rawBlockContent blockType+  resultsContent <- option mempty babelResultsBlock+  let identifier = fromMaybe mempty $ blockAttrName blockAttrs+  let codeBlk    = B.codeBlockWith (identifier, classes, kv) content+  let wrap       = maybe pure addCaption (blockAttrCaption blockAttrs)   return $-    (if exportsCode kv    then labelledBlck   else mempty) <>+    (if exportsCode kv    then wrap codeBlk   else mempty) <>     (if exportsResults kv then resultsContent else mempty)  where-   labelDiv :: Blocks -> F Inlines -> F Blocks-   labelDiv blk value =-     B.divWith nullAttr <$> (mappend <$> labelledBlock value <*> pure blk)+   addCaption :: F Inlines -> Blocks -> F Blocks+   addCaption caption blk = B.divWith ("", ["captioned-content"], [])+                         <$> (mkCaptionBlock caption <> pure blk) -   labelledBlock :: F Inlines -> F Blocks-   labelledBlock = fmap (B.plain . B.spanWith ("", ["label"], []))+   mkCaptionBlock :: F Inlines -> F Blocks+   mkCaptionBlock = fmap (B.divWith ("", ["caption"], []) . B.plain)     exportsResults :: [(Text, Text)] -> Bool    exportsResults = maybe False (`elem` ["results", "both"]) . lookup "exports"
src/Text/Pandoc/Readers/Org/DocumentTree.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE TupleSections     #-} {- |    Module      : Text.Pandoc.Readers.Org.DocumentTree-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/Org/ExportSettings.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org.ExportSettings-   Copyright   : © 2016–2020 Albert Krewinkel+   Copyright   : © 2016-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/Org/Inlines.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org.Inlines-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>@@ -572,7 +572,7 @@ underline = fmap B.underline    <$> emphasisBetween '_'  verbatim  :: PandocMonad m => OrgParser m (F Inlines)-verbatim  = return . B.code     <$> verbatimBetween '='+verbatim  = return . B.codeWith ("", ["verbatim"], []) <$> verbatimBetween '='  code      :: PandocMonad m => OrgParser m (F Inlines) code      = return . B.code     <$> verbatimBetween '~'
src/Text/Pandoc/Readers/Org/Meta.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org.Meta-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>@@ -239,7 +239,7 @@ todoSequence :: Monad m => OrgParser m TodoSequence todoSequence = try $ do   todoKws <- todoKeywords-  doneKws <- optionMaybe $ todoDoneSep *> todoKeywords+  doneKws <- optionMaybe $ todoDoneSep *> doneKeywords   newline   -- There must be at least one DONE keyword. The last TODO keyword is   -- taken if necessary.@@ -250,11 +250,17 @@                     (x:xs) -> return $ keywordsToSequence (reverse xs) [x]   where+   todoKeyword :: Monad m => OrgParser m Text+   todoKeyword = many1Char nonspaceChar <* skipSpaces+    todoKeywords :: Monad m => OrgParser m [Text]    todoKeywords = try $-     let keyword = many1Char nonspaceChar <* skipSpaces-         endOfKeywords = todoDoneSep <|> void newline-     in manyTill keyword (lookAhead endOfKeywords)+     let endOfKeywords = todoDoneSep <|> void newline+     in manyTill todoKeyword (lookAhead endOfKeywords)++   doneKeywords :: Monad m => OrgParser m [Text]+   doneKeywords = try $+     manyTill (todoKeyword <* optional todoDoneSep) (lookAhead newline)     todoDoneSep :: Monad m => OrgParser m ()    todoDoneSep = void . try $ skipSpaces *> char '|' <* skipSpaces1
src/Text/Pandoc/Readers/Org/ParserState.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings     #-} {- |    Module      : Text.Pandoc.Readers.Org.ParserState-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/Org/Parsing.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Readers.Org.Parsing-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/Org/Shared.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Readers.Org.Shared-   Copyright   : Copyright (C) 2014-2020 Albert Krewinkel+   Copyright   : Copyright (C) 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Readers/RST.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE ViewPatterns        #-} {- |    Module      : Text.Pandoc.Readers.RST-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Readers/Textile.hs view
@@ -3,7 +3,7 @@ {- |    Module      : Text.Pandoc.Readers.Textile    Copyright   : Copyright (C) 2010-2012 Paul Rivier-                               2010-2020 John MacFarlane+                               2010-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : Paul Rivier <paul*rivier#demotera*com>
src/Text/Pandoc/Readers/Txt2Tags.hs view
@@ -564,7 +564,7 @@               _                               -> "html"  atStart :: T2T ()-atStart = (sourceColumn <$> getPosition) >>= guard . (== 1)+atStart = getPosition >>= guard . (== 1) . sourceColumn  ignoreSpacesCap :: T2T Text -> T2T Text ignoreSpacesCap p = T.toLower <$> (spaces *> p <* spaces)
src/Text/Pandoc/RoffChar.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.RoffChar-   Copyright   : Copyright (C) 2007-2020 John MacFarlane+   Copyright   : Copyright (C) 2007-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/SelfContained.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE TupleSections     #-} {- |    Module      : Text.Pandoc.SelfContained-   Copyright   : Copyright (C) 2011-2020 John MacFarlane+   Copyright   : Copyright (C) 2011-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Shared.hs view
@@ -8,7 +8,7 @@ {-# LANGUAGE OverloadedStrings     #-} {- |    Module      : Text.Pandoc.Shared-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Slides.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Slides-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Templates.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Templates-   Copyright   : Copyright (C) 2009-2020 John MacFarlane+   Copyright   : Copyright (C) 2009-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -81,6 +81,8 @@   case format of        "native"  -> return ""        "csljson" -> return ""+       "bibtex"  -> return ""+       "biblatex" -> return ""        "json"    -> return ""        "docx"    -> return ""        "fb2"     -> return ""
src/Text/Pandoc/Translations.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings          #-} {- |    Module      : Text.Pandoc.Translations-   Copyright   : Copyright (C) 2017-2020 John MacFarlane+   Copyright   : Copyright (C) 2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/UTF8.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.UTF8-   Copyright   : Copyright (C) 2010-2020 John MacFarlane+   Copyright   : Copyright (C) 2010-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/UUID.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.UUID-   Copyright   : Copyright (C) 2010-2020 John MacFarlane+   Copyright   : Copyright (C) 2010-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE OverloadedStrings   #-} {- |    Module      : Text.Pandoc-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -21,6 +21,8 @@     , writeAsciiDoc     , writeAsciiDoctor     , writeBeamer+    , writeBibTeX+    , writeBibLaTeX     , writeCommonMark     , writeConTeXt     , writeCustom@@ -85,6 +87,7 @@ import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Error import Text.Pandoc.Writers.AsciiDoc+import Text.Pandoc.Writers.BibTeX import Text.Pandoc.Writers.CommonMark import Text.Pandoc.Writers.ConTeXt import Text.Pandoc.Writers.CslJson@@ -185,6 +188,8 @@   ,("tei"          , TextWriter writeTEI)   ,("muse"         , TextWriter writeMuse)   ,("csljson"      , TextWriter writeCslJson)+  ,("bibtex"       , TextWriter writeBibTeX)+  ,("biblatex"     , TextWriter writeBibLaTeX)   ]  -- | Retrieve writer, extensions based on formatSpec (format+extensions).
src/Text/Pandoc/Writers/AsciiDoc.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.AsciiDoc-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
+ src/Text/Pandoc/Writers/BibTeX.hs view
@@ -0,0 +1,48 @@+{-# LANGUAGE OverloadedStrings #-}+{- |+   Module      : Text.Pandoc.Writers.BibTeX+   Copyright   : Copyright (C) 2021 John MacFarlane+   License     : GNU GPL, version 2 or above++   Maintainer  : John MacFarlane <jgm@berkeley.edu>+   Stability   : alpha+   Portability : portable++Writes a BibTeX or BibLaTeX bibliographies based on the+'references' metadata in a Pandoc document.+-}+module Text.Pandoc.Writers.BibTeX+  ( writeBibTeX+  , writeBibLaTeX+  )+where++import Text.Pandoc.Options+import Text.Pandoc.Definition+import Data.Text (Text)+import Data.Maybe (mapMaybe)+import Citeproc (parseLang)+import Text.Pandoc.Class (PandocMonad)+import Text.Pandoc.Citeproc.BibTeX as BibTeX+import Text.Pandoc.Citeproc.MetaValue (metaValueToReference)+import Text.Pandoc.Writers.Shared (lookupMetaString)++-- | Write BibTeX based on the references metadata from a Pandoc document.+writeBibTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text+writeBibTeX = writeBibTeX' BibTeX.Bibtex++-- | Write BibLaTeX based on the references metadata from a Pandoc document.+writeBibLaTeX :: PandocMonad m => WriterOptions -> Pandoc -> m Text+writeBibLaTeX = writeBibTeX' BibTeX.Biblatex++writeBibTeX' :: PandocMonad m => Variant -> WriterOptions -> Pandoc -> m Text+writeBibTeX' variant opts (Pandoc meta _) = do+  let mblang = case lookupMetaString "lang" meta of+                 "" -> Nothing+                 t  -> Just $ parseLang t+  let refs = case lookupMeta "references" meta of+               Just (MetaList xs) -> mapMaybe metaValueToReference xs+               _ -> []+  return $ mconcat $+    map (BibTeX.writeBibtexString opts variant mblang) refs+
src/Text/Pandoc/Writers/CommonMark.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Writers.CommonMark-   Copyright   : Copyright (C) 2015-2020 John MacFarlane+   Copyright   : Copyright (C) 2015-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/ConTeXt.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ViewPatterns        #-} {- |    Module      : Text.Pandoc.Writers.ConTeXt-   Copyright   : Copyright (C) 2007-2020 John MacFarlane+   Copyright   : Copyright (C) 2007-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/CslJson.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.CslJson-   Copyright   : Copyright (C) 2020 John MacFarlane+   Copyright   : Copyright (C) 2020-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Custom.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings  #-} {- |    Module      : Text.Pandoc.Writers.Custom-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Docbook.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.Docbook-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Docx.hs view
@@ -7,7 +7,7 @@ {-# LANGUAGE OverloadedStrings   #-} {- |    Module      : Text.Pandoc.Writers.Docx-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -1023,23 +1023,15 @@             _ -> es ++ [Elem $ mknode "w:p" [] ()]   headers' <- mapM cellToOpenXML $ zip aligns headers   rows' <- mapM (mapM cellToOpenXML . zip aligns) rows-  let borderProps = Elem $ mknode "w:tcPr" []-                    [ mknode "w:tcBorders" []-                      $ mknode "w:bottom" [("w:val","single")] ()-                    , mknode "w:vAlign" [("w:val","bottom")] () ]   compactStyle <- pStyleM "Compact"   let emptyCell' = [Elem $ mknode "w:p" [] [mknode "w:pPr" [] [compactStyle]]]-  let mkcell border contents = mknode "w:tc" []-                            $ [ borderProps | border ] ++-                            if null contents-                               then emptyCell'-                               else contents-  let mkrow border cells =+  let mkcell contents = mknode "w:tc" []+                            $ if null contents+                                 then emptyCell'+                                 else contents+  let mkrow cells =          mknode "w:tr" [] $-         [ mknode "w:trPr" []-           [ mknode "w:cnfStyle" [("w:firstRow","1")] ()]-         | border]-         ++ map (mkcell border) cells+           map mkcell cells   let textwidth = 7920  -- 5.5 in in twips, 1/20 pt   let fullrow = 5000 -- 100% specified in pct   let rowwidth = fullrow * sum widths@@ -1047,6 +1039,15 @@                        [("w:w", show (floor (textwidth * w) :: Integer))] ()   let hasHeader = not $ all null headers   modify $ \s -> s { stInTable = False }+  -- for compatibility with Word <= 2007, we include a val with a bitmask+  -- 0×0020  Apply first row conditional formatting+  -- 0×0040  Apply last row conditional formatting+  -- 0×0080  Apply first column conditional formatting+  -- 0×0100  Apply last column conditional formatting+  -- 0×0200  Do not apply row banding conditional formatting+  -- 0×0400  Do not apply column banding conditional formattin+  let tblLookVal :: Int+      tblLookVal = if hasHeader then 0x20 else 0   return $     caption' ++     [Elem $@@ -1059,15 +1060,17 @@                                ,("w:firstColumn","0")                                ,("w:lastColumn","0")                                ,("w:noHBand","0")-                               ,("w:noVBand","0")] () :+                               ,("w:noVBand","0")+                               ,("w:val", printf "%04x" tblLookVal)+                               ] () :           [ mknode "w:tblCaption" [("w:val", T.unpack captionStr)] ()           | not (null caption) ] )       : mknode "w:tblGrid" []         (if all (==0) widths             then []             else map mkgridcol widths)-      : [ mkrow True headers' | hasHeader ] ++-      map (mkrow False) rows'+      : [ mkrow headers' | hasHeader ] +++      map mkrow rows'       )] blockToOpenXML' opts el   | BulletList lst <- el = addOpenXMLList BulletMarker lst
src/Text/Pandoc/Writers/Docx/StyleMap.hs view
@@ -2,7 +2,7 @@ {- |    Module : Text.Pandoc.Writers.Docx.StyleMap    Copyright   : © 2014-2020 Jesse Rosenthal <jrosenthal@jhu.edu>,-                   2014-2020 John MacFarlane <jgm@berkeley.edu>,+                   2014-2021 John MacFarlane <jgm@berkeley.edu>,                    2015-2019 Nikolay Yakimov <root@livid.pp.ru>    License     : GNU GPL, version 2 or above 
src/Text/Pandoc/Writers/DokuWiki.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.DokuWiki-   Copyright   : Copyright (C) 2008-2020 John MacFarlane+   Copyright   : Copyright (C) 2008-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : Clare Macrae <clare.macrae@googlemail.com>
src/Text/Pandoc/Writers/EPUB.hs view
@@ -5,7 +5,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Writers.EPUB-   Copyright   : Copyright (C) 2010-2020 John MacFarlane+   Copyright   : Copyright (C) 2010-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -465,7 +465,12 @@                 case epubCoverImage metadata of                      Nothing   -> return ([],[])                      Just img  -> do-                       let coverImage = takeFileName img+                       let fp = takeFileName img+                       mediaPaths <- gets (map (fst . snd) . stMediaPaths)+                       coverImageName <-  -- see #4206+                            if ("media/" <> fp) `elem` mediaPaths+                               then getMediaNextNewName (takeExtension fp)+                               else return fp                        imgContent <- lift $ P.readFileLazy img                        (coverImageWidth, coverImageHeight) <-                              case imageSize opts' (B.toStrict imgContent) of@@ -478,7 +483,7 @@                                     ("coverpage", toVal' "true"),                                     ("pagetitle", toVal $                                       escapeStringForXML $ TS.pack plainTitle),-                                    ("cover-image", toVal' coverImage),+                                    ("cover-image", toVal' coverImageName),                                     ("cover-image-width", toVal' $                                        show coverImageWidth),                                     ("cover-image-height", toVal' $@@ -486,7 +491,7 @@                                      cssvars True <> vars }                             (Pandoc meta [])                        coverEntry <- mkEntry "text/cover.xhtml" cpContent-                       coverImageEntry <- mkEntry ("media/" ++ coverImage)+                       coverImageEntry <- mkEntry ("media/" ++ coverImageName)                                              imgContent                        return ( [ coverEntry ]                               , [ coverImageEntry ] )@@ -557,6 +562,20 @@   let extractLinkURL' :: Int -> Inline -> [(TS.Text, TS.Text)]       extractLinkURL' num (Span (ident, _, _) _)         | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]+      extractLinkURL' num (Link (ident, _, _) _ _)+        | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]+      extractLinkURL' num (Image (ident, _, _) _ _)+        | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]+      extractLinkURL' num (RawInline fmt raw)+        | isHtmlFormat fmt+        = foldr (\tag ->+                   case tag of+                     TagOpen{} ->+                       case fromAttrib "id" tag of+                         "" -> id+                         x  -> ((x, TS.pack (showChapter num) <> "#" <> x):)+                     _ -> id)+            [] (parseTags raw)       extractLinkURL' _ _ = []    let extractLinkURL :: Int -> Block -> [(TS.Text, TS.Text)]@@ -564,6 +583,18 @@         | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]       extractLinkURL num (Header _ (ident, _, _) _)         | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]+      extractLinkURL num (Table (ident,_,_) _ _ _ _ _)+        | not (TS.null ident) = [(ident, TS.pack (showChapter num) <> "#" <> ident)]+      extractLinkURL num (RawBlock fmt raw)+        | isHtmlFormat fmt+        = foldr (\tag ->+                   case tag of+                     TagOpen{} ->+                       case fromAttrib "id" tag of+                         "" -> id+                         x  -> ((x, TS.pack (showChapter num) <> "#" <> x):)+                     _ -> id)+            [] (parseTags raw)       extractLinkURL num b = query (extractLinkURL' num) b    let reftable = concat $ zipWith (\(Chapter bs) num ->@@ -1050,14 +1081,19 @@ getMediaNextNewName ext = do   nextId <- gets stMediaNextId   modify $ \st -> st { stMediaNextId = nextId + 1 }-  let nextName = "file" ++ show nextId ++ ext-  (P.fetchItem (TS.pack nextName) >> getMediaNextNewName ext) `catchError` const (return nextName)+  return $ "file" ++ show nextId ++ ext +isHtmlFormat :: Format -> Bool+isHtmlFormat (Format "html") = True+isHtmlFormat (Format "html4") = True+isHtmlFormat (Format "html5") = True+isHtmlFormat _ = False+ transformBlock  :: PandocMonad m                 => Block                 -> E m Block transformBlock (RawBlock fmt raw)-  | fmt == Format "html" = do+  | isHtmlFormat fmt = do   let tags = parseTags raw   tags' <- mapM transformTag tags   return $ RawBlock fmt (renderTags' tags')@@ -1077,7 +1113,7 @@     return $ Span ("",["math",mathclass],[])                 [Image nullAttr [x] ("../" <> newsrc, "")] transformInline _opts (RawInline fmt raw)-  | fmt == Format "html" = do+  | isHtmlFormat fmt = do   let tags = parseTags raw   tags' <- mapM transformTag tags   return $ RawInline fmt (renderTags' tags')
src/Text/Pandoc/Writers/FB2.hs view
@@ -3,7 +3,7 @@ {- | Module      : Text.Pandoc.Writers.FB2 Copyright   : Copyright (C) 2011-2012 Sergey Astanin-                            2012-2020 John MacFarlane+                            2012-2021 John MacFarlane License     : GNU GPL, version 2 or above  Maintainer  : John MacFarlane
src/Text/Pandoc/Writers/HTML.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE ViewPatterns        #-} {- |    Module      : Text.Pandoc.Writers.HTML-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -1455,11 +1455,15 @@                     else let lastBlock   = last blocks                              otherBlocks = init blocks                          in  case lastBlock of-                                  (Para lst)  -> otherBlocks +++                                  Para [Image _ _ (_,tit)]+                                      | "fig:" `T.isPrefixOf` tit+                                            -> otherBlocks ++ [lastBlock,+                                                  Plain backlink]+                                  Para lst  -> otherBlocks ++                                                  [Para (lst ++ backlink)]-                                  (Plain lst) -> otherBlocks +++                                  Plain lst -> otherBlocks ++                                                  [Plain (lst ++ backlink)]-                                  _           -> otherBlocks ++ [lastBlock,+                                  _         -> otherBlocks ++ [lastBlock,                                                  Plain backlink]   contents <- blockListToHtml opts blocks'   let noteItem = H.li ! prefixedId opts ("fn" <> ref) $ contents
src/Text/Pandoc/Writers/Ipynb.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Text.Pandoc.Writers.Ipynb-   Copyright   : Copyright (C) 2019-2020 John MacFarlane+   Copyright   : Copyright (C) 2019-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/JATS.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ViewPatterns #-} {- |    Module      : Text.Pandoc.Writers.JATS-   Copyright   : Copyright (C) 2017-2020 John MacFarlane+   Copyright   : 2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -29,6 +29,7 @@ import Data.Time (toGregorian, Day, parseTimeM, defaultTimeLocale, formatTime) import qualified Data.Text as T import Data.Text (Text)+import Text.Pandoc.Citeproc (getReferences) import Text.Pandoc.Class.PandocMonad (PandocMonad, report) import Text.Pandoc.Definition import Text.Pandoc.Highlighting (languages, languagesByExtension)@@ -40,6 +41,7 @@ import Text.Pandoc.Shared import Text.Pandoc.Templates (renderTemplate) import Text.DocTemplates (Context(..), Val(..))+import Text.Pandoc.Writers.JATS.References (referencesToJATS) import Text.Pandoc.Writers.JATS.Table (tableToJATS) import Text.Pandoc.Writers.JATS.Types import Text.Pandoc.Writers.Math@@ -71,15 +73,19 @@  -- | Convert a @'Pandoc'@ document to JATS. writeJats :: PandocMonad m => JATSTagSet -> WriterOptions -> Pandoc -> m Text-writeJats tagSet opts d =-  runReaderT (evalStateT (docToJATS opts d) initialState)-             environment-  where initialState = JATSState { jatsNotes = [] }-        environment = JATSEnv+writeJats tagSet opts d = do+  refs <- if extensionEnabled Ext_element_citations $ writerExtensions opts+          then getReferences Nothing d+          else pure []+  let environment = JATSEnv           { jatsTagSet = tagSet           , jatsInlinesWriter = inlinesToJATS           , jatsBlockWriter = blockToJATS+          , jatsReferences = refs           }+  let initialState = JATSState { jatsNotes = [] }+  runReaderT (evalStateT (docToJATS opts d) initialState)+             environment  -- | Convert Pandoc document to string in JATS format. docToJATS :: PandocMonad m => WriterOptions -> Pandoc -> JATS m Text@@ -156,9 +162,11 @@     wrappedBlockToJATS b = do       inner <- blockToJATS opts b       return $-        if needsWrap b+        if needsWrap b || isBlockQuote b -- see #7041            then inTags True "p" [("specific-use","wrapper")] inner            else inner+    isBlockQuote (BlockQuote _) = True+    isBlockQuote _ = False  -- | Auxiliary function to convert Plain block to Para. plainToPara :: Block -> Block@@ -168,13 +176,15 @@ -- | Convert a list of pairs of terms and definitions into a list of -- JATS varlistentrys. deflistItemsToJATS :: PandocMonad m-                      => WriterOptions -> [([Inline],[[Block]])] -> JATS m (Doc Text)+                   => WriterOptions+                   -> [([Inline],[[Block]])] -> JATS m (Doc Text) deflistItemsToJATS opts items =   vcat <$> mapM (uncurry (deflistItemToJATS opts)) items  -- | Convert a term and a list of blocks into a JATS varlistentry. deflistItemToJATS :: PandocMonad m-                     => WriterOptions -> [Inline] -> [[Block]] -> JATS m (Doc Text)+                  => WriterOptions+                  -> [Inline] -> [[Block]] -> JATS m (Doc Text) deflistItemToJATS opts term defs = do   term' <- inlinesToJATS opts term   def' <- wrappedBlocksToJATS (not . isPara)@@ -186,7 +196,8 @@  -- | Convert a list of lists of blocks to a list of JATS list items. listItemsToJATS :: PandocMonad m-                => WriterOptions -> Maybe [Text] -> [[Block]] -> JATS m (Doc Text)+                => WriterOptions+                -> Maybe [Text] -> [[Block]] -> JATS m (Doc Text) listItemsToJATS opts markers items =   case markers of        Nothing -> vcat <$> mapM (listItemToJATS opts Nothing) items@@ -194,12 +205,13 @@  -- | Convert a list of blocks into a JATS list item. listItemToJATS :: PandocMonad m-               => WriterOptions -> Maybe Text -> [Block] -> JATS m (Doc Text)+               => WriterOptions+               -> Maybe Text -> [Block] -> JATS m (Doc Text) listItemToJATS opts mbmarker item = do   contents <- wrappedBlocksToJATS (not . isParaOrList) opts                  (walk demoteHeaderAndRefs item)   return $ inTagsIndented "list-item" $-           maybe empty (\lbl -> inTagsSimple "label" (text $ T.unpack lbl)) mbmarker+           maybe empty (inTagsSimple "label" . text . T.unpack) mbmarker            $$ contents  imageMimeType :: Text -> [(Text, Text)] -> (Text, Text)@@ -247,10 +259,15 @@   return $ inTags True "sec" attribs $       inTagsSimple "title" title' $$ contents -- Bibliography reference:-blockToJATS opts (Div (T.stripPrefix "ref-" -> Just _,_,_) [Para lst]) =+blockToJATS opts (Div (ident,_,_) [Para lst]) | "ref-" `T.isPrefixOf` ident =+  inTags True "ref" [("id", ident)] .+  inTagsSimple "mixed-citation" <$>   inlinesToJATS opts lst blockToJATS opts (Div ("refs",_,_) xs) = do-  contents <- blocksToJATS opts xs+  refs <- asks jatsReferences+  contents <- if null refs+              then blocksToJATS opts xs+              else referencesToJATS opts refs   return $ inTagsIndented "ref-list" contents blockToJATS opts (Div (ident,[cls],kvs) bs) | cls `elem` ["fig", "caption", "table-wrap"] = do   contents <- blocksToJATS opts bs@@ -470,10 +487,13 @@   | escapeURI t == email =   return $ inTagsSimple "email" $ literal (escapeStringForXML email) inlineToJATS opts (Link (ident,_,kvs) txt (T.uncons -> Just ('#', src), _)) = do-  let attr = [("id", ident) | not (T.null ident)] ++-             [("alt", stringify txt) | not (null txt)] ++-             [("rid", src)] ++-             [(k,v) | (k,v) <- kvs, k `elem` ["ref-type", "specific-use"]]+  let attr = mconcat+             [ [("id", ident) | not (T.null ident)]+             , [("alt", stringify txt) | not (null txt)]+             , [("rid", src)]+             , [(k,v) | (k,v) <- kvs, k `elem` ["ref-type", "specific-use"]]+             , [("ref-type", "bibr") | "ref-" `T.isPrefixOf` src]+             ]   if null txt      then return $ selfClosingTag "xref" attr      else do@@ -529,7 +549,7 @@ demoteHeaderAndRefs x = x  parseDate :: Text -> Maybe Day-parseDate s = msum (map (\fs -> parsetimeWith fs $ T.unpack s) formats) :: Maybe Day+parseDate s = msum (map (`parsetimeWith` T.unpack s) formats)   where parsetimeWith = parseTimeM True defaultTimeLocale         formats = ["%x","%m/%d/%Y", "%D","%F", "%d %b %Y",                     "%e %B %Y", "%b. %e, %Y", "%B %e, %Y",
+ src/Text/Pandoc/Writers/JATS/References.hs view
@@ -0,0 +1,160 @@+{-# LANGUAGE LambdaCase        #-}+{-# LANGUAGE OverloadedStrings #-}+{- |+   Module      : Text.Pandoc.Writers.JATS.References+   Copyright   : © 2021 Albert Krewinkel+   License     : GNU GPL, version 2 or above++   Maintainer  : Albert Krewinkel <tarleb@zeitkraut.de>+   Stability   : alpha+   Portability : portable++Creation of a bibliography list using @<element-citation>@ elements in+reference items.+-}+module Text.Pandoc.Writers.JATS.References+  ( referencesToJATS+  , referenceToJATS+  ) where++import Citeproc.Pandoc ()+import Citeproc.Types+  ( Date (..), DateParts (..), ItemId (..), Name (..), Reference (..)+  , Val (..) , lookupVariable, valToText+  )+import Data.Text (Text)+import Text.DocLayout (Doc, empty, isEmpty, literal, vcat)+import Text.Pandoc.Class.PandocMonad (PandocMonad)+import Text.Pandoc.Builder (Inlines)+import Text.Pandoc.Options (WriterOptions)+import Text.Pandoc.Shared (tshow)+import Text.Pandoc.Writers.JATS.Types+import Text.Pandoc.XML (inTags)+import qualified Data.Text as T++referencesToJATS :: PandocMonad m+                 => WriterOptions+                 -> [Reference Inlines]+                 -> JATS m (Doc Text)+referencesToJATS opts =+  fmap (inTags True "ref-list" [] . vcat) . mapM (referenceToJATS opts)++referenceToJATS :: PandocMonad m+                => WriterOptions+                -> Reference Inlines+                -> JATS m (Doc Text)+referenceToJATS _opts ref = do+  let refType = referenceType ref+  let pubType = [("publication-type", refType) | not (T.null refType)]+  let wrap = inTags True "ref" [("id", "ref-" <> unItemId (referenceId ref))]+           . inTags True "element-citation" pubType+  return . wrap . vcat $+    [ authors+    , "title" `varInTag`+      if refType == "book"+      then "source"+      else "article-title"+    , if refType == "book"+      then empty+      else "container-title" `varInTag` "source"+    , editors+    , "publisher"       `varInTag` "publisher-name"+    , "publisher-place" `varInTag` "publisher-loc"+    , yearTag+    , accessed+    , "volume"          `varInTag` "volume"+    , "issue"           `varInTag` "issue"+    , "page-first"      `varInTag` "fpage"+    , "page-last"       `varInTag` "lpage"+    , "pages"           `varInTag` "page-range"+    , "ISBN"            `varInTag` "isbn"+    , "ISSN"            `varInTag` "issn"+    , varInTagWith "doi"  "pub-id" [("pub-id-type", "doi")]+    , varInTagWith "pmid" "pub-id" [("pub-id-type", "pmid")]+    ]+  where+    varInTag var tagName = varInTagWith var tagName []++    varInTagWith var tagName tagAttribs =+      case lookupVariable var ref >>= valToText of+        Nothing  -> mempty+        Just val -> inTags' tagName tagAttribs $ literal val++    authors = case lookupVariable "author" ref of+      Just (NamesVal names) ->+        inTags True "person-group" [("person-group-type", "author")] . vcat $+        map toNameElements names+      _                     -> empty++    editors = case lookupVariable "editor" ref of+      Just (NamesVal names) ->+        inTags True "person-group" [("person-group-type", "editor")] . vcat $+        map toNameElements names+      _                     -> empty++    yearTag =+      case lookupVariable "issued" ref of+        Just (DateVal date) -> toDateElements date+        _ -> empty++    accessed =+      case lookupVariable "accessed" ref of+        Just (DateVal d) -> inTags' "date-in-citation"+                                    [("content-type", "access-date")]+                                    (toDateElements d)+        _ -> empty++toDateElements :: Date -> Doc Text+toDateElements date =+  case dateParts date of+    dp@(DateParts (y:m:d:_)):_ -> yearElement y dp <>+                                  monthElement m <>+                                  dayElement d+    dp@(DateParts (y:m:_)):_   -> yearElement y dp <> monthElement m+    dp@(DateParts (y:_)):_     -> yearElement y dp+    _                          -> empty++yearElement :: Int -> DateParts -> Doc Text+yearElement year dp =+  inTags' "year" [("iso-8601-date", iso8601 dp)] $ literal (fourDigits year)++monthElement :: Int -> Doc Text+monthElement month = inTags' "month" [] . literal $ twoDigits month++dayElement :: Int -> Doc Text+dayElement day = inTags' "day" [] . literal $ twoDigits day++iso8601 :: DateParts -> Text+iso8601 = T.intercalate "-" . \case+  DateParts (y:m:d:_) -> [fourDigits y, twoDigits m, twoDigits d]+  DateParts (y:m:_)   -> [fourDigits y, twoDigits m]+  DateParts (y:_)     -> [fourDigits y]+  _                   -> []++twoDigits :: Int -> Text+twoDigits n = T.takeEnd 2 $ '0' `T.cons` tshow n++fourDigits :: Int -> Text+fourDigits n = T.takeEnd 4 $ "000" <> tshow n++toNameElements :: Name -> Doc Text+toNameElements name =+  if not (isEmpty nameTags)+  then inTags' "name" [] nameTags+  else nameLiteral name `inNameTag` "string-name"+    where+      inNameTag val tag = maybe empty (inTags' tag [] . literal) val+      surnamePrefix = maybe mempty (`T.snoc` ' ') $+                      nameNonDroppingParticle name+      givenSuffix = maybe mempty (T.cons ' ') $+                    nameDroppingParticle name+      nameTags = mconcat+        [ ((surnamePrefix <>) <$> nameFamily name) `inNameTag` "surname"+        , ((<> givenSuffix) <$> nameGiven name) `inNameTag` "given-names"+        , nameSuffix name `inNameTag` "suffix"+        ]++-- | Put the supplied contents between start and end tags of tagType,+--   with specified attributes.+inTags' :: Text -> [(Text, Text)] -> Doc Text -> Doc Text+inTags' = inTags False
src/Text/Pandoc/Writers/JATS/Table.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE TupleSections #-} {- |    Module      : Text.Pandoc.Writers.JATS.Table-   Copyright   : © 2020 Albert Krewinkel+   Copyright   : © 2020-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb@zeitkraut.de>
src/Text/Pandoc/Writers/JATS/Types.hs view
@@ -1,6 +1,6 @@ {- |    Module      : Text.Pandoc.Writers.JATS.Types-   Copyright   : Copyright (C) 2017-2020 John MacFarlane+   Copyright   : Copyright (C) 2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -17,11 +17,12 @@   ) where +import Citeproc.Types (Reference) import Control.Monad.Reader (ReaderT) import Control.Monad.State (StateT) import Data.Text (Text) import Text.DocLayout (Doc)-import Text.Pandoc.Definition (Block, Inline)+import Text.Pandoc.Builder (Block, Inline, Inlines) import Text.Pandoc.Options (WriterOptions)  -- | JATS tag set variant@@ -40,6 +41,7 @@   { jatsTagSet :: JATSTagSet   , jatsInlinesWriter :: WriterOptions -> [Inline] -> JATS m (Doc Text)   , jatsBlockWriter   :: WriterOptions -> Block    -> JATS m (Doc Text)+  , jatsReferences    :: [Reference Inlines]   }  -- | JATS writer type
src/Text/Pandoc/Writers/Jira.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE PatternGuards #-} {- |    Module      : Text.Pandoc.Writers.Jira-   Copyright   : © 2010-2020 Albert Krewinkel, John MacFarlane+   Copyright   : © 2010-2021 Albert Krewinkel, John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -5,7 +5,7 @@ {-# LANGUAGE ViewPatterns        #-} {- |    Module      : Text.Pandoc.Writers.LaTeX-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/LaTeX/Caption.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.LaTeX.Caption-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/LaTeX/Notes.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.LaTeX.Notes-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/LaTeX/Table.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.LaTeX.Table-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -169,7 +169,7 @@            -> LW m (Doc Text) rowToLaTeX blocksWriter celltype row = do   cellsDocs <- mapM (cellToLaTeX blocksWriter celltype) (fillRow row)-  return $ hsep (intersperse "&" cellsDocs) <> " \\\\ \\addlinespace"+  return $ hsep (intersperse "&" cellsDocs) <> " \\\\"  -- | Pads row with empty cells to adjust for rowspans above this row. fillRow :: [Ann.Cell] -> [Ann.Cell]
src/Text/Pandoc/Writers/Man.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.Man-   Copyright   : Copyright (C) 2007-2020 John MacFarlane+   Copyright   : Copyright (C) 2007-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Markdown.hs view
@@ -5,7 +5,7 @@ {-# LANGUAGE ViewPatterns        #-} {- |    Module      : Text.Pandoc.Writers.Markdown-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -494,25 +494,24 @@   let renderEmpty = mempty <$ report (BlockNotRendered b)   case variant of     PlainText -> renderEmpty-    _ | f `elem` ["markdown", "markdown_github", "markdown_phpextra",-                  "markdown_mmd", "markdown_strict"] ->-            return $ literal str <> literal "\n"-      | isEnabled Ext_raw_attribute opts -> rawAttribBlock-      | f `elem` ["html", "html5", "html4"] ->-            case () of-              _ | isEnabled Ext_markdown_attribute opts -> return $-                    literal (addMarkdownAttribute str) <> literal "\n"-                | isEnabled Ext_raw_html opts -> return $-                    literal str <> literal "\n"-                | isEnabled Ext_raw_attribute opts -> rawAttribBlock-                | otherwise -> renderEmpty-      | f `elem` ["latex", "tex"] ->-            case () of-              _ | isEnabled Ext_raw_tex opts -> return $-                    literal str <> literal "\n"-                | isEnabled Ext_raw_attribute opts -> rawAttribBlock-                | otherwise -> renderEmpty-      | otherwise -> renderEmpty+    Commonmark+      | f `elem` ["gfm", "commonmark", "commonmark_x", "markdown"]+         -> return $ literal str <> literal "\n"+    Markdown+      | f `elem` ["markdown", "markdown_github", "markdown_phpextra",+                  "markdown_mmd", "markdown_strict"]+         -> return $ literal str <> literal "\n"+    _ | isEnabled Ext_raw_attribute opts -> rawAttribBlock+      | f `elem` ["html", "html5", "html4"]+      , isEnabled Ext_markdown_attribute opts+         -> return $ literal (addMarkdownAttribute str) <> literal "\n"+      | f `elem` ["html", "html5", "html4"]+      , isEnabled Ext_raw_html opts+         -> return $ literal str <> literal "\n"+      | f `elem` ["latex", "tex"]+      , isEnabled Ext_raw_tex opts+         -> return $ literal str <> literal "\n"+    _ -> renderEmpty blockToMarkdown' opts HorizontalRule =   return $ blankline <> literal (T.replicate (writerColumns opts) "-") <> blankline blockToMarkdown' opts (Header level attr inlines) = do@@ -674,7 +673,10 @@   contents <- inList $ mapM (bulletListItemToMarkdown opts) items   return $ (if isTightList items then vcat else vsep) contents <> blankline blockToMarkdown' opts (OrderedList (start,sty,delim) items) = do-  let start' = if isEnabled Ext_startnum opts then start else 1+  variant <- asks envVariant+  let start' = if variant == Commonmark || isEnabled Ext_startnum opts+                  then start+                  else 1   let sty'   = if isEnabled Ext_fancy_lists opts then sty else DefaultStyle   let delim' = if isEnabled Ext_fancy_lists opts then delim else DefaultDelim   let attribs = (start', sty', delim')@@ -1247,21 +1249,23 @@   let renderEmpty = mempty <$ report (InlineNotRendered il)   case variant of     PlainText -> renderEmpty-    _ | f `elem` ["markdown", "markdown_github", "markdown_phpextra",-                  "markdown_mmd", "markdown_strict"] ->-            return $ literal str-      | isEnabled Ext_raw_attribute opts -> rawAttribInline-      | f `elem` ["html", "html5", "html4"] ->-            case () of-              _ | isEnabled Ext_raw_html opts -> return $ literal str-                | isEnabled Ext_raw_attribute opts -> rawAttribInline-                | otherwise -> renderEmpty-      | f `elem` ["latex", "tex"] ->-            case () of-              _ | isEnabled Ext_raw_tex opts -> return $ literal str-                | isEnabled Ext_raw_attribute opts -> rawAttribInline-                | otherwise -> renderEmpty-      | otherwise -> renderEmpty+    Commonmark+      | f `elem` ["gfm", "commonmark", "commonmark_x", "markdown"]+         -> return $ literal str+    Markdown+      | f `elem` ["markdown", "markdown_github", "markdown_phpextra",+                  "markdown_mmd", "markdown_strict"]+         -> return $ literal str+    _ | isEnabled Ext_raw_attribute opts -> rawAttribInline+      | f `elem` ["html", "html5", "html4"]+      , isEnabled Ext_raw_html opts+         -> return $ literal str+      | f `elem` ["latex", "tex"]+      , isEnabled Ext_raw_tex opts+         -> return $ literal str+    _ -> renderEmpty++ inlineToMarkdown opts LineBreak = do   variant <- asks envVariant   if variant == PlainText || isEnabled Ext_hard_line_breaks opts
src/Text/Pandoc/Writers/MediaWiki.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.MediaWiki-   Copyright   : Copyright (C) 2008-2020 John MacFarlane+   Copyright   : Copyright (C) 2008-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Ms.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.Ms-   Copyright   : Copyright (C) 2007-2020 John MacFarlane+   Copyright   : Copyright (C) 2007-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -263,8 +263,10 @@                          return $ makeRow cols) rows   setFirstPara   return $ literal ".PP" $$ caption' $$+           literal ".na" $$ -- we don't want justification in table cells            literal ".TS" $$ literal "delim(@@) tab(\t);" $$ coldescriptions $$-           colheadings' $$ vcat body $$ literal ".TE"+           colheadings' $$ vcat body $$ literal ".TE" $$+           literal ".ad"  blockToMs opts (BulletList items) = do   contents <- mapM (bulletListItemToMs opts) items
src/Text/Pandoc/Writers/Native.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.Native-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/ODT.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings   #-} {- |    Module      : Text.Pandoc.Writers.ODT-   Copyright   : Copyright (C) 2008-2020 John MacFarlane+   Copyright   : Copyright (C) 2008-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/OOXML.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.OOXML-   Copyright   : Copyright (C) 2012-2020 John MacFarlane+   Copyright   : Copyright (C) 2012-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/OPML.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE CPP               #-} {- |    Module      : Text.Pandoc.Writers.OPML-   Copyright   : Copyright (C) 2013-2020 John MacFarlane+   Copyright   : Copyright (C) 2013-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Org.hs view
@@ -3,8 +3,8 @@ {- |    Module      : Text.Pandoc.Writers.Org    Copyright   : © 2010-2015 Puneeth Chaganti <punchagan@gmail.com>-                   2010-2020 John MacFarlane <jgm@berkeley.edu>-                   2016-2020 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>+                   2010-2021 John MacFarlane <jgm@berkeley.edu>+                   2016-2021 Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
src/Text/Pandoc/Writers/RST.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.RST-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>@@ -519,8 +519,8 @@           (Quoted _ _, _)          -> keep f i           (_, Quoted _ _)          -> keep f i           -- spans are not rendered using RST inlines, so we can keep them-          (Span ("",[],[]) _, _)   -> keep f i-          (_, Span ("",[],[]) _)   -> keep f i+          (Span (_,_,[]) _, _)   -> keep f i+          (_, Span (_,_,[]) _)   -> keep f i           -- inlineToRST handles this case properly so it's safe to keep           ( Link{}, Image{})       -> keep f i           -- parent inlines would prevent links from being correctly
src/Text/Pandoc/Writers/RTF.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings   #-} {- |    Module      : Text.Pandoc.Writers.RTF-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Roff.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.Roff-   Copyright   : Copyright (C) 2007-2020 John MacFarlane+   Copyright   : Copyright (C) 2007-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Shared.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.Shared-   Copyright   : Copyright (C) 2013-2020 John MacFarlane+   Copyright   : Copyright (C) 2013-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/TEI.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE PatternGuards     #-} {- |    Module      : Text.Pandoc.Writers.Docbook-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/Texinfo.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Text.Pandoc.Writers.Texinfo-   Copyright   : Copyright (C) 2008-2020 John MacFarlane+   Copyright   : Copyright (C) 2008-2021 John MacFarlane                                2012 Peter Wang    License     : GNU GPL, version 2 or above 
src/Text/Pandoc/Writers/Textile.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.Textile-   Copyright   : Copyright (C) 2010-2020 John MacFarlane+   Copyright   : Copyright (C) 2010-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
src/Text/Pandoc/Writers/ZimWiki.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.Writers.ZimWiki-   Copyright   : © 2008-2020 John MacFarlane,+   Copyright   : © 2008-2021 John MacFarlane,                    2017-2019 Alex Ivkin    License     : GNU GPL, version 2 or above 
src/Text/Pandoc/XML.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ViewPatterns      #-} {- |    Module      : Text.Pandoc.XML-   Copyright   : Copyright (C) 2006-2020 John MacFarlane+   Copyright   : Copyright (C) 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
stack.yaml view
@@ -13,15 +13,15 @@ - hslua-1.1.2 - jira-wiki-markup-1.3.2 - HsYAML-aeson-0.2.0.0-- commonmark-0.1.1.2+- commonmark-0.1.1.3 - commonmark-extensions-0.2.0.4 - commonmark-pandoc-0.2.0.1 - doctemplates-0.9-- citeproc-0.3.0.3 - texmath-0.12.1+- citeproc-0.3.0.5 # - citeproc: #   git: https://github.com/jgm/citeproc.git-#   commit: a8193fe375fa2354049bf9a967ba3bad4b1ba053+#   commit: d44e24696ab444090d0e63e321c3a573f68b2e74 ghc-options:    "$locals": -fhide-source-paths -Wno-missing-home-modules resolver: lts-16.23
test/Tests/Command.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {- |    Module      : Tests.Command-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
test/Tests/Helpers.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE FlexibleInstances    #-} {- |    Module      : Tests.Helpers-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
test/Tests/Lua.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Tests.Lua-   Copyright   : © 2017-2020 Albert Krewinkel+   Copyright   : © 2017-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Lua/Module.hs view
@@ -1,6 +1,6 @@ {- | Module      : Tests.Lua.Module-Copyright   : © 2019-2020 Albert Krewinkel+Copyright   : © 2019-2021 Albert Krewinkel License     : GNU GPL, version 2 or above  Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Old.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {- |    Module      : Tests.Old-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
test/Tests/Readers/Creole.hs view
@@ -3,7 +3,7 @@ {- |    Module      : Tests.Readers.Creole    Copyright   : © 2017 Sascha Wilde-                   2017-2020 John MacFarlane+                   2017-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : Sascha Wilde <wilde@sha-bang.de>
test/Tests/Readers/EPUB.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE NoImplicitPrelude #-} {- |    Module      : Tests.Readers.EPUB-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.eu>
test/Tests/Readers/HTML.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.HTML-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
test/Tests/Readers/Jira.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Tests.Readers.Jira-   Copyright   : © 2019-2020 Albert Krewinel+   Copyright   : © 2019-2021 Albert Krewinel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <tarleb@zeitkraut.de>
test/Tests/Readers/LaTeX.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.LaTeX-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
test/Tests/Readers/Man.hs view
@@ -2,7 +2,7 @@ {- |    Module      : Tests.Readers.Man    Copyright   : © 2018-2019 Yan Pas <yanp.bugz@gmail.com>,-                   2018-2020 John MacFarlane+                   2018-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
test/Tests/Readers/Markdown.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Markdown-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
test/Tests/Readers/Odt.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Odt-   Copyright   : © 2015-2020 John MacFarlane+   Copyright   : © 2015-2021 John MacFarlane                    2015 Martin Linnemann    License     : GNU GPL, version 2 or above 
test/Tests/Readers/Org.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Shared-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Block.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Block-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Block/CodeBlock.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Block.CodeBlock-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>@@ -185,10 +185,10 @@                 , "#+end_src"                 ] =?>       divWith-         nullAttr+         ("", ["captioned-content"], [] )          (mappend-          (plain $ spanWith ("", ["label"], [])-                            (spcSep [ "Functor", "laws", "in", "Haskell" ]))+          (divWith ("", ["caption"], []) $+           plain (spcSep [ "Functor", "laws", "in", "Haskell" ]))           (codeBlockWith ("functor-laws", ["haskell"], [])                          (T.unlines [ "fmap id = id"                                     , "fmap (p . q) = (fmap p) . (fmap q)"
test/Tests/Readers/Org/Block/Figure.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Block.Figure-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Block/Header.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Block.Header-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Block/List.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Block.Header-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Block/Table.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Block.Table-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Directive.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Directive-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Inline.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Inline-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>@@ -56,7 +56,7 @@    , "Verbatim" =:       "=Robot.rock()=" =?>-      para (code "Robot.rock()")+      para (codeWith ("", ["verbatim"], []) "Robot.rock()")    , "Code" =:       "~word for word~" =?>@@ -190,7 +190,7 @@                   ])   , "Verbatim text can contain equal signes (=)" =:       "=is_subst = True=" =?>-      para (code "is_subst = True")+      para (codeWith ("", ["verbatim"], []) "is_subst = True")    , testGroup "Images"     [ "Image" =:
test/Tests/Readers/Org/Inline/Citation.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Inline.Citation-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Inline/Note.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Inline.Note-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Inline/Smart.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Inline.Smart-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/Org/Meta.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Meta-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>@@ -115,6 +115,16 @@     , "Document language" =:       "#+LANGUAGE: de-DE" =?>       Pandoc (setMeta "lang" (MetaString "de-DE") nullMeta) mempty++    , testGroup "Todo sequences"+      [ "not included in document" =:+        "#+todo: WAITING | FINISHED" =?>+        Pandoc mempty mempty++      , "can contain multiple pipe characters" =:+        "#+todo: UNFINISHED | RESEARCH | NOTES | CHART\n" =?>+        Pandoc mempty mempty+      ]      , testGroup "LaTeX"       [ "LATEX_HEADER" =:
test/Tests/Readers/Org/Shared.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Org.Shared-   Copyright   : © 2014-2020 Albert Krewinkel+   Copyright   : © 2014-2021 Albert Krewinkel    License     : GNU GPL, version 2 or above     Maintainer  : Albert Krewinkel <albert@zeitkraut.de>
test/Tests/Readers/RST.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {- |    Module      : Tests.Readers.RST-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>
test/Tests/Readers/Txt2Tags.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Readers.Txt2Tags-   Copyright   : © 2014-2020 John MacFarlane,+   Copyright   : © 2014-2021 John MacFarlane,                  © 2014 Matthew Pickering    License     : GNU GPL, version 2 or above 
test/Tests/Shared.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Tests.Shared-   Copyright   : © 2006-2020 John MacFarlane+   Copyright   : © 2006-2021 John MacFarlane    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley@edu>
test/command/2378.md view
@@ -14,14 +14,14 @@ \begin{longtable}[]{@{}ll@{}} \caption{a table}\tabularnewline \toprule-x & y\footnote{a footnote} \\ \addlinespace+x & y\footnote{a footnote} \\ \midrule \endfirsthead \toprule-x & y{} \\ \addlinespace+x & y{} \\ \midrule \endhead-1 & 2 \\ \addlinespace+1 & 2 \\ \bottomrule \end{longtable} ```
test/command/3516.md view
@@ -29,11 +29,7 @@  [(AlignDefault,ColWidth 5.555555555555555e-2)  ,(AlignDefault,ColWidth 5.555555555555555e-2)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])
test/command/5367.md view
@@ -24,14 +24,14 @@   >{\centering\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{0.17}}@{}} \caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline \toprule-Fruit\footnote{header footnote} \\ \addlinespace+Fruit\footnote{header footnote} \\ \midrule \endfirsthead \toprule-Fruit{} \\ \addlinespace+Fruit{} \\ \midrule \endhead-Bans\footnote{table cell footnote} \\ \addlinespace+Bans\footnote{table cell footnote} \\ \bottomrule \end{longtable} 
test/command/5708.md view
@@ -9,11 +9,7 @@  [(AlignDefault,ColWidth 0.125)  ,(AlignDefault,ColWidth 0.2361111111111111)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])
+ test/command/6993.md view
@@ -0,0 +1,21 @@+```+% pandoc -f mediawiki -t native+'''Should be bold '''+^D+[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]]+```++```+% pandoc -f mediawiki -t native+''' Should be bold'''+^D+[Para [Strong [Str "Should",Space,Str "be",Space,Str "bold"]]]+```++```+% pandoc -f mediawiki -t native+'' Should be emph ''+^D+[Para [Emph [Str "Should",Space,Str "be",Space,Str "emph"]]]+```+
+ test/command/7003.md view
@@ -0,0 +1,37 @@+```+% pandoc -f latex -t native+\documentclass{article}+\usepackage{listings}++\lstset{basicstyle=\ttfamily}++\begin{filecontents*}[overwrite]{example.tex}+\documentclass{article}+\begin{document}+\section{Bar}+This a Bar section+\end{document}+\end{filecontents*}++\begin{document}++\section{With lstlisting environment}++\begin{lstlisting}+\documentclass{article}+\begin{document}+\section{Foo}+This a Foo section+\end{document}+\end{lstlisting}++\section{With lstinputlisting command}++\lstinputlisting{example.tex}+\end{document}+^D+[Header 1 ("with-lstlisting-environment",[],[]) [Str "With",Space,Str "lstlisting",Space,Str "environment"]+,CodeBlock ("",[],[]) "\\documentclass{article}\n\\begin{document}\n\\section{Foo}\nThis a Foo section\n\\end{document}"+,Header 1 ("with-lstinputlisting-command",[],[]) [Str "With",Space,Str "lstinputlisting",Space,Str "command"]+,CodeBlock ("",["latex"],[]) "\\documentclass{article}\n\\begin{document}\n\\section{Bar}\nThis a Bar section\n\\end{document}"]+```
+ test/command/7006.md view
@@ -0,0 +1,20 @@+```+% pandoc -t html+Test.[^fn]++[^fn]: Foo:++    ![Caption.](/image.jpg)+^D+<p>Test.<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>+<section class="footnotes" role="doc-endnotes">+<hr />+<ol>+<li id="fn1" role="doc-endnote"><p>Foo:</p>+<figure>+<img src="/image.jpg" alt="Caption." /><figcaption aria-hidden="true">Caption.</figcaption>+</figure>+<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></li>+</ol>+</section>+```
+ test/command/7009.md view
@@ -0,0 +1,8 @@+```+% pandoc -t gfm+3. a+4. b+^D+3.  a+4.  b+```
+ test/command/7016.md view
@@ -0,0 +1,48 @@+```+% pandoc --citeproc --to=jats_archiving --standalone+---+csl: command/apa.csl+references:+- id: doe+  type: article+  author:+  - family: Doe+    given: Jane+  container-title: Proceedings of the Academy of Test Inputs+  doi: 10.x/nope+  issued: 2021+  title: Another article+...+Blah [@doe].+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<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">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+</article-meta>+</front>+<body>+<p>Blah (Doe, 2021).</p>+</body>+<back>+<ref-list>+  <ref id="ref-doe">+    <mixed-citation>Doe, J. (2021). Another article. <italic>Proceedings+    of the Academy of Test Inputs</italic>.+    doi:<ext-link ext-link-type="uri" xlink:href="https://doi.org/10.x/nope">10.x/nope</ext-link></mixed-citation>+  </ref>+</ref-list>+</back>+</article>+```
+ test/command/7042.md view
@@ -0,0 +1,146 @@+```+% pandoc -f markdown -t jats_publishing+element_citations --citeproc -s+---+nocite: "[@*]"+references:+- author:+  - family: Jane+    given: Doe+  container-title: Public Library of Tests+  id: year-month+  issued: 1999-08+  title: Year and month+  type: article-journal+- accessed: 1999-01-22+  author:+  - family: Negidius+    given: Numerius+  container-title: Public Library of Tests+  id: access-date+  issued: 1911-10-03+  title: Entry with access date+  type: article-journal+- author:+  - family: Beethoven+    given: Ludwig+    dropping-particle: van+  - family: Bray+    given: Jan+    non-dropping-particle: de+  container-title: Public Library of Tests+  id: name-particles+  issued: 1820+  title: Name particles, dropping and non-dropping+  type: article-journal+- author:+  - 宮水 三葉+  - 立花 瀧+  title: Big Book of Tests+  id: book-with-japanese-authors+  issued: 2016+  type: book+- author:+  - family: Watson+    given: J. D.+  - family: Crick+    given: F. H. C.+  container-title: Nature+  doi: '10.1038/171737a0'+  id: full-journal-article-entry+  issue: 4356+  issued: '1953-04-01'+  pages: 737-738+  pmid: 13054692+  title: 'Molecular Structure of Nucleic Acids: A Structure for Deoxyribose Nucleic Acid'+  type: article-journal+  volume: 171+...+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.2 20190208//EN"+                  "JATS-publishing1.dtd">+<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">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+</article-meta>+</front>+<body>++</body>+<back>+<ref-list>+  <ref-list>+    <ref id="ref-year-month">+      <element-citation publication-type="article-journal">+        <person-group person-group-type="author">+          <name><surname>Jane</surname><given-names>Doe</given-names></name>+        </person-group>+        <article-title>Year and month</article-title>+        <source>Public Library of Tests</source>+        <year iso-8601-date="1999-08">1999</year><month>08</month>+      </element-citation>+    </ref>+    <ref id="ref-access-date">+      <element-citation publication-type="article-journal">+        <person-group person-group-type="author">+          <name><surname>Negidius</surname><given-names>Numerius</given-names></name>+        </person-group>+        <article-title>Entry with access date</article-title>+        <source>Public Library of Tests</source>+        <year iso-8601-date="1911-10-03">1911</year><month>10</month><day>03</day>+        <date-in-citation content-type="access-date"><year iso-8601-date="1999-01-22">1999</year><month>01</month><day>22</day></date-in-citation>+      </element-citation>+    </ref>+    <ref id="ref-name-particles">+      <element-citation publication-type="article-journal">+        <person-group person-group-type="author">+          <name><surname>Beethoven</surname><given-names>Ludwig van</given-names></name>+          <name><surname>de Bray</surname><given-names>Jan</given-names></name>+        </person-group>+        <article-title>Name particles, dropping and non-dropping</article-title>+        <source>Public Library of Tests</source>+        <year iso-8601-date="1820">1820</year>+      </element-citation>+    </ref>+    <ref id="ref-book-with-japanese-authors">+      <element-citation publication-type="book">+        <person-group person-group-type="author">+          <string-name>宮水 三葉</string-name>+          <string-name>立花 瀧</string-name>+        </person-group>+        <source>Big Book of Tests</source>+        <year iso-8601-date="2016">2016</year>+      </element-citation>+    </ref>+    <ref id="ref-full-journal-article-entry">+      <element-citation publication-type="article-journal">+        <person-group person-group-type="author">+          <name><surname>Watson</surname><given-names>J. D.</given-names></name>+          <name><surname>Crick</surname><given-names>F. H. C.</given-names></name>+        </person-group>+        <article-title>Molecular Structure of Nucleic Acids: A Structure for Deoxyribose Nucleic Acid</article-title>+        <source>Nature</source>+        <year iso-8601-date="1953-04-01">1953</year><month>04</month><day>01</day>+        <volume>171</volume>+        <issue>4356</issue>+        <fpage>737</fpage>+        <page-range>737-738</page-range>+        <pub-id pub-id-type="doi">10.1038/171737a0</pub-id>+        <pub-id pub-id-type="pmid">13054692</pub-id>+      </element-citation>+    </ref>+  </ref-list>+</ref-list>+</back>+</article>++```
+ test/command/defaults-inheritance-1.md view
@@ -0,0 +1,6 @@+```+% pandoc -d command/defaults3+# Header+^D+# Header+```
+ test/command/defaults-inheritance-2.md view
@@ -0,0 +1,5 @@+```+% pandoc -d command/defaults6+^D+Error: Circular defaults file reference in 'command/defaults7.yaml'+```
+ test/command/defaults-inheritance-3.md view
@@ -0,0 +1,6 @@+```+% pandoc -d command/defaults8+<h1>Header</h1>+^D+# Header+```
+ test/command/defaults3.yaml view
@@ -0,0 +1,4 @@+defaults:+  - command/defaults4+  - command/defaults5+to: markdown
+ test/command/defaults4.yaml view
@@ -0,0 +1,3 @@+from: html+defaults:+  - command/defaults5
+ test/command/defaults5.yaml view
@@ -0,0 +1,2 @@+from: markdown+to: html
+ test/command/defaults6.yaml view
@@ -0,0 +1,2 @@+defaults:+  - command/defaults7
+ test/command/defaults7.yaml view
@@ -0,0 +1,2 @@+defaults:+  - command/defaults6
+ test/command/defaults8.yaml view
@@ -0,0 +1,2 @@+from: html+defaults: command/defaults9
+ test/command/defaults9.yaml view
@@ -0,0 +1,1 @@+to: markdown
test/command/pandoc-citeproc-chicago-fullnote-bibliography.md view
@@ -107,7 +107,7 @@  [^5]: [30](#ref-item1), with suffix. -[^6]: [*First Book*, 2005](#ref-item1); ["Article," *Journal of Generic+[^6]: [*First Book*](#ref-item1); ["Article," *Journal of Generic     Studies* 6 (2006): 30](#ref-item2); see also [John Doe and Jenny     Roe, "Why Water Is Wet," in *Third Book*, ed. Sam Smith (Oxford:     Oxford University Press, 2007)](#ref-пункт3).@@ -116,22 +116,20 @@     and a citation without locators ([Doe and Roe, "Why Water Is     Wet"](#ref-пункт3)). -[^8]: See [Doe, *First Book*, 2005, chap. 3](#ref-item1); also [Doe and-    Roe, "Why Water Is Wet," 34--35](#ref-пункт3).+[^8]: See [Doe, *First Book*, chap. 3](#ref-item1); also [Doe and Roe,+    "Why Water Is Wet," 34--35](#ref-пункт3). -[^9]: See [Doe, *First Book*, 2005, 34--35](#ref-item1).+[^9]: See [Doe, *First Book*, 34--35](#ref-item1).  [^10]: Some citations (see [Doe, chap. 3](#ref-item1); [Doe and Roe,-    "Why Water Is Wet"](#ref-пункт3); [Doe, "Article,"-    2006](#ref-item2)).+    "Why Water Is Wet"](#ref-пункт3); [Doe, "Article"](#ref-item2)). -[^11]: [Doe, *First Book*, 2005, 33, 35--37](#ref-item1), and nowhere-    else.+[^11]: [Doe, *First Book*, 33, 35--37](#ref-item1), and nowhere else. -[^12]: [Doe, *First Book*, 2005](#ref-item1) and nowhere else.+[^12]: [Doe, *First Book*](#ref-item1) and nowhere else.  [^13]: Like a citation without author: (), and again (), and now Doe-    with a locator (["Article," 2006, 44](#ref-item2)).+    with a locator (["Article," 44](#ref-item2)). -[^14]: *See* [Doe, *First Book*, 2005, 32](#ref-item1).+[^14]: *See* [Doe, *First Book*, 32](#ref-item1). ```
test/command/svg.md view
@@ -36,28 +36,27 @@ % pandoc -f latex -t icml \includegraphics{command/SVG_logo.svg} ^D-[WARNING] Could not determine image size for 'command/SVG_logo.svg': could not determine SVG size <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">-    <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 150 -100">+    <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 37.5 -37.5">       <Properties>         <PathGeometry>           <GeometryPathType PathOpen="false">             <PathPointArray>-              <PathPointType Anchor="-150 -100" LeftDirection="-150 -100" RightDirection="-150 -100" />-              <PathPointType Anchor="-150 100" LeftDirection="-150 100" RightDirection="-150 100" />-              <PathPointType Anchor="150 100" LeftDirection="150 100" RightDirection="150 100" />-              <PathPointType Anchor="150 -100" LeftDirection="150 -100" RightDirection="150 -100" />+              <PathPointType Anchor="-37.5 -37.5" LeftDirection="-37.5 -37.5" RightDirection="-37.5 -37.5" />+              <PathPointType Anchor="-37.5 37.5" LeftDirection="-37.5 37.5" RightDirection="-37.5 37.5" />+              <PathPointType Anchor="37.5 37.5" LeftDirection="37.5 37.5" RightDirection="37.5 37.5" />+              <PathPointType Anchor="37.5 -37.5" LeftDirection="37.5 -37.5" RightDirection="37.5 -37.5" />             </PathPointArray>           </GeometryPathType>         </PathGeometry>       </Properties>-      <Image Self="ue6" ItemTransform="1 0 0 1 -150 -100">+      <Image Self="ue6" ItemTransform="1 0 0 1 -37.5 -37.5">         <Properties>           <Profile type="string">             $ID/Embedded           </Profile>-          <GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />+          <GraphicBounds Left="0" Top="0" Right="75" Bottom="75" />         </Properties>         <Link Self="ueb" LinkResourceURI="file:command/SVG_logo.svg" />       </Image>@@ -70,28 +69,27 @@ % pandoc -f latex -t icml \includegraphics{command/SVG_logo-without-xml-declaration.svg} ^D-[WARNING] Could not determine image size for 'command/SVG_logo-without-xml-declaration.svg': could not determine SVG size <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">   <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">-    <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 150 -100">+    <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 37.5 -37.5">       <Properties>         <PathGeometry>           <GeometryPathType PathOpen="false">             <PathPointArray>-              <PathPointType Anchor="-150 -100" LeftDirection="-150 -100" RightDirection="-150 -100" />-              <PathPointType Anchor="-150 100" LeftDirection="-150 100" RightDirection="-150 100" />-              <PathPointType Anchor="150 100" LeftDirection="150 100" RightDirection="150 100" />-              <PathPointType Anchor="150 -100" LeftDirection="150 -100" RightDirection="150 -100" />+              <PathPointType Anchor="-37.5 -37.5" LeftDirection="-37.5 -37.5" RightDirection="-37.5 -37.5" />+              <PathPointType Anchor="-37.5 37.5" LeftDirection="-37.5 37.5" RightDirection="-37.5 37.5" />+              <PathPointType Anchor="37.5 37.5" LeftDirection="37.5 37.5" RightDirection="37.5 37.5" />+              <PathPointType Anchor="37.5 -37.5" LeftDirection="37.5 -37.5" RightDirection="37.5 -37.5" />             </PathPointArray>           </GeometryPathType>         </PathGeometry>       </Properties>-      <Image Self="ue6" ItemTransform="1 0 0 1 -150 -100">+      <Image Self="ue6" ItemTransform="1 0 0 1 -37.5 -37.5">         <Properties>           <Profile type="string">             $ID/Embedded           </Profile>-          <GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />+          <GraphicBounds Left="0" Top="0" Right="75" Bottom="75" />         </Properties>         <Link Self="ueb" LinkResourceURI="file:command/SVG_logo-without-xml-declaration.svg" />       </Image>
test/docx/golden/block_quotes.docx view

binary file changed (10001 → 10092 bytes)

test/docx/golden/codeblock.docx view

binary file changed (9853 → 9944 bytes)

test/docx/golden/comments.docx view

binary file changed (10188 → 10279 bytes)

test/docx/golden/custom_style_no_reference.docx view

binary file changed (9952 → 10042 bytes)

test/docx/golden/custom_style_preserve.docx view

binary file changed (10578 → 10666 bytes)

test/docx/golden/definition_list.docx view

binary file changed (9850 → 9941 bytes)

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

binary file changed (9856 → 9947 bytes)

test/docx/golden/document-properties.docx view

binary file changed (10332 → 10423 bytes)

test/docx/golden/headers.docx view

binary file changed (9989 → 10080 bytes)

test/docx/golden/image.docx view

binary file changed (26667 → 26758 bytes)

test/docx/golden/inline_code.docx view

binary file changed (9789 → 9880 bytes)

test/docx/golden/inline_formatting.docx view

binary file changed (9969 → 10060 bytes)

test/docx/golden/inline_images.docx view

binary file changed (26725 → 26816 bytes)

binary file changed (10010 → 10101 bytes)

test/docx/golden/links.docx view

binary file changed (10185 → 10276 bytes)

test/docx/golden/lists.docx view

binary file changed (10261 → 10352 bytes)

test/docx/golden/lists_continuing.docx view

binary file changed (10052 → 10143 bytes)

test/docx/golden/lists_multiple_initial.docx view

binary file changed (10141 → 10232 bytes)

test/docx/golden/lists_restarting.docx view

binary file changed (10053 → 10144 bytes)

test/docx/golden/nested_anchors_in_header.docx view

binary file changed (10148 → 10239 bytes)

test/docx/golden/notes.docx view

binary file changed (9955 → 10046 bytes)

test/docx/golden/raw-blocks.docx view

binary file changed (9888 → 9980 bytes)

test/docx/golden/raw-bookmarks.docx view

binary file changed (10023 → 10115 bytes)

test/docx/golden/table_one_row.docx view

binary file changed (9834 → 9932 bytes)

test/docx/golden/table_with_list_cell.docx view

binary file changed (10199 → 10249 bytes)

test/docx/golden/tables.docx view

binary file changed (10225 → 10266 bytes)

test/docx/golden/track_changes_deletion.docx view

binary file changed (9833 → 9924 bytes)

test/docx/golden/track_changes_insertion.docx view

binary file changed (9816 → 9907 bytes)

test/docx/golden/track_changes_move.docx view

binary file changed (9850 → 9941 bytes)

test/docx/golden/track_changes_scrubbed_metadata.docx view

binary file changed (9962 → 10053 bytes)

test/docx/golden/unicode.docx view

binary file changed (9774 → 9865 bytes)

test/docx/golden/verbatim_subsuper.docx view

binary file changed (9822 → 9913 bytes)

test/markdown-reader-more.native view
@@ -134,13 +134,7 @@  ,(AlignDefault,ColWidth 0.16666666666666666)  ,(AlignDefault,ColWidth 0.18055555555555555)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])@@ -198,13 +192,7 @@  ,(AlignLeft,ColWidth 0.16666666666666666)  ,(AlignCenter,ColWidth 0.18055555555555555)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])@@ -230,13 +218,7 @@  ,(AlignDefault,ColWidth 0.16666666666666666)  ,(AlignDefault,ColWidth 0.18055555555555555)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])@@ -262,13 +244,7 @@  ,(AlignDefault,ColWidth 0.16666666666666666)  ,(AlignDefault,ColWidth 0.18055555555555555)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])@@ -300,11 +276,7 @@  [(AlignDefault,ColWidth 5.555555555555555e-2)  ,(AlignDefault,ColWidth 5.555555555555555e-2)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])
test/rst-reader.native view
@@ -346,13 +346,7 @@  ,(AlignDefault,ColWidth 0.15)  ,(AlignDefault,ColWidth 0.1625)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])@@ -378,13 +372,7 @@  ,(AlignDefault,ColWidth 0.15)  ,(AlignDefault,ColWidth 0.1625)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])@@ -410,13 +398,7 @@  ,(AlignDefault,ColWidth 0.15)  ,(AlignDefault,ColWidth 0.1625)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])
test/tables-rstsubset.native view
@@ -276,15 +276,7 @@  ,(AlignDefault,ColWidth 0.15)  ,(AlignDefault,ColWidth 0.3375)]  (TableHead ("",[],[])- [Row ("",[],[])-  [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []-  ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)-   []]])+ [])  [(TableBody ("",[],[]) (RowHeadColumns 0)   []   [Row ("",[],[])
test/tables.latex view
@@ -3,16 +3,16 @@ \begin{longtable}[]{@{}rlcl@{}} \caption{Demonstration of simple table syntax.}\tabularnewline \toprule-Right & Left & Center & Default \\ \addlinespace+Right & Left & Center & Default \\ \midrule \endfirsthead \toprule-Right & Left & Center & Default \\ \addlinespace+Right & Left & Center & Default \\ \midrule \endhead-12 & 12 & 12 & 12 \\ \addlinespace-123 & 123 & 123 & 123 \\ \addlinespace-1 & 1 & 1 & 1 \\ \addlinespace+12 & 12 & 12 & 12 \\+123 & 123 & 123 & 123 \\+1 & 1 & 1 & 1 \\ \bottomrule \end{longtable} @@ -20,12 +20,12 @@  \begin{longtable}[]{@{}rlcl@{}} \toprule-Right & Left & Center & Default \\ \addlinespace+Right & Left & Center & Default \\ \midrule \endhead-12 & 12 & 12 & 12 \\ \addlinespace-123 & 123 & 123 & 123 \\ \addlinespace-1 & 1 & 1 & 1 \\ \addlinespace+12 & 12 & 12 & 12 \\+123 & 123 & 123 & 123 \\+1 & 1 & 1 & 1 \\ \bottomrule \end{longtable} @@ -34,16 +34,16 @@ \begin{longtable}[]{@{}rlcl@{}} \caption{Demonstration of simple table syntax.}\tabularnewline \toprule-Right & Left & Center & Default \\ \addlinespace+Right & Left & Center & Default \\ \midrule \endfirsthead \toprule-Right & Left & Center & Default \\ \addlinespace+Right & Left & Center & Default \\ \midrule \endhead-12 & 12 & 12 & 12 \\ \addlinespace-123 & 123 & 123 & 123 \\ \addlinespace-1 & 1 & 1 & 1 \\ \addlinespace+12 & 12 & 12 & 12 \\+123 & 123 & 123 & 123 \\+1 & 1 & 1 & 1 \\ \bottomrule \end{longtable} @@ -56,19 +56,15 @@   >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.35}}@{}} \caption{Here's the caption. It may span multiple lines.}\tabularnewline \toprule-Centered Header & Left Aligned & Right Aligned & Default-aligned \\ \addlinespace+Centered Header & Left Aligned & Right Aligned & Default aligned \\ \midrule \endfirsthead \toprule-Centered Header & Left Aligned & Right Aligned & Default-aligned \\ \addlinespace+Centered Header & Left Aligned & Right Aligned & Default aligned \\ \midrule \endhead-First & row & 12.0 & Example of a row that spans multiple-lines. \\ \addlinespace-Second & row & 5.0 & Here's another one. Note the blank line between-rows. \\ \addlinespace+First & row & 12.0 & Example of a row that spans multiple lines. \\+Second & row & 5.0 & Here's another one. Note the blank line between rows. \\ \bottomrule \end{longtable} @@ -80,14 +76,11 @@   >{\raggedleft\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.16}}   >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.35}}@{}} \toprule-Centered Header & Left Aligned & Right Aligned & Default-aligned \\ \addlinespace+Centered Header & Left Aligned & Right Aligned & Default aligned \\ \midrule \endhead-First & row & 12.0 & Example of a row that spans multiple-lines. \\ \addlinespace-Second & row & 5.0 & Here's another one. Note the blank line between-rows. \\ \addlinespace+First & row & 12.0 & Example of a row that spans multiple lines. \\+Second & row & 5.0 & Here's another one. Note the blank line between rows. \\ \bottomrule \end{longtable} @@ -96,9 +89,9 @@ \begin{longtable}[]{@{}rlcr@{}} \toprule \endhead-12 & 12 & 12 & 12 \\ \addlinespace-123 & 123 & 123 & 123 \\ \addlinespace-1 & 1 & 1 & 1 \\ \addlinespace+12 & 12 & 12 & 12 \\+123 & 123 & 123 & 123 \\+1 & 1 & 1 & 1 \\ \bottomrule \end{longtable} @@ -111,9 +104,7 @@   >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.35}}@{}} \toprule \endhead-First & row & 12.0 & Example of a row that spans multiple-lines. \\ \addlinespace-Second & row & 5.0 & Here's another one. Note the blank line between-rows. \\ \addlinespace+First & row & 12.0 & Example of a row that spans multiple lines. \\+Second & row & 5.0 & Here's another one. Note the blank line between rows. \\ \bottomrule \end{longtable}
test/tables.ms view
@@ -2,6 +2,7 @@ Simple table with caption: .PP Demonstration of simple table syntax.+.na .TS delim(@@) tab(	); r l c l.@@ -43,9 +44,11 @@ 1 T} .TE+.ad .LP Simple table without caption: .PP+.na .TS delim(@@) tab(	); r l c l.@@ -87,10 +90,12 @@ 1 T} .TE+.ad .LP Simple table indented two spaces: .PP Demonstration of simple table syntax.+.na .TS delim(@@) tab(	); r l c l.@@ -132,10 +137,12 @@ 1 T} .TE+.ad .LP Multiline table with caption: .PP Here\[cq]s the caption. It may span multiple lines.+.na .TS delim(@@) tab(	); cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).@@ -169,9 +176,11 @@ Note the blank line between rows. T} .TE+.ad .LP Multiline table without caption: .PP+.na .TS delim(@@) tab(	); cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).@@ -205,9 +214,11 @@ Note the blank line between rows. T} .TE+.ad .LP Table without column headers: .PP+.na .TS delim(@@) tab(	); r l c r.@@ -239,9 +250,11 @@ 1 T} .TE+.ad .LP Multiline table without column headers: .PP+.na .TS delim(@@) tab(	); cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).@@ -265,3 +278,4 @@ Note the blank line between rows. T} .TE+.ad
test/tables/nordics.latex view
@@ -6,21 +6,19 @@ \caption{States belonging to the \emph{Nordics.}}\tabularnewline \toprule Name & Capital & \vtop{\hbox{\strut Population}\hbox{\strut (in 2018)}} &-\vtop{\hbox{\strut Area}\hbox{\strut (in-km\textsuperscript{2})}} \\ \addlinespace+\vtop{\hbox{\strut Area}\hbox{\strut (in km\textsuperscript{2})}} \\ \midrule \endfirsthead \toprule Name & Capital & \vtop{\hbox{\strut Population}\hbox{\strut (in 2018)}} &-\vtop{\hbox{\strut Area}\hbox{\strut (in-km\textsuperscript{2})}} \\ \addlinespace+\vtop{\hbox{\strut Area}\hbox{\strut (in km\textsuperscript{2})}} \\ \midrule \endhead-Denmark & Copenhagen & 5,809,502 & 43,094 \\ \addlinespace-Finland & Helsinki & 5,537,364 & 338,145 \\ \addlinespace-Iceland & Reykjavik & 343,518 & 103,000 \\ \addlinespace-Norway & Oslo & 5,372,191 & 323,802 \\ \addlinespace-Sweden & Stockholm & 10,313,447 & 450,295 \\ \addlinespace-Total & & 27,376,022 & 1,258,336 \\ \addlinespace+Denmark & Copenhagen & 5,809,502 & 43,094 \\+Finland & Helsinki & 5,537,364 & 338,145 \\+Iceland & Reykjavik & 343,518 & 103,000 \\+Norway & Oslo & 5,372,191 & 323,802 \\+Sweden & Stockholm & 10,313,447 & 450,295 \\+Total & & 27,376,022 & 1,258,336 \\ \bottomrule \end{longtable}
test/tables/planets.latex view
@@ -3,34 +3,28 @@ \toprule \multicolumn{2}{l}{} & Name & Mass (10\^{}24kg) & Diameter (km) & Density (kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun-(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \addlinespace+(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \midrule \endfirsthead \toprule \multicolumn{2}{l}{} & Name & Mass (10\^{}24kg) & Diameter (km) & Density (kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun-(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \addlinespace+(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \midrule \endhead \multicolumn{2}{l}{\multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 &-4,879 & 5427 & 3.7 & 4222.6 & 57.9 & 167 & 0 & Closest to the-Sun \\ \addlinespace-& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0-& \\ \addlinespace-& & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our-world \\ \addlinespace+4,879 & 5427 & 3.7 & 4222.6 & 57.9 & 167 & 0 & Closest to the Sun \\+& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0 & \\+& & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our world \\ & & Mars & 0.642 & 6,792 & 3933 & 3.7 & 24.7 & 227.9 & -65 & 2 & The red-planet \\ \addlinespace+planet \\ \multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898-& 142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest-planet \\ \addlinespace-& & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62-& \\ \addlinespace+& 142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest planet \\+& & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62 & \\ & \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &-2872.5 & -195 & 27 & \\ \addlinespace-& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14-& \\ \addlinespace+2872.5 & -195 & 27 & \\+& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\ \multicolumn{2}{l}{Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 &-153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\ \addlinespace+153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\ \bottomrule \end{longtable}
test/tables/students.latex view
@@ -3,21 +3,21 @@   >{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{0.50}}@{}} \caption{List of Students}\tabularnewline \toprule-Student ID & Name \\ \addlinespace+Student ID & Name \\ \midrule \endfirsthead \toprule-Student ID & Name \\ \addlinespace+Student ID & Name \\ \midrule \endhead-\multicolumn{2}{l}{Computer Science} \\ \addlinespace-3741255 & Jones, Martha \\ \addlinespace-4077830 & Pierce, Benjamin \\ \addlinespace-5151701 & Kirk, James \\ \addlinespace-\multicolumn{2}{l}{Russian Literature} \\ \addlinespace-3971244 & Nim, Victor \\ \addlinespace-\multicolumn{2}{l}{Astrophysics} \\ \addlinespace-4100332 & Petrov, Alexandra \\ \addlinespace-4100332 & Toyota, Hiroko \\ \addlinespace+\multicolumn{2}{l}{Computer Science} \\+3741255 & Jones, Martha \\+4077830 & Pierce, Benjamin \\+5151701 & Kirk, James \\+\multicolumn{2}{l}{Russian Literature} \\+3971244 & Nim, Victor \\+\multicolumn{2}{l}{Astrophysics} \\+4100332 & Petrov, Alexandra \\+4100332 & Toyota, Hiroko \\ \bottomrule \end{longtable}
test/writer.context view
@@ -51,8 +51,6 @@ \setupfloat[figure][default={here,nonumber}] \setupfloat[table][default={here,nonumber}] -\setupthinrules[width=15em] % width of horizontal rules- \setupxtable[frame=off] \setupxtable[head][topframe=on,bottomframe=on] \setupxtable[body][]
test/writer.jats_archiving view
@@ -78,31 +78,39 @@ <sec id="block-quotes">   <title>Block Quotes</title>   <p>E-mail style:</p>-  <disp-quote>-    <p>This is a block quote. It is pretty short.</p>-  </disp-quote>-  <disp-quote>-    <p>Code in a block quote:</p>-    <preformat>sub status {-    print &quot;working&quot;;-}</preformat>-    <p>A list:</p>-    <list list-type="order">-      <list-item>-        <p>item one</p>-      </list-item>-      <list-item>-        <p>item two</p>-      </list-item>-    </list>-    <p>Nested block quotes:</p>+  <p specific-use="wrapper">     <disp-quote>-      <p>nested</p>+      <p>This is a block quote. It is pretty short.</p>     </disp-quote>+  </p>+  <p specific-use="wrapper">     <disp-quote>-      <p>nested</p>+      <p>Code in a block quote:</p>+      <preformat>sub status {+    print &quot;working&quot;;+}</preformat>+      <p>A list:</p>+      <list list-type="order">+        <list-item>+          <p>item one</p>+        </list-item>+        <list-item>+          <p>item two</p>+        </list-item>+      </list>+      <p>Nested block quotes:</p>+      <p specific-use="wrapper">+        <disp-quote>+          <p>nested</p>+        </disp-quote>+      </p>+      <p specific-use="wrapper">+        <disp-quote>+          <p>nested</p>+        </disp-quote>+      </p>     </disp-quote>-  </disp-quote>+  </p>   <p>This should not be a block quote: 2 &gt; 1.</p>   <p>And a following paragraph.</p> </sec>@@ -829,10 +837,12 @@       </list-item>     </list>     <p>An e-mail address: <email>nobody@nowhere.net</email></p>-    <disp-quote>-      <p>Blockquoted:-      <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p>-    </disp-quote>+    <p specific-use="wrapper">+      <disp-quote>+        <p>Blockquoted:+        <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p>+      </disp-quote>+    </p>     <p>Auto-links should not occur here:     <monospace>&lt;http://example.com/&gt;</monospace></p>     <preformat>or here: &lt;http://example.com/&gt;</preformat>@@ -856,9 +866,11 @@   <italic>not</italic> be a footnote reference, because it contains a   space.[^my note] Here is an inline   note.<xref ref-type="fn" rid="fn3">3</xref></p>-  <disp-quote>-    <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p>-  </disp-quote>+  <p specific-use="wrapper">+    <disp-quote>+      <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p>+    </disp-quote>+  </p>   <list list-type="order">     <list-item>       <p>And in list items.<xref ref-type="fn" rid="fn5">5</xref></p>
test/writer.jats_articleauthoring view
@@ -67,39 +67,43 @@ <sec id="block-quotes">   <title>Block Quotes</title>   <p>E-mail style:</p>-  <disp-quote>-    <p>This is a block quote. It is pretty short.</p>-  </disp-quote>-  <disp-quote>-    <p>Code in a block quote:</p>-    <p specific-use="wrapper">-      <preformat>sub status {+  <p specific-use="wrapper">+    <disp-quote>+      <p>This is a block quote. It is pretty short.</p>+    </disp-quote>+  </p>+  <p specific-use="wrapper">+    <disp-quote>+      <p>Code in a block quote:</p>+      <p specific-use="wrapper">+        <preformat>sub status {     print &quot;working&quot;; }</preformat>-    </p>-    <p>A list:</p>-    <p specific-use="wrapper">-      <list list-type="order">-        <list-item>-          <p>item one</p>-        </list-item>-        <list-item>-          <p>item two</p>-        </list-item>-      </list>-    </p>-    <p>Nested block quotes:</p>-    <p specific-use="wrapper">-      <disp-quote>-        <p>nested</p>-      </disp-quote>-    </p>-    <p specific-use="wrapper">-      <disp-quote>-        <p>nested</p>-      </disp-quote>-    </p>-  </disp-quote>+      </p>+      <p>A list:</p>+      <p specific-use="wrapper">+        <list list-type="order">+          <list-item>+            <p>item one</p>+          </list-item>+          <list-item>+            <p>item two</p>+          </list-item>+        </list>+      </p>+      <p>Nested block quotes:</p>+      <p specific-use="wrapper">+        <disp-quote>+          <p>nested</p>+        </disp-quote>+      </p>+      <p specific-use="wrapper">+        <disp-quote>+          <p>nested</p>+        </disp-quote>+      </p>+    </disp-quote>+  </p>   <p>This should not be a block quote: 2 &gt; 1.</p>   <p>And a following paragraph.</p> </sec>@@ -813,10 +817,12 @@       </list-item>     </list>     <p>An e-mail address: <email>nobody@nowhere.net</email></p>-    <disp-quote>-      <p>Blockquoted:-      <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p>-    </disp-quote>+    <p specific-use="wrapper">+      <disp-quote>+        <p>Blockquoted:+        <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p>+      </disp-quote>+    </p>     <p>Auto-links should not occur here:     <monospace>&lt;http://example.com/&gt;</monospace></p>     <preformat>or here: &lt;http://example.com/&gt;</preformat>@@ -854,11 +860,13 @@     and <monospace>]</monospace> verbatim characters, as well as [bracketed     text].</p>   </fn></p>-  <disp-quote>-    <p>Notes can go in quotes.<fn>-      <p>In quote.</p>-    </fn></p>-  </disp-quote>+  <p specific-use="wrapper">+    <disp-quote>+      <p>Notes can go in quotes.<fn>+        <p>In quote.</p>+      </fn></p>+    </disp-quote>+  </p>   <list list-type="order">     <list-item>       <p>And in list items.<fn>
test/writer.jats_publishing view
@@ -78,31 +78,39 @@ <sec id="block-quotes">   <title>Block Quotes</title>   <p>E-mail style:</p>-  <disp-quote>-    <p>This is a block quote. It is pretty short.</p>-  </disp-quote>-  <disp-quote>-    <p>Code in a block quote:</p>-    <preformat>sub status {-    print &quot;working&quot;;-}</preformat>-    <p>A list:</p>-    <list list-type="order">-      <list-item>-        <p>item one</p>-      </list-item>-      <list-item>-        <p>item two</p>-      </list-item>-    </list>-    <p>Nested block quotes:</p>+  <p specific-use="wrapper">     <disp-quote>-      <p>nested</p>+      <p>This is a block quote. It is pretty short.</p>     </disp-quote>+  </p>+  <p specific-use="wrapper">     <disp-quote>-      <p>nested</p>+      <p>Code in a block quote:</p>+      <preformat>sub status {+    print &quot;working&quot;;+}</preformat>+      <p>A list:</p>+      <list list-type="order">+        <list-item>+          <p>item one</p>+        </list-item>+        <list-item>+          <p>item two</p>+        </list-item>+      </list>+      <p>Nested block quotes:</p>+      <p specific-use="wrapper">+        <disp-quote>+          <p>nested</p>+        </disp-quote>+      </p>+      <p specific-use="wrapper">+        <disp-quote>+          <p>nested</p>+        </disp-quote>+      </p>     </disp-quote>-  </disp-quote>+  </p>   <p>This should not be a block quote: 2 &gt; 1.</p>   <p>And a following paragraph.</p> </sec>@@ -829,10 +837,12 @@       </list-item>     </list>     <p>An e-mail address: <email>nobody@nowhere.net</email></p>-    <disp-quote>-      <p>Blockquoted:-      <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p>-    </disp-quote>+    <p specific-use="wrapper">+      <disp-quote>+        <p>Blockquoted:+        <ext-link ext-link-type="uri" xlink:href="http://example.com/">http://example.com/</ext-link></p>+      </disp-quote>+    </p>     <p>Auto-links should not occur here:     <monospace>&lt;http://example.com/&gt;</monospace></p>     <preformat>or here: &lt;http://example.com/&gt;</preformat>@@ -856,9 +866,11 @@   <italic>not</italic> be a footnote reference, because it contains a   space.[^my note] Here is an inline   note.<xref ref-type="fn" rid="fn3">3</xref></p>-  <disp-quote>-    <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p>-  </disp-quote>+  <p specific-use="wrapper">+    <disp-quote>+      <p>Notes can go in quotes.<xref ref-type="fn" rid="fn4">4</xref></p>+    </disp-quote>+  </p>   <list list-type="order">     <list-item>       <p>And in list items.<xref ref-type="fn" rid="fn5">5</xref></p>
test/writers-lang-and-dir.context view
@@ -49,8 +49,6 @@ \setupfloat[figure][default={here,nonumber}] \setupfloat[table][default={here,nonumber}] -\setupthinrules[width=15em] % width of horizontal rules- \setupxtable[frame=off] \setupxtable[head][topframe=on,bottomframe=on] \setupxtable[body][]
trypandoc/trypandoc.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {- |    Module      : Main-   Copyright   : © 2014-2020 John MacFarlane <jgm@berkeley.edu>+   Copyright   : © 2014-2021 John MacFarlane <jgm@berkeley.edu>    License     : GNU GPL, version 2 or above     Maintainer  : John MacFarlane <jgm@berkeley.edu>