packages feed

pandoc 3.6.4 → 3.7

raw patch · 163 files changed

+1728/−790 lines, 163 filesdep ~citeprocdep ~randomdep ~texmath

Dependency ranges changed: citeproc, random, texmath, typst

Files

AUTHORS.md view
@@ -246,6 +246,7 @@ - Lucas V. R - Luis Rivera - Luke Plant+- Manolis Stamatogiannakis - Marc Schreiber - Marcin Serwin - Mario Lang@@ -287,6 +288,7 @@ - Mikołaj Machowski - Milan Bracke - MinRK+- Mohamed Akram - Morgan Willcock - Morton Fox - Nathan Gass@@ -295,7 +297,8 @@ - Nick Bart - Nick Berendsen - Nick Fleisher-- Nicolas Kaiser+- Nicolas Kaise+- Niklas Eicker - Nikolai Korobeinikov - Nikolay Yakimov - Nils Carlson
CONTRIBUTING.md view
@@ -118,7 +118,7 @@ So before submitting a bug report, consider whether it might be "out of scope." If it concerns a feature of documents that isn't representable in pandoc's Markdown, then it very likely is.-(If in doubt, you can always ask on the [discussion-forum].)+(If in doubt, you can always ask on the [discussion forum].)  Fixing bugs from the issue tracker ----------------------------------
@@ -24,9 +24,9 @@  [GPL]: https://www.gnu.org/copyleft/gpl.html -Pandoc's complete source code is available from the [Pandoc home page].--[Pandoc home page]: https://pandoc.org+The complete source code for pandoc version X.Y.Z is available at+<https://hackage.haskell.org/package/pandoc-X.Y.Z/pandoc-X.Y.Z.tar.gz>+and at <https://github.com/jgm/pandoc/tree/X.Y.Z>.  Pandoc includes some code with different copyrights, or subject to different licenses.  The copyright and license statements for these sources are included
INSTALL.md view
@@ -8,13 +8,13 @@ </a>  For alternative ways to install pandoc, see below under the heading for-your operating system. +your operating system.  **Note**: the statically linked Pandoc binaries provided by us (or those available on Conda Forge) have a limitation. They are unable to utilise Lua filters that rely on Lua modules written in C. If you require the functionality offered by these filters, please consider an alternative-method of installation. +method of installation.  ## Windows @@ -78,6 +78,10 @@ Homebrew installs from source, which takes additional time and disk space for the `ghc` compiler and dependent Haskell libraries. +You can also install pandoc using [MacPorts]:++    port install pandoc+ Or, you can install Pandoc using [Conda forge].  We also provide a zip file containing the binaries and man@@ -399,7 +403,7 @@ [GHC]:  https://www.haskell.org/ghc/ [GitLab CI/CD]: https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/ [Haskell platform]: https://hackage.haskell.org/platform/-[MacPorts]: https://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile+[MacPorts]: https://ports.macports.org/port/pandoc/ [MacTeX]: https://tug.org/mactex/ [OpenBSD ports]: https://cvsweb.openbsd.org/ports/textproc/pandoc/ [BasicTeX]: https://www.tug.org/mactex/morepackages.html
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: March 16, 2025+date: 2025-05-14 ---  # Synopsis@@ -774,14 +774,32 @@     not used, a default template appropriate for the output     format will be used (see `-D/--print-default-template`). -`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]+`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`=`*VAL*]  :   Set the template variable *KEY* to the string value *VAL* when rendering-    the document in standalone mode. If no *VAL* is specified, the+    the document in standalone mode. Either `:` or `=` may be used+    to separate *KEY* from *VAL*. If no *VAL* is specified, the     key will be given the value `true`.  Structured values (lists, maps)     cannot be assigned using this option, but they can be assigned in-    the `variables` section of a [defaults file][Defaults files].+    the `variables` section of a [defaults file][Defaults files] or+    using the `--variable-json` option. If the variable already has+    a *list* value, the value will be added to the list. If it already+    has another kind of value, it will be made into a list containing+    the previous and the new value. For example,+    `-V keyword=Joe -V author=Sue` makes `author` contain a list+    of strings: `Joe` and `Sue`. +`--variable-json=`*KEY*[`=`:*JSON*]++:   Set the template variable *KEY* to the value specified by a JSON+    string (this may be a boolean, a string, a list, or a mapping;+    a number will be treated as a string). For example,+    `--variable-json foo=false` will give `foo` the boolean false+    value, while `--variable-json foo='"false"'` will give it the+    string value `"false"`. Either `:` or `=` may be used to+    separate *KEY* from *VAL*. If the variable already has a+    value, this value will be replaced.+ `--sandbox[=true|false]`  :   Run pandoc in a sandbox, limiting IO operations in readers@@ -865,11 +883,14 @@     unless `-s/--standalone` is used, and it has no effect     on `man`, `docbook4`, `docbook5`, or `jats` output. -    Note that if you are producing a PDF via `ms`, the table+    Note that if you are producing a PDF via `ms` and using+    (the default) `pdfroff` as a `--pdf-engine`, the table     of contents will appear at the beginning of the     document, before the title.  If you would prefer it to     be at the end of the document, use the option-    `--pdf-engine-opt=--no-toc-relocation`.+    `--pdf-engine-opt=--no-toc-relocation`. If `groff` is+    used as the `--pdf-engine`, the table of contents will+    always appear at the end of the document.  `--toc-depth=`*NUMBER* @@ -1281,7 +1302,6 @@         Character styles:          - Default Paragraph Font-        - Body Text Char         - Verbatim Char         - Footnote Reference         - Hyperlink@@ -1456,11 +1476,11 @@ :   Use the specified engine when producing PDF output.     Valid values are `pdflatex`, `lualatex`, `xelatex`, `latexmk`,     `tectonic`, `wkhtmltopdf`, `weasyprint`, `pagedjs-cli`,-    `prince`, `context`, `pdfroff`, and `typst`. If the engine is not in-    your PATH, the full path of the engine may be specified here.-    If this option is not specified, pandoc uses the following-    defaults depending on the output format specified using-    `-t/--to`:+    `prince`, `context`, `groff`, `pdfroff`, and `typst`.+    If the engine is not in your PATH, the full path of the engine+    may be specified here. If this option is not specified,+    pandoc uses the following defaults depending on the output+    format specified using `-t/--to`:      - `-t latex` or none: `pdflatex` (other options: `xelatex`, `lualatex`,         `tectonic`, `latexmk`)@@ -1472,6 +1492,14 @@     - `-t ms`:  `pdfroff`     - `-t typst`: `typst` +    This option is normally intended to be used when a PDF+    file is specified as `-o/--output`.  However, it may still+    have an effect when other output formats are requested.+    For example, `ms` output will include `.pdfhref` macros+    only if a `--pdf-engine` is selected, and the macros will+    be differently encoded depending on whether `groff` or+    `pdfroff` is specified.+ `--pdf-engine-opt=`*STRING*  :   Use the given string as a command-line argument to the `pdf-engine`.@@ -2866,7 +2894,7 @@  `revealjs-url` :   base URL for reveal.js documents (defaults to-    `https://unpkg.com/reveal.js@^4/`)+    `https://unpkg.com/reveal.js@^5`)  `s5-url` :   base URL for S5 documents (defaults to `s5/default`)@@ -3443,6 +3471,10 @@      If you need absolute paths, use e.g. `$curdir$/$sourcefile$`. +`pdf-engine`+:   name of PDF engine if provided using `--pdf-engine`, or the+    default engine for the format if PDF output is requested.+ `curdir` :   working directory from which pandoc is run. @@ -3854,7 +3886,6 @@ emphasized text. The `emphasis-command` template variable is set if the extension is enabled. - # Pandoc's Markdown  Pandoc understands an extended and slightly revised version of@@ -6054,6 +6085,9 @@    [GitHub-style Markdown alerts]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts +Note: This extension currently only works with commonmark:+`commonmark`, `gfm`, `commonmark_x`.+ ### Extension: `autolink_bare_uris` ###  Makes all absolute URIs into links, even when not surrounded by@@ -7629,7 +7663,10 @@ `lua` as the first argument will make it function as a standalone Lua interpreter. The behavior is mostly identical to that of the [standalone `lua` executable][lua standalone], version 5.4.-For full documentation, see the [pandoc-lua] man page.+All `pandoc.*` packages, as well as the packages `re` and `lpeg`,+are available via global variables. Furthermore, the globals+`PANDOC_VERSION`, `PANDOC_STATE`, and `PANDOC_API_VERSION` are+set at startup. For full documentation, see the [pandoc-lua] man page.  [lua standalone]: https://www.lua.org/manual/5.4/manual.html#7 [pandoc-lua]: https://github.com/jgm/pandoc/blob/master/doc/pandoc-lua.md
changelog.md view
@@ -1,5 +1,278 @@ # Revision history for pandoc +## pandoc 3.7 (2025-05-14)++  * Add new command-line option `--variable-json` (#10341).+    This allows non-string values (booleans, lists, maps) to be given to+    template variables on the command line.++  * The `--pdf-engine` option can now take `groff` as a value.++  * Markdown writer:++    + Avoid spaces after/before open/close delimiters (#10696).+      E.g. instead of rendering `x<em> space </em>y` as `x* space *y` we render+      it as `x *space* y`.+    + Handle row/colspans in grid tables, and expand cells when it isn't+      possible to lay them out without breaking string of non-whitespace.+    + Render a figure with Para caption as implicit figure (#10755).+    + When falling back to a Div with class `figure` for a figure that+      can't be represented any other way, include a Div with class+      `caption` containing the caption.+    + Improve use of implicit figures when possible (#10758).+      When the alt differs from the caption, but only as regards formatting, we+      still use an implicit figure.+    + Omit initial newlines in gfm `math` blocks to avoid an ugly blank line.+    * Support the `four_space_rule` extension for `plain` output (#10813,+      Manolis Stamatogiannakis).++  * RST writer:++    + Handle row/colspans in grid tables, and expand cells when it isn't+      possible to lay them out without breaking string of non-whitespace.++  * Muse writer:++    + Handle row/colspans in grid tables, and expand cells when it isn't+      possible to lay them out without breaking string of non-whitespace.++  * JATS writer:++    + Fix escaping for writing-review-editing role (#10744).++  * HTML writer:++    + Remove trailing slash from default revealjs URL (#8749). This+      avoids a double slash in the URL's path component.++  * LaTeX writer:++    + Make alignment work within `multirow` in tables (#10772).++  * Typst writer:++    + Support `mark` class on spans (#10747).+    + Add equation label if math contains `\label{..}` (#10805).+    + Handle equation labels with spaces (#10805).++  * Roff format writers (man, ms):++    + Use the most compatible form for roff escapes (#10716).+      For example, `\(xy` instead of `\[xy]`. This was the original+      AT&T troff form and is the most widely supported. The+      bracketed form causes problem for some tools, e.g.+      `makewhatis` on macOS. And emit `e` followed by an escape+      for a unicode combining accent rather than the form `\[e aa]`,+      which works for groff but not e.g. on macOS's man.+      This change affects Text.Pandoc.RoffChar,+      Text.Pandoc.Writers.Roff, and the Man and Ms writers.++  * Docx writer:++    + Ensure that figures and tables with custom styles are not dropped (#10705).+    + Preserve Relationships for images from reference docx (#10759).+      This should allow one to include an image in a reference.docx and+      reference it in an openxml template.+    + Don't renumber rels (#10769). We used to renumber the+      Relationships so they didn't conflict with the set of fixed+      Relationships we imposed. We are now preserving the ids+      from the reference doc's document.xml.refs, so we shouldn't+      renumber them or references introduced by the user (e.g. in+      a template) will fail.++  * Ms writer:++    + Improve PDF TOC labels. We now use the plain writer to render these,+      so that Greek characters etc. will show up properly.+    + When no `pdf-engine` variable is specified, do not use the+      `.pdfhref` macros at all (#10738). This gives better results for links+      in formats other than PDF, since the link text would simply+      disappear if it exists only in a `.pdfhref` macro. When a PDF+      engine is specified, escape the argument of `.pdfhref O` in a way+      that is appropriate.++  * OpenDocument writer:++    + Fix character styles in footnotes (#10791). Character+      styles governing the position of the footnote reference+      should not be imposed on the footnote text.++  * Powerpoint writer:++    + Use reference-doc font for captions (#9896, R. N. West).++  * DocBook writer:++    + Use literallayout element for LineBlock (#10825).++  * MediaWiki reader/writer:++    + Allow definition on same line as term (#10708).++  * LaTeX reader:++    + Skip at most one argument to LaTeX tabular newline (#7512,+      Evan Silberman).+    + Disable ligatures inside `\texttt` (#10781).+    + Support more symbol commands (#10782).++  * Commonmark Reader:++    + Handle GFM math irregularity with braces (#10631). In GFM, you need+      to use `\\{` rather than `\{` for a literal brace.++  * DocBook reader:++    + Improve handling of literallayout (#10825). This is now only made+      a CodeBlock when there is a `monospaced` class. Otherwise it is made+      a LineBlock.++  * Org reader:++    + Add AVIF to Org Reader image extensions (#10736, Christian Christiansen).+    + Don't include newlines in inine code/verbatim (#10730).+      Convert newlines to spaces as we do in other formats.+    + Change handling of inline TeX (#10836). Previously inline+      TeX was handled in a way that was different from org's own export,+      and that could lead to information loss. This was particularly noticeable+      for inline math environments such as `equation`.  Previously, an+      `equation` environment starting at the beginning of a line would create+      a raw block, splitting up the paragraph containing it (see #10836). On the+      other hand, an `equation` environment not at the beginning of a line would+      be turned into regular inline elements representing the math. (This would+      cause the equation number to go missing and in some cases degrade the math+      formatting.) Now, we parse all of these as raw "latex"+      inlines, which will be omitted when converting to formats+      other than LaTeX (and other formats like pandoc's Markdown+      that allow raw LaTex).++  * Beamer template: fix regression in 3.6.4, reverting the omission of+    `\date` when the document does not have a date. By default, beamer+    will display a date when no `\date` is present in the title block,+    so this was an unintended behavior change. The reverted+    change was motivated by the desire to include a custom+    `\date` in the frontmatter via header-includes. This can be+    achieved more simply by simply setting the `date` variable.+    In markdown you can even use `date` in metadata and put some+    raw LaTeX there.++  * Ms template:++    + Use T rather than P as default font family (#10738).+    + Put PDF-specific things under a conditional.+      Don't inculde them if `pdf-engine` isn't set.++  * Upgrade reveal.js URL to v5 (#10740, Kolen Cheung).+    v4 is no longer available on unpkg.com.++  * Text.Pandoc.PDF: Allow `groff` to be used as `--pdf-engine` with `ms`+    (#10738). When `groff` is used as a PDF engine, the `groff`+    extension to `ms` is automatically enabled. Limitations:++    - `groff` currently produces larger PDFs than `pdfroff`.+    - With `groff`, a table of contents produced with+      `--table-of-contents/--toc` will always be placed at the end of+      the document.+    - Certain characters (e.g. Greek characters) may be dropped in+      the PDF outline.++  * Text.Pandoc.Writers.Shared:++    + Export `surroundInlines` [API change].+    + Rename `surroundInlines` -> `delimited`.+    + New version of `gridTable` (#6344) [API change]. This+      handles row and colspans. It also ensures that cells won't+      wrap text in places where it wouldn't normally wrap, even+      if this means making the cells wider than requested by the+      colspec (#9001, #7641). Because the parameters are+      different, this is a breaking API change.++  * Text.Pandoc.App: set `pdf-engine` variable.+    If `--pdf-engine` is specified or if a PDF is being produced, we set the+    `pdf-engine` variable. This allows writers and templates to behave+    differently depending on the PDF engine.++  * Text.Pandoc.Class and Text.Pandoc.URI:++    + Fix parsing of base64 data URIs to allow URI escapes and+      whitespace (which will be ignored) (#10704).+    + Handle percent encoding in `pBase64URI` instead of+      unescaping later, for efficiency (#10704).++  * Text.Pandoc.Citeproc.BibTeX:++    + Recognize `en` as a `langid` in biblatex bibliographies (#10764).++  * Text.Pandoc.MIME:++    + Add mime type and extension for `avif` (#10704).+    + Handle `apng`, `avif`, `jxl` (#10704).++  * Text.Pandoc.Readers.LaTeX.Math: export `inlineEnvironmentNames`.+    Internal module, not a change to the public API.++  * `reference.docx` (Andrew Dunning):++    + Remove extra spaces around text placeholders.+    + Add footnote block text sample.++  * Text.Pandoc.Class.Sandbox:++    + Add `sandboxWithFileTree` function [API change] (Albert Krewinkel).++  * Lua subsystem (Albert Krewinkel):++    + pandoc-lua-engine: add all test files to the cabal file.+    + Allow `pandoc.read` to be called in "sandbox" mode for added+      security (#10831). Readers running in a sandbox will not be+      able to access the network or file system. The sandbox is+      enabled if the fourth parameter is a list of files or+      filename/content pairs. The files are read and then made+      available in the sandbox via en ersatz file system.++  * Makefile:++    + Add target `release-checkist`.+    + Install @daisy/ace from npm if not present.+    + Use pandoc lua instead of lua.+    + Fix typo in `latex-package-dependencies` target.+    + Use `jq` instead of `json_reformat` in `validate-docx-golden-tests2`.++  * NiX infrastructure: new working `flake.nix` and simpler `shell.nix`.+    Removed old `default.nix`.++  * Require random >= 1.3 and use `splitGen`. `split` has been deprecated.++  * Use citeproc-0.9. Bump citeproc bounds for pandoc, pandoc-lua-engine.++  * Use texmath-0.12.10.1.++  * Use released typst 0.8 (partially supporting typst 0.13).++  * Use citeproc 0.9.0.1.++  * MANUAL.txt:++    + Fix default URL for revealjs.+    + Add note that `alerts` extension only works with commonmark (#9716).+    + Remove "Body Text Char" from list of Word styles that can be customized+      using a reference.docx (#10646). This doesn't seem to be present in+      pandoc-generated docx files, nor is it a Word default.+    + For pandoc lua, add note about the environment.+    + Improve documentation of `--variable` option.++  * `doc/typst-property-output.md`: Mention that `typst:no-figure` is a+    class, not an attribute (#10826, Niklas Eicker).++  * Change RELEASE-CHECKLIST to RELEASE-CHECKLIST-TEMPLATE.org. Use org-babel+    to automate many of the steps of the release.++  * INSTALL.md: update MacPorts information (#10719, Mohamed Akram).++  * COPYRIGHT: fix link to source code.++  * CONTRIBUTING.md: Fix link to discussion forum. (#10834, R. N. West).+ ## pandoc 3.6.4 (2025-03-16)    * Disable `citations` extension in writers if `--citeproc` is used (#10662).
data/docx/word/document.xml view
@@ -15,9 +15,7 @@         <w:pStyle w:val="Title" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Title-</w:t>+        <w:t xml:space="preserve">Title</w:t>       </w:r>     </w:p>     <w:p>@@ -25,9 +23,7 @@         <w:pStyle w:val="Subtitle" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Subtitle-</w:t>+        <w:t xml:space="preserve">Subtitle</w:t>       </w:r>     </w:p>     <w:p>@@ -35,9 +31,7 @@         <w:pStyle w:val="Author" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Author-</w:t>+        <w:t xml:space="preserve">Author</w:t>       </w:r>     </w:p>     <w:p>@@ -45,9 +39,7 @@         <w:pStyle w:val="Date" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Date-</w:t>+        <w:t xml:space="preserve">Date</w:t>       </w:r>     </w:p>     <w:p>@@ -55,9 +47,7 @@         <w:pStyle w:val="Abstract" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Abstract-</w:t>+        <w:t xml:space="preserve">Abstract</w:t>       </w:r>     </w:p>     <w:p>@@ -66,9 +56,7 @@       </w:pPr>       <w:bookmarkStart w:id="21" w:name="heading-1" />       <w:r>-        <w:t xml:space="preserve">-Heading 1-</w:t>+        <w:t xml:space="preserve">Heading 1</w:t>       </w:r>       <w:bookmarkEnd w:id="21" />     </w:p>@@ -78,9 +66,7 @@       </w:pPr>       <w:bookmarkStart w:id="22" w:name="heading-2" />       <w:r>-        <w:t xml:space="preserve">-Heading 2-</w:t>+        <w:t xml:space="preserve">Heading 2</w:t>       </w:r>       <w:bookmarkEnd w:id="22" />     </w:p>@@ -90,9 +76,7 @@       </w:pPr>       <w:bookmarkStart w:id="23" w:name="heading-3" />       <w:r>-        <w:t xml:space="preserve">-Heading 3-</w:t>+        <w:t xml:space="preserve">Heading 3</w:t>       </w:r>       <w:bookmarkEnd w:id="23" />     </w:p>@@ -102,9 +86,7 @@       </w:pPr>       <w:bookmarkStart w:id="24" w:name="heading-4" />       <w:r>-        <w:t xml:space="preserve">-Heading 4-</w:t>+        <w:t xml:space="preserve">Heading 4</w:t>       </w:r>       <w:bookmarkEnd w:id="24" />     </w:p>@@ -114,9 +96,7 @@       </w:pPr>       <w:bookmarkStart w:id="25" w:name="heading-5" />       <w:r>-        <w:t xml:space="preserve">-Heading 5-</w:t>+        <w:t xml:space="preserve">Heading 5</w:t>       </w:r>       <w:bookmarkEnd w:id="25" />     </w:p>@@ -126,9 +106,7 @@       </w:pPr>       <w:bookmarkStart w:id="26" w:name="heading-6" />       <w:r>-        <w:t xml:space="preserve">-Heading 6-</w:t>+        <w:t xml:space="preserve">Heading 6</w:t>       </w:r>       <w:bookmarkEnd w:id="26" />     </w:p>@@ -138,9 +116,7 @@       </w:pPr>       <w:bookmarkStart w:id="27" w:name="heading-7" />       <w:r>-        <w:t xml:space="preserve">-Heading 7-</w:t>+        <w:t xml:space="preserve">Heading 7</w:t>       </w:r>       <w:bookmarkEnd w:id="27" />     </w:p>@@ -150,9 +126,7 @@       </w:pPr>       <w:bookmarkStart w:id="28" w:name="heading-8" />       <w:r>-        <w:t xml:space="preserve">-Heading 8-</w:t>+        <w:t xml:space="preserve">Heading 8</w:t>       </w:r>       <w:bookmarkEnd w:id="28" />     </w:p>@@ -162,9 +136,7 @@       </w:pPr>       <w:bookmarkStart w:id="29" w:name="heading-9" />       <w:r>-        <w:t xml:space="preserve">-Heading 9-</w:t>+        <w:t xml:space="preserve">Heading 9</w:t>       </w:r>       <w:bookmarkEnd w:id="29" />     </w:p>@@ -173,9 +145,7 @@         <w:pStyle w:val="FirstParagraph" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-First Paragraph.-</w:t>+        <w:t xml:space="preserve">First Paragraph.</w:t>       </w:r>     </w:p>     <w:p>@@ -183,57 +153,39 @@         <w:pStyle w:val="BodyText" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Body Text. Body Text Char.-</w:t>+        <w:t xml:space="preserve">Body Text. Body Text Char.</w:t>       </w:r>       <w:r>-        <w:t xml:space="preserve">--</w:t>+        <w:t xml:space="preserve"> </w:t>       </w:r>       <w:r>         <w:rPr>           <w:rStyle w:val="VerbatimChar" />         </w:rPr>-        <w:t xml:space="preserve">-Verbatim Char-</w:t>+        <w:t xml:space="preserve">Verbatim Char</w:t>       </w:r>       <w:r>-        <w:t xml:space="preserve">-.-</w:t>+        <w:t xml:space="preserve">.</w:t>       </w:r>       <w:r>-        <w:t xml:space="preserve">--</w:t>+        <w:t xml:space="preserve"> </w:t>       </w:r>       <w:hyperlink r:id="rId30">         <w:r>           <w:rPr>             <w:rStyle w:val="Hyperlink" />           </w:rPr>-          <w:t xml:space="preserve">-Hyperlink-</w:t>+          <w:t xml:space="preserve">Hyperlink</w:t>         </w:r>       </w:hyperlink>       <w:r>-        <w:t xml:space="preserve">-.-</w:t>+        <w:t xml:space="preserve">.</w:t>       </w:r>       <w:r>-        <w:t xml:space="preserve">--</w:t>+        <w:t xml:space="preserve"> </w:t>       </w:r>       <w:r>-        <w:t xml:space="preserve">-Footnote.-</w:t>+        <w:t xml:space="preserve">Footnote.</w:t>       </w:r>       <w:r>         <w:rPr>@@ -247,9 +199,7 @@         <w:pStyle w:val="BlockText" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Block Text.-</w:t>+        <w:t xml:space="preserve">Block Text.</w:t>       </w:r>     </w:p>     <w:p>@@ -257,9 +207,7 @@         <w:pStyle w:val="TableCaption" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Table caption.-</w:t>+        <w:t xml:space="preserve">Table caption.</w:t>       </w:r>     </w:p>     <w:tbl>@@ -286,9 +234,7 @@               <w:jc w:val="left" />             </w:pPr>             <w:r>-              <w:t xml:space="preserve">-Table-</w:t>+              <w:t xml:space="preserve">Table</w:t>             </w:r>           </w:p>         </w:tc>@@ -305,9 +251,7 @@               <w:jc w:val="left" />             </w:pPr>             <w:r>-              <w:t xml:space="preserve">-Table-</w:t>+              <w:t xml:space="preserve">Table</w:t>             </w:r>           </w:p>         </w:tc>@@ -320,9 +264,7 @@               <w:jc w:val="left" />             </w:pPr>             <w:r>-              <w:t xml:space="preserve">-1-</w:t>+              <w:t xml:space="preserve">1</w:t>             </w:r>           </w:p>         </w:tc>@@ -333,9 +275,7 @@               <w:jc w:val="left" />             </w:pPr>             <w:r>-              <w:t xml:space="preserve">-2-</w:t>+              <w:t xml:space="preserve">2</w:t>             </w:r>           </w:p>         </w:tc>@@ -346,9 +286,7 @@         <w:pStyle w:val="ImageCaption" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Image Caption-</w:t>+        <w:t xml:space="preserve">Image Caption</w:t>       </w:r>     </w:p>     <w:p>@@ -356,9 +294,7 @@         <w:pStyle w:val="DefinitionTerm" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-DefinitionTerm-</w:t>+        <w:t xml:space="preserve">DefinitionTerm</w:t>       </w:r>     </w:p>     <w:p>@@ -366,9 +302,7 @@         <w:pStyle w:val="Definition" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Definition-</w:t>+        <w:t xml:space="preserve">Definition</w:t>       </w:r>     </w:p>     <w:p>@@ -376,9 +310,7 @@         <w:pStyle w:val="DefinitionTerm" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-DefinitionTerm-</w:t>+        <w:t xml:space="preserve">DefinitionTerm</w:t>       </w:r>     </w:p>     <w:p>@@ -386,9 +318,7 @@         <w:pStyle w:val="Definition" />       </w:pPr>       <w:r>-        <w:t xml:space="preserve">-Definition-</w:t>+        <w:t xml:space="preserve">Definition</w:t>       </w:r>     </w:p>     <w:sectPr>
data/docx/word/footnotes.xml view
@@ -1,7 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?>-<w:footnotes xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><w:footnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator /></w:r></w:p></w:footnote><w:footnote w:type="separator" w:id="-1"><w:p><w:r><w:separator /></w:r></w:p></w:footnote><w:footnote w:id="31"><w:p><w:pPr><w:pStyle w:val="FootnoteText" /></w:pPr><w:r>-  <w:rPr>-    <w:rStyle w:val="FootnoteReference" />-  </w:rPr>-  <w:footnoteRef />-</w:r><w:r><w:t xml:space="preserve"> </w:t></w:r><w:r><w:t xml:space="preserve">Footnote Text.</w:t></w:r></w:p></w:footnote></w:footnotes>+<w:footnotes xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">+  <w:footnote w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator /></w:r></w:p></w:footnote>+  <w:footnote w:type="separator" w:id="-1"><w:p><w:r><w:separator /></w:r></w:p></w:footnote>+  <w:footnote w:id="31">+    <w:p>+      <w:pPr><w:pStyle w:val="FootnoteText" /></w:pPr>+      <w:r>+        <w:rPr>+          <w:rStyle w:val="FootnoteReference" />+        </w:rPr>+      <w:footnoteRef />+      </w:r>+      <w:r><w:t>Footnote Text.</w:t></w:r>+    </w:p>+    <w:p>+      <w:pPr><w:pStyle w:val="FootnoteBlockText"/></w:pPr>+      <w:r><w:t>Footnote Block Text</w:t></w:r>+    </w:p>+  </w:footnote>+</w:footnotes>
data/templates/default.beamer view
@@ -114,9 +114,7 @@ \subtitle$if(shortsubtitle)$[$shortsubtitle$]$endif${$subtitle$} $endif$ \author$if(shortauthor)$[$shortauthor$]$endif${$for(author)$$author$$sep$ \and $endfor$}-$if(date)$ \date$if(shortdate)$[$shortdate$]$endif${$date$}-$endif$ $if(institute)$ \institute$if(shortinstitute)$[$shortinstitute$]$endif${$for(institute)$$institute$$sep$ \and $endfor$} $endif$
data/templates/default.ms view
@@ -35,7 +35,7 @@ .\" line height .nr VS $if(lineheight)$$lineheight$$else$12p$endif$ .\" font family: A, BM, H, HN, N, P, T, ZCM-.fam $if(fontfamily)$$fontfamily$$else$P$endif$+.fam $if(fontfamily)$$fontfamily$$else$T$endif$ .\" paragraph indent .nr PI $if(indent)$$indent$$else$0m$endif$ .\" interparagraph space@@ -50,10 +50,6 @@ $endif$ .\" color used for strikeout .defcolor strikecolor rgb 0.7 0.7 0.7-.\" color for links (rgb)-.ds PDFHREF.COLOUR   0.35 0.00 0.60-.\" border for links (default none)-.ds PDFHREF.BORDER   0 0 0 .\" point size difference between heading levels .nr PSINCR 1p .\" heading level above which point size no longer changes@@ -64,14 +60,6 @@ .\" page numbers in footer, centered .ds CH .ds CF %-.\" pdf outline fold level-.nr PDFOUTLINE.FOLDLEVEL 3-.\" start out in outline view-.pdfview /PageMode /UseOutlines-.\" ***************************************************************-.\" PDF metadata-.pdfinfo /Title "$title-meta$"-.pdfinfo /Author "$author-meta$" $if(adjusting)$ .ad $adjusting$ $endif$@@ -84,6 +72,20 @@ .EQ delim @@ .EN+$endif$+$if(pdf-engine)$+.\" color for links (rgb)+.ds PDFHREF.COLOUR   0.35 0.00 0.60+.\" border for links (default none)+.ds PDFHREF.BORDER   0 0 0+.\" pdf outline fold level+.nr PDFOUTLINE.FOLDLEVEL 3+.\" start out in outline view+.pdfview /PageMode /UseOutlines+.\" ***************************************************************+.\" PDF metadata+.pdfinfo /Title "$title-meta$"+.pdfinfo /Author "$author-meta$" $endif$ $for(header-includes)$ $header-includes$
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version:   2.4 name:            pandoc-version:         3.6.4+version:         3.7 build-type:      Simple license:         GPL-2.0-or-later license-file:    COPYING.md@@ -494,7 +494,7 @@                  blaze-markup          >= 0.8      && < 0.9,                  bytestring            >= 0.9      && < 0.13,                  case-insensitive      >= 1.2      && < 1.3,-                 citeproc              >= 0.8.1.3  && < 0.9,+                 citeproc              >= 0.9.0.1  && < 0.10,                  commonmark            >= 0.2.6.1  && < 0.3,                  commonmark-extensions >= 0.2.6    && < 0.3,                  commonmark-pandoc     >= 0.2.3    && < 0.3,@@ -526,7 +526,7 @@                  pretty                >= 1.1      && < 1.2,                  pretty-show           >= 1.10     && < 1.11,                  process               >= 1.2.3    && < 1.7,-                 random                >= 1        && < 1.4,+                 random                >= 1.2      && < 1.4,                  safe                  >= 0.3.18   && < 0.4,                  scientific            >= 0.3      && < 0.4,                  skylighting           >= 0.14.5   && < 0.15,@@ -535,7 +535,7 @@                  syb                   >= 0.1      && < 0.8,                  tagsoup               >= 0.14.6   && < 0.15,                  temporary             >= 1.1      && < 1.4,-                 texmath               >= 0.12.9   && < 0.13,+                 texmath               >= 0.12.10.2 && < 0.13,                  text                  >= 1.1.1.0  && < 2.2,                  text-conversions      >= 0.3      && < 0.4,                  time                  >= 1.5      && < 1.15,@@ -546,7 +546,7 @@                  zip-archive           >= 0.4.3.1  && < 0.5,                  zlib                  >= 0.5      && < 0.8,                  xml                   >= 1.3.12   && < 1.4,-                 typst                 >= 0.7      && < 0.8,+                 typst                 >= 0.8      && < 0.9,                  vector                >= 0.12     && < 0.14,                  djot                  >= 0.1.2.2  && < 0.2,                  tls                   >= 2.0.1    && < 2.2,
src/Text/Pandoc/App.hs view
@@ -40,6 +40,7 @@ import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TE import qualified Data.Text.Encoding.Error as TE+import Data.Char (toLower) import System.Directory (doesDirectoryExist, createDirectory) import Codec.Archive.Zip (toArchiveOrFail,                           extractFilesFromArchive, ZipOption(..))@@ -186,7 +187,8 @@   let writerOptions = outputWriterOptions outputSettings    -- whether we are targeting PDF.-  let pdfOutput = isJust $ outputPdfProgram outputSettings+  let pdfOutput = map toLower (takeExtension outputFile) == ".pdf" ||+                  optTo opts == Just "pdf"   -- whether standalone output should be produced.   let bibOutput = format `elem` ["bibtex", "biblatex", "csljson"]   let standalone = isJust (writerTemplate writerOptions) || bibOutput@@ -309,7 +311,7 @@       | format == "chunkedhtml" -> ZipOutput <$> f writerOptions doc       | otherwise -> BinaryOutput <$> f writerOptions doc     TextWriter f -> case outputPdfProgram outputSettings of-      Just pdfProg -> do+      Just pdfProg | pdfOutput -> do               res <- makePDF pdfProg (optPdfEngineOpts opts) f                       writerOptions doc               case res of@@ -317,7 +319,7 @@                    Left err' -> throwError $ PandocPDFError $                                    TL.toStrict (TE.decodeUtf8With TE.lenientDecode err') -      Nothing -> do+      _ -> do               let ensureNl t                     | standalone = t                     | T.null t || T.last t /= '\n' = t <> T.singleton '\n'
src/Text/Pandoc/App/CommandLineOptions.hs view
@@ -25,6 +25,7 @@ import Control.Monad.Trans import Control.Monad.State.Strict import Data.Containers.ListUtils (nubOrd)+import Data.Aeson (eitherDecode) import Data.Aeson.Encode.Pretty (encodePretty', Config(..), keyOrder,          defConfig, Indent(..), NumberFormat(..)) import Data.Bifunctor (second)@@ -222,6 +223,7 @@           map ("latex",) latexEngines ++           map ("beamer",) latexEngines ++           [ ("ms", "pdfroff")+          , ("ms", "groff")           , ("typst", "typst")           , ("context", "context")           ]@@ -369,6 +371,23 @@                                   setVariable (T.pack key) (T.pack val) $                                     optVariables opt })                   "KEY[:VALUE]")+                 ""++    , Option "" ["variable-json"]+                 (ReqArg+                  (\arg opt -> do+                     let (key, json) = splitField arg+                     case eitherDecode (B.fromStrict . UTF8.fromString $ json) of+                       Right (val :: Val Text) ->+                         return opt{ optVariables =+                                      let Context m = optVariables opt+                                       in Context $ M.insert (T.pack key) val m }+                           -- note that this replaces any existing value, which+                           -- is different from what --variable does+                       Left err'  -> optError $ PandocOptionError $+                          "Could not parse '" <> T.pack json <> "' as JSON:\n" <>+                           T.pack err')+                  "KEY[:JSON]")                  ""      , Option "" ["wrap"]
src/Text/Pandoc/App/OutputSettings.hs view
@@ -84,16 +84,16 @@                         _ -> pure Nothing          liftIO $ pdfWriterAndProg outflavor (optPdfEngine opts)        else case optTo opts of-              Just f -> (, Nothing) <$> parseFlavoredFormat f+              Just f -> (, optPdfEngine opts) <$> parseFlavoredFormat f               Nothing                | outputFile == "-" ->-                   return (defaultOutputFlavor, Nothing)+                   return (defaultOutputFlavor, optPdfEngine opts)                | otherwise -> case formatFromFilePaths [outputFile] of                    Nothing -> do                      report $ CouldNotDeduceFormat                        [T.pack $ takeExtension outputFile] defaultOutput-                     return (defaultOutputFlavor,Nothing)-                   Just f  -> return (f, Nothing)+                     return (defaultOutputFlavor, optPdfEngine opts)+                   Just f  -> return (f, optPdfEngine opts)    when (format == "asciidoctor") $ do     report $ Deprecated "asciidoctor" "use asciidoc instead"@@ -196,6 +196,8 @@     setVariableM "outputfile" (T.pack outputFile)     >>=     setVariableM "pandoc-version" pandocVersionText+    >>=+    maybe return (setVariableM "pdf-engine" . T.pack) maybePdfProg     >>=     setFilesVariableM "include-before" (optIncludeBeforeBody opts)     >>=
src/Text/Pandoc/Citeproc/BibTeX.hs view
@@ -394,7 +394,8 @@                   <|> return Nothing     modify $ \s -> s{ untitlecase = untitlecase s &&                                       case hyphenation of-                                        Just x -> "en-" `T.isPrefixOf` x+                                        Just x ->+                                          "en-" `T.isPrefixOf` x || x == "en"                                         _ -> True }  
src/Text/Pandoc/Class/PandocMonad.hs view
@@ -336,7 +336,7 @@                -> m (B.ByteString, Maybe MimeType) downloadOrRead s  | "data:" `T.isPrefixOf` s,-   Right (bs, mt) <- A.parseOnly pBase64DataURI s+   Right (bs, mt) <- A.parseOnly (pBase64DataURI <* A.endOfInput) s    = pure (bs, Just mt)  | otherwise = do   sourceURL <- getsCommonState stSourceURL
src/Text/Pandoc/Class/PandocPure.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-}@@ -49,7 +50,7 @@ import System.Directory (doesDirectoryExist, getDirectoryContents) import System.FilePath ((</>)) import System.FilePath.Glob (match, compile)-import System.Random (StdGen, split, mkStdGen)+import System.Random (StdGen, mkStdGen) import Text.Pandoc.Class.CommonState (CommonState (..)) import Text.Pandoc.Class.PandocMonad import Text.Pandoc.Error@@ -58,6 +59,15 @@ import qualified Data.Map as M import qualified Data.Text as T import qualified System.Directory as Directory (getModificationTime)++#if MIN_VERSION_random(1,3,0)+import System.Random (splitGen, SplitGen)++split :: SplitGen g => g -> (g, g)+split = splitGen+#else+import System.Random (split)+#endif  -- | The 'PureState' contains ersatz representations -- of things that would normally be obtained through IO.
src/Text/Pandoc/Class/Sandbox.hs view
@@ -12,7 +12,9 @@ -}  module Text.Pandoc.Class.Sandbox-  ( sandbox )+  ( sandbox+  , sandboxWithFileTree+  ) where  import Control.Monad (foldM)@@ -30,8 +32,18 @@ -- ersatz file system and be available for reading. sandbox :: (PandocMonad m, MonadIO m) => [FilePath] -> PandocPure a -> m a sandbox files action = do-  oldState <- getCommonState   tree <- liftIO $ foldM addToFileTree mempty files+  sandboxWithFileTree tree action++-- | Lift a PandocPure action into any instance of PandocMonad.+-- The main computation is done purely, but CommonState is preserved+-- continuously, and warnings are emitted after the action completes.+-- The parameter is an ersatz file system which will be available for+-- reading.+sandboxWithFileTree :: (PandocMonad m, MonadIO m)+                    => FileTree -> PandocPure a -> m a+sandboxWithFileTree tree action = do+  oldState <- getCommonState   case runPure (do putCommonState oldState                    modifyPureState $ \ps -> ps{ stFiles = tree }                    result <- action
src/Text/Pandoc/MIME.hs view
@@ -89,10 +89,12 @@            [("%","application/x-trash")            ,("323","text/h323")            ,("alc","chemical/x-alchemy")+           ,("apng","image/apng")            ,("art","image/x-jg")            ,("asn","chemical/x-ncbi-asn1")            ,("aso","chemical/x-ncbi-asn1-binary")            ,("atomsrv","application/atomserv+xml")+           ,("avif", "image/avif")            ,("b","chemical/x-molconn-Z")            ,("bak","application/x-trash")            ,("bat","application/x-msdos-program")@@ -186,6 +188,7 @@            ,("istr","chemical/x-isostar")            ,("jdx","chemical/x-jcamp-dx")            ,("jfif","image/jpeg")+           ,("jxl","image/jxl")            ,("jmz","application/x-jmol")            ,("key","application/pgp-keys")            ,("kil","application/x-killustrator")
src/Text/Pandoc/PDF.hs view
@@ -111,6 +111,20 @@                    ["-U" | ".PDFPIC" `T.isInfixOf` source] ++                     paperargs ++ pdfargs       generic2pdf program args source+    "groff" -> do+      source <- writer opts doc+      let paperargs =+            case lookupContext "papersize" (writerVariables opts) of+              Just s+                | T.takeEnd 1 s == "l" -> ["-P-p" <>+                                           T.unpack (T.dropEnd 1 s), "-P-l"]+                | otherwise -> ["-P-p" <> T.unpack s]+              Nothing -> []+      let args   = ["-ms", "-Tpdf",+                    "-e", "-t", "-k", "-KUTF-8"] +++                   ["-U" | ".PDFPIC" `T.isInfixOf` source] +++                    paperargs ++ pdfargs+      generic2pdf program args source     baseProg -> do       withTempDir "tex2pdf." $ \tmpdir' -> do #ifdef _WINDOWS
src/Text/Pandoc/Readers/CommonMark.hs view
@@ -120,8 +120,10 @@ handleGfmMath x = walk handleGfmMathInline x  handleGfmMathInline :: Inline -> Inline-handleGfmMathInline (Math InlineMath math') =-  let (ticks, rest) = T.span (== '`') math'+handleGfmMathInline (Math InlineMath math'') =+  let math' = T.replace "\\\\{" "\\{" . T.replace "\\\\}" "\\}" $ math''+              -- see #10631+      (ticks, rest) = T.span (== '`') math'   in  if T.null ticks          then Math InlineMath math'          else case T.stripSuffix ticks rest of
src/Text/Pandoc/Readers/DocBook.hs view
@@ -25,6 +25,7 @@ import Data.FileEmbed import Data.Char (isSpace, isLetter, chr) import Data.Default+import Data.List.Split (splitWhen) import Data.Either (rights) import Data.Foldable (asum) import Data.Generics@@ -539,11 +540,12 @@  type DB m = StateT DBState m -data DBState = DBState{ dbSectionLevel :: Int-                      , dbQuoteType    :: QuoteType-                      , dbMeta         :: Meta-                      , dbBook         :: Bool-                      , dbContent      :: [Content]+data DBState = DBState{ dbSectionLevel  :: Int+                      , dbQuoteType     :: QuoteType+                      , dbMeta          :: Meta+                      , dbBook          :: Bool+                      , dbContent       :: [Content]+                      , dbLiteralLayout :: Bool                       } deriving Show  instance Default DBState where@@ -551,7 +553,8 @@                , dbQuoteType = DoubleQuote                , dbMeta = mempty                , dbBook = False-               , dbContent = [] }+               , dbContent = []+               , dbLiteralLayout = False }   readDocBook :: (PandocMonad m, ToSources a)@@ -966,7 +969,7 @@         "informalexample" -> divWith ("", ["informalexample"], []) <$>                              getBlocks e         "linegroup" -> lineBlock <$> lineItems-        "literallayout" -> codeBlockWithLang+        "literallayout" -> literalLayout         "screen" -> codeBlockWithLang         "programlisting" -> codeBlockWithLang         "?xml"  -> return mempty@@ -990,6 +993,17 @@                             then map (fmap paraToPlain)                             else id +         literalLayout+           | "monospaced" `elem` (T.words (attrValue "class" e))+               = codeBlockWithLang+           | otherwise = do+               oldLiteralLayout <- gets dbLiteralLayout+               modify $ \st -> st{ dbLiteralLayout = True }+               content <- mconcat <$> mapM parseInline (elContent e)+               let ls = map fromList . splitWhen (== LineBreak) . toList $ content+               modify $ \st -> st{ dbLiteralLayout = oldLiteralLayout }+               return $ lineBlock ls+          codeBlockWithLang = do            let classes' = case attrValue "language" e of                                 "" -> []@@ -1203,7 +1217,14 @@         _ -> Just (n, attrValue n e)  parseInline :: PandocMonad m => Content -> DB m Inlines-parseInline (Text (CData _ s _)) = return $ text s+parseInline (Text (CData _ s _)) = do+  literalLayout <- gets dbLiteralLayout+  if literalLayout+     then do+       let ls = T.splitOn "\n" s+       let toLiteralLine = str . T.map (\c -> if c == ' ' then '\xa0' else c)+       return $ mconcat $ intersperse linebreak $ map toLiteralLine ls+     else return $ text s parseInline (CRef ref) =   return $ text $ fromMaybe (T.toUpper ref) $ lookupEntity ref parseInline (Elem e) =
src/Text/Pandoc/Readers/Docx.hs view
@@ -800,14 +800,17 @@   bs <- bodyPartToBlocks bpart   captContents <- bodyPartToBlocks (Paragraph parstyle parparts)   let capt = Caption Nothing (toList captContents)-  case toList bs of-    [Table attr _cap colspecs thead tbodies tfoot]-      -> pure $ singleton $ Table attr capt colspecs thead tbodies tfoot-    [Figure attr _cap blks]-      -> pure $ singleton $ Figure attr capt blks-    [Para im@[Image{}]]-      -> pure $ singleton $ Figure nullAttr capt [Plain im]-    _ -> pure captContents+  let toCaptioned attr' bls = case bls of+        [Table attr _cap colspecs thead tbodies tfoot]+          -> singleton $ Table (attr <> attr') capt colspecs thead tbodies tfoot+        [Figure attr _cap blks]+          -> singleton $ Figure (attr <> attr') capt blks+        [Para im@[Image{}]]+          -> singleton $ Figure attr' capt [Plain im]+        [Div attr bls']+          -> toCaptioned (attr <> attr') bls'+        _ -> captContents+  pure $ toCaptioned nullAttr (toList bs) bodyPartToBlocks (Tbl _ _ _ _ []) =   return mempty bodyPartToBlocks (Tbl mbsty cap grid look parts) = do
src/Text/Pandoc/Readers/Docx/Util.hs view
@@ -79,13 +79,7 @@   | otherwise = Just (modifiedElement, removedChildren)  -- Children removed, return Just   where     -- Separate the children based on the condition-    (removedChildren, keptChildren) = partition condition (onlyElems' $ elContent el)--    -- Helper function to filter only Element types from Content-    onlyElems' :: [Content] -> [Element]-    onlyElems' = foldr (\c acc -> case c of-                                   Elem e -> e : acc-                                   _      -> acc) []+    (removedChildren, keptChildren) = partition condition (onlyElems $ elContent el)      -- Reconstruct the element with the kept children     modifiedElement = el { elContent = map Elem keptChildren }
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -67,6 +67,7 @@ import Text.Pandoc.Readers.LaTeX.Inline (acronymCommands, refCommands,                                          nameCommands, charCommands,                                          accentCommands,+                                         miscCommands,                                          biblatexInlineCommands,                                          verbCommands, rawInlineOr,                                          listingsLanguage)@@ -331,6 +332,7 @@ inlineCommands :: PandocMonad m => M.Map Text (LP m Inlines) inlineCommands = M.unions   [ accentCommands tok+  , miscCommands   , citationCommands inline   , siunitxCommands tok   , acronymCommands@@ -343,6 +345,12 @@   , biblatexInlineCommands tok   , rest ]  where+  disableLigatures p = do+    oldLigatures <- sLigatures <$> getState+    updateState (\s -> s{ sLigatures = False })+    res <- p+    updateState (\s -> s{ sLigatures = oldLigatures })+    pure res   rest = M.fromList     [ ("emph", extractSpaces emph <$> tok)     , ("textit", extractSpaces emph <$> tok)@@ -352,7 +360,7 @@     , ("textmd", extractSpaces (spanWith ("",["medium"],[])) <$> tok)     , ("textrm", extractSpaces (spanWith ("",["roman"],[])) <$> tok)     , ("textup", extractSpaces (spanWith ("",["upright"],[])) <$> tok)-    , ("texttt", formatCode nullAttr <$> tok)+    , ("texttt", formatCode nullAttr <$> disableLigatures tok)     , ("alert", skipopts >> spanWith ("",["alert"],[]) <$> tok) -- beamer     , ("textsuperscript", extractSpaces superscript <$> tok)     , ("textsubscript", extractSpaces subscript <$> tok)@@ -634,6 +642,7 @@         do eatOneToken            report $ ParsingUnescaped t pos            return $ str t+  ligatures <- sLigatures <$> getState   case toktype of     Comment     -> mempty <$ eatOneToken     Spaces      -> space <$ eatOneToken@@ -641,14 +650,19 @@     Word        -> str t <$ eatOneToken     Symbol      ->       case t of-        "-"     -> eatOneToken *>+        "-" | ligatures+                -> eatOneToken *>                     option (str "-") (symbol '-' *>                       option (str "–") (str "—" <$ symbol '-'))         "'"     -> eatOneToken *>-                    option (str "’") (str  "”" <$ symbol '\'')+                    option (str "’") (str  "”" <$ (guard ligatures *> symbol '\''))         "~"     -> str "\160" <$ eatOneToken-        "`"     -> doubleQuote <|> singleQuote <|> symbolAsString-        "\""    -> doubleQuote <|> singleQuote <|> symbolAsString+        "`" | ligatures+                -> doubleQuote <|> singleQuote <|> (str "‘" <$ symbol '`')+            | otherwise+                -> str "‘" <$ symbol '`'+        "\"" | ligatures+                -> doubleQuote <|> singleQuote <|> symbolAsString         "“"     -> doubleQuote <|> symbolAsString         "‘"     -> singleQuote <|> symbolAsString         "$"     -> dollarsMath <|> unescapedSymbolAsString
src/Text/Pandoc/Readers/LaTeX/Inline.hs view
@@ -14,6 +14,7 @@   , verbCommands   , charCommands   , accentCommands+  , miscCommands   , nameCommands   , biblatexInlineCommands   , refCommands@@ -183,6 +184,43 @@   , ("Verb", doverb)   ] +miscCommands :: PandocMonad m => M.Map Text (LP m Inlines)+miscCommands =+  M.fromList+  [ ("pounds", lit "£")+  , ("euro", lit "€")+  , ("copyright", lit "©")+  , ("textasciicircum", lit "^")+  , ("textasciitilde", lit "~")+  , ("textbaht", lit "฿")+  , ("textblank", lit "␢")+  , ("textbigcircle", lit "○")+  , ("textbrokenbar", lit "¦")+  , ("textbullet", lit "•")+  , ("textcentoldstyle", lit "¢")+  , ("textcopyright", lit "©")+  , ("textdagger", lit "†")+  , ("textdegree", lit "°")+  , ("textdollar", lit "$")+  , ("textdong", lit "₫")+  , ("textlira", lit "₤")+  , ("textmu", lit "μ")+  , ("textmusicalnote", lit "♪")+  , ("textonehalf", lit "½")+  , ("textonequarter", lit "¼")+  , ("textparagraph", lit "¶")+  , ("textpertenthousand", lit "‱")+  , ("textpeso", lit "₱")+  , ("textquotesingle", lit "'")+  , ("textregistered", lit "®")+  , ("textsection", lit "§")+  , ("textsterling", lit "£")+  , ("textthreequarters", lit "¾")+  , ("textthreesuperior", lit "³")+  , ("texttwosuperior", lit "²")+  , ("textyen", lit "¥")+  ]+ accentCommands :: PandocMonad m => LP m Inlines -> M.Map Text (LP m Inlines) accentCommands tok =   let accent = accentWith tok@@ -198,11 +236,6 @@   , ("AE", lit "Æ")   , ("oe", lit "œ")   , ("OE", lit "Œ")-  , ("pounds", lit "£")-  , ("euro", lit "€")-  , ("copyright", lit "©")-  , ("textasciicircum", lit "^")-  , ("textasciitilde", lit "~")   , ("H", accent '\779' Nothing) -- hungarumlaut   , ("`", accent '\768' (Just '`')) -- grave   , ("'", accent '\769' (Just '\'')) -- acute
src/Text/Pandoc/Readers/LaTeX/Math.hs view
@@ -2,6 +2,7 @@ module Text.Pandoc.Readers.LaTeX.Math   ( dollarsMath   , inlineEnvironments+  , inlineEnvironmentNames   , inlineEnvironment   , mathInline   , mathDisplay@@ -79,6 +80,10 @@   controlSeq "begin"   name <- untokenize <$> braced   M.findWithDefault mzero name inlineEnvironments++inlineEnvironmentNames :: [Text]+inlineEnvironmentNames =+  M.keys (inlineEnvironments :: M.Map Text (LP PandocPure Inlines))  inlineEnvironments :: PandocMonad m => M.Map Text (LP m Inlines) inlineEnvironments = M.fromList [
src/Text/Pandoc/Readers/LaTeX/Parsing.hs view
@@ -173,6 +173,7 @@                             , sFileContents  :: M.Map Text Text                             , sEnableWithRaw :: Bool                             , sRawTokens     :: IntMap.IntMap [Tok]+                            , sLigatures     :: Bool                             }      deriving Show @@ -201,6 +202,7 @@                               , sFileContents  = M.empty                               , sEnableWithRaw = True                               , sRawTokens     = IntMap.empty+                              , sLigatures     = True                               }  instance PandocMonad m => HasQuoteContext LaTeXState m where
src/Text/Pandoc/Readers/LaTeX/Table.hs view
@@ -57,7 +57,7 @@  lbreak :: PandocMonad m => LP m Tok lbreak = (controlSeq "\\" <|> controlSeq "tabularnewline")-         <* skipopts <* spaces+         <* optional (void rawopt) <* spaces  amp :: PandocMonad m => LP m Tok amp = symbol '&'
src/Text/Pandoc/Readers/MediaWiki.hs view
@@ -55,6 +55,7 @@                                             , mwIdentifierList = Set.empty                                             , mwLogMessages = []                                             , mwInTT = False+                                            , mwAllowNewlines = True                                             }             sources   case parsed of@@ -68,6 +69,7 @@                        , mwIdentifierList  :: Set.Set Text                        , mwLogMessages     :: [LogMessage]                        , mwInTT            :: Bool+                       , mwAllowNewlines   :: Bool                        }  type MWParser m = ParsecT Sources MWState m@@ -453,9 +455,8 @@   guardColumnOne   char ';'   skipMany spaceChar-  pos' <- getPosition-  anyLine >>= parseFromString (do setPosition pos'-                                  trimInlines . mconcat <$> many inline)+  trimInlines . mconcat <$> many (notFollowedBy (oneOf ":\r\n") *> inline) <*+    optional newline  listStart :: PandocMonad m => Char -> MWParser m () listStart c = char c *> notFollowedBy listStartChar@@ -472,7 +473,7 @@  listItem :: PandocMonad m => Char -> MWParser m Blocks listItem c = try $ do-  guardColumnOne+  guardColumnOne <|> guard (c == ':') -- def can start on same line as term   extras <- many (try $ char c <* lookAhead listStartChar)   if null extras      then listItem' c@@ -607,13 +608,14 @@          <|> B.softbreak <$ endline  endline :: PandocMonad m => MWParser m ()-endline = () <$ try (newline <*-                     notFollowedBy spaceChar <*-                     notFollowedBy newline <*-                     notFollowedBy' hrule <*-                     notFollowedBy tableStart <*-                     notFollowedBy' header <*-                     notFollowedBy anyListStart)+endline = do+ getState >>= guard . mwAllowNewlines+ () <$ try (newline <* notFollowedBy spaceChar <*+                       notFollowedBy newline <*+                       notFollowedBy' hrule <*+                       notFollowedBy tableStart <*+                       notFollowedBy' header <*+                       notFollowedBy anyListStart)  imageIdentifier :: PandocMonad m => MWParser m () imageIdentifier = try $ do
src/Text/Pandoc/Readers/Org/BlockStarts.hs view
@@ -23,13 +23,14 @@   , endOfBlock   ) where -import Control.Monad (void)+import Control.Monad (void, guard) import Data.Text (Text) import Text.Pandoc.Readers.Org.Parsing import Text.Pandoc.Definition as Pandoc import Text.Pandoc.Shared (safeRead) import Text.Pandoc.Parsing (lowerAlpha, upperAlpha) import Text.Pandoc.Extensions+import Text.Pandoc.Readers.LaTeX.Math (inlineEnvironmentNames) import Data.Functor (($>))  -- | Horizontal Line (five -- dashes or more)@@ -55,10 +56,13 @@   latexEnvStart :: Monad m => OrgParser m Text-latexEnvStart = try $-  skipSpaces *> string "\\begin{"-             *> latexEnvName-             <* string "}"+latexEnvStart = try $ do+  skipSpaces+  string "\\begin{"+  name <- latexEnvName+  char '}'+  guard $ name `notElem` inlineEnvironmentNames+  pure name  where    latexEnvName :: Monad m => OrgParser m Text    latexEnvName = try $ mappend <$> many1Char alphaNum <*> option "" (textStr "*")
src/Text/Pandoc/Readers/Org/Blocks.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts  #-} {-# LANGUAGE LambdaCase        #-} {-# LANGUAGE OverloadedStrings #-}@@ -25,7 +26,7 @@ import Text.Pandoc.Readers.Org.Parsing import Text.Pandoc.Readers.Org.Shared (cleanLinkText, isImageFilename,                                        originalLang, translateLang, exportsCode)-+import Text.Pandoc.Readers.LaTeX.Math (inlineEnvironmentNames) import Text.Pandoc.Builder (Blocks, Inlines, Many(..)) import Text.Pandoc.Class.PandocMonad (PandocMonad) import Text.Pandoc.Definition@@ -796,6 +797,7 @@ latexFragment :: PandocMonad m => OrgParser m (F Blocks) latexFragment = try $ do   envName <- latexEnvStart+  guard $ envName `notElem` inlineEnvironmentNames   texOpt  <- getExportSetting exportWithLatex   let envStart = "\\begin{" <> envName <> "}"   let envEnd = "\\end{" <> envName <> "}"
src/Text/Pandoc/Readers/Org/Inlines.hs view
@@ -635,11 +635,11 @@ verbatimBetween :: PandocMonad m                 => Char                 -> OrgParser m Text-verbatimBetween c = try $-  emphasisStart c *>-  many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c)+verbatimBetween c = newlinesToSpaces <$>+  try (emphasisStart c *> many1TillNOrLessNewlines 1 verbatimChar (emphasisEnd c))  where    verbatimChar = noneOf "\n\r" >>= updatePositions+   newlinesToSpaces = T.map (\d -> if d == '\n' then ' ' else d)  -- | Parses a raw string delimited by @c@ using Org's math rules mathTextBetween :: PandocMonad m@@ -808,16 +808,20 @@   allowEntities <- getExportSetting exportWithEntities   ils <- parseAsInlineLaTeX cmd texOpt   maybe mzero returnF $-     parseAsMathMLSym allowEntities cmd `mplus`-     parseAsMath cmd texOpt `mplus`-     ils+    if "\\begin{" `T.isPrefixOf` cmd+       then ils+       else parseAsMathMLSym allowEntities cmd `mplus`+            parseAsMath cmd texOpt `mplus`+            ils  where    parseAsInlineLaTeX :: PandocMonad m                       => Text -> TeXExport -> OrgParser m (Maybe Inlines)    parseAsInlineLaTeX cs = \case-     TeXExport -> maybeRight <$> runParserT inlineCommand state "" (toSources cs)+     TeXExport -> maybeRight <$> runParserT+                  (B.rawInline "latex" . snd <$> withRaw inlineCommand)+                  state "" (toSources cs)      TeXIgnore -> return (Just mempty)-     TeXVerbatim -> return (Just $ B.str cs)+     TeXVerbatim -> return (Just $ B.text cs)     parseAsMathMLSym :: Bool -> Text -> Maybe Inlines    parseAsMathMLSym allowEntities cs = do
src/Text/Pandoc/Readers/Org/Shared.hs view
@@ -32,7 +32,7 @@                        `elem` imageExtensions    isKnownProtocolUri = any (\x -> (x <> "://") `T.isPrefixOf` fp) protocols -   imageExtensions = [ ".jpeg", ".jpg", ".png", ".gif", ".svg", ".webp", ".jxl" ]+   imageExtensions = [ ".jpeg", ".jpg", ".png", ".gif", ".svg", ".webp", ".jxl", ".avif" ]    protocols = [ "file", "http", "https" ]  -- | Cleanup and canonicalize a string describing a link.  Return @Nothing@ if
src/Text/Pandoc/Readers/Typst.hs view
@@ -466,7 +466,7 @@                 (B.fromList . blocksToInlines . B.toList <$> pBlocks) body       pure $ B.link src "" description)   ,("image", \_ fields -> do-      path <- getField "path" fields+      path <- getField "source" fields <|> getField "path" fields       alt <- (B.text <$> getField "alt" fields) `mplus` pure mempty       (mbwidth :: Maybe Text) <-         fmap (renderLength False) <$> getField "width" fields
src/Text/Pandoc/RoffChar.hs view
@@ -19,23 +19,25 @@ import qualified Data.Text as T  -- | These are the escapes specifically mentioned in groff_man(7),--- plus @ and ellipsis.+-- plus @ and ellipsis. We use the \(aq form when possible (with+-- two-letter escapes), because these are compatible with all forms+-- of roff (#10716). standardEscapes :: [(Char, T.Text)] standardEscapes =   [ ('\160', "\\ ")-  , ('\'', "\\[aq]")-  , ('‘', "\\[oq]")-  , ('’', "\\[cq]")-  , ('"', "\\[dq]")-  , ('“', "\\[lq]")-  , ('”', "\\[rq]")-  , ('—', "\\[em]")-  , ('–', "\\[en]")-  , ('`', "\\[ga]")-  , ('^', "\\[ha]")-  , ('~', "\\[ti]")-  , ('\\', "\\[rs]")-  , ('@', "\\[at]") -- because we use @ as a table and math delimiter+  , ('\'', "\\(aq")+  , ('‘', "\\(oq")+  , ('’', "\\(cq")+  , ('"', "\\(dq")+  , ('“', "\\(lq")+  , ('”', "\\(rq")+  , ('—', "\\(em")+  , ('–', "\\(en")+  , ('`', "\\(ga")+  , ('^', "\\(ha")+  , ('~', "\\(ti")+  , ('\\', "\\(rs")+  , ('@', "\\(at") -- because we use @ as a table and math delimiter   , ('\x2026', "\\&...")  -- because u2026 doesn't render on tty   ] 
src/Text/Pandoc/URI.hs view
@@ -24,11 +24,12 @@ import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.Text as T import qualified Data.Set as Set-import Data.Char (isSpace, isAscii)+import Data.Char (isSpace, isAscii, isHexDigit, chr)+import Safe (readMay) import Network.URI (URI (uriScheme), parseURI, escapeURIString) import qualified Data.Attoparsec.Text as A import Data.Text.Encoding (encodeUtf8)-import Control.Applicative (many)+import Control.Applicative (many, (<|>))  urlEncode :: T.Text -> T.Text urlEncode = UTF8.toText . HTTP.urlEncode True . UTF8.fromText@@ -133,10 +134,18 @@       mps <- many mediaParam       pure $ n1 <> "/" <> n2 <> mconcat mps     A.string ";base64,"-    b64 <- A.takeWhile (A.inClass "A-Za-z0-9+/")+    b64 <- mconcat <$> many+              (A.takeWhile1 (A.inClass "A-Za-z0-9/+ \t\r\n") <|> percentOctet)     A.skipWhile (== '=')     -- this decode should be lazy:     pure (decodeLenient (encodeUtf8 b64), mime)+  percentOctet = do+    A.char '%'+    x <- A.satisfy isHexDigit+    y <- A.satisfy isHexDigit+    case readMay ['0','x',x,y] of+      Nothing -> fail $ "Could not read percent encoded byte " <> [x,y]+      Just d -> pure $ T.singleton $ chr d   restrictedName = do     c <- A.satisfy (A.inClass "A-Za-z0-9")     rest <- A.takeWhile (A.inClass "A-Za-z0-9!#$&^_.+-")
src/Text/Pandoc/Writers/DocBook.hs view
@@ -246,7 +246,7 @@                         <$> inlinesToDocBook opts lst   | otherwise         = inTagsIndented "para" <$> inlinesToDocBook opts lst blockToDocBook opts (LineBlock lns) =-  blockToDocBook opts $ linesToPara lns+  inTags False "literallayout" [] . vcat <$> mapM (inlinesToDocBook opts) lns blockToDocBook opts (BlockQuote blocks) =   inTagsIndented "blockquote" <$> blocksToDocBook opts blocks blockToDocBook opts (CodeBlock (_,classes,_) str) = return $
src/Text/Pandoc/Writers/Docx.hs view
@@ -3,9 +3,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ViewPatterns        #-} {-# LANGUAGE FlexibleContexts    #-}-{-# LANGUAGE LambdaCase          #-} {-# LANGUAGE OverloadedStrings   #-}-{-# LANGUAGE TypeApplications    #-} {- |    Module      : Text.Pandoc.Writers.Docx    Copyright   : Copyright (C) 2012-2024 John MacFarlane@@ -64,29 +62,6 @@ import Data.Generics (mkT, everywhere) import Text.Collate.Lang (renderLang, Lang(..)) -renumIdMap :: Int -> [Element] -> M.Map Text Text-renumIdMap _ [] = M.empty-renumIdMap n (e:es)-  | Just oldId <- findAttr (QName "Id" Nothing Nothing) e =-      M.insert oldId ("rId" <> tshow n) (renumIdMap (n+1) es)-  | otherwise = renumIdMap n es--replaceAttr :: (QName -> Bool) -> Text -> [XML.Attr] -> [XML.Attr]-replaceAttr f val = map $-    \a -> if f (attrKey a) then XML.Attr (attrKey a) val else a--renumId :: (QName -> Bool) -> M.Map Text Text -> Element -> Element-renumId f renumMap e-  | Just oldId <- findAttrBy f e-  , Just newId <- M.lookup oldId renumMap =-    let attrs' = replaceAttr f newId (elAttribs e)-    in-     e { elAttribs = attrs' }-  | otherwise = e--renumIds :: (QName -> Bool) -> M.Map Text Text -> [Element] -> [Element]-renumIds f renumMap = map (renumId f renumMap)- writeDocx :: (PandocMonad m)           => WriterOptions  -- ^ Writer options           -> Pandoc         -- ^ Document to convert@@ -176,12 +151,6 @@                    [] -> stTocTitle defaultWriterState                    ls -> ls -  let initialSt = defaultWriterState {-          stStyleMaps  = styleMaps-        , stTocTitle   = tocTitle-        , stCurId      = 20-        }-   let isRTLmeta = case lookupMeta "dir" meta of         Just (MetaString "rtl")        -> True         Just (MetaInlines [Str "rtl"]) -> True@@ -194,52 +163,61 @@         , envPrintWidth = maybe 420 (`quot` 20) pgContentWidth         } -  parsedRels <- parseXml refArchive distArchive "word/_rels/document.xml.rels"+  let isImageNode e = findAttr (QName "Type" Nothing Nothing) e == Just "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"   let isHeaderNode e = findAttr (QName "Type" Nothing Nothing) e == Just "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"   let isFooterNode e = findAttr (QName "Type" Nothing Nothing) e == Just "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"-  let headers = filterElements isHeaderNode parsedRels-  let footers = filterElements isFooterNode parsedRels+  parsedRels <- filterElements+                  (\e -> isImageNode e || isHeaderNode e || isFooterNode e)+              <$> parseXml refArchive distArchive "word/_rels/document.xml.rels"+  let getRelId e =+        case findAttr (QName "Id" Nothing Nothing) e of+          Just ident -> T.stripPrefix "rId" ident >>= safeRead+          Nothing -> Nothing+  let relIds = mapMaybe getRelId parsedRels+  let maxRelId = if null relIds then 0 else maximum relIds++  let headers = filter isHeaderNode parsedRels+  let footers = filter isFooterNode parsedRels   -- word/_rels/document.xml.rels-  let toBaseRel (url', id', target') = mknode "Relationship"-                                          [("Type",url')-                                          ,("Id",id')-                                          ,("Target",target')] ()-  let baserels' = map toBaseRel+  let addBaseRel (url', target') (maxId, rels) =+        case [e | e <- rels+                , findAttr (QName "Target" Nothing Nothing) e ==+                   Just target'] of+          [] -> (maxId + 1, mknode "Relationship"+                            [("Type",url')+                            ,("Id","rId" <> tshow (maxId + 1))+                            ,("Target",target')] () : rels)+          _ -> (maxId, rels)++  let (newMaxRelId, baserels) = foldr addBaseRel (maxRelId, parsedRels)                     [("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",-                      "rId1",                       "numbering.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",-                      "rId2",                       "styles.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",-                      "rId3",                       "settings.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",-                      "rId4",                       "webSettings.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",-                      "rId5",                       "fontTable.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",-                      "rId6",                       "theme/theme1.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",-                      "rId7",                       "footnotes.xml")                     ,("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",-                      "rId8",                       "comments.xml")                     ] -  let idMap = renumIdMap (length baserels' + 1) (headers ++ footers)+  let initialSt = defaultWriterState {+          stStyleMaps  = styleMaps+        , stTocTitle   = tocTitle+        , stCurId      = newMaxRelId + 1+        }    -- adjust contents to add sectPr from reference.docx   let sectpr = case mbsectpr of-        Just sectpr' -> let cs = renumIds-                                 (\q -> qName q == "id" && qPrefix q == Just "r")-                                 idMap-                                 (elChildren sectpr')-                        in add_attrs (elAttribs sectpr') $ mknode "w:sectPr" [] cs+        Just sectpr' -> add_attrs (elAttribs sectpr') $ mknode "w:sectPr" []+                             (elChildren sectpr')         Nothing      -> mknode "w:sectPr" []                           [ mknode "w:footnotePr" []                             [ mknode "w:numRestart" [("w:val","eachSect")] () ]@@ -331,10 +309,6 @@   let contentTypesEntry = toEntry "[Content_Types].xml" epochtime         $ renderXml contentTypesDoc --  let renumHeaders = renumIds (\q -> qName q == "Id") idMap headers-  let renumFooters = renumIds (\q -> qName q == "Id") idMap footers-  let baserels = baserels' ++ renumHeaders ++ renumFooters   let toImgRel (ident,path,_,_) =  mknode "Relationship" [("Type","http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"),("Id",T.pack ident),("Target",T.pack path)] ()   let imgrels = map toImgRel imgs   let toLinkRel (src,ident) =  mknode "Relationship" [("Type","http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"),("Id",ident),("Target",src),("TargetMode","External") ] ()
src/Text/Pandoc/Writers/HTML.hs view
@@ -447,7 +447,7 @@                   defField "slidy-url"                     ("https://www.w3.org/Talks/Tools/Slidy2" :: Doc Text) .                   defField "slideous-url" ("slideous" :: Doc Text) .-                  defField "revealjs-url" ("https://unpkg.com/reveal.js@^4/" :: Doc Text) $+                  defField "revealjs-url" ("https://unpkg.com/reveal.js@^5" :: Doc Text) $                   defField "s5-url" ("s5/default" :: Doc Text) .                   defField "table-caption-below"                      (writerTableCaptionPosition opts == CaptionBelow) .
src/Text/Pandoc/Writers/Haddock.hs view
@@ -125,14 +125,12 @@ blockToHaddock opts (BlockQuote blocks) =   blockListToHaddock opts blocks blockToHaddock opts (Table _ blkCapt specs thead tbody tfoot) = do-  let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot-  caption' <- inlineListToHaddock opts caption+  let Caption _ caption = blkCapt+  caption' <- blockListToHaddock opts caption   let caption'' = if null caption                      then empty                      else blankline <> caption' <> blankline-  tbl <- gridTable opts blockListToHaddock-              (all null headers) (map (const AlignDefault) aligns)-                widths headers rows+  tbl <- gridTable opts blockListToHaddock specs thead tbody tfoot   return $ (tbl $$ blankline $$ caption'') $$ blankline blockToHaddock opts (BulletList items) = do   contents <- mapM (bulletListItemToHaddock opts) items
src/Text/Pandoc/Writers/JATS.hs view
@@ -72,7 +72,7 @@     ("validation", "Validation"),     ("visualization", "Visualization"),     ("writing-original-draft", "Writing – original draft"),-    ("writing-review-editing", "Writing – review & editing")]+    ("writing-review-editing", "Writing – review &amp; editing")]  -- | Ensure every role with a `credit` key also has a `credit-name`, -- using a default value if necessary
src/Text/Pandoc/Writers/LaTeX/Table.hs view
@@ -367,6 +367,10 @@                                <> braces ("%\n" <> x)                                   -- linebreak for readability   let hasColWidths = not (all (== ColWidthDefault) colWidths)+  let aligncmd = case specAlign of+                   AlignCenter -> "\\centering\\arraybackslash "+                   AlignRight -> "\\raggedright\\arraybackslash "+                   _ -> mempty   let inMultiRow x = case rowspan of                        (RowSpan 1) -> x                        (RowSpan n) -> let nrows = literal (tshow n)@@ -375,7 +379,7 @@                                              (if hasColWidths                                                  then "=" -- max width                                                  else "*") -- natural width-                                         <> braces x+                                         <> braces (aligncmd <> x)   return . inMultiColumn . inMultiRow $ result  -- | Returns the width of a cell spanning @n@ columns.
src/Text/Pandoc/Writers/Man.hs view
@@ -200,7 +200,7 @@ bulletListItemToMan opts (Plain first:rest) = do   first' <- blockToMan opts (Plain first)   rest' <- blockListToMan opts rest-  let first'' = literal ".IP \\[bu] 2" $$ first'+  let first'' = literal ".IP \\(bu 2" $$ first'   let rest''  = if null rest                    then empty                    else literal ".RS 2" $$ rest' $$ literal ".RE"@@ -208,7 +208,7 @@ bulletListItemToMan opts (first:rest) = do   first' <- blockToMan opts first   rest' <- blockListToMan opts rest-  return $ literal "\\[bu] .RS 2" $$ first' $$ rest' $$ literal ".RE"+  return $ literal "\\(bu .RS 2" $$ first' $$ rest' $$ literal ".RE"  -- | Convert ordered list item (a list of blocks) to man. orderedListItemToMan :: PandocMonad m@@ -299,7 +299,7 @@   return $ char '`' <> contents <> char '\'' inlineToMan opts (Quoted DoubleQuote lst) = do   contents <- inlineListToMan opts lst-  return $ literal "\\[lq]" <> contents <> literal "\\[rq]"+  return $ literal "\\(lq" <> contents <> literal "\\(rq" inlineToMan opts (Cite _ lst) =   inlineListToMan opts lst inlineToMan opts (Code _ str) =
src/Text/Pandoc/Writers/Markdown.hs view
@@ -604,6 +604,15 @@   return $ text leader <> prefixed leader contents <> blankline blockToMarkdown' opts t@(Table (ident,_,_) blkCapt specs thead tbody tfoot) = do   let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot+  let isColRowSpans (Cell _ _ rs cs _) = rs > 1 || cs > 1+  let rowHasColRowSpans (Row _ cs) = any isColRowSpans cs+  let tbodyHasColRowSpans (TableBody _ _ rhs rs) =+        any rowHasColRowSpans rhs || any rowHasColRowSpans rs+  let theadHasColRowSpans (TableHead _ rs) = any rowHasColRowSpans rs+  let tfootHasColRowSpans (TableFoot _ rs) = any rowHasColRowSpans rs+  let hasColRowSpans = theadHasColRowSpans thead ||+                       any tbodyHasColRowSpans tbody ||+                       tfootHasColRowSpans tfoot   let numcols = maximum (length aligns :| length widths :                            map length (headers:rows))   caption' <- inlineListToMarkdown opts caption@@ -616,7 +625,7 @@         = blankline $$ (": " <> caption'') $$ blankline         | otherwise = blankline $$ caption'' $$ blankline   let hasSimpleCells = onlySimpleTableCells $ headers : rows-  let isSimple = hasSimpleCells && all (==0) widths+  let isSimple = hasSimpleCells && all (==0) widths && not hasColRowSpans   let isPlainBlock (Plain _) = True       isPlainBlock _         = False   let hasBlocks = not (all (all (all isPlainBlock)) $ headers:rows)@@ -646,7 +655,7 @@            tbl <- pipeTable opts (all null headers) aligns' widths'                      rawHeaders rawRows            return $ (tbl $$ caption''') $$ blankline-       | not hasBlocks &&+       | not (hasBlocks || hasColRowSpans) &&          isEnabled Ext_multiline_tables opts -> do            rawHeaders <- padRow <$> mapM (blockListToMarkdown opts) headers            rawRows <- mapM (fmap padRow . mapM (blockListToMarkdown opts))@@ -655,11 +664,12 @@                      aligns' widths' rawHeaders rawRows            return $ nest 2 (tbl $$ caption''') $$ blankline        | isEnabled Ext_grid_tables opts &&-          writerColumns opts >= 8 * numcols -> do+          (hasColRowSpans || writerColumns opts >= 8 * numcols) -> do            tbl <- gridTable opts blockListToMarkdown-             (all null headers) aligns' widths' headers rows+                     specs thead tbody tfoot            return $ (tbl $$ caption''') $$ blankline-       | hasSimpleCells &&+       | hasSimpleCells,+         not hasColRowSpans,          isEnabled Ext_pipe_tables opts -> do            rawHeaders <- padRow <$> mapM (blockListToMarkdown opts) headers            rawRows <- mapM (fmap padRow . mapM (blockListToMarkdown opts))@@ -709,14 +719,20 @@   return $ mconcat contents <> blankline blockToMarkdown' opts (Figure figattr capt body) = do   let combinedAttr imgattr = case imgattr of-        ("", cls, kv) | (figid, [], []) <- figattr -> Just (figid, cls, kv)+        ("", cls, kv)+          | (figid, [], []) <- figattr -> Just (figid, cls, kv)+          | otherwise -> Just ("", cls, kv)         _ -> Nothing   let combinedAlt alt = case capt of         Caption Nothing [] -> if null alt                               then Just [Str "image"]                               else Just alt         Caption Nothing [Plain captInlines]-          | captInlines == alt || null alt -> Just captInlines+          | null alt || stringify captInlines == stringify alt+            -> Just captInlines+        Caption Nothing [Para captInlines]+          | null alt || stringify captInlines == stringify alt+            -> Just captInlines         _ -> Nothing   case body of     [Plain [Image imgAttr alt (src, ttl)]]@@ -763,8 +779,11 @@       writeHtml5String         opts{ writerTemplate = Nothing }         (Pandoc nullMeta [Figure attr capt body])-  | otherwise = let attr' = (ident, ["figure"] `union` classes, kvs)-                in blockToMarkdown' opts (Div attr' body)+  | otherwise = do+      let attr' = (ident, ["figure"] `union` classes, kvs)+      let Caption _mbshort caption = capt+      let captionBs = [Div ("",["caption"],[]) caption | not (null caption)]+      blockToMarkdown' opts (Div attr' (body <> captionBs))  itemEndsWithTightList :: [Block] -> Bool itemEndsWithTightList bs =@@ -783,6 +802,9 @@               Markua -> "* "               Commonmark -> "- "               Markdown+                | isEnabled Ext_four_space_rule opts+                  -> "- " <> T.replicate (writerTabStop opts - 2) " "+              PlainText                 | isEnabled Ext_four_space_rule opts                   -> "- " <> T.replicate (writerTabStop opts - 2) " "               _ -> "- "
src/Text/Pandoc/Writers/Markdown/Inline.hs view
@@ -372,9 +372,9 @@   contents <- inlineListToMarkdown opts lst   return $ case variant of              PlainText-               | isEnabled Ext_gutenberg opts -> "_" <> contents <> "_"+               | isEnabled Ext_gutenberg opts -> delimited "_" "_" contents                | otherwise ->  contents-             _ -> "*" <> contents <> "*"+             _ -> delimited "*" "*" contents inlineToMarkdown _ (Underline []) = return empty inlineToMarkdown opts (Underline lst) = do   variant <- asks envVariant@@ -382,7 +382,7 @@   case variant of     PlainText -> return contents     _     | isEnabled Ext_bracketed_spans opts ->-            return $ "[" <> contents <> "]" <> "{.underline}"+            return $ delimited "[" "]{.underline}" contents           | isEnabled Ext_native_spans opts ->             return $ tagWithAttrs "span" ("", ["underline"], [])               <> contents@@ -401,12 +401,12 @@                   else lst     _ -> do        contents <- inlineListToMarkdown opts lst-       return $ "**" <> contents <> "**"+       return $ delimited "**" "**" contents inlineToMarkdown _ (Strikeout []) = return empty inlineToMarkdown opts (Strikeout lst) = do   contents <- inlineListToMarkdown opts lst   return $ if isEnabled Ext_strikeout opts-              then "~~" <> contents <> "~~"+              then delimited "~~" "~~" contents               else if isEnabled Ext_raw_html opts                        then "<s>" <> contents <> "</s>"                        else contents@@ -415,7 +415,7 @@   local (\env -> env {envEscapeSpaces = envVariant env == Markdown}) $ do     contents <- inlineListToMarkdown opts lst     if isEnabled Ext_superscript opts-       then return $ "^" <> contents <> "^"+       then return $ delimited "^" "^" contents        else if isEnabled Ext_raw_html opts                 then return $ "<sup>" <> contents <> "</sup>"                 else@@ -433,7 +433,7 @@   local (\env -> env {envEscapeSpaces = envVariant env == Markdown}) $ do     contents <- inlineListToMarkdown opts lst     if isEnabled Ext_subscript opts-       then return $ "~" <> contents <> "~"+       then return $ delimited "~" "~" contents        else if isEnabled Ext_raw_html opts                 then return $ "<sub>" <> contents <> "</sub>"                 else@@ -511,7 +511,7 @@           _ | isEnabled Ext_tex_math_gfm opts ->                 return $ "$`" <> literal str <> "`$"             | isEnabled Ext_tex_math_dollars opts ->-                return $ "$" <> literal str <> "$"+                return $ delimited "$" "$" (literal str)             | isEnabled Ext_tex_math_single_backslash opts ->                 return $ "\\(" <> literal str <> "\\)"             | isEnabled Ext_tex_math_double_backslash opts ->@@ -537,10 +537,10 @@                         (url <> urlEncode str', str'))           _ | isEnabled Ext_tex_math_gfm opts ->                 return $ cr <> (literal "``` math"-                             $$ literal str+                             $$ literal (T.dropAround (=='\n') str)                              $$ literal "```") <> cr             | isEnabled Ext_tex_math_dollars opts ->-                return $ "$$" <> literal str <> "$$"+                return $ delimited "$$" "$$" (literal str)             | isEnabled Ext_tex_math_single_backslash opts ->                 return $ "\\[" <> literal str <> "\\]"             | isEnabled Ext_tex_math_double_backslash opts ->
src/Text/Pandoc/Writers/MediaWiki.hs view
@@ -38,6 +38,7 @@ data WriterState = WriterState {     stNotes   :: Bool            -- True if there are notes   , stOptions :: WriterOptions   -- writer options+  , stInDefLabel :: Bool         -- True if in definition list label   }  data WriterReader = WriterReader {@@ -51,7 +52,8 @@ -- | Convert Pandoc to MediaWiki. writeMediaWiki :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeMediaWiki opts document =-  let initialState = WriterState { stNotes = False, stOptions = opts }+  let initialState = WriterState {+        stNotes = False, stOptions = opts, stInDefLabel = False }       env = WriterReader { options = opts, listLevel = [], useTags = False }   in  evalStateT (runReaderT (pandocToMediaWiki document) env) initialState @@ -237,7 +239,9 @@                               => ([Inline],[[Block]])                               -> MediaWikiWriter m Text definitionListItemToMediaWiki (label, items) = do+  modify $ \st -> st{ stInDefLabel = True }   labelText <- inlineListToMediaWiki label+  modify $ \st -> st{ stInDefLabel = False }   contents <- mapM blockListToMediaWiki items   tags <- asks useTags   if tags@@ -446,7 +450,13 @@ inlineToMediaWiki (Code _ str) =   return $ "<code>" <> escapeText str <> "</code>" -inlineToMediaWiki (Str str) = return $ escapeText str+inlineToMediaWiki (Str str) = do+  inDefLabel <- gets stInDefLabel+  return $+    if inDefLabel+       then T.intercalate "<nowiki>:</nowiki>" $+              map escapeText $ T.splitOn ":" str+       else escapeText str  inlineToMediaWiki (Math mt str) = return $   "<math display=\"" <>
src/Text/Pandoc/Writers/Ms.hs view
@@ -28,7 +28,7 @@ import Data.List (intercalate, intersperse) import Data.List.NonEmpty (nonEmpty) import qualified Data.Map as Map-import Data.Maybe (catMaybes)+import Data.Maybe (catMaybes, isNothing) import Data.Text (Text) import qualified Data.Text as T import Network.URI (escapeURIString, isAllowedInURI)@@ -42,11 +42,13 @@ import Text.Pandoc.Logging import Text.Pandoc.Options import Text.DocLayout hiding (Color)+import Text.DocTemplates (lookupContext) import Text.Pandoc.Shared import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Writers.Math import Text.Pandoc.Writers.Shared import Text.Pandoc.Writers.Roff+import Text.Pandoc.Writers.Markdown (writePlain) import Text.Printf (printf) import Text.TeXMath (writeEqn) import qualified Data.Text.Encoding as TE@@ -98,8 +100,7 @@ -- In PDF we need to encode as UTF-16 BE. escapePDFString :: Text -> Text escapePDFString t-  | T.all isAscii t =-    T.replace "(" "\\(" .  T.replace ")" "\\)" . T.replace "\\" "\\\\" $ t+  | T.all (\c -> isAscii c && c /= '(' && c /= ')' && c /= '\\' && c /= '"') t = t   | otherwise = ("\\376\\377" <>) .  -- add bom     mconcat . map encodeChar .  T.unpack $ t  where@@ -127,12 +128,15 @@ -- line.  roff treats the line-ending period differently. -- See http://code.google.com/p/pandoc/issues/detail?id=148. +getPdfEngine :: WriterOptions -> Maybe Text+getPdfEngine opts = lookupContext "pdf-engine" (writerVariables opts)+ blockToMs :: PandocMonad m           => WriterOptions -- ^ Options           -> Block         -- ^ Block element           -> MS m (Doc Text) blockToMs opts (Div (ident,cls,kvs) bs) = do-  let anchor = if T.null ident+  let anchor = if isNothing (getPdfEngine opts) || T.null ident                   then empty                   else nowrap $                          literal ".pdfhref M "@@ -181,23 +185,30 @@ blockToMs opts (Header level (ident,classes,_) inlines) = do   setFirstPara   modify $ \st -> st{ stInHeader = True }-  contents <- inlineListToMs' opts $ map breakToSpace inlines+  let inlines' = map breakToSpace inlines+  contents <- inlineListToMs' opts inlines'+  plainContents <- inlinesToPlain inlines'   modify $ \st -> st{ stInHeader = False }   let (heading, secnum) = if writerNumberSections opts &&                               "unnumbered" `notElem` classes                              then (".NH", "\\*[SN]")                              else (".SH", "")+  let mbPdfEngine = getPdfEngine opts   let anchor = if T.null ident                   then empty                   else nowrap $                          literal ".pdfhref M "                          <> doubleQuotes (literal (toAscii ident))   let bookmark = literal ".pdfhref O " <> literal (tshow level <> " ") <>-                      doubleQuotes (literal $ secnum <>+                      nowrap (doubleQuotes+                              (literal $ secnum <>                                       (if T.null secnum                                           then ""                                           else "  ") <>-                                      escapePDFString (stringify inlines))+                                      (case mbPdfEngine of+                                         Just "groff" -> id+                                         _ -> escapePDFString)+                                        plainContents))   let backlink = nowrap (literal ".pdfhref L -D " <>        doubleQuotes (literal (toAscii ident)) <> space <> literal "\\") <> cr <>        literal " -- "@@ -215,9 +226,9 @@   modify $ \st -> st{ stFirstPara = True }   return $ (literal heading <> space <> literal (tshow level)) $$            contents $$-           bookmark $$-           anchor $$-           tocEntry+           case mbPdfEngine of+             Nothing -> mempty+             Just _ -> bookmark $$ anchor $$ tocEntry blockToMs opts (CodeBlock attr str) = do   hlCode <- highlightCode opts attr str   setFirstPara@@ -328,7 +339,7 @@ bulletListItemToMs opts (Plain first:rest) = do   first' <- blockToMs opts (Plain first)   rest' <- blockListToMs opts rest-  let first'' = literal ".IP \\[bu] 3" $$ first'+  let first'' = literal ".IP \\(bu 3" $$ first'   let rest''  = if null rest                    then empty                    else literal ".RS 3" $$ rest' $$ literal ".RE"@@ -336,7 +347,7 @@ bulletListItemToMs opts (first:rest) = do   first' <- blockToMs opts first   rest' <- blockListToMs opts rest-  return $ literal "\\[bu] .RS 3" $$ first' $$ rest' $$ literal ".RE"+  return $ literal "\\(bu .RS 3" $$ first' $$ rest' $$ literal ".RE"  -- | Convert ordered list item (a list of blocks) to ms. orderedListItemToMs :: PandocMonad m@@ -435,7 +446,7 @@   return $ char '`' <> contents <> char '\'' inlineToMs opts (Quoted DoubleQuote lst) = do   contents <- inlineListToMs opts lst-  return $ literal "\\[lq]" <> contents <> literal "\\[rq]"+  return $ literal "\\(lq" <> contents <> literal "\\(rq" inlineToMs opts (Cite _ lst) =   inlineListToMs opts lst inlineToMs opts (Code attr str) = do@@ -479,17 +490,25 @@ inlineToMs opts (Link _ txt (T.uncons -> Just ('#',ident), _)) = do   -- internal link   contents <- inlineListToMs' opts $ map breakToSpace txt-  return $ literal "\\c" <> cr <> nowrap (literal ".pdfhref L -D " <>-       doubleQuotes (literal (toAscii ident)) <> literal " -A " <>-       doubleQuotes (literal "\\c") <> space <> literal "\\") <> cr <>-       literal " -- " <> doubleQuotes (nowrap contents) <> cr <> literal "\\&"+  return $+    case getPdfEngine opts of+      Just _ -> literal "\\c" <> cr <> nowrap (literal ".pdfhref L -D " <>+            doubleQuotes (literal (toAscii ident)) <> literal " -A " <>+            doubleQuotes (literal "\\c") <> space <> literal "\\") <> cr <>+            literal " -- " <> doubleQuotes (nowrap contents) <> cr <>+            literal "\\&"+      Nothing -> contents inlineToMs opts (Link _ txt (src, _)) = do   -- external link   contents <- inlineListToMs' opts $ map breakToSpace txt-  return $ literal "\\c" <> cr <> nowrap (literal ".pdfhref W -D " <>-       doubleQuotes (literal (escapeUri src)) <> literal " -A " <>-       doubleQuotes (literal "\\c") <> space <> literal "\\") <> cr <>-       literal " -- " <> doubleQuotes (nowrap contents) <> cr <> literal "\\&"+  return $+    case getPdfEngine opts of+      Just _ -> literal "\\c" <> cr <> nowrap (literal ".pdfhref W -D " <>+            doubleQuotes (literal (escapeUri src)) <> literal " -A " <>+            doubleQuotes (literal "\\c") <> space <> literal "\\") <> cr <>+            literal " -- " <> doubleQuotes (nowrap contents) <> cr <>+            literal "\\&"+      Nothing -> contents inlineToMs opts (Image attr alternate (src, _)) = do   let desc = literal "[IMAGE: " <>              literal (escapeStr opts (stringify alternate)) <> char ']'@@ -656,3 +675,7 @@  where   mbW = inPoints opts <$> dimension Width attr   mbH = inPoints opts <$> dimension Height attr++inlinesToPlain :: PandocMonad m => [Inline] -> m Text+inlinesToPlain ils = T.strip <$> writePlain def{ writerWrapText = WrapNone }+                                    (Pandoc nullMeta [Plain ils])
src/Text/Pandoc/Writers/Muse.hs view
@@ -265,12 +265,15 @@   return $ blankline <> attr' $$ nowrap (header' <> contents) <> blankline -- https://www.gnu.org/software/emacs-muse/manual/muse.html#Horizontal-Rules-and-Anchors blockToMuse HorizontalRule = return $ blankline $$ "----" $$ blankline-blockToMuse (Table _ blkCapt specs thead tbody tfoot) =+blockToMuse (Table _ blkCapt specs thead@(TableHead hattr hrows) tbody tfoot) =   if isSimple && numcols > 1     then simpleTable caption headers rows     else do       opts <- asks envOptions-      gridTable opts blocksToDoc True (map (const AlignDefault) aligns) widths headers rows+      let tbody' = case hrows of+                     [] -> tbody+                     _  -> TableBody nullAttr 0 [] hrows : tbody+      gridTable opts blocksToDoc specs (TableHead hattr []) tbody' tfoot   where     (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot     blocksToDoc opts blocks =
src/Text/Pandoc/Writers/OpenDocument.hs view
@@ -115,10 +115,6 @@ addTextStyle attrs i = modify $ \s ->   s { stTextStyles = Map.insert attrs i (stTextStyles s) } -addTextStyleAttr :: PandocMonad m => TextStyle -> OD m ()-addTextStyleAttr t = modify $ \s ->-  s { stTextStyleAttr = Set.insert t (stTextStyleAttr s) }- increaseIndent :: PandocMonad m => OD m () increaseIndent = modify $ \s -> s { stIndentPara = 1 + stIndentPara s } @@ -150,14 +146,18 @@ inSpanTags :: Text -> Doc Text -> Doc Text inSpanTags s = inTags False "text:span" [("text:style-name",s)] -withTextStyle :: PandocMonad m => TextStyle -> OD m a -> OD m a-withTextStyle s f = do+withAlteredTextStyles :: PandocMonad m+                       => (Set.Set TextStyle -> Set.Set TextStyle) -> OD m a -> OD m a+withAlteredTextStyles f action = do   oldTextStyleAttr <- gets stTextStyleAttr-  addTextStyleAttr s-  res <- f+  modify $ \st -> st{ stTextStyleAttr = f oldTextStyleAttr }+  res <- action   modify $ \st -> st{ stTextStyleAttr = oldTextStyleAttr }   return res +withTextStyle :: PandocMonad m => TextStyle -> OD m a -> OD m a+withTextStyle s = withAlteredTextStyles (Set.insert s)+ inTextStyle :: PandocMonad m => Doc Text -> OD m (Doc Text) inTextStyle d = do   at <- gets stTextStyleAttr@@ -691,7 +691,8 @@                          , ("text:note-class", "footnote"     )] $                          inTagsSimple "text:note-citation" (text . show $ n + 1) <>                          inTagsSimple "text:note-body" t-        nn <- footNote <$> withParagraphStyle o "Footnote" l+        nn <- footNote <$> withAlteredTextStyles (const mempty)+                            (withParagraphStyle o "Footnote" l)         addNote nn         return nn 
src/Text/Pandoc/Writers/Powerpoint/Output.hs view
@@ -1059,7 +1059,8 @@        mknode "p:sp" [] [ mknode "p:nvSpPr" []                           [ mknode "p:cNvPr" [("id","1"), ("name","TextBox 3")] ()                           , mknode "p:cNvSpPr" [("txBox", "1")] ()-                          , mknode "p:nvPr" [] ()+                          , mknode "p:nvPr" []+                            [mknode "p:ph" [("idx", "1")] ()]                           ]                         , mknode "p:spPr" []                           [ mknode "a:xfrm" []
src/Text/Pandoc/Writers/RST.hs view
@@ -329,7 +329,8 @@   contents <- blockListToRST blocks   return $ nest 3 contents <> blankline blockToRST (Table _attrs blkCapt specs thead tbody tfoot) = do-  let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot+  let (caption, aligns, widths, headers, rows) =+        toLegacyTable blkCapt specs thead tbody tfoot   caption' <- inlineListToRST caption   let blocksToDoc opts bs = do          oldOpts <- gets stOptions@@ -338,9 +339,7 @@          modify $ \st -> st{ stOptions = oldOpts }          return result   opts <- gets stOptions-  let renderGrid = gridTable opts blocksToDoc (all null headers)-                    (map (const AlignDefault) aligns) widths-                    headers rows+  let renderGrid = gridTable opts blocksToDoc specs thead tbody tfoot       isSimple = all (== 0) widths && length widths > 1       renderSimple = do         tbl' <- simpleTable opts blocksToDoc headers rows
src/Text/Pandoc/Writers/Roff.hs view
@@ -26,13 +26,12 @@ import Data.Text (Text) import qualified Data.Text as Text import Data.String-import Data.Maybe (fromMaybe, isJust, catMaybes)+import Data.Maybe (fromMaybe) import Text.Pandoc.Class.PandocMonad (PandocMonad) import Text.Pandoc.Definition import Text.DocLayout import Text.Printf (printf)-import Text.Pandoc.RoffChar (standardEscapes,-                              characterCodes, combiningAccents)+import Text.Pandoc.RoffChar (standardEscapes, characterCodes)  data WriterState = WriterState { stHasInlineMath :: Bool                                , stFirstPara     :: Bool@@ -68,9 +67,6 @@                 | AsciiOnly        -- ^ escape everything                 deriving Show -combiningAccentsMap :: Map.Map Char Text-combiningAccentsMap = Map.fromList combiningAccents- essentialEscapes :: Map.Map Char Text essentialEscapes = Map.fromList standardEscapes @@ -92,17 +88,16 @@         Nothing           | isAscii x -> Text.singleton x : escapeString' escapeMode xs           | otherwise ->-              case escapeMode of-                AllowUTF8 -> Text.singleton x : escapeString' escapeMode xs+              (case escapeMode of+                AllowUTF8 -> Text.singleton x                 AsciiOnly ->-                  let accents = catMaybes $ takeWhile isJust-                        (map (`Map.lookup` combiningAccentsMap) xs)-                      rest = drop (length accents) xs-                      s = case Map.lookup x characterCodeMap of-                            Just t  -> "\\[" <> Text.unwords (t:accents) <> "]"-                            Nothing -> "\\[" <> Text.unwords-                              (Text.pack (printf "u%04X" (ord x)) : accents) <> "]"-                  in  s : escapeString' escapeMode rest+                   case Map.lookup x characterCodeMap of+                      Just t+                        | Text.length t == 2 -> "\\(" <> t -- see #10716+                        | otherwise -> "\\C'" <> t <> "'"+                      Nothing ->+                        "\\C'" <> Text.pack (printf "u%04X" (ord x)) <> "'")+               : escapeString' escapeMode xs  characterCodeMap :: Map.Map Char Text characterCodeMap = Map.fromList characterCodes
src/Text/Pandoc/Writers/Shared.hs view
@@ -48,16 +48,17 @@                      , setupTranslations                      , isOrderedListMarker                      , toTaskListItem+                     , delimited                      ) where-import Safe (lastMay)+import Safe (lastMay, maximumMay, atDef) import qualified Data.ByteString.Lazy as BL-import Control.Monad (zipWithM, MonadPlus, mzero)+import Control.Monad (MonadPlus, mzero) import Data.Either (isRight) import Data.Aeson (ToJSON (..), encode) import Data.Char (chr, ord, isSpace, isLetter, isUpper)-import Data.List (groupBy, intersperse, transpose, foldl')-import Data.List.NonEmpty (NonEmpty(..), nonEmpty)+import Data.List (groupBy, intersperse, foldl', transpose)+import Data.List.NonEmpty (NonEmpty(..)) import Data.Text.Conversions (FromText(..)) import qualified Data.Map as M import qualified Data.Text as T@@ -80,7 +81,10 @@ import Text.Pandoc.Class (PandocMonad, toLang) import Text.Pandoc.Translations (setTranslations) import Data.Maybe (fromMaybe)+import qualified Text.Pandoc.Writers.AnnotatedTable as Ann +-- import Debug.Trace+ -- | Create template Context from a 'Meta' and an association list -- of variables, specified at the command line or in the writer. -- Variables overwrite metadata fields with the same names.@@ -281,122 +285,227 @@   _       -> T.singleton c  -- | Writes a grid table.-gridTable :: (Monad m, HasChars a)-          => WriterOptions-          -> (WriterOptions -> [Block] -> m (Doc a)) -- ^ format Doc writer-          -> Bool             -- ^ headless-          -> [Alignment]      -- ^ column alignments-          -> [Double]         -- ^ column widths-          -> [[Block]]        -- ^ table header row-          -> [[[Block]]]      -- ^ table body rows-          -> m (Doc a)-gridTable opts blocksToDoc headless aligns widths headers rows = do-  -- the number of columns will be used in case of even widths-  let numcols = maximum (length aligns :| length widths :-                           map length (headers:rows))-  let officialWidthsInChars :: [Double] -> [Int]-      officialWidthsInChars widths' = map (-                        (max 1) .-                        (\x -> x - 3) . floor .-                        (fromIntegral (writerColumns opts) *)-                        ) widths'-  -- handleGivenWidths wraps the given blocks in order for them to fit-  -- in cells with given widths. the returned content can be-  -- concatenated with borders and frames-  let handleGivenWidthsInChars widthsInChars' = do-        -- replace page width (in columns) in the options with a-        -- given width if smaller (adjusting by two)-        let useWidth w = opts{writerColumns = min (w - 2) (writerColumns opts)}-        -- prepare options to use with header and row cells-        let columnOptions = map useWidth widthsInChars'-        rawHeaders' <- zipWithM blocksToDoc columnOptions headers-        rawRows' <- mapM-             (\cs -> zipWithM blocksToDoc columnOptions cs)-             rows-        return (widthsInChars', rawHeaders', rawRows')-  let handleGivenWidths widths' = handleGivenWidthsInChars-                                     (officialWidthsInChars widths')-  -- handleFullWidths tries to wrap cells to the page width or even-  -- more in cases where `--wrap=none`. thus the content here is left-  -- as wide as possible-  let handleFullWidths widths' = do-        rawHeaders' <- mapM (blocksToDoc opts) headers-        rawRows' <- mapM (mapM (blocksToDoc opts)) rows-        let numChars = maybe 0 maximum . nonEmpty . map offset-        let minWidthsInChars =-                map numChars $ transpose (rawHeaders' : rawRows')-        let widthsInChars' = zipWith max-                              minWidthsInChars-                              (officialWidthsInChars widths')-        return (widthsInChars', rawHeaders', rawRows')-  -- handleZeroWidths calls handleFullWidths to check whether a wide-  -- table would fit in the page. if the produced table is too wide,-  -- it calculates even widths and passes the content to-  -- handleGivenWidths-  let handleZeroWidths widths' = do-        (widthsInChars', rawHeaders', rawRows') <- handleFullWidths widths'-        if foldl' (+) 0 widthsInChars' > writerColumns opts-           then do -- use even widths except for thin columns-             let evenCols  = max 5-                              (((writerColumns opts - 1) `div` numcols) - 3)-             let (numToExpand, colsToExpand) =-                   foldr (\w (n, tot) -> if w < evenCols-                                            then (n, tot + (evenCols - w))-                                            else (n + 1, tot))-                                   (0,0) widthsInChars'-             let expandAllowance = colsToExpand `div` numToExpand-             let newWidthsInChars = map (\w -> if w < evenCols+gridTable :: Monad m+           => WriterOptions+           -> (WriterOptions -> [Block] -> m (Doc Text)) -- ^ format Doc writer+           -> [ColSpec]+           -> TableHead+           -> [TableBody]+           -> TableFoot+           -> m (Doc Text)+gridTable opts blocksToDoc colspecs' thead' tbodies' tfoot' = do+  let Ann.Table _ _ colspecs thead tbodies tfoot =+        Ann.toTable mempty (Caption Nothing mempty)+                    colspecs' thead' tbodies' tfoot'+  let widths = map (toCharWidth opts . getColWidth) colspecs+  let renderRows = fmap (map (addDummies widths)) . mapM (gridRow opts blocksToDoc)+  let getHeadCells (Ann.HeaderRow _ _ cells) = cells+  let getHeadRows (Ann.TableHead _ rs) = map getHeadCells rs+  headCells <- renderRows (getHeadRows thead)+  let getFootRows (Ann.TableFoot _ xs) = map getHeadCells xs+  footCells <- renderRows (getFootRows tfoot)+  let getBodyCells (Ann.BodyRow _ _ _ cells) = cells+  let getBody (Ann.TableBody _ _ hs xs) = map getHeadCells hs <> map getBodyCells xs+  bodyCells <- mapM (renderRows . getBody) tbodies+  let rows = setTopBorder SingleLine headCells +++             (setTopBorder (if null headCells then SingleLine else DoubleLine)+              . setBottomBorder SingleLine) (mconcat bodyCells) +++             (if null footCells+                 then mempty+                 else setTopBorder DoubleLine . setBottomBorder DoubleLine $+                       footCells)+  let cellHasColSpan c = cellColSpan c > 1+  let hasColSpans = any (any cellHasColSpan) rows+  let isSimple = all ((== ColWidthDefault) . snd) colspecs && not hasColSpans+  pure $ gridRows $+    if not hasColSpans  -- TODO: figure out how to calculate widths with colspans+       then redoWidths isSimple opts rows+       else rows++redoWidths :: Bool -> WriterOptions -> [[RenderedCell Text]] -> [[RenderedCell Text]]+redoWidths _ _ [] = []+redoWidths isSimple opts rows@(r:_) =+  map (\cs -> zipWith resetWidth newwidths cs) rows+ where+  actualWidths = map cellWidth r+  fullwidths = calculateFullWidths rows+  minwidths = case writerWrapText opts of+                WrapNone -> fullwidths+                _ -> calculateMinWidths rows+  totwidth = writerColumns opts - (3 * length r) - 1+  evenwidth = totwidth `div` length r+  resetWidth w c = c{ cellWidth = w }+  keepwidths = filter (< evenwidth) fullwidths+  evenwidth' = (totwidth - sum keepwidths) `div`+                (length r - length keepwidths)+  ensureMinWidths = zipWith max minwidths+  newwidths = ensureMinWidths $+              case isSimple of+                True | sum fullwidths <= totwidth -> fullwidths+                     | otherwise -> map (\w -> if w < evenwidth                                                   then w-                                                  else min-                                                       (evenCols + expandAllowance)-                                                       w)-                                        widthsInChars'-             handleGivenWidthsInChars newWidthsInChars-           else return (widthsInChars', rawHeaders', rawRows')-  -- render the contents of header and row cells differently depending-  -- on command line options, widths given in this specific table, and-  -- cells' contents-  let handleWidths-        | writerWrapText opts == WrapNone    = handleFullWidths widths-        | all (== 0) widths                  = handleZeroWidths widths-        | otherwise                          = handleGivenWidths widths-  (widthsInChars, rawHeaders, rawRows) <- handleWidths-  let hpipeBlocks blocks = hcat [beg, middle, end]-        where sep'    = vfill " | "-              beg     = vfill "| "-              end     = vfill " |"-              middle  = chomp $ hcat $ intersperse sep' blocks-  let makeRow = hpipeBlocks . zipWith lblock widthsInChars-  let head' = makeRow rawHeaders-  let rows' = map (makeRow . map chomp) rawRows-  let borderpart ch align widthInChars =-           (if align == AlignLeft || align == AlignCenter-               then char ':'-               else char ch) <>-           text (replicate widthInChars ch) <>-           (if align == AlignRight || align == AlignCenter-               then char ':'-               else char ch)-  let border ch aligns' widthsInChars' =-        char '+' <>-        hcat (intersperse (char '+') (zipWith (borderpart ch)-                aligns' widthsInChars')) <> char '+'-  let body = vcat $ intersperse (border '-' (repeat AlignDefault) widthsInChars)-                    rows'-  let head'' = if headless-                  then empty-                  else head' $$ border '=' aligns widthsInChars-  if headless-     then return $-           border '-' aligns widthsInChars $$-           body $$-           border '-' (repeat AlignDefault) widthsInChars-     else return $-           border '-' (repeat AlignDefault) widthsInChars $$-           head'' $$-           body $$-           border '-' (repeat AlignDefault) widthsInChars+                                                  else evenwidth') fullwidths+                False -> actualWidths +-- Returns for each column a pair (full width, min width)+calculateFullWidths :: [[RenderedCell Text]] -> [Int]+calculateFullWidths rows =+  map (fromMaybe 0 . maximumMay) (transpose (map (map (\c ->+         offset (cellContents c))) rows))++calculateMinWidths :: [[RenderedCell Text]] -> [Int]+calculateMinWidths rows =+  map (fromMaybe 0 . maximumMay) (transpose (map (map (\c ->+         minOffset (cellContents c))) rows))++makeDummy :: [Int] -> Int -> Int -> RenderedCell Text+makeDummy widths n len =+ let width = atDef 0 widths n+ in RenderedCell{ cellColNum = n,+                cellColSpan = len,+                cellAlign = AlignDefault,+                cellRowSpan = 0, -- indicates dummy+                cellWidth = width,+                cellHeight = 0,+                cellContents = mempty,+                cellBottomBorder = NoLine,+                cellTopBorder = NoLine }++addDummies :: [Int] -> [RenderedCell Text] -> [RenderedCell Text]+addDummies widths = reverse . snd . foldl' addDummy (0,[])+ where+   addDummy (i,cs) c =+     case cellColNum c - i of+       0 -> (i+1, c:cs)+       len -> (cellColNum c + 1, c : makeDummy widths i len : cs)+++setTopBorder :: LineStyle -> [[RenderedCell Text]] -> [[RenderedCell Text]]+setTopBorder _ [] = []+setTopBorder sty (cs:rest) = (map (\c -> c{ cellTopBorder = sty }) cs) : rest++setBottomBorder :: LineStyle -> [[RenderedCell Text]] -> [[RenderedCell Text]]+setBottomBorder _ [] = []+setBottomBorder sty [cs] = [map (\c -> c{ cellBottomBorder = sty }) cs]+setBottomBorder sty (c:cs) = c : setBottomBorder sty cs++gridRows :: [[RenderedCell Text]] -> Doc Text+gridRows [] = mempty+gridRows (x:xs) =+  (formatBorder cellTopBorder False (map (\z -> z{ cellBottomBorder = NoLine }) x))+  $$+  vcat (zipWith rowAndBottom (x:xs) (xs ++ [[]]))+ where+  -- generate wrapped contents. include pipe borders, bottom and left++  renderCellContents c =+    -- we don't use cblock or lblock because the content might+    -- be interpreted as an indented code block...even though it+    -- would look better to right-align right-aligned cells...+    -- (TODO: change this on parsing side?)+    lblock (case cellWidth c of+                  0 -> 16 -- TODO arbitrary+                  w -> w) (cellContents c)++  formatRow cs = vfill "| " <>+   hcat (intersperse (vfill " | ") (map renderCellContents cs)) <> vfill " |"++  rowAndBottom thisRow nextRow =+    let isLastRow = null nextRow+        border1 = render Nothing (formatBorder cellBottomBorder False thisRow)+        border2 = render Nothing (formatBorder cellTopBorder False nextRow)+        go '+' _ = '+'+        go _ '+' = '+'+        go '=' _ = '='+        go _ '=' = '='+        go c _   = c+        combinedBorder = if isLastRow+                            then literal border1+                            else literal $ T.zipWith go border1 border2+    in formatRow thisRow $$ combinedBorder+++formatBorder :: (RenderedCell Text -> LineStyle) -> Bool -> [RenderedCell Text]+             -> Doc Text+formatBorder _ _alignMarkers [] = mempty+formatBorder borderStyle alignMarkers (c:cs)+  | borderStyle c == NoLine+    = openpipe <> text (replicate (cellWidth c + 2) ' ') <> closepipe <>+      formatBorder borderStyle alignMarkers cs+  | otherwise+    = openplus <> leftalign <> underline <> rightalign <> closeplus <>+      formatBorder borderStyle alignMarkers cs+  where++    openpipe = "|"+    closepipe = if null cs then "|" else mempty+    openplus = "+"+    closeplus = if null cs+                   then "+"+                   else mempty+    lineChar = case borderStyle c of+                 NoLine -> ' '+                 SingleLine -> '-'+                 DoubleLine -> '='+    (leftalign, rightalign) =+       case cellAlign c of+         _ | not alignMarkers -> (char lineChar,char lineChar)+         AlignLeft -> (char ':',char lineChar)+         AlignCenter -> (char ':',char ':')+         AlignRight -> (char lineChar,char ':')+         AlignDefault -> (char lineChar,char lineChar)+    underline = text (replicate (cellWidth c) lineChar)++data LineStyle = NoLine | SingleLine | DoubleLine+    deriving (Show, Ord, Eq)++data RenderedCell a =+  RenderedCell{ cellColNum :: Int+              , cellColSpan :: Int+              , cellAlign :: Alignment+              , cellRowSpan :: Int+              , cellWidth :: Int+              , cellHeight :: Int+              , cellContents :: Doc a+              , cellBottomBorder :: LineStyle+              , cellTopBorder :: LineStyle+              }+  deriving (Show)++getColWidth :: ColSpec -> Double+getColWidth (_, ColWidth n) = n+getColWidth (_, ColWidthDefault) = 0 -- TODO?++toCharWidth :: WriterOptions -> Double -> Int+toCharWidth opts width =+  max 1 (floor (width * fromIntegral (writerColumns opts)) - 3)++gridRow :: (Monad m, HasChars a)+        => WriterOptions+        -> (WriterOptions -> [Block] -> m (Doc a)) -- ^ format Doc writer+        -> [Ann.Cell]+        -> m [RenderedCell a]+gridRow opts blocksToDoc = mapM renderCell+ where+  renderer = blocksToDoc opts+  renderCell (Ann.Cell cellcolspecs (Ann.ColNumber colnum)+               (Cell _ _ (RowSpan rowspan) _ blocks)) = do+    let ((align,_):|_) = cellcolspecs+    let width = toCharWidth opts $ sum (fmap getColWidth cellcolspecs)+    rendered <- renderer blocks+    pure $ RenderedCell{ cellColNum = colnum,+                         cellColSpan = length cellcolspecs,+                         cellAlign = align,+                         cellRowSpan = rowspan,+                         cellWidth = width,+                         cellHeight = height rendered,+                         cellContents = rendered,+                         cellBottomBorder = if rowspan < 2+                                               then SingleLine+                                               else NoLine,+                         cellTopBorder = SingleLine }++ -- | Retrieve the metadata value for a given @key@ -- and convert to Bool. lookupMetaBool :: Text -> Meta -> Bool@@ -662,3 +771,25 @@ toTaskListItem (Para  (Str "☐":Space:ils):xs) = pure (False, Para ils:xs) toTaskListItem (Para  (Str "☒":Space:ils):xs) = pure (True, Para ils:xs) toTaskListItem _                              = mzero++-- | Add an opener and closer to a Doc. If the Doc begins or ends+-- with whitespace, export this outside the opener or closer.+-- This is used for formats, like Markdown, which don't allow spaces+-- after opening or before closing delimiters.+delimited :: Doc Text -> Doc Text -> Doc Text -> Doc Text+delimited opener closer content =+  mconcat initialWS <> opener <> mconcat middle <> closer <> mconcat finalWS+ where+  contents = toList content+  (initialWS, rest) = span isWS contents+  (reverseFinalWS, reverseMiddle) = span isWS (reverse rest)+  finalWS = reverse reverseFinalWS+  middle = reverse reverseMiddle+  isWS NewLine = True+  isWS CarriageReturn = True+  isWS BreakingSpace = True+  isWS BlankLines{} = True+  isWS _ = False+  toList (Concat (Concat a b) c) = toList (Concat a (Concat b c))+  toList (Concat a b) = a : toList b+  toList x = [x]
src/Text/Pandoc/Writers/Typst.hs view
@@ -384,9 +384,12 @@       case res of           Left il -> inlineToTypst il           Right r ->-            case mathType of-              InlineMath -> return $ "$" <> literal r <> "$"-              DisplayMath -> return $ "$ " <> literal r <> " $"+            (case extractLabel str of -- #10805+              Nothing -> id+              Just lab -> (<> (toLabel FreestandingLabel lab))) <$>+             case mathType of+               InlineMath -> return $ "$" <> literal r <> "$"+               DisplayMath -> return $ "$ " <> literal r <> " $"     Code (_,cls,_) code -> return $       case cls of         (lang:_) -> "#raw(lang:" <> doubleQuoted lang <>@@ -405,14 +408,15 @@     Superscript inlines -> textstyle "#super" inlines     Subscript inlines -> textstyle "#sub" inlines     SmallCaps inlines -> textstyle "#smallcaps" inlines-    Span (ident,_,kvs) inlines -> do+    Span (ident,cls,kvs) inlines -> do       let lab = toLabel FreestandingLabel ident       let (_, typstTextAttrs) = pickTypstAttrs kvs-      case typstTextAttrs of-        [] -> (<> lab) <$> inlinesToTypst inlines-        _ -> do-          contents <- inlinesToTypst inlines-          return $ toTypstTextElement typstTextAttrs contents <> lab+      contents <- inlinesToTypst inlines+      let addHl x = "#highlight" <> brackets x+      return $ (if "mark" `elem` cls+                   then addHl+                   else id)+               (toTypstTextElement typstTextAttrs contents) <> lab     Quoted quoteType inlines -> do       opts <- gets stOptions       let smart = isEnabled Ext_smart opts@@ -604,3 +608,10 @@  endCode :: Doc Text endCode = beforeNonBlank ";"++extractLabel :: Text -> Maybe Text+extractLabel = go . T.unpack+ where+   go [] = Nothing+   go ('\\':'l':'a':'b':'e':'l':'{':xs) = Just (T.pack (takeWhile (/='}') xs))+   go (_:xs) = go xs
test/Tests/Old.hs view
@@ -196,7 +196,14 @@     [ testGroup "writer" $ writerTests' "muse"     ]   , testGroup "ms"-    [ testGroup "writer" $ writerTests' "ms"+    [ test' "basic"  ["-f", "native", "-t", "ms", "--columns=80",+                      "--variable", "pandoc-version=",+                      "--pdf-engine", "pdfroff", "-s"]+      "testsuite.native" "writer.ms"+    , test' "tables" ["-f", "native", "-t", "ms", "--columns=80",+                      "--variable", "pandoc-version=",+                      "--pdf-engine", "pdfroff"]+      "tables.native"  "tables.ms"     ]   , testGroup "typst"     [ testGroup "writer" $ writerTests' "typst" ++ extWriterTests' "typst"
test/Tests/Readers/Org/Block.hs view
@@ -169,26 +169,24 @@       rawBlock "html" "<samp>Hello, World!</samp>\n"      , "LaTeX fragment" =:-      T.unlines [ "\\begin{equation}"-                , "X_i = \\begin{cases}"-                , "      G_{\\alpha(i)} & \\text{if }\\alpha(i-1) = \\alpha(i)\\\\"-                , "      C_{\\alpha(i)} & \\text{otherwise}"-                , "      \\end{cases}"-                , "\\end{equation}"-                ] =?>-      rawBlock "latex"-      (T.unlines [ "\\begin{equation}"-               , "X_i = \\begin{cases}"-               , "      G_{\\alpha(i)} & \\text{if }\\alpha(i-1) =" <>-                 " \\alpha(i)\\\\"-               , "      C_{\\alpha(i)} & \\text{otherwise}"-               , "      \\end{cases}"-               , "\\end{equation}"-               ])+      "\\begin{equation}\n\+      \X_i = \\begin{cases}\n\+      \      G_{\\alpha(i)} & \\text{if }\\alpha(i-1) = \\alpha(i)\\\\\n\+      \      C_{\\alpha(i)} & \\text{otherwise}\n\+      \      \\end{cases}\n\+      \\\end{equation}"+      =?>+      para (rawInline "latex"+             "\\begin{equation}\n\+             \X_i = \\begin{cases}\n\+             \      G_{\\alpha(i)} & \\text{if }\\alpha(i-1) = \\alpha(i)\\\\\n\+             \      C_{\\alpha(i)} & \\text{otherwise}\n\+             \      \\end{cases}\n\+             \\\end{equation}")      , "One-line LaTeX fragment" =:       "\\begin{equation} 2 + 3 \\end{equation}" =?>-      rawBlock "latex" "\\begin{equation} 2 + 3 \\end{equation}\n"+      para (rawInline "latex" "\\begin{equation} 2 + 3 \\end{equation}")      , "LaTeX fragment with more arguments" =:       T.unlines [ "\\begin{tikzcd}[ampersand replacement=\\&]"
test/Tests/Readers/Org/Directive.hs view
@@ -188,7 +188,7 @@           T.unlines [ "#+OPTIONS: tex:t"                     , "Hello \\emph{Name}"                     ] =?>-          para ("Hello" <> space <> emph "Name")+          para ("Hello" <> space <> rawInline "latex" "\\emph{Name}")          , "Alpha" =:           T.unlines [ "#+OPTIONS: tex:t"@@ -197,15 +197,15 @@           para "α"          , "equation environment" =:-          T.unlines [ "#+OPTIONS: tex:t"-                    , "\\begin{equation}"-                    , "f(x) = x^2"-                    , "\\end{equation}"-                    ] =?>-          rawBlock "latex" (T.unlines [ "\\begin{equation}"-                                      , "f(x) = x^2"-                                      , "\\end{equation}"-                                      ])+          "#+OPTIONS: tex:t\n\+          \\\begin{equation}\n\+          \f(x) = x^2\n\+          \\\end{equation}"+          =?>+          para (rawInline "latex"+                 "\\begin{equation}\n\+                 \f(x) = x^2\n\+                 \\\end{equation}")         ]        , testGroup "Ignore LaTeX fragments"@@ -227,7 +227,7 @@                     , "f(x) = x^2"                     , "\\end{equation}"                     ] =?>-          (mempty :: Blocks)+          (para mempty)         ]        , testGroup "Verbatim LaTeX"
test/Tests/Readers/Org/Inline.hs view
@@ -342,7 +342,7 @@    , "Inline LaTeX command with spaces" =:       "\\emph{Emphasis mine}" =?>-      para (emph "Emphasis mine")+      para (rawInline "latex" "\\emph{Emphasis mine}")    , "Inline math symbols" =:       "\\tau \\oplus \\alpha" =?>
test/Tests/Readers/Org/Inline/Citation.hs view
@@ -201,13 +201,6 @@    , "LaTeX citation" =:     "\\cite{Coffee}" =?>-    let citation = Citation-                   { citationId = "Coffee"-                   , citationPrefix = []-                   , citationSuffix = []-                   , citationMode = NormalCitation-                   , citationNoteNum = 0-                   , citationHash = 0}-    in (para . cite [citation] $ rawInline "latex" "\\cite{Coffee}")+      para (rawInline "latex" "\\cite{Coffee}")    ]
test/Tests/Writers/Markdown.hs view
@@ -46,6 +46,9 @@              =: bulletList [ plain "foo" <> bulletList [ plain "bar" ],                              plain "baz" ]              =?> "- foo\n  - bar\n- baz\n"+        , "emph/strong with spaces (#10696)"+             =: emph (str "f" <> strong (space <> str "d" <> space)) <> str "l" =?>+             "*f **d*** l"         ] ++ [noteTests] ++ [shortcutLinkRefsTests]  {-
+ test/command/10631.md view
@@ -0,0 +1,8 @@+GFM has funny treatment of escaped braces, requiring `\\{` instead of `\{`.++```+% pandoc -f gfm -t markdown+$\\{x,y\\}$+^D+$\{x,y\}$+```
+ test/command/10708.md view
@@ -0,0 +1,24 @@+```+% pandoc -f html -t mediawiki+<dl>+<dt>Case 1: Both subsets are non-empty</dt>+<dd>+In this case, …+</dd>+</dl>+^D+; Case 1<nowiki>:</nowiki> Both subsets are non-empty+: In this case, …+```++```+% pandoc -f mediawiki -t html+; term : definition+^D+<dl>+<dt>term</dt>+<dd>+definition+</dd>+</dl>+```
+ test/command/10730.md view
@@ -0,0 +1,7 @@+```+% pandoc -f org -t native+=hi+there=+^D+[ Para [ Code ( "" , [ "verbatim" ] , [] ) "hi there" ] ]+```
+ test/command/10747.md view
@@ -0,0 +1,6 @@+```+% pandoc -t typst+[Mark]{.mark}+^D+#highlight[Mark]+```
+ test/command/10755.md view
@@ -0,0 +1,71 @@+```+% pandoc -f native -t markdown+[ Figure+    ( "" , [] , [] )+    (Caption+       Nothing [ Para [ Str "An" , Space , Str "image." ] ])+    [ Plain+        [ Image+            ( ""+            , []+            , []+            )+            [ Str "An" , Space , Str "image." ]+            ( "media/rId20.jpg" , "" )+        ]+    ]+]+^D+![An image.](media/rId20.jpg)+```++```+% pandoc -f native -t markdown -t markdown-implicit_figures+[ Figure+    ( "" , [] , [] )+    (Caption+       Nothing [ Para [ Str "An" , Space , Str "image." ] ])+    [ Plain+        [ Image+            ( ""+            , []+            , []+            )+            [ Str "An" , Space , Str "image." ]+            ( "media/rId20.jpg" , "" )+        ]+    ]+]+^D+<figure>+<img src="media/rId20.jpg" alt="An image." />+<figcaption aria-hidden="true"><p>An image.</p></figcaption>+</figure>+```++```+% pandoc -f native -t markdown -t markdown-implicit_figures-raw_html+[ Figure+    ( "" , [] , [] )+    (Caption+       Nothing [ Para [ Str "An" , Space , Str "image." ] ])+    [ Plain+        [ Image+            ( ""+            , []+            , []+            )+            [ Str "An" , Space , Str "image." ]+            ( "media/rId20.jpg" , "" )+        ]+    ]+]+^D+:::: figure+![An image.](media/rId20.jpg)++::: caption+An image.+:::+::::+```
+ test/command/10758.md view
@@ -0,0 +1,21 @@+```+% pandoc -f native -t markdown+[ Figure+    ( "" , [] , [] )+    (Caption+       Nothing+       [ Para [ Str "Foo" , Space , Emph [ Str "emphasis" ] ] ])+    [ Plain+        [ Image+            ( ""+            , []+            , []+            )+            [ Str "Foo" , Space , Str "emphasis" ]+            ( "media/rId20.jpg" , "" )+        ]+    ]+]+^D+![Foo *emphasis*](media/rId20.jpg)+```
+ test/command/10781.md view
@@ -0,0 +1,8 @@+```+% pandoc -f latex -t markdown --wrap=preserve+This is \texttt{--flag} with dashes.+This is the same --flag without a code.+^D+This is `--flag` with dashes.+This is the same --flag without a code.+```
+ test/command/10791.md view
@@ -0,0 +1,14 @@+```+% pandoc -t opendocument+Aboard **the luxury cruise ship Heart of the Ocean[^1] in the Atlantic Ocean**...++[^1]: **Heart of the Ocean** (海洋之心) – The Heart of the Ocean+^D+<text:p text:style-name="Text_20_body">Aboard+<text:span text:style-name="T1">the luxury cruise ship Heart of the+Ocean</text:span><text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body><text:p text:style-name="Footnote"><text:span text:style-name="T1">Heart+of the Ocean</text:span> (海洋之心) – The Heart of the+Ocean</text:p></text:note-body></text:note><text:span text:style-name="T1">+in the Atlantic Ocean</text:span>…</text:p>++```
+ test/command/10805.md view
@@ -0,0 +1,19 @@+```+% pandoc -t typst -f latex+\begin{equation}+  \label{eq:U}+  U = A+\end{equation}+^D+$ U = A $<eq:U>+```++```+% pandoc -t typst -f latex+\begin{equation}+  \label{eq:U 2}+  U = A+\end{equation}+^D+$ U = A $#label("eq:U 2")+```
+ test/command/10812.md view
@@ -0,0 +1,41 @@+Check that the `four_space_rule` extension works for plain writer.++```+% pandoc -f markdown -t plain+four_space_rule+This is the title++Here we fix:++- a+- b+- c+^D+This is the title++Here we fix:++-   a+-   b+-   c+```++Check that the `four_space_rule` extension is off by default.++```+% pandoc -f markdown -t plain+This is the title++Here we fix:++- a+- b+- c+^D+This is the title++Here we fix:++- a+- b+- c+```
+ test/command/10825.md view
@@ -0,0 +1,39 @@+```+% pandoc -f docbook -t html+<?xml version="1.0" encoding="utf-8"?>+<book xmlns="http://docbook.org/ns/docbook" version="5.0">+  <info><title>Literallayout test</title></info>+  <chapter>+    <info><title>Literallayout without class</title></info>+    <literallayout>First line.+Second line.+  Third line, indented two spaces.</literallayout>+  </chapter>+  <chapter>+    <info><title>Literallayout with normal class</title></info>+    <literallayout class="normal">First line.+Second line.+  Third line, indented two spaces.</literallayout>+  </chapter>+  <chapter>+    <info><title>Literallayout with monospaced</title></info>+    <literallayout class="monospaced">First line.+Second line.+  Third line, indented two spaces.</literallayout>+  </chapter>+</book>+^D+<h1>Literallayout without class</h1>+<div class="line-block">First line.<br />+Second line.<br />+  Third line, indented two spaces.</div>+<h1>Literallayout with normal class</h1>+<div class="line-block">First line.<br />+Second line.<br />+  Third line, indented two spaces.</div>+<h1>Literallayout with monospaced</h1>+<pre><code>First line.+Second line.+  Third line, indented two spaces.</code></pre>++```
+ test/command/10836.md view
@@ -0,0 +1,12 @@+```+% pandoc -f org -t latex+Some equation here+\begin{equation}+x = y+\end{equation}+where $x$ is something important.+^D+Some equation here \begin{equation}+x = y+\end{equation} where \(x\) is something important.+```
test/command/2834.md view
@@ -19,11 +19,11 @@   </tr> </table> ^D-+-----------------------------------------------------------------------+-| +------------------------------------------------------------------+  |-| |   -----------                                                    |  |-| |   some text                                                      |  |-| |   -----------                                                    |  |-| +------------------------------------------------------------------+  |-+-----------------------------------------------------------------------+++---------------------------------------------------------------------------++| +-----------------------------------------------------------------------+ |+| |   -----------                                                         | |+| |   some text                                                           | |+| |   -----------                                                         | |+| +-----------------------------------------------------------------------+ |++---------------------------------------------------------------------------+ ```
test/command/3516.md view
@@ -91,6 +91,8 @@  [])] ^D +---+---++|   |   |++===+===+ | 1 | 2 | +---+---+ |   |   |
test/command/3958.md view
@@ -9,7 +9,7 @@ % pandoc -f latex -t native \texttt{``hi''} ^D-[ Para [ Code ( "" , [] , [] ) "\8220hi\8221" ] ]+[ Para [ Code ( "" , [] , [] ) "\8216\8216hi\8217\8217" ] ] ```  ```
test/command/4550.md view
@@ -3,5 +3,5 @@ A ‘simple’ example ^D .LP-A \[oq]simple\[cq] example+A \(oqsimple\(cq example ```
test/command/5128.md view
@@ -7,20 +7,20 @@ | =^=     | Centered , the same amount of characters is added to the left and the right.                                                                                                                               | | ===      | Padding. If a numeric value is printed with a sign, then additional characters are added after the sign. Otherwise it behaves like "=>=". This option is only available for numbers (default for numbers). | ^D-+--------+------------------------------------------------------------------+-| Option | Meaning                                                          |-+========+==================================================================+-| ``<``  | Left alignment, additional characters are added to the right     |-|        | (default for string).                                            |-+--------+------------------------------------------------------------------+-| ``>``  | Right alignment, additional characters are added to the left.    |-+--------+------------------------------------------------------------------+-| ``^``  | Centered , the same amount of characters is added to the left    |-|        | and the right.                                                   |-+--------+------------------------------------------------------------------+-| ``=``  | Padding. If a numeric value is printed with a sign, then         |-|        | additional characters are added after the sign. Otherwise it     |-|        | behaves like "``>``". This option is only available for numbers  |-|        | (default for numbers).                                           |-+--------+------------------------------------------------------------------+++--------+-------------------------------------------------------------------++| Option | Meaning                                                           |++========+===================================================================++| ``<``  | Left alignment, additional characters are added to the right      |+|        | (default for string).                                             |++--------+-------------------------------------------------------------------++| ``>``  | Right alignment, additional characters are added to the left.     |++--------+-------------------------------------------------------------------++| ``^``  | Centered , the same amount of characters is added to the left and |+|        | the right.                                                        |++--------+-------------------------------------------------------------------++| ``=``  | Padding. If a numeric value is printed with a sign, then          |+|        | additional characters are added after the sign. Otherwise it      |+|        | behaves like "``>``". This option is only available for numbers   |+|        | (default for numbers).                                            |++--------+-------------------------------------------------------------------+ ```
test/command/5899.md view
@@ -37,15 +37,15 @@ ^D - A list of stuff with a table inside -  +-------+----------------------------------------------------+-------+-  | First | Second                                             | Third |-  +=======+====================================================+=======+-  | First | The big long table cell. The big long table cell.  | Third |-  |       | The big long table cell. The big long table cell.  |       |-  |       | The big long table cell. The big long table cell.  |       |-  |       | The big long table cell. The big long table cell.  |       |-  |       | The big long table cell. The big long table cell.  |       |-  +-------+----------------------------------------------------+-------++  +-------+------------------------------------------------------+-------++  | First | Second                                               | Third |+  +=======+======================================================+=======++  | First | The big long table cell. The big long table cell.    | Third |+  |       | The big long table cell. The big long table cell.    |       |+  |       | The big long table cell. The big long table cell.    |       |+  |       | The big long table cell. The big long table cell.    |       |+  |       | The big long table cell. The big long table cell.    |       |+  +-------+------------------------------------------------------+-------+  - Another list item  ```
+ test/command/7512.md view
@@ -0,0 +1,65 @@+```+% pandoc -t native -f latex+\begin{equation*}+[d,\delta]=0.+\end{equation*}+^D+[ Para [ Math DisplayMath "[d,\\delta]=0." ] ]+```++```+% pandoc -t native -f latex+\begin{table}[htb]+  \begin{tabular}{|c|c|}+       $W$      & rel. err. \\[0mm]+       [$\mu$m] & [\%]\\+  \end{tabular}+\end{table}+^D+[ Table+    ( "" , [] , [] )+    (Caption Nothing [])+    [ ( AlignCenter , ColWidthDefault )+    , ( AlignCenter , ColWidthDefault )+    ]+    (TableHead ( "" , [] , [] ) [])+    [ TableBody+        ( "" , [] , [] )+        (RowHeadColumns 0)+        []+        [ Row+            ( "" , [] , [] )+            [ Cell+                ( "" , [] , [] )+                AlignDefault+                (RowSpan 1)+                (ColSpan 1)+                [ Plain [ Math InlineMath "W" ] ]+            , Cell+                ( "" , [] , [] )+                AlignDefault+                (RowSpan 1)+                (ColSpan 1)+                [ Plain [ Str "rel." , Space , Str "err." ] ]+            ]+        , Row+            ( "" , [] , [] )+            [ Cell+                ( "" , [] , [] )+                AlignDefault+                (RowSpan 1)+                (ColSpan 1)+                [ Plain [ Str "[" , Math InlineMath "\\mu" , Str "m]" ]+                ]+            , Cell+                ( "" , [] , [] )+                AlignDefault+                (RowSpan 1)+                (ColSpan 1)+                [ Plain [ Str "[%]" ] ]+            ]+        ]+    ]+    (TableFoot ( "" , [] , [] ) [])+]+```
test/command/8508.md view
@@ -7,12 +7,12 @@ * [EBNF](https://en.wikipedia.org/wiki/Extended_Backus–Naur_form) ^D .SH SEE ALSO-.IP \[bu] 2+.IP \(bu 2 \c .UR https://en.wikipedia.org/wiki/Milk Milk .UE \c-.IP \[bu] 2+.IP \(bu 2 \c .UR https://en.wikipedia.org/wiki/Extended_Backus–Naur_form EBNF
test/command/ascii.md view
@@ -17,7 +17,7 @@ äéıå ^D .PP-\[:a]\['e]\[.i]\[oa]+\(:a\('e\(.i\(oa ```  ```@@ -25,7 +25,7 @@ äéıå ^D .LP-\[:a]\['e]\[.i]\[oa]+\(:a\('e\(.i\(oa ```  ```
test/docx/golden/block_quotes.docx view

binary file changed (10691 → 10689 bytes)

test/docx/golden/codeblock.docx view

binary file changed (10508 → 10507 bytes)

test/docx/golden/comments.docx view

binary file changed (10839 → 10838 bytes)

test/docx/golden/custom_style_no_reference.docx view

binary file changed (10610 → 10609 bytes)

test/docx/golden/custom_style_preserve.docx view

binary file changed (11235 → 11235 bytes)

test/docx/golden/custom_style_reference.docx view

binary file changed (12543 → 12542 bytes)

test/docx/golden/definition_list.docx view

binary file changed (10498 → 10498 bytes)

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

binary file changed (10512 → 10512 bytes)

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

binary file changed (10998 → 10997 bytes)

test/docx/golden/headers.docx view

binary file changed (10652 → 10652 bytes)

test/docx/golden/image.docx view

binary file changed (27388 → 27380 bytes)

test/docx/golden/inline_code.docx view

binary file changed (10449 → 10448 bytes)

test/docx/golden/inline_formatting.docx view

binary file changed (10625 → 10624 bytes)

test/docx/golden/inline_images.docx view

binary file changed (27384 → 27380 bytes)

binary file changed (10666 → 10661 bytes)

test/docx/golden/links.docx view

binary file changed (10840 → 10839 bytes)

test/docx/golden/lists.docx view

binary file changed (11034 → 11031 bytes)

test/docx/golden/lists_9994.docx view

binary file changed (10786 → 10785 bytes)

test/docx/golden/lists_continuing.docx view

binary file changed (10700 → 10699 bytes)

test/docx/golden/lists_div_bullets.docx view

binary file changed (10684 → 10682 bytes)

test/docx/golden/lists_multiple_initial.docx view

binary file changed (10916 → 10915 bytes)

test/docx/golden/lists_restarting.docx view

binary file changed (10697 → 10696 bytes)

test/docx/golden/nested_anchors_in_header.docx view

binary file changed (10841 → 10842 bytes)

test/docx/golden/notes.docx view

binary file changed (10611 → 10612 bytes)

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

binary file changed (10542 → 10541 bytes)

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

binary file changed (10681 → 10680 bytes)

test/docx/golden/table_one_row.docx view

binary file changed (10520 → 10519 bytes)

test/docx/golden/table_with_list_cell.docx view

binary file changed (10970 → 10969 bytes)

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

binary file changed (10883 → 10879 bytes)

test/docx/golden/tables.docx view

binary file changed (10896 → 10893 bytes)

test/docx/golden/tables_separated_with_rawblock.docx view

binary file changed (10517 → 10516 bytes)

test/docx/golden/task_list.docx view

binary file changed (10781 → 10780 bytes)

test/docx/golden/track_changes_deletion.docx view

binary file changed (10490 → 10489 bytes)

test/docx/golden/track_changes_insertion.docx view

binary file changed (10474 → 10473 bytes)

test/docx/golden/track_changes_move.docx view

binary file changed (10504 → 10503 bytes)

test/docx/golden/track_changes_scrubbed_metadata.docx view

binary file changed (10615 → 10614 bytes)

test/docx/golden/unicode.docx view

binary file changed (10466 → 10465 bytes)

test/docx/golden/verbatim_subsuper.docx view

binary file changed (10477 → 10476 bytes)

test/pptx/background-image/output.pptx view

binary file changed (53335 → 53336 bytes)

test/pptx/background-image/templated.pptx view

binary file changed (66426 → 66427 bytes)

test/pptx/comparison/both-columns/output.pptx view

binary file changed (44543 → 44543 bytes)

test/pptx/comparison/both-columns/templated.pptx view

binary file changed (57667 → 57666 bytes)

test/pptx/comparison/extra-image/output.pptx view

binary file changed (44571 → 44572 bytes)

test/pptx/comparison/extra-image/templated.pptx view

binary file changed (57693 → 57693 bytes)

test/pptx/comparison/extra-text/output.pptx view

binary file changed (44543 → 44543 bytes)

test/pptx/comparison/extra-text/templated.pptx view

binary file changed (57667 → 57666 bytes)

test/pptx/comparison/non-text-first/output.pptx view

binary file changed (44458 → 44459 bytes)

test/pptx/comparison/non-text-first/templated.pptx view

binary file changed (57553 → 57553 bytes)

test/pptx/content-with-caption/heading-text-image/output.pptx view

binary file changed (44300 → 44302 bytes)

test/pptx/content-with-caption/heading-text-image/templated.pptx view

binary file changed (57390 → 57391 bytes)

test/pptx/content-with-caption/image-text/output.pptx view

binary file changed (44989 → 44999 bytes)

test/pptx/content-with-caption/image-text/templated.pptx view

binary file changed (58079 → 58089 bytes)

test/pptx/content-with-caption/text-image/output.pptx view

binary file changed (44241 → 44244 bytes)

test/pptx/content-with-caption/text-image/templated.pptx view

binary file changed (57330 → 57332 bytes)

test/pptx/images/output.pptx view

binary file changed (46208 → 46224 bytes)

test/pptx/images/templated.pptx view

binary file changed (59299 → 59315 bytes)

test/pptx/incremental-lists/with-flag/output.pptx view

binary file changed (77152 → 77156 bytes)

test/pptx/incremental-lists/with-flag/templated.pptx view

binary file changed (90277 → 90284 bytes)

test/pptx/incremental-lists/without-flag/output.pptx view

binary file changed (75402 → 75406 bytes)

test/pptx/incremental-lists/without-flag/templated.pptx view

binary file changed (88522 → 88529 bytes)

test/pptx/layouts/deleted.pptx view

binary file changed (55630 → 55633 bytes)

test/pptx/layouts/moved.pptx view

binary file changed (66365 → 66368 bytes)

test/pptx/slide-level-0/h1-with-image/output.pptx view

binary file changed (44212 → 44217 bytes)

test/pptx/slide-level-0/h1-with-image/templated.pptx view

binary file changed (57302 → 57307 bytes)

test/pptx/slide-level-0/h2-with-image/output.pptx view

binary file changed (44212 → 44217 bytes)

test/pptx/slide-level-0/h2-with-image/templated.pptx view

binary file changed (57302 → 57307 bytes)

test/pptx/speaker-notes-afterseps/output.pptx view

binary file changed (51455 → 51466 bytes)

test/pptx/speaker-notes-afterseps/templated.pptx view

binary file changed (64548 → 64559 bytes)

test/pptx/tables/output.pptx view

binary file changed (29134 → 29134 bytes)

test/pptx/tables/templated.pptx view

binary file changed (42228 → 42229 bytes)

test/pptx/two-column/text-and-image/output.pptx view

binary file changed (45489 → 45496 bytes)

test/pptx/two-column/text-and-image/templated.pptx view

binary file changed (58574 → 58582 bytes)

test/tables.man view
@@ -135,7 +135,7 @@ .PP Multiline table with caption: .PP-Here\[cq]s the caption. It may span multiple lines.+Here\(cqs the caption. It may span multiple lines. .TS tab(@); cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).@@ -165,7 +165,7 @@ T}@T{ 5.0 T}@T{-Here\[cq]s another one.+Here\(cqs another one. Note the blank line between rows. T} .TE@@ -201,7 +201,7 @@ T}@T{ 5.0 T}@T{-Here\[cq]s another one.+Here\(cqs another one. Note the blank line between rows. T} .TE@@ -261,7 +261,7 @@ T}@T{ 5.0 T}@T{-Here\[cq]s another one.+Here\(cqs another one. Note the blank line between rows. T} .TE
test/tables.ms view
@@ -141,7 +141,7 @@ .LP Multiline table with caption: .PP-Here\[cq]s the caption. It may span multiple lines.+Here\(cqs the caption. It may span multiple lines. .na .nr LLold \n[LL] .TS@@ -181,7 +181,7 @@ 5.0 T}	T{ .nr LL 24.5n-Here\[cq]s another one.+Here\(cqs another one. Note the blank line between rows. T} .TE@@ -229,7 +229,7 @@ 5.0 T}	T{ .nr LL 24.5n-Here\[cq]s another one.+Here\(cqs another one. Note the blank line between rows. T} .TE@@ -303,7 +303,7 @@ 5.0 T}	T{ .nr LL 24.5n-Here\[cq]s another one.+Here\(cqs another one. Note the blank line between rows. T} .TE
test/tables.muse view
@@ -24,6 +24,9 @@ Multiline table with caption:  +-----------+----------+------------+---------------------------++| Centered  | Left     | Right      | Default aligned           |+| Header    | Aligned  | Aligned    |                           |++-----------+----------+------------+---------------------------+ | First     | row      | 12.0       | Example of a row that     | |           |          |            | spans multiple lines.     | +-----------+----------+------------+---------------------------+@@ -33,6 +36,9 @@ +-----------+----------+------------+---------------------------+ Multiline table without caption: ++-----------+----------+------------+---------------------------++| Centered  | Left     | Right      | Default aligned           |+| Header    | Aligned  | Aligned    |                           | +-----------+----------+------------+---------------------------+ | First     | row      | 12.0       | Example of a row that     | |           |          |            | spans multiple lines.     |
test/tables/planets.latex view
@@ -17,17 +17,18 @@ \bottomrule\noalign{} \endlastfoot \multicolumn{2}{@{}c}{%-\multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 & 4,879 & 5427 & 3.7 &-4222.6 & 57.9 & 167 & 0 & Closest to the Sun \\+\multirow{4}{*}{\centering\arraybackslash Terrestrial planets}} & Mercury &+0.330 & 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 \\-\multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898 &-142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest planet \\+\multirow{4}{*}{\centering\arraybackslash Jovian planets} &+\multirow{2}{*}{\centering\arraybackslash Gas giants} & Jupiter & 1898 & 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 & \\+& \multirow{2}{*}{\centering\arraybackslash Ice giants} & Uranus & 86.8 & 51,118+& 1271 & 8.7 & 17.2 & 2872.5 & -195 & 27 & \\ & & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\ \multicolumn{2}{@{}c}{% Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 & 153.3 & 5906.4 & -225 & 5
test/writer.jats_archiving view
@@ -687,7 +687,7 @@     <list-item>       <p>Here’s some display math: <disp-formula><alternatives>       <tex-math><![CDATA[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}]]></tex-math>-      <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi>lim</mml:mi><mml:mo>&#8289;</mml:mo><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></alternatives></disp-formula></p>+      <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi>lim</mml:mi><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></alternatives></disp-formula></p>     </list-item>     <list-item>       <p>Here’s one that has a line break in it: <inline-formula><alternatives>
test/writer.jats_articleauthoring view
@@ -673,7 +673,7 @@     </list-item>     <list-item>       <p>Here’s some display math:-      <disp-formula><mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi>lim</mml:mi><mml:mo>&#8289;</mml:mo><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></disp-formula></p>+      <disp-formula><mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi>lim</mml:mi><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></disp-formula></p>     </list-item>     <list-item>       <p>Here’s one that has a line break in it:
test/writer.jats_publishing view
@@ -687,7 +687,7 @@     <list-item>       <p>Here’s some display math: <disp-formula><alternatives>       <tex-math><![CDATA[\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}]]></tex-math>-      <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi>lim</mml:mi><mml:mo>&#8289;</mml:mo><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></alternatives></disp-formula></p>+      <mml:math display="block" xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mfrac><mml:mi>d</mml:mi><mml:mrow><mml:mi>d</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>=</mml:mo><mml:munder><mml:mi>lim</mml:mi><mml:mrow><mml:mi>h</mml:mi><mml:mo>→</mml:mo><mml:mn>0</mml:mn></mml:mrow></mml:munder><mml:mfrac><mml:mrow><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo>+</mml:mo><mml:mi>h</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo><mml:mo>−</mml:mo><mml:mi>f</mml:mi><mml:mo stretchy="false" form="prefix">(</mml:mo><mml:mi>x</mml:mi><mml:mo stretchy="false" form="postfix">)</mml:mo></mml:mrow><mml:mi>h</mml:mi></mml:mfrac></mml:mrow></mml:math></alternatives></disp-formula></p>     </list-item>     <list-item>       <p>Here’s one that has a line break in it: <inline-formula><alternatives>
test/writer.man view
@@ -1,7 +1,7 @@ .TH "Pandoc Test Suite" "" "July 17, 2006" "" .PP This is a set of tests for pandoc.-Most of them are adapted from John Gruber\[cq]s markdown test suite.+Most of them are adapted from John Gruber\(cqs markdown test suite. .PP    *   *   *   *   * .SH Headers@@ -18,7 +18,7 @@ .PP    *   *   *   *   * .SH Paragraphs-Here\[cq]s a regular paragraph.+Here\(cqs a regular paragraph. .PP In Markdown 1.0.0 and earlier. Version 8.@@ -26,7 +26,7 @@ Because a hard\-wrapped line in the middle of a paragraph looked like a list item. .PP-Here\[cq]s one with a bullet.+Here\(cqs one with a bullet. * criminey. .PP There should be a hard line break@@ -49,7 +49,7 @@ .IP .EX sub status {-    print \[dq]working\[dq];+    print \(dqworking\(dq; } .EE .PP@@ -82,7 +82,7 @@ \-\-\-\- (should be four hyphens)  sub status {-    print \[dq]working\[dq];+    print \(dqworking\(dq; }  this code block is indented by one tab@@ -93,58 +93,58 @@ .EX     this code block is indented by two tabs -These should not be escaped:  \[rs]$ \[rs]\[rs] \[rs]> \[rs][ \[rs]{+These should not be escaped:  \(rs$ \(rs\(rs \(rs> \(rs[ \(rs{ .EE .PP    *   *   *   *   * .SH Lists .SS Unordered Asterisks tight:-.IP \[bu] 2+.IP \(bu 2 asterisk 1-.IP \[bu] 2+.IP \(bu 2 asterisk 2-.IP \[bu] 2+.IP \(bu 2 asterisk 3 .PP Asterisks loose:-.IP \[bu] 2+.IP \(bu 2 asterisk 1-.IP \[bu] 2+.IP \(bu 2 asterisk 2-.IP \[bu] 2+.IP \(bu 2 asterisk 3 .PP Pluses tight:-.IP \[bu] 2+.IP \(bu 2 Plus 1-.IP \[bu] 2+.IP \(bu 2 Plus 2-.IP \[bu] 2+.IP \(bu 2 Plus 3 .PP Pluses loose:-.IP \[bu] 2+.IP \(bu 2 Plus 1-.IP \[bu] 2+.IP \(bu 2 Plus 2-.IP \[bu] 2+.IP \(bu 2 Plus 3 .PP Minuses tight:-.IP \[bu] 2+.IP \(bu 2 Minus 1-.IP \[bu] 2+.IP \(bu 2 Minus 2-.IP \[bu] 2+.IP \(bu 2 Minus 3 .PP Minuses loose:-.IP \[bu] 2+.IP \(bu 2 Minus 1-.IP \[bu] 2+.IP \(bu 2 Minus 2-.IP \[bu] 2+.IP \(bu 2 Minus 3 .SS Ordered Tight:@@ -186,35 +186,35 @@ .PP Item 1. graf two.-The quick brown fox jumped over the lazy dog\[cq]s back.+The quick brown fox jumped over the lazy dog\(cqs back. .RE .IP "2." 3 Item 2. .IP "3." 3 Item 3. .SS Nested-.IP \[bu] 2+.IP \(bu 2 Tab .RS 2-.IP \[bu] 2+.IP \(bu 2 Tab .RS 2-.IP \[bu] 2+.IP \(bu 2 Tab .RE .RE .PP-Here\[cq]s another:+Here\(cqs another: .IP "1." 3 First .IP "2." 3 Second: .RS 4-.IP \[bu] 2+.IP \(bu 2 Fee-.IP \[bu] 2+.IP \(bu 2 Fie-.IP \[bu] 2+.IP \(bu 2 Foe .RE .IP "3." 3@@ -226,24 +226,24 @@ .IP "2." 3 Second: .RS 4-.IP \[bu] 2+.IP \(bu 2 Fee-.IP \[bu] 2+.IP \(bu 2 Fie-.IP \[bu] 2+.IP \(bu 2 Foe .RE .IP "3." 3 Third .SS Tabs and spaces-.IP \[bu] 2+.IP \(bu 2 this is a list item indented with tabs-.IP \[bu] 2+.IP \(bu 2 this is a list item indented with spaces .RS 2-.IP \[bu] 2+.IP \(bu 2 this is an example list item indented with tabs-.IP \[bu] 2+.IP \(bu 2 this is an example list item indented with spaces .RE .SS Fancy list markers@@ -402,7 +402,7 @@ This is \f[I]emphasized\f[R] And this is \f[B]strong\f[R] .PP-Here\[cq]s a simple block:+Here\(cqs a simple block: .PP foo .PP@@ -441,7 +441,7 @@ <hr /> .EE .PP-Hr\[cq]s:+Hr\(cqs: .PP    *   *   *   *   * .SH Inline Markup@@ -459,7 +459,7 @@ .PP So is \f[B]\f[BI]this\f[B]\f[R] word. .PP-This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\[rs]\f[R], \f[CR]\[rs]$\f[R],+This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\(rs\f[R], \f[CR]\(rs$\f[R], \f[CR]<html>\f[R]. .PP [STRIKEOUT:This is \f[I]strikeout\f[R].]@@ -469,80 +469,80 @@ Subscripts: H~2~O, H~23~O, H~many\ of\ them~O. .PP These should not be superscripts or subscripts, because of the unescaped spaces:-a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.+a\(hab c\(had, a\(tib c\(tid. .PP    *   *   *   *   * .SH Smart quotes, ellipses, dashes-\[lq]Hello,\[rq] said the spider.-\[lq]`Shelob' is my name.\[rq]+\(lqHello,\(rq said the spider.+\(lq`Shelob' is my name.\(rq .PP `A', `B', and `C' are letters. .PP `Oak,' `elm,' and `beech' are names of trees. So is `pine.' .PP-`He said, \[lq]I want to go.\[rq]' Were you alive in the 70\[cq]s?+`He said, \(lqI want to go.\(rq' Were you alive in the 70\(cqs? .PP-Here is some quoted `\f[CR]code\f[R]' and a \[lq]\c+Here is some quoted `\f[CR]code\f[R]' and a \(lq\c .UR http://example.com/?foo=1&bar=2 quoted link .UE \c-\[rq].+\(rq. .PP-Some dashes: one\[em]two \[em] three\[em]four \[em] five.+Some dashes: one\(emtwo \(em three\(emfour \(em five. .PP-Dashes between numbers: 5\[en]7, 255\[en]66, 1987\[en]1999.+Dashes between numbers: 5\(en7, 255\(en66, 1987\(en1999. .PP Ellipses\&...and\&...and\&.... .PP    *   *   *   *   * .SH LaTeX-.IP \[bu] 2-.IP \[bu] 2+.IP \(bu 2+.IP \(bu 2 2 + 2 = 4-.IP \[bu] 2+.IP \(bu 2 \f[I]x\f[R] ∈ \f[I]y\f[R]-.IP \[bu] 2+.IP \(bu 2 \f[I]α\f[R] ∧ \f[I]ω\f[R]-.IP \[bu] 2+.IP \(bu 2 223-.IP \[bu] 2+.IP \(bu 2 \f[I]p\f[R]\-Tree-.IP \[bu] 2-Here\[cq]s some display math:+.IP \(bu 2+Here\(cqs some display math: .RS-$$\[rs]frac{d}{dx}f(x)=\[rs]lim_{h\[rs]to 0}\[rs]frac{f(x+h)\-f(x)}{h}$$+$$\(rsfrac{d}{dx}f(x)=\(rslim_{h\(rsto 0}\(rsfrac{f(x+h)\-f(x)}{h}$$ .RE-.IP \[bu] 2-Here\[cq]s one that has a line break in it:+.IP \(bu 2+Here\(cqs one that has a line break in it: \f[I]α\f[R] + \f[I]ω\f[R] × \f[I]x\f[R]^2^. .PP-These shouldn\[cq]t be math:-.IP \[bu] 2-To get the famous equation, write \f[CR]$e = mc\[ha]2$\f[R].-.IP \[bu] 2+These shouldn\(cqt be math:+.IP \(bu 2+To get the famous equation, write \f[CR]$e = mc\(ha2$\f[R].+.IP \(bu 2 $22,000 is a \f[I]lot\f[R] of money. So is $34,000.-(It worked if \[lq]lot\[rq] is emphasized.)-.IP \[bu] 2+(It worked if \(lqlot\(rq is emphasized.)+.IP \(bu 2 Shoes ($20) and socks ($5).-.IP \[bu] 2+.IP \(bu 2 Escaped \f[CR]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$. .PP-Here\[cq]s a LaTeX table:+Here\(cqs a LaTeX table: .PP    *   *   *   *   * .SH Special Characters Here is some unicode:-.IP \[bu] 2+.IP \(bu 2 I hat: Î-.IP \[bu] 2+.IP \(bu 2 o umlaut: ö-.IP \[bu] 2+.IP \(bu 2 section: §-.IP \[bu] 2+.IP \(bu 2 set membership: ∈-.IP \[bu] 2+.IP \(bu 2 copyright: © .PP AT&T has an ampersand in their name.@@ -555,9 +555,9 @@ .PP 6 > 5. .PP-Backslash: \[rs]+Backslash: \(rs .PP-Backtick: \[ga]+Backtick: \(ga .PP Asterisk: * .PP@@ -633,32 +633,32 @@ .PP Foo biz. .SS With ampersands-Here\[cq]s a \c+Here\(cqs a \c .UR http://example.com/?foo=1&bar=2 link with an ampersand in the URL .UE \c \&. .PP-Here\[cq]s a link with an amersand in the link text: \c+Here\(cqs a link with an amersand in the link text: \c .UR http://att.com/ AT&T .UE \c \&. .PP-Here\[cq]s an inline link.+Here\(cqs an inline link. .PP-Here\[cq]s an inline link in pointy braces.+Here\(cqs an inline link in pointy braces. .SS Autolinks With an ampersand: \c .UR http://example.com/?foo=1&bar=2 .UE \c-.IP \[bu] 2+.IP \(bu 2 In a list?-.IP \[bu] 2+.IP \(bu 2 \c .UR http://example.com/ .UE \c-.IP \[bu] 2+.IP \(bu 2 It should. .PP An e\-mail address: \c@@ -679,7 +679,7 @@ .PP    *   *   *   *   * .SH Images-From \[lq]Voyage dans la Lune\[rq] by Georges Melies (1902):+From \(lqVoyage dans la Lune\(rq by Georges Melies (1902): [IMAGE: lalune] lalune .PP@@ -688,7 +688,7 @@    *   *   *   *   * .SH Footnotes Here is a footnote reference,[1] and another.[2] This should \f[I]not\f[R] be a-footnote reference, because it contains a space.[\[ha]my note] Here is an inline+footnote reference, because it contains a space.[\(hamy note] Here is an inline note.[3] .RS .PP@@ -706,7 +706,7 @@ It need not be placed at the end of the document. .SS [2] .PP-Here\[cq]s the long note.+Here\(cqs the long note. This one contains multiple blocks. .PP Subsequent blocks are indented to show that they belong to the footnote (as with
test/writer.ms view
@@ -27,7 +27,7 @@ .\" line height .nr VS 12p .\" font family: A, BM, H, HN, N, P, T, ZCM-.fam P+.fam T .\" paragraph indent .nr PI 0m .\" interparagraph space@@ -38,10 +38,6 @@ .nr FPS (\n[PS] - 2000) .\" color used for strikeout .defcolor strikecolor rgb 0.7 0.7 0.7-.\" color for links (rgb)-.ds PDFHREF.COLOUR   0.35 0.00 0.60-.\" border for links (default none)-.ds PDFHREF.BORDER   0 0 0 .\" point size difference between heading levels .nr PSINCR 1p .\" heading level above which point size no longer changes@@ -52,6 +48,14 @@ .\" page numbers in footer, centered .ds CH .ds CF %+.hy+.EQ+delim @@+.EN+.\" color for links (rgb)+.ds PDFHREF.COLOUR   0.35 0.00 0.60+.\" border for links (default none)+.ds PDFHREF.BORDER   0 0 0 .\" pdf outline fold level .nr PDFOUTLINE.FOLDLEVEL 3 .\" start out in outline view@@ -60,10 +64,6 @@ .\" PDF metadata .pdfinfo /Title "Pandoc Test Suite" .pdfinfo /Author "John MacFarlane; Anonymous"-.hy-.EQ-delim @@-.EN .TL Pandoc Test Suite .AU@@ -78,7 +78,7 @@ .1C .LP This is a set of tests for pandoc.-Most of them are adapted from John Gruber\[cq]s markdown test suite.+Most of them are adapted from John Gruber\(cqs markdown test suite. .HLINE .SH 1 Headers@@ -129,7 +129,7 @@ .pdfhref O 1 "Paragraphs" .pdfhref M "paragraphs" .LP-Here\[cq]s a regular paragraph.+Here\(cqs a regular paragraph. .PP In Markdown 1.0.0 and earlier. Version 8.@@ -137,7 +137,7 @@ Because a hard-wrapped line in the middle of a paragraph looked like a list item. .PP-Here\[cq]s one with a bullet.+Here\(cqs one with a bullet. * criminey. .PP There should be a hard line break@@ -162,7 +162,7 @@ .nf \f[C] sub status {-    print \[dq]working\[dq];+    print \(dqworking\(dq; } \f[] .fi@@ -200,7 +200,7 @@ ---- (should be four hyphens)  sub status {-    print \[dq]working\[dq];+    print \(dqworking\(dq; }  this code block is indented by one tab@@ -213,7 +213,7 @@ \f[C]     this code block is indented by two tabs -These should not be escaped:  \[rs]$ \[rs]\[rs] \[rs]> \[rs][ \[rs]{+These should not be escaped:  \(rs$ \(rs\(rs \(rs> \(rs[ \(rs{ \f[] .fi .HLINE@@ -227,51 +227,51 @@ .pdfhref M "unordered" .LP Asterisks tight:-.IP \[bu] 3+.IP \(bu 3 asterisk 1-.IP \[bu] 3+.IP \(bu 3 asterisk 2-.IP \[bu] 3+.IP \(bu 3 asterisk 3 .LP Asterisks loose:-.IP \[bu] 3+.IP \(bu 3 asterisk 1-.IP \[bu] 3+.IP \(bu 3 asterisk 2-.IP \[bu] 3+.IP \(bu 3 asterisk 3 .LP Pluses tight:-.IP \[bu] 3+.IP \(bu 3 Plus 1-.IP \[bu] 3+.IP \(bu 3 Plus 2-.IP \[bu] 3+.IP \(bu 3 Plus 3 .LP Pluses loose:-.IP \[bu] 3+.IP \(bu 3 Plus 1-.IP \[bu] 3+.IP \(bu 3 Plus 2-.IP \[bu] 3+.IP \(bu 3 Plus 3 .LP Minuses tight:-.IP \[bu] 3+.IP \(bu 3 Minus 1-.IP \[bu] 3+.IP \(bu 3 Minus 2-.IP \[bu] 3+.IP \(bu 3 Minus 3 .LP Minuses loose:-.IP \[bu] 3+.IP \(bu 3 Minus 1-.IP \[bu] 3+.IP \(bu 3 Minus 2-.IP \[bu] 3+.IP \(bu 3 Minus 3 .SH 2 Ordered@@ -317,7 +317,7 @@ .PP Item 1. graf two.-The quick brown fox jumped over the lazy dog\[cq]s back.+The quick brown fox jumped over the lazy dog\(cqs back. .RE .IP " 2." 4 Item 2.@@ -327,28 +327,28 @@ Nested .pdfhref O 2 "Nested" .pdfhref M "nested"-.IP \[bu] 3+.IP \(bu 3 Tab .RS 3-.IP \[bu] 3+.IP \(bu 3 Tab .RS 3-.IP \[bu] 3+.IP \(bu 3 Tab .RE .RE .LP-Here\[cq]s another:+Here\(cqs another: .IP " 1." 4 First .IP " 2." 4 Second: .RS 4-.IP \[bu] 3+.IP \(bu 3 Fee-.IP \[bu] 3+.IP \(bu 3 Fie-.IP \[bu] 3+.IP \(bu 3 Foe .RE .IP " 3." 4@@ -360,11 +360,11 @@ .IP " 2." 4 Second: .RS 4-.IP \[bu] 3+.IP \(bu 3 Fee-.IP \[bu] 3+.IP \(bu 3 Fie-.IP \[bu] 3+.IP \(bu 3 Foe .RE .IP " 3." 4@@ -373,14 +373,14 @@ Tabs and spaces .pdfhref O 2 "Tabs and spaces" .pdfhref M "tabs-and-spaces"-.IP \[bu] 3+.IP \(bu 3 this is a list item indented with tabs-.IP \[bu] 3+.IP \(bu 3 this is a list item indented with spaces .RS 3-.IP \[bu] 3+.IP \(bu 3 this is an example list item indented with tabs-.IP \[bu] 3+.IP \(bu 3 this is an example list item indented with spaces .RE .SH 2@@ -572,7 +572,7 @@ This is \f[I]emphasized\f[R] And this is \f[B]strong\f[R] .PP-Here\[cq]s a simple block:+Here\(cqs a simple block: .LP foo .LP@@ -619,7 +619,7 @@ \f[] .fi .LP-Hr\[cq]s:+Hr\(cqs: .HLINE .SH 1 Inline Markup@@ -643,7 +643,7 @@ .PP So is \f[B]\f[BI]this\f[B]\f[R] word. .PP-This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\[rs]\f[R], \f[CR]\[rs]$\f[R],+This is code: \f[CR]>\f[R], \f[CR]$\f[R], \f[CR]\(rs\f[R], \f[CR]\(rs$\f[R], \f[CR]<html>\f[R]. .PP \m[strikecolor]This is \f[I]strikeout\f[R].\m[]@@ -653,31 +653,31 @@ Subscripts: H\*<2\*>O, H\*<23\*>O, H\*<many\ of\ them\*>O. .PP These should not be superscripts or subscripts, because of the unescaped spaces:-a\[ha]b c\[ha]d, a\[ti]b c\[ti]d.+a\(hab c\(had, a\(tib c\(tid. .HLINE .SH 1 Smart quotes, ellipses, dashes .pdfhref O 1 "Smart quotes, ellipses, dashes" .pdfhref M "smart-quotes-ellipses-dashes" .LP-\[lq]Hello,\[rq] said the spider.-\[lq]`Shelob' is my name.\[rq]+\(lqHello,\(rq said the spider.+\(lq`Shelob' is my name.\(rq .PP `A', `B', and `C' are letters. .PP `Oak,' `elm,' and `beech' are names of trees. So is `pine.' .PP-`He said, \[lq]I want to go.\[rq]' Were you alive in the 70\[cq]s?+`He said, \(lqI want to go.\(rq' Were you alive in the 70\(cqs? .PP-Here is some quoted `\f[CR]code\f[R]' and a \[lq]\c+Here is some quoted `\f[CR]code\f[R]' and a \(lq\c .pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \  -- "quoted link"-\&\[rq].+\&\(rq. .PP-Some dashes: one\[em]two \[em] three\[em]four \[em] five.+Some dashes: one\(emtwo \(em three\(emfour \(em five. .PP-Dashes between numbers: 5\[en]7, 255\[en]66, 1987\[en]1999.+Dashes between numbers: 5\(en7, 255\(en66, 1987\(en1999. .PP Ellipses\&...and\&...and\&.... .HLINE@@ -685,38 +685,38 @@ LaTeX .pdfhref O 1 "LaTeX" .pdfhref M "latex"-.IP \[bu] 3-.IP \[bu] 3+.IP \(bu 3+.IP \(bu 3 @2 + 2 = 4@-.IP \[bu] 3+.IP \(bu 3 @x \[u2208] y@-.IP \[bu] 3+.IP \(bu 3 @alpha \[u2227] omega@-.IP \[bu] 3+.IP \(bu 3 @223@-.IP \[bu] 3+.IP \(bu 3 @p@-Tree-.IP \[bu] 3-Here\[cq]s some display math:+.IP \(bu 3+Here\(cqs some display math: .EQ d over {d x} f ( x ) = lim from {h -> 0} {f ( x + h ) - f ( x )} over h .EN-.IP \[bu] 3-Here\[cq]s one that has a line break in it: @alpha + omega times x sup 2@.+.IP \(bu 3+Here\(cqs one that has a line break in it: @alpha + omega times x sup 2@. .LP-These shouldn\[cq]t be math:-.IP \[bu] 3-To get the famous equation, write \f[CR]$e = mc\[ha]2$\f[R].-.IP \[bu] 3+These shouldn\(cqt be math:+.IP \(bu 3+To get the famous equation, write \f[CR]$e = mc\(ha2$\f[R].+.IP \(bu 3 $22,000 is a \f[I]lot\f[R] of money. So is $34,000.-(It worked if \[lq]lot\[rq] is emphasized.)-.IP \[bu] 3+(It worked if \(lqlot\(rq is emphasized.)+.IP \(bu 3 Shoes ($20) and socks ($5).-.IP \[bu] 3+.IP \(bu 3 Escaped \f[CR]$\f[R]: $73 \f[I]this should be emphasized\f[R] 23$. .LP-Here\[cq]s a LaTeX table:+Here\(cqs a LaTeX table: .HLINE .SH 1 Special Characters@@ -724,15 +724,15 @@ .pdfhref M "special-characters" .LP Here is some unicode:-.IP \[bu] 3+.IP \(bu 3 I hat: Î-.IP \[bu] 3+.IP \(bu 3 o umlaut: ö-.IP \[bu] 3+.IP \(bu 3 section: §-.IP \[bu] 3+.IP \(bu 3 set membership: ∈-.IP \[bu] 3+.IP \(bu 3 copyright: © .LP AT&T has an ampersand in their name.@@ -745,9 +745,9 @@ .PP 6 > 5. .PP-Backslash: \[rs]+Backslash: \(rs .PP-Backtick: \[ga]+Backtick: \(ga .PP Asterisk: * .PP@@ -887,22 +887,22 @@ .pdfhref O 2 "With ampersands" .pdfhref M "with-ampersands" .LP-Here\[cq]s a \c+Here\(cqs a \c .pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \  -- "link with an ampersand in the URL" \&. .PP-Here\[cq]s a link with an amersand in the link text: \c+Here\(cqs a link with an amersand in the link text: \c .pdfhref W -D "http://att.com/" -A "\c" \  -- "AT&T" \&. .PP-Here\[cq]s an \c+Here\(cqs an \c .pdfhref W -D "/script?foo=1&bar=2" -A "\c" \  -- "inline link" \&. .PP-Here\[cq]s an \c+Here\(cqs an \c .pdfhref W -D "/script?foo=1&bar=2" -A "\c" \  -- "inline link in pointy braces" \&.@@ -915,19 +915,19 @@ .pdfhref W -D "http://example.com/?foo=1&bar=2" -A "\c" \  -- "http://example.com/?foo=1&bar=2" \&-.IP \[bu] 3+.IP \(bu 3 In a list?-.IP \[bu] 3+.IP \(bu 3 \c .pdfhref W -D "http://example.com/" -A "\c" \  -- "http://example.com/" \&-.IP \[bu] 3+.IP \(bu 3 It should. .LP An e-mail address: \c .pdfhref W -D "mailto:nobody%40nowhere.net" -A "\c" \- -- "nobody\[at]nowhere.net"+ -- "nobody\(atnowhere.net" \& .QS .LP@@ -950,7 +950,7 @@ .pdfhref O 1 "Images" .pdfhref M "images" .LP-From \[lq]Voyage dans la Lune\[rq] by Georges Melies (1902):+From \(lqVoyage dans la Lune\(rq by Georges Melies (1902): \" .IMAGE "lalune.jpg" .ce 1 lalune@@ -973,7 +973,7 @@ .FE and another.\** .FS-Here\[cq]s the long note.+Here\(cqs the long note. This one contains multiple blocks. .PP Subsequent blocks are indented to show that they belong to the footnote (as with@@ -989,7 +989,7 @@ the first line of each block. .FE This should \f[I]not\f[R] be a footnote reference, because it contains a-space.[\[ha]my note] Here is an inline note.\**+space.[\(hamy note] Here is an inline note.\** .FS This is \f[I]easier\f[R] to type. Inline notes may contain \c