packages feed

pandoc 3.6.2 → 3.6.3

raw patch · 99 files changed

+1441/−346 lines, 99 filesdep ~citeprocdep ~commonmark-extensionsdep ~commonmark-pandocPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: citeproc, commonmark-extensions, commonmark-pandoc, typst

API changes (from Hackage documentation)

Files

AUTHORS.md view
@@ -69,6 +69,7 @@ - Cezary Drożak - Chandrahas77 - Charanjit Singh+- Charles Tapley Hoyt - Charlotte Koch - Chris Black - Christian Conkle@@ -149,6 +150,7 @@ - Gwern Branwen - Hamish Mackenzie - Hans-Peter Deifel+- Hendrik Erz - Heiko Schlittermann - Henrik Tramberend - Henry de Valence@@ -197,6 +199,7 @@ - Jeroen de Haas - Jerry Sky - Jesse Rosenthal+- Jez Cope - Joe Hermaszewski - Joe Hillenbrand - John KetzerX@@ -246,6 +249,7 @@ - Marc Schreiber - Marcin Serwin - Mario Lang+- Mark Gardner - Mark Szepieniec - Mark Wright - Martin Joerg@@ -349,6 +353,7 @@ - Scott Morrison - Sebastian Talmon - Sebbones+- Sen-wen Deng - Sergei Trofimovich - Sergey Astanin - Seth Speaks@@ -366,6 +371,7 @@ - Stephan Meijer - Stephen Altamirano - Stephen Huan+- Stephen Reindl - Stéphane Guillou - Sukil Etxenike - Sukka
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: January 12, 2025+date: February 9, 2025 ---  # Synopsis@@ -1109,7 +1109,7 @@ `--top-level-division=default`|`section`|`chapter`|`part`  :   Treat top-level headings as the given division type in-    LaTeX, ConTeXt, DocBook, and  TEI output. The hierarchy+    LaTeX, ConTeXt, DocBook, and TEI output. The hierarchy     order is part, chapter, then section; all headings are     shifted such that the top-level heading becomes the     specified type. The default behavior is to determine the@@ -1122,6 +1122,11 @@     headings to become `\part{..}`, while second-level headings     remain as their default type. +    In Docx output, this option adds section breaks before first-level+    headings if `chapter` is selected, and before first- and second-level+    headings if `part` is selected. Footnote numbers will restart+    with each section break unless the reference doc modifies this.+ `-N`, `--number-sections=[true|false]`  :   Number section headings in LaTeX, ConTeXt, HTML, Docx, ms, or EPUB@@ -3032,6 +3037,19 @@ :   produce a handout version of Beamer slides (with overlays condensed     into single slides) +`csquotes`+:   load `csquotes` package and use `\enquote` or `\enquote*` for quoted text.++`csquotesoptions`+:   options to use for `csquotes` package (repeat for multiple options).++`babeloptions`+:   options to pass to the babel package (may be repeated for+    multiple options). This defaults to `provide=*` if the main+    language isn't a European language written with Latin or+    Cyrillic script or Vietnamese. Most users will not need to+    adjust the default setting.+ #### Fonts  `fontenc`@@ -7560,6 +7578,12 @@            --pdf-engine-opt=--tagged-pdf ...  See the prince documentation for more info.++## Typst++Typst 0.12 can produce PDF/A-2b:++    pandoc --pdf-engine=typst --pdf-engine-opt=--pdf-standard=a-2b ...  ## Word Processors 
changelog.md view
@@ -1,8 +1,151 @@ # Revision history for pandoc +## pandoc 3.6.3 (2025-02-09)++  * Track wikilinks with a class instead of a title (Evan Silberman).+    Previously wikilinks were distinguished by giving them the `title`+    `wikilink`.  Now that we have link attributes, it makes more sense+    to give them the `class` `wikilink`. This change affects all readers+    and writers that support wikilinks.++  * DocBook reader:++    + Handle title inside `orderedlist` (#10594). Also some other+      elements that allow title: `blockquote`, `calloutlist`, etc.+    + Better handle `informalequation` (#10592, tombolano). Include `id`+      attribute.+    + Better handle `formalpara`, `example`, and `sidebar` (#8666, tombolano).+      Include identifiers and titles in each case.++  * Markdown reader:++    + Simplify and fix normal citation parsing (#10584).+      This fixes a bug that causes some normal citations to be+      parsed as bracketed regular citations.++  * ODT reader:++    + Create Figure elements for images that are figures (#10567).+    + Avoid producing spurious blockquotes in list items (#9505).+    + Fix unwanted block quotes (#10575). Previously the reader created+      block quotes whenever a paragraph was marked indented (even though+      this just affects the first line). With this change we still+      generate block quotes for content that has an altered left margin,+      but not for indented paragraphs.++  * Docx reader:++    + Do not issue warning for comments with `+styles` (#10571, Stephen Reindl).++  * LaTeX reader:++    + Test \{,re}newcommand arguments (#4470, Evan Silberman).++  * Pod reader:++    + Consume blanks after =encoding in pod reader (#10537, Evan Silberman).++  * JATS writer:++    + Add CRediT roles to JATS (Charles Tapley Hoyt and Jez Cope, #10152).+      Enable annotating author roles using the Contribution Role Taxonomy+      (CRediT) and export this information in conformant JATS.++  * LaTeX writer/templates:++    + Improve babel support (#8283). Previously we used the `.ini`+      files for every language, but for European languages these tend to+      provide inferior results to the `.ldf` files used by classic+      Babel. Currently Babel documentation recommends using the classic+      system for European languages written in Latin and Cyrillic+      scripts and Vietnamese. So the LaTeX writer and template now+      follow this guidance.++      Main languages in the list of languages with good "classic" support+      are added to global documentclass options and will be automatically+      handled by Babel using the `.ldf` files.++      If the main language is not in this list, the `babeloptions` variable+      will be set to `provide=*`, which will cause support to be loaded from+      the `.ini` file rather than an `.ldf`. So, for example, setting+      `-V babeloptions=''` with a polytonic Greek document will cause the+      `.ldf` support to be used instead of the `.ini`.++      The default setting of this variable can be overwritten, but in most+      cases the default should give good results.++    + Allow `csquotesoptions` to be specified.+    + Fix indentation bugs in `font-settings.latex`.++  * Docx writer:++    + Repeat reference doc's `sectPr` for each new section (#10577).+      Previously we were only carrying over the reference doc's `sectPr`+      at the end of the document, so it wouldn't affect the intermediate+      sections that are now added if `--top-level-division` is `chapter`+      or `part`. This could lead to bad results (e.g. page numbering+      starting only on the last chapter).+    + Create section divisions with `--top-level-division=part` (#10576).+    + Improve title style in reference.docx; base Author and Date+      on Title; remove condensed spacing (Andrew Dunning, #10581).++  * Typst writer:++    + Brace tables with `typst:no-figure` and `typst:text` attributes (#10563,+      Gordon Woodhull).++  * Ms writer:++    + Fix escaping of `-` (#10536). `-` should now be escaped in man+      output but not in ms output (where `\-` is a unicode minus sign).++  * HTML styles: fix style of `hr` so it works when printed (#10535, Hendrik Erz).+    Previously `background-color` was used to style the hr, but this gets ignored+    when printing.  This commit uses `border-top` instead.++  * Text.Pandoc.Shared:++    + Handle `<abbr>` as a span-like inline in `htmlSpanLikeElements`+      (#5793, Evan Silberman).++  * Text.Pandoc.MediaBag:++    + Prefer MIME type when determining extensions for MediaBag items (#10557,+      Max Heller).  This should give different results for remote images+      that are served at URLs that do not contain misleading extensions+      (e.g. `shields.io`).++  * Text.Pandoc.Citeproc:++    + Fix moving punctuation before citation notes. This previously worked with+      regular citations, but not author-in-text citations. Now it works with both.++  * `doc/lua-filters.md`:++    + Correct luacheck URL (#10589, R. N. West).+    + Add static analysis paragraph to debugging section (#10568, R. N. West).+    + Add note about extensions handling in `read` and `write` (Albert Krewinkel).++  * `doc/extras.md`:++    + Add entry for pandoc-subfigs (R. N. West).+    + Update diagram Lua filter URL and description (R. N. West).++  * MANUAL.txt:++    + Add note on using typst to produce pdf/a-2b.+    + Document top-level-division functionality with Docx (#10579, Andrew Dunning).++  * Raise xml-conduit upper bound.++  * Depend on latest commonmark-pandoc, commonmark-extensions,+    citeproc, typst.++  * Makefile: make `make binpath` quiet.+ ## pandoc 3.6.2 (2025-01-12) -  * New output format: `pod` (Evan Silberman). Pod ("Plain old documentation")+  * New input format: `pod` (Evan Silberman). Pod ("Plain old documentation")     is a markup languaged used principally to document Perl modules and     programs. 
data/docx/word/styles.xml view
@@ -60,8 +60,6 @@       <w:rFonts w:asciiTheme="majorHAnsi"       w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi"       w:cstheme="majorBidi" />-      <w:spacing w:val="-10" />-      <w:kern w:val="28" />       <w:sz w:val="56" />       <w:szCs w:val="56" />     </w:rPr>@@ -77,8 +75,6 @@       <w:rFonts w:asciiTheme="majorHAnsi"       w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi"       w:cstheme="majorBidi" />-      <w:spacing w:val="-10" />-      <w:kern w:val="28" />       <w:sz w:val="56" />       <w:szCs w:val="56" />     </w:rPr>@@ -123,23 +119,31 @@   </w:style>   <w:style w:type="paragraph" w:customStyle="1" w:styleId="Author">     <w:name w:val="Author" />+    <w:basedOn w:val="Title" />     <w:next w:val="BodyText" />     <w:qFormat />     <w:pPr>       <w:keepNext />       <w:keepLines />-      <w:jc w:val="center" />     </w:pPr>+    <w:rPr>+      <w:sz w:val="24" />+      <w:szCs w:val="24" />+    </w:rPr>   </w:style>   <w:style w:type="paragraph" w:styleId="Date">     <w:name w:val="Date" />+    <w:basedOn w:val="Title" />     <w:next w:val="BodyText" />     <w:qFormat />     <w:pPr>       <w:keepNext />       <w:keepLines />-      <w:jc w:val="center" />     </w:pPr>+    <w:rPr>+      <w:sz w:val="24" />+      <w:szCs w:val="24" />+    </w:rPr>   </w:style>   <w:style w:type="paragraph" w:customStyle="1" w:styleId="AbstractTitle">     <w:name w:val="Abstract Title" />
data/templates/article.jats_publishing view
@@ -109,6 +109,17 @@ $else$ <string-name>$author$</string-name> $endif$+$for(author.roles)$+$if(it.credit)$+<role vocab="credit"$if(it.degree)$ degree-contribution="$it.degree$"$endif$+      vocab-identifier="https://credit.niso.org/"+      vocab-term-identifier="https://credit.niso.org/contributor-roles/$it.credit$/"+      vocab-term="$it.credit-name$"+>$if(it.name)$$it.name$$else$$it.credit-name$$endif$</role>+$elseif(it.name)$+<role>$it.name$</role>+$endif$+$endfor$ $if(author.email)$ <email>$author.email$</email> $endif$
data/templates/common.latex view
@@ -183,12 +183,11 @@ $-- $if(lang)$ \ifLuaTeX-\usepackage[bidi=basic]{babel}+\usepackage[bidi=basic$for(babeloptions)$,$babeloptions$$endfor$]{babel} \else-\usepackage[bidi=default]{babel}+\usepackage[bidi=default$for(babeloptions)$,$babeloptions$$endfor$]{babel} \fi $if(babel-lang)$-\babelprovide[main,import]{$babel-lang$} $if(mainfont)$ \ifPDFTeX \else@@ -196,9 +195,6 @@ \fi $endif$ $endif$-$for(babel-otherlangs)$-\babelprovide[import]{$babel-otherlangs$}-$endfor$ $for(babelfonts/pairs)$ \babelfont[$babelfonts.key$]{rm}{$babelfonts.value$} $endfor$@@ -261,5 +257,5 @@ $-- csquotes $-- $if(csquotes)$-\usepackage{csquotes}+\usepackage[$for(csquotesoptions)$$csquotesoptions$$sep$,$endfor$]{csquotes} $endif$
data/templates/default.latex view
@@ -1,5 +1,11 @@ $passoptions.latex()$ \documentclass[+$for(babel-otherlangs)$+  $babel-otherlangs$,+$endfor$+$if(babel-lang)$+  $babel-lang$,+$endif$ $if(fontsize)$   $fontsize$, $endif$
data/templates/default.openxml view
@@ -60,15 +60,6 @@ $for(include-after)$     $include-after$ $endfor$-$-- sectpr will be set to the last sectpr in a reference.docx, if present-$if(sectpr)$     $sectpr$-$else$-    <w:sectPr>-      <w:footnotePr>-        <w:numRestart w:val="eachSect" />-      </w:footnotePr>-    </w:sectPr>-$endif$   </w:body> </w:document>
data/templates/font-settings.latex view
@@ -5,36 +5,36 @@ \ifPDFTeX\else   % xetex/luatex font selection $if(mainfont)$-  $if(mainfontfallback)$-    \ifLuaTeX-      \usepackage{luaotfload}-      \directlua{luaotfload.add_fallback("mainfontfallback",{-        $for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$-      })}-    \fi-  $endif$+$if(mainfontfallback)$+  \ifLuaTeX+    \usepackage{luaotfload}+    \directlua{luaotfload.add_fallback("mainfontfallback",{+      $for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$+    })}+  \fi+$endif$   \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$} $endif$ $if(sansfont)$-  $if(sansfontfallback)$-    \ifLuaTeX-      \usepackage{luaotfload}-      \directlua{luaotfload.add_fallback("sansfontfallback",{-        $for(sansfontfallback)$"$sansfontfallback$"$sep$,$endfor$-      })}-    \fi-  $endif$+$if(sansfontfallback)$+  \ifLuaTeX+    \usepackage{luaotfload}+    \directlua{luaotfload.add_fallback("sansfontfallback",{+      $for(sansfontfallback)$"$sansfontfallback$"$sep$,$endfor$+    })}+  \fi+$endif$   \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$$if(sansfontfallback)$,RawFeature={fallback=sansfontfallback}$endif$]{$sansfont$} $endif$ $if(monofont)$-  $if(monofontfallback)$-    \ifLuaTeX-      \usepackage{luaotfload}-      \directlua{luaotfload.add_fallback("monofontfallback",{-        $for(monofontfallback)$"$monofontfallback$"$sep$,$endfor$-      })}-    \fi-  $endif$+$if(monofontfallback)$+  \ifLuaTeX+    \usepackage{luaotfload}+    \directlua{luaotfload.add_fallback("monofontfallback",{+      $for(monofontfallback)$"$monofontfallback$"$sep$,$endfor$+    })}+  \fi+$endif$   \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$} $endif$ $for(fontfamilies)$@@ -55,12 +55,12 @@   \ifXeTeX     \usepackage{xeCJK}     \setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}-    $if(CJKsansfont)$-      \setCJKsansfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKsansfont$}-    $endif$-    $if(CJKmonofont)$-      \setCJKmonofont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmonofont$}-    $endif$+$if(CJKsansfont)$+    \setCJKsansfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKsansfont$}+$endif$+$if(CJKmonofont)$+    \setCJKmonofont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmonofont$}+$endif$   \fi $endif$ $if(luatexjapresetoptions)$
data/templates/styles.html view
@@ -130,8 +130,8 @@  overflow: visible; } hr {-  background-color: #1a1a1a;   border: none;+  border-top: 1px solid #1a1a1a;   height: 1px;   margin: 1em 0; }
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version:   2.4 name:            pandoc-version:         3.6.2+version:         3.6.3 build-type:      Simple license:         GPL-2.0-or-later license-file:    COPYING.md@@ -206,10 +206,12 @@                  citeproc/biblatex-localization/*.lbx.strings                  -- documentation                  MANUAL.txt, COPYRIGHT+extra-doc-files:+                 changelog.md extra-source-files:                  -- documentation                  INSTALL.md, AUTHORS.md, README.md,-                 CONTRIBUTING.md, BUGS, changelog.md,+                 CONTRIBUTING.md, BUGS,                  -- tests                  test/bodybg.gif                  test/*.native@@ -429,7 +431,7 @@                  test/pod-reader.pod source-repository head   type:          git-  location:      git://github.com/jgm/pandoc.git+  location:      https://github.com/jgm/pandoc.git  flag embed_data_files   Description:   Embed data files in binary for relocatable executable.@@ -466,7 +468,7 @@ library xml-light   import:        common-options   build-depends: xml                   >= 1.3.12   && < 1.4,-                 xml-conduit           >= 1.9.1.1  && < 1.10,+                 xml-conduit           >= 1.9.1.1  && < 1.11,                  xml-types             >= 0.3      && < 0.4,                  containers            >= 0.6.0.1  && < 0.8,                  text                  >= 1.1.1.0  && < 2.2@@ -492,10 +494,10 @@                  blaze-markup          >= 0.8      && < 0.9,                  bytestring            >= 0.9      && < 0.13,                  case-insensitive      >= 1.2      && < 1.3,-                 citeproc              >= 0.8.1.2  && < 0.9,+                 citeproc              >= 0.8.1.3  && < 0.9,                  commonmark            >= 0.2.6.1  && < 0.3,-                 commonmark-extensions >= 0.2.5.6  && < 0.3,-                 commonmark-pandoc     >= 0.2.2.3  && < 0.3,+                 commonmark-extensions >= 0.2.6    && < 0.3,+                 commonmark-pandoc     >= 0.2.3    && < 0.3,                  containers            >= 0.6.0.1  && < 0.8,                  crypton               >= 0.30     && < 1.1,                  crypton-connection    >= 0.3.1    && < 0.5,@@ -544,7 +546,7 @@                  zip-archive           >= 0.4.3.1  && < 0.5,                  zlib                  >= 0.5      && < 0.8,                  xml                   >= 1.3.12   && < 1.4,-                 typst                 >= 0.6.1    && < 0.6.2,+                 typst                 >= 0.6.2    && < 0.6.3,                  vector                >= 0.12     && < 0.14,                  djot                  >= 0.1.2.2  && < 0.2,                  tls                   >= 2.0.1    && < 2.2,
src/Text/Pandoc/Citeproc.hs view
@@ -382,12 +382,12 @@             _ -> Nothing  isNote :: Inline -> Bool-isNote (Cite _ [Note _]) = True- -- the following allows citation styles that are "in-text" but use superscript- -- references to be treated as if they are "notes" for the purposes of moving- -- the citations after trailing punctuation (see <https://github.com/jgm/pandoc-citeproc/issues/382>):-isNote (Cite _ [Superscript _]) = True-isNote _                 = False+isNote (Note _) = True+-- the following allows citation styles that are "in-text" but use superscript+-- references to be treated as if they are "notes" for the purposes of moving+-- the citations after trailing punctuation (see <https://github.com/jgm/pandoc-citeproc/issues/382>):+isNote (Superscript _) = True+isNote _ = False  isSpacy :: Inline -> Bool isSpacy Space     = True@@ -405,9 +405,9 @@ mvPunct moveNotes locale (x : xs)   | isSpacy x = x : mvPunct moveNotes locale xs -- 'x [^1],' -> 'x,[^1]'-mvPunct moveNotes locale (q : s : x : ys)+mvPunct moveNotes locale (q : s : x@(Cite _ [il]) : ys)   | isSpacy s-  , isNote x+  , isNote il   = let spunct = T.takeWhile isPunctuation $ stringify ys     in  if moveNotes            then if T.null spunct@@ -418,9 +418,8 @@                           (dropTextWhile isPunctuation (B.fromList ys)))            else q : x : mvPunct moveNotes locale ys -- 'x[^1],' -> 'x,[^1]'-mvPunct moveNotes locale (Cite cs ils : ys)-   | not (null ils)-   , isNote (last ils)+mvPunct moveNotes locale (Cite cs ils@(_:_) : ys)+   | isNote (last ils)    , startWithPunct ys    , moveNotes    = let s = stringify ys@@ -431,8 +430,10 @@                     ++ [last ils]) :          mvPunct moveNotes locale            (B.toList (dropTextWhile isPunctuation (B.fromList ys)))-mvPunct moveNotes locale (s : x : ys) | isSpacy s, isNote x =-  x : mvPunct moveNotes locale ys+mvPunct moveNotes locale (s : x@(Cite _ [il]) : ys)+  | isSpacy s+  , isNote il+  = x : mvPunct moveNotes locale ys mvPunct moveNotes locale (s : x@(Cite _ (Superscript _ : _)) : ys)   | isSpacy s = x : mvPunct moveNotes locale ys mvPunct moveNotes locale (Cite cs ils : Str "." : ys)
src/Text/Pandoc/MediaBag.hs view
@@ -107,9 +107,11 @@                   _     -> getMimeTypeDef fp''   mt = fromMaybe fallback mbMime   path = maybe fp'' (unEscapeString . uriPath) uri-  ext = case takeExtension path of-          '.':e | '%' `notElem` e -> '.':e-          _ -> maybe "" (\x -> '.':T.unpack x) $ extensionFromMimeType mt+  ext = case extensionFromMimeType mt of+             Just e -> '.':T.unpack e+             Nothing -> case takeExtension path of+                             '.':e | '%' `notElem` e -> '.':e+                             _ -> ""  -- | Lookup a media item in a 'MediaBag', returning mime type and contents. lookupMedia :: FilePath
src/Text/Pandoc/Readers/DocBook.hs view
@@ -797,6 +797,9 @@ admonitionTags :: [Text] admonitionTags = ["caution","danger","important","note","tip","warning"] +titledBlockElements :: [Text]+titledBlockElements = ["example", "formalpara", "sidebar"]+ -- Trim leading and trailing newline characters trimNl :: Text -> Text trimNl = T.dropAround (== '\n')@@ -860,16 +863,10 @@         "toc"   -> skip -- skip TOC, since in pandoc it's autogenerated         "index" -> skip -- skip index, since page numbers meaningless         "para"  -> parseMixed para (elContent e)-        "formalpara" -> do-           tit <- case filterChild (named "title") e of-                        Just t  -> divWith ("",["formalpara-title"],[]) .-                                   para .  strong <$> getInlines t-                        Nothing -> return mempty-           (tit <>) <$> parseMixed para (elContent e)         "simpara"  -> parseMixed para (elContent e)         "ackno"  -> parseMixed para (elContent e)         "epigraph" -> parseBlockquote-        "blockquote" -> parseBlockquote+        "blockquote" -> withOptionalTitle parseBlockquote         "attribution" -> skip         "titleabbrev" -> skip         "authorinitials" -> skip@@ -882,7 +879,8 @@         "bibliomisc" -> parseMixed para (elContent e)         "bibliomixed" -> parseMixed para (elContent e)         "equation"         -> para <$> equation e displayMath-        "informalequation" -> para <$> equation e displayMath+        "informalequation" -> divWith (attrValue "id" e,["informalequation"],[]) .+                              para <$> equation e displayMath         "glosssee" -> para . (\ils -> text "See " <> ils <> str ".")                          <$> getInlines e         "glossseealso" -> para . (\ils -> text "See also " <> ils <> str ".")@@ -910,6 +908,7 @@         "refsect2" -> sect 2         "refsect3" -> sect 3         "refsection" -> gets dbSectionLevel >>= sect . (+1)+        l | l `elem` titledBlockElements -> parseAdmonition l         l | l `elem` admonitionTags -> parseAdmonition l         "area" -> skip         "areaset" -> skip@@ -918,9 +917,10 @@         "question" -> addToStart (strong (str "Q:") <> str " ") <$> getBlocks e         "answer" -> addToStart (strong (str "A:") <> str " ") <$> getBlocks e         "abstract" -> blockQuote <$> getBlocks e-        "calloutlist" -> bulletList <$> callouts-        "itemizedlist" -> bulletList . handleCompact <$> listitems-        "orderedlist" -> do+        "calloutlist" -> withOptionalTitle $ bulletList <$> callouts+        "itemizedlist" -> withOptionalTitle $+                            bulletList . handleCompact <$> listitems+        "orderedlist" -> withOptionalTitle $ do           let listStyle = case attrValue "numeration" e of                                "arabic"     -> Decimal                                "loweralpha" -> LowerAlpha@@ -981,6 +981,7 @@            lift $ report $ IgnoredElement name            return mempty +          compactSpacing = case attrValue "spacing" e of                             "compact" -> True                             _         -> False@@ -1106,23 +1107,34 @@              Just t  -> Just ("titleabbrev", strContentRecursive t)              Nothing -> Nothing          lineItems = mapM getInlines $ filterChildren (named "line") e++         -- <title> elements can be directly nested inside an admonition block, use+         -- it if it's there. It is unclear whether we should include the label in+         -- the title: docbook references are ambiguous on that, and some implementations of admonitions+         -- (e.g. asciidoctor) just use an icon in all cases. To be conservative, we don't+         -- include the label and leave it to styling.+         --+         getTitle = case filterChild (named "title") e of+                        Just t  -> Just <$> getInlines t+                        Nothing -> return Nothing+         withOptionalTitle p = do+           mbt <- getTitle+           b <- p+           case mbt of+             Nothing -> return b+             Just t -> return $ divWith (attrValue "id" e,[],[])+                         (divWith ("", ["title"], []) (plain t) <> b)+          -- Admonitions are parsed into a div. Following other Docbook tools that output HTML,          -- we parse the optional title as a div with the @title@ class, and give the          -- block itself a class corresponding to the admonition name.          parseAdmonition label = do-           -- <title> elements can be directly nested inside an admonition block, use-           -- it if it's there. It is unclear whether we should include the label in-           -- the title: docbook references are ambiguous on that, and some implementations of admonitions-           -- (e.g. asciidoctor) just use an icon in all cases. To be conservative, we don't-           -- include the label and leave it to styling.-           title <- divWith ("", ["title"], []) . plain <$>-                    case filterChild (named "title") e of-                        Just t  -> getInlines t-                        Nothing -> return mempty-           -- this will ignore the title element if it is present+           mbt <- getTitle+           -- this will ignore the title element if it is present:            b <- getBlocks e+           let t = divWith ("", ["title"], []) (plain $ fromMaybe mempty mbt)            -- we also attach the label as a class, so it can be styled properly-           return $ divWith (attrValue "id" e,[label],[]) (title <> b)+           return $ divWith (attrValue "id" e,[label],[]) (t <> b)  toAlignment :: Element -> Alignment toAlignment c = case findAttr (unqual "align") c of
src/Text/Pandoc/Readers/Docx.hs view
@@ -357,9 +357,10 @@ blocksToInlinesWarn :: PandocMonad m => T.Text -> Blocks -> DocxContext m Inlines blocksToInlinesWarn cmtId blks = do   let paraOrPlain :: Block -> Bool-      paraOrPlain (Para _)  = True-      paraOrPlain (Plain _) = True-      paraOrPlain _         = False+      paraOrPlain (Para _)       = True+      paraOrPlain (Plain _)      = True+      paraOrPlain (Div _ nested) = all paraOrPlain nested+      paraOrPlain _              = False   unless (all paraOrPlain blks) $     lift $ P.report $ DocxParserWarning $       "Docx comment " <> cmtId <> " will not retain formatting"
src/Text/Pandoc/Readers/Markdown.hs view
@@ -1859,6 +1859,7 @@   => (Attr -> Text -> Text -> Inlines -> Inlines)   -> MarkdownParser m (F Inlines) wikilink constructor = do+  let attr = (mempty, ["wikilink"], mempty)   titleAfter <-     (True <$ guardEnabled Ext_wikilinks_title_after_pipe) <|>     (False <$ guardEnabled Ext_wikilinks_title_before_pipe)@@ -1871,7 +1872,7 @@             | titleAfter -> (T.drop 1 after, before)             | otherwise -> (before, T.drop 1 after)     guard $ T.all (`notElem` ['\n','\r','\f','\t']) url-    return . pure . constructor nullAttr url "wikilink" $+    return . pure . constructor attr url "" $        B.text $ fromEntities title  link :: PandocMonad m => MarkdownParser m (F Inlines)@@ -2267,7 +2268,11 @@  normalCite :: PandocMonad m => MarkdownParser m (F [Citation]) normalCite = try $ do-  citations <- inBalancedBrackets (spnl *> citeList <* spnl)+  char '['+  spnl+  citations <- citeList+  spnl+  char ']'   -- not a link or a bracketed span   notFollowedBy (try (void source) <|>                   (guardEnabled Ext_bracketed_spans *> void attributes) <|>
src/Text/Pandoc/Readers/MediaWiki.hs view
@@ -667,7 +667,7 @@   sym "]]"   -- see #8525:   linktrail <- B.text <$> manyChar (satisfy (\c -> isLetter c && not (isCJK c)))-  let link = B.link (addUnderscores pagename) "wikilink" (label <> linktrail)+  let link = B.linkWith (mempty, ["wikilink"], mempty) (addUnderscores pagename) (stringify label) (label <> linktrail)   if "Category:" `T.isPrefixOf` pagename      then do        updateState $ \st -> st{ mwCategoryLinks = link : mwCategoryLinks st }
src/Text/Pandoc/Readers/ODT.hs view
@@ -15,7 +15,9 @@  import Codec.Archive.Zip import Text.Pandoc.XML.Light+import Text.Pandoc.Walk +import Data.Char (isDigit) import qualified Data.ByteString.Lazy as B  import System.FilePath@@ -46,8 +48,23 @@ readODT opts bytes = case readODT' opts bytes of   Right (doc, mb) -> do     P.setMediaBag mb-    return doc+    return $ walk makeFigure doc   Left e -> throwError e++-- the ODT parser uses old-style figures: an image with title beginning+-- "fig:" in a paragraph by itself.  Convert these to new Figure elements.+makeFigure :: Block -> Block+makeFigure (Para [ Image (ident, classes, kvs) capt (src, tit) ])+  | "fig:" `T.isPrefixOf` tit+  = Figure (ident, [], []) (Caption Nothing [Plain capt'])+      [Plain [Image ("", classes, kvs) capt (src, "")]]+   where+     capt' = case capt of -- strip "Figure 1:" for consistency+                 (Str _ : Space : Str t : Space : xs)+                    | T.all (\c -> isDigit c || c == ':') t+                    , ":" `T.isSuffixOf` t -> xs+                 xs -> xs+makeFigure x = x  -- readODT' :: ReaderOptions
src/Text/Pandoc/Readers/ODT/ContentReader.hs view
@@ -393,39 +393,24 @@  -- | Returns either 'id' or 'blockQuote' depending if any of the StyleProperties -- are indented at quote level.-getParaModifier :: [StyleProperties] -> ParaModifier-getParaModifier props | any isBlockQuote props-                       = blockQuote-                       | otherwise-                       = id+getParaModifier :: ListLevel -> [StyleProperties] -> ParaModifier+getParaModifier listLevel props+  | listLevel > 0 = id -- see #9505, list paragraphs need indentation+  | any isBlockQuote props = blockQuote+  | otherwise = id   where   isBlockQuote SProps {..} | Just paraProps <- paraProperties-                                    , isQuoteWidth (indentation paraProps)-                                                  (margin_left paraProps)+                                    , isQuoteWidth (margin_left paraProps)                                     = True                                     | otherwise                                     = False-  isQuoteWidth mIndent mMargin-    | LengthValueMM indent <- mIndent-    ,  indent          > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_MM_-     = True+  isQuoteWidth mMargin     | LengthValueMM margin <- mMargin     ,           margin > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_MM_      = True-    | LengthValueMM indent <- mIndent-    , LengthValueMM margin <- mMargin-     = indent + margin > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_MM_--    | PercentValue  indent <- mIndent-    ,  indent          > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_PERCENT_-     = True     | PercentValue  margin <- mMargin     ,           margin > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_PERCENT_      = True-    | PercentValue  indent <- mIndent-    , PercentValue  margin <- mMargin-     = indent + margin > _MINIMUM_INDENTATION_FOR_BLOCKQUOTES_IN_PERCENT_-     | otherwise      = False @@ -440,7 +425,8 @@       arr tableCaptionP  -< blocks'     Right (_, style) -> do       props <- fromStyles extendedStylePropertyChain -< [style]-      let modifier = getParaModifier props+      listLevel <- getCurrentListLevel -< ()+      let modifier = getParaModifier listLevel props       blocks' <- reader   -<  blocks       arr modifier        -<< blocks'   where
src/Text/Pandoc/Readers/Pod.hs view
@@ -112,6 +112,7 @@ encoding = do   cmd "encoding"   anyLine+  optional blanklines   logMessage $ IgnoredElement "=encoding; Pandoc requires UTF-8 input"   return mempty 
src/Text/Pandoc/Readers/TWiki.hs view
@@ -469,25 +469,25 @@   st <- getState   guard $ stateAllowLinks st   setState $ st{ stateAllowLinks = False }-  (url, title, content) <- linkText <|> simpleWikiLink+  (url, title, classes, content) <- linkText <|> simpleWikiLink   setState $ st{ stateAllowLinks = True }-  return $ B.link url title content+  return $ B.linkWith ("",classes,[]) url title content -linkText :: PandocMonad m => TWParser m (Text, Text, B.Inlines)+linkText :: PandocMonad m => TWParser m (Text, Text, [Text], B.Inlines) linkText = do   string "[["   url <- T.pack <$> many1Till anyChar (char ']')   content <- option (B.str url) (mconcat <$> linkContent)   char ']'-  return (url, "", content)+  return (url, "", [], content)   where     linkContent      = char '[' >> many1Till anyChar (char ']') >>= parseLinkContent . T.pack     parseLinkContent = parseFromString' $ many1 inline -simpleWikiLink :: PandocMonad m => TWParser m (Text, Text, B.Inlines)+simpleWikiLink :: PandocMonad m => TWParser m (Text, Text, [Text], B.Inlines) simpleWikiLink = do   w <- wikiWord-  return (w, "wikilink", B.str w)+  return (w, "", ["wikilink"], B.str w)  where    wikiWord = do      cs <- many1 $ satisfy (\x -> isLetter x && isUpper x)
src/Text/Pandoc/Readers/Vimwiki.hs view
@@ -56,15 +56,7 @@ import qualified Data.Text as T import Safe (lastMay) import Text.Pandoc.Builder (Blocks, Inlines, fromList, toList, trimInlines)-import qualified Text.Pandoc.Builder as B (blockQuote, bulletList, code,-                                           codeBlockWith, definitionList,-                                           displayMath, divWith, emph,-                                           headerWith, horizontalRule, image,-                                           imageWith, link, math, orderedList,-                                           para, plain, setMeta, simpleTable,-                                           softbreak, space, spanWith, str,-                                           strikeout, strong, subscript,-                                           superscript)+import qualified Text.Pandoc.Builder as B import Text.Pandoc.Class.PandocMonad (PandocMonad (..)) import Text.Pandoc.Definition (Attr, Block (BulletList, OrderedList),                                Inline (Space), ListNumberDelim (..),@@ -555,17 +547,14 @@                   then do                     url <- manyTillChar anyChar $ char '|'                     lab <- mconcat <$> manyTill inline (string "]]")-                    let tit = if isURI url-                                 then ""-                                 else "wikilink"-                    return $ B.link (procLink url) tit lab+                    return $ B.linkWith (attr url) (procLink url) "" lab                   else do                     manyTill anyChar (string "]]") -- not using try here because [[hell]o]] is not rendered as a link in vimwiki-                    let tit = if isURI contents-                                 then ""-                                 else "wikilink"-                    return $ B.link (procLink contents) tit (B.str contents)+                    return $ B.linkWith (attr contents) (procLink contents) "" (B.str contents)+  where+    attr t | isURI t = B.nullAttr+           | otherwise = (mempty, ["wikilink"], mempty)  image :: PandocMonad m => VwParser m Inlines image = try $ do
src/Text/Pandoc/RoffChar.hs view
@@ -34,7 +34,6 @@   , ('`', "\\[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/Shared.hs view
@@ -679,7 +679,7 @@ -- | Set of HTML elements that are represented as Span with a class equal as -- the element tag itself. htmlSpanLikeElements :: Set.Set T.Text-htmlSpanLikeElements = Set.fromList ["kbd", "mark", "dfn"]+htmlSpanLikeElements = Set.fromList ["kbd", "mark", "dfn", "abbr"]  -- | Reformat 'Inlines' as code, putting the stringlike parts in 'Code' -- elements while bringing other inline formatting outside.
src/Text/Pandoc/Writers/Docx.hs view
@@ -239,20 +239,17 @@                                  (\q -> qName q == "id" && qPrefix q == Just "r")                                  idMap                                  (elChildren sectpr')-                        in Just . ppElement $-                             add_attrs (elAttribs sectpr') $ mknode "w:sectPr" [] cs-        Nothing      -> Nothing-+                        in add_attrs (elAttribs sectpr') $ mknode "w:sectPr" [] cs+        Nothing      -> mknode "w:sectPr" []+                          [ mknode "w:footnotePr" []+                            [ mknode "w:numRestart" [("w:val","eachSect")] () ]+                          ]    ((contents, footnotes, comments), st) <- runStateT                          (runReaderT-                          (writeOpenXML opts{ writerWrapText = WrapNone-                                            , writerVariables =-                                                (maybe id (setField "sectpr") sectpr)-                                                (writerVariables opts)-                                                }+                          (writeOpenXML opts{ writerWrapText = WrapNone }                                         doc')-                          env)+                          env{ envSectPr = Just sectpr })                          initialSt   let epochtime = floor $ utcTimeToPOSIXSeconds utctime   let imgs = M.elems $ stImages st
src/Text/Pandoc/Writers/Docx/OpenXML.hs view
@@ -288,6 +288,8 @@                  meta   cStyleMap <- gets (smParaStyle . stStyleMaps)   let styleIdOf name = fromStyleId $ getStyleIdFromName name cStyleMap+  renderedSectPr <- maybe mempty ppElement <$> asks envSectPr+   let context = resetField "body" body               . resetField "toc"                    (vcat (map (literal . showElement) toc))@@ -307,6 +309,7 @@               . resetField "date-style-id" (styleIdOf "Date")               . resetField "abstract-title-style-id" (styleIdOf "AbstractTitle")               . resetField "abstract-style-id" (styleIdOf "Abstract")+              . resetField "sectpr" renderedSectPr               $ metadata   tpl <- maybe (lift $ compileDefaultTemplate "openxml") pure $ writerTemplate opts   let rendered = render Nothing $ renderTemplate tpl context@@ -375,7 +378,10 @@   wrapBookmark ident $ header <> contents blockToOpenXML' opts (Header lev (ident,_,kvs) lst) = do   setFirstPara-  let isChapter = lev == 1 && writerTopLevelDivision opts == TopLevelChapter+  let isSection = case writerTopLevelDivision opts of+                     TopLevelChapter -> lev == 1+                     TopLevelPart -> lev <= 2+                     _ -> False   paraProps <- withParaPropM (pStyleM (fromString $ "Heading "++show lev)) $                     getParaProps False   number <-@@ -389,10 +395,12 @@                 Nothing -> return []            else return []   contents <- (number ++) <$> inlinesToOpenXML opts lst+  sectpr <- asks envSectPr   let addSectionBreak-       | isChapter = (Elem (mknode "w:p" []-                            (mknode "w:pPr" []-                             [mknode "w:sectPr" [] ()])) :)+       | isSection+       , Just sectPrElem <- sectpr+        = (Elem (mknode "w:p" []+                   (mknode "w:pPr" [] [sectPrElem])) :)        | otherwise = id   addSectionBreak <$>     if T.null ident
src/Text/Pandoc/Writers/Docx/Types.hs view
@@ -89,6 +89,7 @@   , envChangesDate    :: Text   , envPrintWidth     :: Integer   , envLang           :: Maybe Text+  , envSectPr         :: Maybe Element   }  defaultWriterEnv :: WriterEnv@@ -104,6 +105,7 @@   , envChangesDate    = "1969-12-31T19:00:00Z"   , envPrintWidth     = 1   , envLang           = Nothing+  , envSectPr         = Nothing   }  
src/Text/Pandoc/Writers/JATS.hs view
@@ -27,7 +27,7 @@ import Control.Monad.State import Data.Generics (everywhere, mkT) import qualified Data.Map as M-import Data.Maybe (fromMaybe, listToMaybe)+import Data.Maybe (fromMaybe, listToMaybe, isNothing) import Data.Time (toGregorian, Day, parseTimeM, defaultTimeLocale, formatTime) import qualified Data.Text as T import Data.Text (Text)@@ -43,7 +43,7 @@ import Text.Pandoc.Shared import Text.Pandoc.URI import Text.Pandoc.Templates (renderTemplate)-import Text.DocTemplates (Context(..), Val(..))+import Text.DocTemplates (Context(..), Val(..), toVal) import Text.Pandoc.Writers.JATS.References (referencesToJATS) import Text.Pandoc.Writers.JATS.Table (tableToJATS) import Text.Pandoc.Writers.JATS.Types@@ -54,6 +54,54 @@ import qualified Text.Pandoc.Writers.AnnotatedTable as Ann import qualified Text.XML.Light as Xml +-- | Default human-readable names for roles in the Contributor Role+-- Taxonomy (CRediT). This is useful for generating JATS that annotate+-- contributor roles+creditNames :: M.Map Text Text+creditNames = M.fromList [+    ("conceptualization", "Conceptualization"),+    ("data-curation", "Data curation"),+    ("formal-analysis", "Formal analysis"),+    ("funding-acquisition", "Funding acquisition"),+    ("investigation", "Investigation"),+    ("methodology", "Methodology"),+    ("project-administration", "Project administration"),+    ("resources", "Resources"),+    ("software", "Software"),+    ("supervision", "Supervision"),+    ("validation", "Validation"),+    ("visualization", "Visualization"),+    ("writing-original-draft", "Writing – original draft"),+    ("writing-review-editing", "Writing – review & editing")]++-- | Ensure every role with a `credit` key also has a `credit-name`,+-- using a default value if necessary+addCreditNames :: Context Text -> Context Text+addCreditNames context =+  case getField "author" context of+    -- If there is an "authors" key, then we replace the existing value+    -- with one we mutate by running the addCreditNamesToAuthor helper+    -- function on each+    Just (ListVal authors) ->+      resetField "author" (map addCreditNamesToAuthor authors) context+    -- If there is no "authors" key in the context, then we don't have to do+    -- anything, and just return the context as is+    _ -> context+  where+    addCreditNamesToAuthor :: Val Text -> Val Text+    addCreditNamesToAuthor val = fromMaybe val $ do+      MapVal authorCtx <- pure val+      ListVal roles <- getField "roles" authorCtx+      return $ toVal $ resetField "roles" (map addCreditNameToRole roles) authorCtx++    addCreditNameToRole :: Val Text -> Val Text+    addCreditNameToRole val = fromMaybe val $ do+      MapVal roleCtx <- pure val+      guard $ isNothing (getField "credit-name" roleCtx :: Maybe (Val Text))+      creditId <- getField "credit" roleCtx+      creditName <- M.lookup creditId creditNames+      return $ toVal $ resetField "credit-name" creditName roleCtx+ -- | Convert a @'Pandoc'@ document to JATS (Archiving and Interchange -- Tag Set.) writeJatsArchiving :: PandocMonad m => WriterOptions -> Pandoc -> m Text@@ -159,6 +207,7 @@                (lookupMetaInlines "title" meta)   let context = defField "body" main               $ defField "back" back+              $ addCreditNames               $ resetField "title" title'               $ resetField "date" date               $ defField "mathml" (case writerHTMLMathMethod opts of
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -265,9 +265,15 @@                       (literal $ renderLang l)) mblang         $ maybe id (\l -> defField "babel-lang"                       (literal l)) babelLang+        $ (case babelLang of -- see #8283+                Just l | l `notElem` ldfLanguages+                         -> defField "babeloptions" ("provide=*" :: Text)+                _ -> id)         $ defField "babel-otherlangs"              (map literal-               (nubOrd . catMaybes . filter (/= babelLang)+               (filter (`elem` ldfLanguages) .+                nubOrd . catMaybes .+                filter (/= babelLang)                 $ map toBabel docLangs))         $ defField "selnolig-langs"              (literal . T.intercalate "," $@@ -1187,3 +1193,96 @@   result <- pa   modify $ \st -> st{ stInSoulCommand = oldInSoulCommand }   pure result++-- Babel languages with a .ldf that works well with all engines (see #8283).+-- We follow the guidance from the Babel documentation:+-- "In general, you should do this for European languages written in Latin+-- and Cyrillic scripts, as well as for Vietnamese."+ldfLanguages :: [Text]+ldfLanguages =+  [ "magyar"+  , "croatian"+  , "ngerman"+  , "germanb"+  , "german"+  , "austrian"+  , "ngermanb"+  , "naustrian"+  , "nswissgerman"+  , "swissgerman"+  , "italian"+  , "greek"+  , "azerbaijani"+  , "american"+  , "newzealand"+  , "UKenglish"+  , "USenglish"+  , "australian"+  , "british"+  , "canadian"+  , "english"+  , "bahasa"+  , "slovak"+  , "finnish"+  , "occitan"+  , "swedish"+  , "brazil"+  , "portuguese"+  , "portuges"+  , "brazilian"+  , "spanish"+  , "norwegian"+  , "norsk"+  , "nynorsk"+  , "bulgarian"+  , "breton"+  , "belarusian"+  , "piedmontese"+  , "esperanto"+  , "lithuanian"+  , "ukraineb"+  , "scottishgaelic"+  , "scottish"+  , "dutch"+  , "afrikaans"+  , "czech"+  , "serbian"+  , "latvian"+  , "catalan"+  , "basque"+  , "albanian"+  , "irish"+  , "serbianc"+  , "interlingua"+  , "bosnian"+  , "friulan"+  , "romanian"+  , "icelandic"+  , "classiclatin"+  , "ecclesiasticlatin"+  , "medievallatin"+  , "latin"+  , "georgian"+  , "macedonian"+  , "welsh"+  , "vietnamese"+  , "romansh"+  , "danish"+  , "lsorbian"+  , "usorbian"+  , "polish-compat"+  , "polish"+  , "estonian"+  , "french"+  , "frenchb"+  , "canadien"+  , "acadian"+  , "francais"+  , "turkish"+  , "hindi"+  , "northernsami"+  , "samin"+  , "russianb"+  , "galician"+  , "slovene"+  ]
src/Text/Pandoc/Writers/Man.hs view
@@ -86,9 +86,9 @@        Just tpl -> renderTemplate tpl context  escString :: WriterOptions -> Text -> Text-escString opts = escapeString (if writerPreferAscii opts-                                  then AsciiOnly-                                  else AllowUTF8)+escString opts = escapeString True (if writerPreferAscii opts+                                       then AsciiOnly+                                       else AllowUTF8)  -- | Return man representation of notes. notesToMan :: PandocMonad m => WriterOptions -> [[Block]] -> StateT WriterState m (Doc Text)
src/Text/Pandoc/Writers/Markdown/Inline.hs view
@@ -649,7 +649,7 @@                 case txt of                       [Str s] | escapeURI s == srcSuffix -> True                       _       -> False-  let useWikilink = tit == "wikilink" &&+  let useWikilink = "wikilink" `elem` classes &&                     (isEnabled Ext_wikilinks_title_after_pipe opts ||                      isEnabled Ext_wikilinks_title_before_pipe opts)   let useRefLinks = writerReferenceLinks opts && not useAuto
src/Text/Pandoc/Writers/Ms.hs view
@@ -92,7 +92,7 @@  escapeStr :: WriterOptions -> Text -> Text escapeStr opts =-  escapeString (if writerPreferAscii opts then AsciiOnly else AllowUTF8)+  escapeString False (if writerPreferAscii opts then AsciiOnly else AllowUTF8)  -- In PDFs we need to escape parentheses and backslash. -- In PDF we need to encode as UTF-16 BE.
src/Text/Pandoc/Writers/Roff.hs view
@@ -74,13 +74,18 @@ essentialEscapes :: Map.Map Char Text essentialEscapes = Map.fromList standardEscapes --- | Escape special characters for roff.-escapeString :: EscapeMode -> Text -> Text-escapeString e = Text.concat . escapeString' e . Text.unpack+-- | Escape special characters for roff. If the first parameter is+-- True, escape @-@ as @\-@, as required by current versions of groff man;+-- otherwise leave it unescaped, as neededfor ms.+escapeString :: Bool -> EscapeMode -> Text -> Text+escapeString escapeHyphen e = Text.concat . escapeString' e . Text.unpack   where     escapeString' _ [] = []     escapeString' escapeMode ('\n':'.':xs) =       "\n\\&." : escapeString' escapeMode xs+    -- see #10533; we need to escape hyphens as \- in man but not in ms:+    escapeString' escapeMode ('-':xs) | escapeHyphen =+      "\\-" : escapeString' escapeMode xs     escapeString' escapeMode (x:xs) =       case Map.lookup x essentialEscapes of         Just s  -> s : escapeString' escapeMode xs
src/Text/Pandoc/Writers/Typst.hs view
@@ -131,8 +131,16 @@  toTypstSetText :: [(Text, Text)] -> Doc Text toTypstSetText [] = ""-toTypstSetText typstTextAttrs = "#set text" <> parens (toTypstPropsListSep typstTextAttrs) <> "; " -- newline?+toTypstSetText typstTextAttrs = "set text" <> parens (toTypstPropsListSep typstTextAttrs) <> "; " +toTypstPoundSetText :: [(Text, Text)] -> Doc Text+toTypstPoundSetText [] = ""+toTypstPoundSetText typstTextAttrs = "#" <> toTypstSetText typstTextAttrs++toTypstBracesSetText :: [(Text, Text)] -> Doc Text -> Doc Text+toTypstBracesSetText [] x = "#" <> x+toTypstBracesSetText typstTextAttrs x = "#" <> braces (toTypstSetText typstTextAttrs <> x)+ blocksToTypst :: PandocMonad m => [Block] -> TW m (Doc Text) blocksToTypst blocks = vcat <$> mapM blockToTypst blocks @@ -259,7 +267,7 @@                      ColSpan n -> [ "colspan: " <> tshow n ]) ++                   map formatTypstProp typstAttrs2             cellContents <- blocksToTypst bs-            let contents2 = brackets (toTypstSetText typstTextAttrs <> cellContents)+            let contents2 = brackets (toTypstPoundSetText typstTextAttrs <> cellContents)             pure $ if null cellattrs                       then contents2                       else "table.cell" <>@@ -288,7 +296,7 @@       header <- fromHead thead       footer <- fromFoot tfoot       body <- vcat <$> mapM fromTableBody tbodies-      let table = toTypstSetText typstTextAttrs <> "#table("+      let table = "table("             $$ nest 2                 (  "columns: " <> columns <> ","                 $$ "align: " <> alignarray <> ","@@ -299,11 +307,11 @@             )             $$ ")"       return $ if "typst:no-figure" `elem` tabclasses-        then table+        then toTypstBracesSetText typstTextAttrs table         else "#figure("             $$             nest 2-            ("align(center)[" <> table <> "]"+            ("align(center)[" <> toTypstPoundSetText typstTextAttrs <> "#" <> table <> "]"               $$ capt'               $$ typstFigureKind               $$ ")")@@ -332,7 +340,7 @@       let (typstAttrs,typstTextAttrs) = pickTypstAttrs kvs       contents <- blocksToTypst blocks       return $ "#block" <> toTypstPropsListParens typstAttrs <> "["-        $$ toTypstSetText typstTextAttrs <> contents+        $$ toTypstPoundSetText typstTextAttrs <> contents         $$ ("]" <+> lab)  defListItemToTypst :: PandocMonad m => ([Inline], [[Block]]) -> TW m (Doc Text)
test/Tests/MediaBag.hs view
@@ -29,7 +29,7 @@         assertBool "file in directory is not extracted with original name" exists1         exists2 <- doesFileExist ("foo" </> "f9d88c3dbe18f6a7f5670e994a947d51216cdf0e.jpg")         assertBool "file above directory is not extracted with hashed name" exists2-        exists3 <- doesFileExist ("foo" </> "2a0eaa89f43fada3e6c577beea4f2f8f53ab6a1d.lua")+        exists3 <- doesFileExist ("foo" </> "2a0eaa89f43fada3e6c577beea4f2f8f53ab6a1d.png")         exists4 <- doesFileExist "a.lua"         assertBool "data uri with malicious payload gets written outside of destination dir"           (exists3 && not exists4)
test/Tests/Readers/Docx.hs view
@@ -487,6 +487,11 @@             "comment warnings (all)"             "docx/comments_warning.docx"             ["Docx comment 1 will not retain formatting"]+          , testForWarningsWithOpts def{readerTrackChanges=AllChanges,+                                        readerExtensions=extensionsFromList [Ext_styles]}+            "comments (with styles extension)"+            "docx/comments.docx"+            []           ]         , testGroup "media"           [ testMediaBag
test/Tests/Readers/Markdown.hs view
@@ -58,6 +58,9 @@ autolinkWith attr s = linkWith attr s' "" (str s')   where s' = T.pack s +wikilink :: Attr+wikilink = (mempty, ["wikilink"], mempty)+ bareLinkTests :: [(Text, Inlines)] bareLinkTests =   [ ("http://google.com is a search engine.",@@ -312,22 +315,22 @@         , testGroup "Github wiki links"           [ test markdownGH "autolink" $             "[[https://example.org]]" =?>-            para (link "https://example.org" "wikilink" (str "https://example.org"))+            para (linkWith wikilink "https://example.org" "" (str "https://example.org"))           , test markdownGH "link with title" $             "[[title|https://example.org]]" =?>-            para (link "https://example.org" "wikilink" (str "title"))+            para (linkWith wikilink "https://example.org" "" (str "title"))           , test markdownGH "bad link with title" $             "[[title|random string]]" =?>-            para (link "random string" "wikilink" (str "title"))+            para (linkWith wikilink "random string" "" (str "title"))           , test markdownGH "autolink not being a link" $             "[[Name of page]]" =?>-            para (link "Name of page" "wikilink" (text "Name of page"))+            para (linkWith wikilink "Name of page" "" (text "Name of page"))           , test markdownGH "autolink not being a link with a square bracket" $             "[[Name of ]page]]" =?>-            para (link "Name of ]page" "wikilink" (text "Name of ]page"))+            para (linkWith wikilink "Name of ]page" "" (text "Name of ]page"))           , test markdownGH "link with inline start should be a link" $             "[[t`i*t_le|https://example.org]]" =?>-            para (link "https://example.org" "wikilink" (str "t`i*t_le"))+            para (linkWith wikilink "https://example.org" "" (str "t`i*t_le"))           ]         , testGroup "Headers"           [ "blank line before header" =:
+ test/command/10152.md view
@@ -0,0 +1,446 @@+# CRediT Roles++This document contains tests and examples for enabling+export of roles to JATS. It was added for+[Issue #10152](https://github.com/jgm/pandoc/issues/10152)+and corresponding [Pull Request #10153](https://github.com/jgm/pandoc/pull/10153).++In the first example, we show a fully qualified CRediT role.+An explicit name isn't given, so the CRediT name is used.++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - credit: software+        credit-name: Software+        degree: Lead+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<role vocab="credit" degree-contribution="Lead"+      vocab-identifier="https://credit.niso.org/"+      vocab-term-identifier="https://credit.niso.org/contributor-roles/software/"+      vocab-term="Software"+>Software</role>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```++In the second example, we show a fully qualified CRediT role.+An explicit name is given in a different language.++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - credit: software+        credit-name: Software+        degree: Lead+        name: Programas+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<role vocab="credit" degree-contribution="Lead"+      vocab-identifier="https://credit.niso.org/"+      vocab-term-identifier="https://credit.niso.org/contributor-roles/software/"+      vocab-term="Software"+>Programas</role>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```++In this example, we show a partially qualified CRediT role+that does not have a `degree`:++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - credit: software+        credit-name: Software+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<role vocab="credit"+      vocab-identifier="https://credit.niso.org/"+      vocab-term-identifier="https://credit.niso.org/contributor-roles/software/"+      vocab-term="Software"+>Software</role>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```++In this example, we show a more stripped-down data that requires automatic lookup of the+`credit-name`.++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - credit: software+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<role vocab="credit"+      vocab-identifier="https://credit.niso.org/"+      vocab-term-identifier="https://credit.niso.org/contributor-roles/software/"+      vocab-term="Software"+>Software</role>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```++In this example, we test the correct XML encoding of+the CRediT role [Writing – review & editing](https://credit.niso.org/contributor-roles/writing-review-editing/),+which annoyingly contains an ampersand in its label.++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - credit: writing-review-editing+        credit-name: Writing – review & editing+        degree: Lead+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<role vocab="credit" degree-contribution="Lead"+      vocab-identifier="https://credit.niso.org/"+      vocab-term-identifier="https://credit.niso.org/contributor-roles/writing-review-editing/"+      vocab-term="Writing – review &amp; editing"+>Writing – review &amp; editing</role>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```++In this example, we show a role that isn't qualified with CRediT.++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - name: Dolphin Catcher+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<role>Dolphin Catcher</role>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```++In this example, we show a role that neither has a CRediT identifer,+nor a name, so it's ignored.++```+% pandoc -s -t jats+---+title: CRediT Test+author:+  - name: Max Mustermann+    affiliation: [ 1 ]+    roles:+      - irrelevant-key: Dolphin Catcher+affiliation:+- id: 1+  name: Silverlight University+---+^D+<?xml version="1.0" encoding="utf-8" ?>+<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"+                  "JATS-archivearticle1.dtd">+<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">+<front>+<journal-meta>+<journal-id></journal-id>+<journal-title-group>+</journal-title-group>+<issn></issn>+<publisher>+<publisher-name></publisher-name>+</publisher>+</journal-meta>+<article-meta>+<title-group>+<article-title>CRediT Test</article-title>+</title-group>+<contrib-group>+<contrib contrib-type="author">+<string-name>Max Mustermann</string-name>+<xref ref-type="aff" rid="aff-1"/>+</contrib>+<aff id="aff-1">+<institution-wrap>+<institution>Silverlight University</institution>+</institution-wrap>+</aff>+</contrib-group>+<permissions>+</permissions>+</article-meta>+</front>+<body>++</body>+<back>+</back>+</article>+```
+ test/command/10537.md view
@@ -0,0 +1,24 @@+```+% pandoc -f pod -t html+=encoding utf8++=head1 NAME++Test document+^D+<h1>NAME</h1>+<p>Test document</p>+```++```+% pandoc -f pod -t html+=encoding utf8+++=head1 NAME++Test document+^D+<h1>NAME</h1>+<p>Test document</p>+```
+ test/command/10594.md view
@@ -0,0 +1,28 @@+```+% pandoc -f docbook -t native+<orderedlist numeration="loweralpha">+<title>header inside listing</title>   // not rendered in any output format!+<listitem>+<simpara>first step</simpara>+</listitem>+</orderedlist>+^D+[ Div+    ( "" , [] , [] )+    [ Div+        ( "" , [ "title" ] , [] )+        [ Plain+            [ Str "header"+            , Space+            , Str "inside"+            , Space+            , Str "listing"+            ]+        ]+    , OrderedList+        ( 1 , LowerAlpha , DefaultDelim )+        [ [ Para [ Str "first" , Space , Str "step" ] ] ]+    ]+]++```
test/command/2649.md view
@@ -90,19 +90,20 @@ <tr> <td><p>1</p></td> <td style="text-align: left;"><p><a href="Sébastien_Loeb"-title="wikilink">Sébastien Loeb</a></p></td>+class="wikilink" title="Sébastien Loeb">Sébastien Loeb</a></p></td> <td><p>78</p></td> </tr> <tr> <td><p>2</p></td> <td style="text-align: left;"><p><strong><a href="Sébastien_Ogier"-title="wikilink">Sébastien Ogier</a></strong></p></td>+class="wikilink" title="Sébastien Ogier">Sébastien+Ogier</a></strong></p></td> <td><p>38</p></td> </tr> <tr> <td><p>10</p></td> <td style="text-align: left;"><p><a href="Hannu_Mikkola"-title="wikilink">Hannu Mikkola</a></p></td>+class="wikilink" title="Hannu Mikkola">Hannu Mikkola</a></p></td> <td><p>18</p></td> </tr> </tbody>
+ test/command/4470.md view
@@ -0,0 +1,27 @@+```+% pandoc -r latex -w plain+\newcommand{\foo}{123}\renewcommand\foo{456}\foo+^D+456+```++```+% pandoc -r latex -w plain+\newcommand\foo{123}\renewcommand\foo{456}\foo+^D+456+```++```+% pandoc -r latex -w plain+\newcommand{\foo}{123}\renewcommand{\foo}{456}\foo+^D+456+```++```+% pandoc -r latex -w plain+\newcommand\foo{123}\renewcommand{\foo}{456}\foo+^D+456+```
+ test/command/5793.md view
@@ -0,0 +1,13 @@+```+% pandoc -f html -t djot+You can use <abbr title="Cascading Style Sheets">CSS</abbr>+^D+You can use [CSS]{.abbr title="Cascading Style Sheets"}+```++```+% pandoc -f djot -t html+You can use [CSS]{.abbr title="Cascading Style Sheets"}+^D+<p>You can use <abbr title="Cascading Style Sheets">CSS</abbr></p>+```
+ test/command/8666.md view
@@ -0,0 +1,40 @@+```+% pandoc -f docbook -t native+<formalpara xml:id="my_code_id">+<title>Code title</title>+<para>+<programlisting language="bash" linenumbering="unnumbered">echo "hello world!"</programlisting>+</para>+</formalpara>+<example xml:id="my_example_id">+<title>Example title</title>+<simpara>example content</simpara>+</example>+<sidebar xml:id="my_sidebar_id">+<title>Sidebar title</title>+<simpara>sidebar content</simpara>+</sidebar>+^D+[ Div+    ( "my_code_id" , [ "formalpara" ] , [] )+    [ Div+        ( "" , [ "title" ] , [] )+        [ Plain [ Str "Code" , Space , Str "title" ] ]+    , CodeBlock ( "" , [ "bash" ] , [] ) "echo \"hello world!\""+    ]+, Div+    ( "my_example_id" , [ "example" ] , [] )+    [ Div+        ( "" , [ "title" ] , [] )+        [ Plain [ Str "Example" , Space , Str "title" ] ]+    , Para [ Str "example" , Space , Str "content" ]+    ]+, Div+    ( "my_sidebar_id" , [ "sidebar" ] , [] )+    [ Div+        ( "" , [ "title" ] , [] )+        [ Plain [ Str "Sidebar" , Space , Str "title" ] ]+    , Para [ Str "sidebar" , Space , Str "content" ]+    ]+]+```
test/command/8853.md view
@@ -2,5 +2,5 @@ % pandoc -f markdown+wikilinks_title_after_pipe --wrap=none [[hi]] and ![[hi]] ^D-<p><a href="hi" title="wikilink">hi</a> and <img src="hi" title="wikilink" alt="hi" /></p>+<p><a href="hi" class="wikilink">hi</a> and <img src="hi" class="wikilink" alt="hi" /></p> ```
test/command/9472.md view
@@ -12,6 +12,8 @@ \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} \documentclass[+  french,+  ngerman, ]{article} \usepackage{xcolor} \usepackage{amsmath,amssymb}@@ -51,8 +53,6 @@ \else \usepackage[bidi=default]{babel} \fi-\babelprovide[main,import]{ngerman}-\babelprovide[import]{french} % get rid of language-specific shorthands (see #6817): \let\LanguageShortHands\languageshorthands \def\languageshorthands#1{}
+ test/command/author-in-text-move-note.md view
@@ -0,0 +1,19 @@+```+% pandoc --citeproc --csl command/chicago-fullnote-bibliography.csl -t plain+---+references:+- id: foo+  type: book+  author: John Doe+  title: A Book+...++See @foo [p. 21], as well.+^D+See John Doe,[1] as well.++John Doe. A Book, n.d.++[1] A Book, n.d., 21.+```+
test/command/typst-property-output.md view
@@ -152,3 +152,81 @@   , kind: table   ) ```++```+% pandoc -f html -t typst+<p>Paragraph before.</p>++<table class="typst:no-figure" typst:text:size="3em">+  <tr>+    <td>A</td>+    <td>B</td>+    <td>C</td>+  </tr>+</table>++<p>Paragraph after.</p>+^D+Paragraph before.++#{set text(size: 3em); table(+  columns: 3,+  align: (auto,auto,auto,),+  [A], [B], [C],+)}+Paragraph after.+```+++```+% pandoc -f html -t typst+<p>Paragraph before.</p>++<table typst:text:size="3em">+  <tr>+    <td>A</td>+    <td>B</td>+    <td>C</td>+  </tr>+</table>++<p>Paragraph after.</p>+^D+Paragraph before.++#figure(+  align(center)[#set text(size: 3em); #table(+    columns: 3,+    align: (auto,auto,auto,),+    [A], [B], [C],+  )]+  , kind: table+  )++Paragraph after.+```+++```+% pandoc -f html -t typst+<p>Paragraph before.</p>++<table class="typst:no-figure">+  <tr>+    <td>A</td>+    <td>B</td>+    <td>C</td>+  </tr>+</table>++<p>Paragraph after.</p>+^D+Paragraph before.++#table(+  columns: 3,+  align: (auto,auto,auto,),+  [A], [B], [C],+)+Paragraph after.+```
@@ -11,20 +11,20 @@  [[name of page|title]] ^D-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="name of page" title="wikilink">name of page</a></p>-<p><a href="name of page" title="wikilink">title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="name of page" class="wikilink">name of page</a></p>+<p><a href="name of page" class="wikilink">title</a></p> ```  ## Writer  ``` % pandoc -t commonmark_x+wikilinks_title_after_pipe -f html-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="Home" title="wikilink">Home</a></p>-<p><a href="Name of page" title="wikilink">Title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="Home" class="wikilink">Home</a></p>+<p><a href="Name of page" class="wikilink">Title</a></p> ^D [[https://example.org]] @@ -48,20 +48,20 @@  [[name of page|title]] ^D-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="name of page" title="wikilink">name of page</a></p>-<p><a href="name of page" title="wikilink">title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="name of page" class="wikilink">name of page</a></p>+<p><a href="name of page" class="wikilink">title</a></p> ```  ## Writer  ``` % pandoc -t markdown+wikilinks_title_after_pipe -f html-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="Home" title="wikilink">Home</a></p>-<p><a href="Name of page" title="wikilink">Title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="Home" class="wikilink">Home</a></p>+<p><a href="Name of page" class="wikilink">Title</a></p> ^D [[https://example.org]] 
@@ -12,20 +12,20 @@  [[Title|Name of page]] ^D-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="Name of page" title="wikilink">Name of page</a></p>-<p><a href="Name of page" title="wikilink">Title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="Name of page" class="wikilink">Name of page</a></p>+<p><a href="Name of page" class="wikilink">Title</a></p> ```  ## Writer  ``` % pandoc -t commonmark_x+wikilinks_title_before_pipe -f html-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="Home" title="wikilink">Home</a></p>-<p><a href="Name of page" title="wikilink">Title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="Home" class="wikilink">Home</a></p>+<p><a href="Name of page" class="wikilink">Title</a></p> ^D [[https://example.org]] @@ -59,20 +59,20 @@  [[Title|Name of page]] ^D-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="Name of page" title="wikilink">Name of page</a></p>-<p><a href="Name of page" title="wikilink">Title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="Name of page" class="wikilink">Name of page</a></p>+<p><a href="Name of page" class="wikilink">Title</a></p> ```  ## Writer  ``` % pandoc -t markdown+wikilinks_title_before_pipe -f html-<p><a href="https://example.org" title="wikilink">https://example.org</a></p>-<p><a href="https://example.org" title="wikilink">title</a></p>-<p><a href="Home" title="wikilink">Home</a></p>-<p><a href="Name of page" title="wikilink">Title</a></p>+<p><a href="https://example.org" class="wikilink">https://example.org</a></p>+<p><a href="https://example.org" class="wikilink">title</a></p>+<p><a href="Home" class="wikilink">Home</a></p>+<p><a href="Name of page" class="wikilink">Title</a></p> ^D [[https://example.org]] 
test/docx/golden/block_quotes.docx view

binary file changed (10691 → 10691 bytes)

test/docx/golden/codeblock.docx view

binary file changed (10508 → 10508 bytes)

test/docx/golden/comments.docx view

binary file changed (10838 → 10839 bytes)

test/docx/golden/custom_style_no_reference.docx view

binary file changed (10611 → 10610 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 (12470 → 12543 bytes)

test/docx/golden/definition_list.docx view

binary file changed (10506 → 10507 bytes)

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

binary file changed (10509 → 10512 bytes)

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

binary file changed (10996 → 10998 bytes)

test/docx/golden/headers.docx view

binary file changed (10651 → 10652 bytes)

test/docx/golden/image.docx view

binary file changed (27389 → 27388 bytes)

test/docx/golden/inline_code.docx view

binary file changed (10449 → 10449 bytes)

test/docx/golden/inline_formatting.docx view

binary file changed (10626 → 10625 bytes)

test/docx/golden/inline_images.docx view

binary file changed (27383 → 27384 bytes)

binary file changed (10665 → 10666 bytes)

test/docx/golden/links.docx view

binary file changed (10840 → 10840 bytes)

test/docx/golden/lists.docx view

binary file changed (11035 → 11034 bytes)

test/docx/golden/lists_9994.docx view

binary file changed (10787 → 10786 bytes)

test/docx/golden/lists_continuing.docx view

binary file changed (10702 → 10700 bytes)

test/docx/golden/lists_div_bullets.docx view

binary file changed (10685 → 10684 bytes)

test/docx/golden/lists_multiple_initial.docx view

binary file changed (10917 → 10916 bytes)

test/docx/golden/lists_restarting.docx view

binary file changed (10699 → 10697 bytes)

test/docx/golden/nested_anchors_in_header.docx view

binary file changed (10843 → 10841 bytes)

test/docx/golden/notes.docx view

binary file changed (10614 → 10611 bytes)

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

binary file changed (10542 → 10542 bytes)

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

binary file changed (10681 → 10681 bytes)

test/docx/golden/table_one_row.docx view

binary file changed (10520 → 10520 bytes)

test/docx/golden/table_with_list_cell.docx view

binary file changed (10972 → 10970 bytes)

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

binary file changed (10883 → 10883 bytes)

test/docx/golden/tables.docx view

binary file changed (10897 → 10896 bytes)

test/docx/golden/tables_separated_with_rawblock.docx view

binary file changed (10517 → 10517 bytes)

test/docx/golden/task_list.docx view

binary file changed (10782 → 10781 bytes)

test/docx/golden/track_changes_deletion.docx view

binary file changed (10489 → 10490 bytes)

test/docx/golden/track_changes_insertion.docx view

binary file changed (10472 → 10474 bytes)

test/docx/golden/track_changes_move.docx view

binary file changed (10504 → 10504 bytes)

test/docx/golden/track_changes_scrubbed_metadata.docx view

binary file changed (10617 → 10615 bytes)

test/docx/golden/unicode.docx view

binary file changed (10466 → 10466 bytes)

test/docx/golden/verbatim_subsuper.docx view

binary file changed (10478 → 10477 bytes)

test/mediawiki-reader.native view
@@ -254,40 +254,46 @@       [ Str "internal" , Space , Str "links" ]   , Para       [ Link-          ( "" , [] , [] ) [ Str "Help" ] ( "Help" , "wikilink" )+          ( "" , [ "wikilink" ] , [] )+          [ Str "Help" ]+          ( "Help" , "Help" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "the" , Space , Str "help" , Space , Str "page" ]-          ( "Help" , "wikilink" )+          ( "Help" , "the help page" )       ]   , Para       [ Link-          ( "" , [] , [] ) [ Str "Helpers" ] ( "Help" , "wikilink" )+          ( "" , [ "wikilink" ] , [] )+          [ Str "Helpers" ]+          ( "Help" , "Help" )       ]   , Para       [ Link-          ( "" , [] , [] ) [ Str "Help" ] ( "Help" , "wikilink" )+          ( "" , [ "wikilink" ] , [] )+          [ Str "Help" ]+          ( "Help" , "Help" )       , Str "ers"       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "Contents" ]-          ( "Help:Contents" , "wikilink" )+          ( "Help:Contents" , "Contents" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "#My" , Space , Str "anchor" ]-          ( "#My_anchor" , "wikilink" )+          ( "#My_anchor" , "#My anchor" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "and" , Space , Str "text" ]-          ( "Page#with_anchor" , "wikilink" )+          ( "Page#with_anchor" , "and text" )       ]   , Header 2 ( "images" , [] , [] ) [ Str "images" ]   , Figure
test/odt/native/imageIndex.native view
@@ -1,1 +1,28 @@-[Para [Image ("",[],[("width","5.292cm"),("height","5.292cm")]) [Str "Abbildung",Space,Str "1:",Space,Str "Image",Space,Str "caption"] ("Pictures/10000000000000FA000000FAD6A15225.jpg","fig:")]]+[ Figure+  ( "" , [] , [] )+  (Caption+     Nothing+     [ Plain+         [ Str "Image"+         , Space+         , Str "caption"+         ]+     ])+  [ Plain+      [ Image+          ( ""+          , []+          , [ ( "width" , "5.292cm" ) , ( "height" , "5.292cm" ) ]+          )+          [ Str "Abbildung"+          , Space+          , Str "1:"+          , Space+          , Str "Image"+          , Space+          , Str "caption"+          ]+          ( "Pictures/10000000000000FA000000FAD6A15225.jpg" , "" )+      ]+  ]+]
test/odt/native/imageWithCaption.native view
@@ -1,1 +1,28 @@-[Para [Image ("",[],[("width","5.292cm"),("height","5.292cm")]) [Str "Abbildung",Space,Str "1:",Space,Str "Image",Space,Str "caption"] ("Pictures/10000000000000FA000000FAD6A15225.jpg","fig:")]]+[ Figure+  ( "" , [] , [] )+  (Caption+     Nothing+     [ Plain+         [ Str "Image"+         , Space+         , Str "caption"+         ]+     ])+  [ Plain+      [ Image+          ( ""+          , []+          , [ ( "width" , "5.292cm" ) , ( "height" , "5.292cm" ) ]+          )+          [ Str "Abbildung"+          , Space+          , Str "1:"+          , Space+          , Str "Image"+          , Space+          , Str "caption"+          ]+          ( "Pictures/10000000000000FA000000FAD6A15225.jpg" , "" )+      ]+  ]+]
test/odt/native/listContinueNumbering2.native view
@@ -1,27 +1,23 @@ [ OrderedList     ( 1 , Decimal , Period )-    [ [ BlockQuote [ Para [ Str "Top" , Space , Str "one" ] ]+    [ [ Para [ Str "Top" , Space , Str "one" ]       , OrderedList           ( 1 , LowerAlpha , Period )-          [ [ BlockQuote-                [ Para-                    [ Str "Sub"-                    , Space-                    , Str "item"-                    , Space-                    , Str "1.a"-                    ]-                ]+          [[ Plain+             [ Str "Sub"+             , Space+             , Str "item"+             , Space+             , Str "1.a"+             ]             ]-          , [ BlockQuote-                [ Para-                    [ Str "Sub"-                    , Space-                    , Str "item"-                    , Space-                    , Str "1.b"-                    ]-                ]+          , [ Plain+              [ Str "Sub"+              , Space+              , Str "item"+              , Space+              , Str "1.b"+              ]             ]           ]       ]@@ -39,28 +35,24 @@ , Para [] , OrderedList     ( 2 , Decimal , Period )-    [ [ BlockQuote [ Para [ Str "Top" , Space , Str "two" ] ]+    [ [ Para [ Str "Top" , Space , Str "two" ]       , OrderedList           ( 1 , LowerAlpha , Period )-          [ [ BlockQuote-                [ Para-                    [ Str "Sub"-                    , Space-                    , Str "item"-                    , Space-                    , Str "2.a"-                    ]-                ]+          [ [ Plain+              [ Str "Sub"+              , Space+              , Str "item"+              , Space+              , Str "2.a"+              ]             ]-          , [ BlockQuote-                [ Para-                    [ Str "Sub"-                    , Space-                    , Str "item"-                    , Space-                    , Str "2.b"-                    ]-                ]+          , [ Plain+              [ Str "Sub"+              , Space+              , Str "item"+              , Space+              , Str "2.b"+              ]             ]           ]       ]@@ -78,28 +70,24 @@ , Para [] , OrderedList     ( 3 , Decimal , Period )-    [ [ BlockQuote [ Para [ Str "Top" , Space , Str "three" ] ]+    [ [ Para [ Str "Top" , Space , Str "three" ]       , OrderedList           ( 1 , LowerAlpha , Period )-          [ [ BlockQuote-                [ Para-                    [ Str "Sub"-                    , Space-                    , Str "item"-                    , Space-                    , Str "3.a"-                    ]-                ]+          [ [ Plain+              [ Str "Sub"+              , Space+              , Str "item"+              , Space+              , Str "3.a"+              ]             ]-          , [ BlockQuote-                [ Para-                    [ Str "Sub"-                    , Space-                    , Str "item"-                    , Space-                    , Str "3.b"-                    ]-                ]+          , [ Plain+              [ Str "Sub"+              , Space+              , Str "item"+              , Space+              , Str "3.b"+              ]             ]           ]       ]
test/pod-reader.native view
@@ -22,8 +22,7 @@     , Space     , Str "pandoc."     ]-, Para-    [ Str "=head2" , Space , Str "Head" , Space , Str "2" ]+, Header 2 ( "" , [] , [] ) [ Str "Head" , Space , Str "2" ] , Header     3     ( "" , [] , [] )
test/twiki-reader.native view
@@ -153,15 +153,15 @@       [ Str "internal" , Space , Str "links" ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "MySimplePage" ]-          ( "MySimplePage" , "wikilink" )+          ( "MySimplePage" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "My23Page23" ]-          ( "My23Page23" , "wikilink" )+          ( "My23Page23" , "" )       ]   , Header       1
test/vimwiki-reader.native view
@@ -559,13 +559,13 @@       [ Str "internal" , Space , Str "links" ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "This is a link" ]-          ( "This is a link" , "wikilink" )+          ( "This is a link" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "Description"           , Space           , Str "of"@@ -574,27 +574,27 @@           , Space           , Str "link"           ]-          ( "This is a link source" , "wikilink" )+          ( "This is a link source" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "projects/Important Project 1" ]-          ( "projects/Important Project 1" , "wikilink" )+          ( "projects/Important Project 1" , "" )       , SoftBreak       , Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "../index" ]-          ( "../index" , "wikilink" )+          ( "../index" , "" )       , SoftBreak       , Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "Other" , Space , Str "files" ]-          ( "a subdirectory/" , "wikilink" )+          ( "a subdirectory/" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "try"           , Space           , Str "me"@@ -607,11 +607,11 @@           , Space           , Str "anchors"           ]-          ( "#tag-one" , "wikilink" )+          ( "#tag-one" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "try"           , Space           , Str "me"@@ -624,11 +624,11 @@           , Space           , Str "anchors"           ]-          ( "#block quotes" , "wikilink" )+          ( "#block quotes" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "try"           , Space           , Str "me"@@ -641,19 +641,19 @@           , Space           , Str "anchors"           ]-          ( "#strong" , "wikilink" )+          ( "#strong" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "Tasks" , Space , Str "for" , Space , Str "tomorrow" ]-          ( "Todo List#Tomorrow" , "wikilink" )+          ( "Todo List#Tomorrow" , "" )       ]   , Para       [ Link-          ( "" , [] , [] )+          ( "" , [ "wikilink" ] , [] )           [ Str "diary:2017-05-01" ]-          ( "diary/2017-05-01" , "wikilink" )+          ( "diary/2017-05-01" , "" )       ]   , Para       [ Link
test/writer.html4 view
@@ -110,8 +110,8 @@      overflow: visible;     }     hr {-      background-color: #1a1a1a;       border: none;+      border-top: 1px solid #1a1a1a;       height: 1px;       margin: 1em 0;     }
test/writer.html5 view
@@ -110,8 +110,8 @@      overflow: visible;     }     hr {-      background-color: #1a1a1a;       border: none;+      border-top: 1px solid #1a1a1a;       height: 1px;       margin: 1em 0;     }
test/writer.ms view
@@ -134,7 +134,7 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.-Because a hard\-wrapped line in the middle of a paragraph looked like a list+Because a hard-wrapped line in the middle of a paragraph looked like a list item. .PP Here\[cq]s one with a bullet.@@ -149,7 +149,7 @@ .pdfhref O 1 "Block Quotes" .pdfhref M "block-quotes" .LP-E\-mail style:+E-mail style: .QS .LP This is a block quote.@@ -197,7 +197,7 @@ .IP .nf \f[C]-\-\-\-\- (should be four hyphens)+---- (should be four hyphens)  sub status {     print \[dq]working\[dq];@@ -605,7 +605,7 @@ .IP .nf \f[C]-<!\-\- Comment \-\->+<!-- Comment --> \f[] .fi .LP@@ -695,7 +695,7 @@ .IP \[bu] 3 @223@ .IP \[bu] 3-@p@\-Tree+@p@-Tree .IP \[bu] 3 Here\[cq]s some display math: .EQ@@ -765,7 +765,7 @@ .PP Right paren: ) .PP-Greater\-than: >+Greater-than: > .PP Hash: # .PP@@ -775,7 +775,7 @@ .PP Plus: + .PP-Minus: \-+Minus: - .HLINE .SH 1 Links@@ -925,7 +925,7 @@ .IP \[bu] 3 It should. .LP-An e\-mail address: \c+An e-mail address: \c .pdfhref W -D "mailto:nobody%40nowhere.net" -A "\c" \  -- "nobody\[at]nowhere.net" \&@@ -937,7 +937,7 @@ \& .QE .LP-Auto\-links should not occur here: \f[CR]<http://example.com/>\f[R]+Auto-links should not occur here: \f[CR]<http://example.com/>\f[R] .IP .nf \f[C]
test/writers-lang-and-dir.latex view
@@ -2,6 +2,12 @@ \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} \documentclass[+  ngerman,+  british,+  nswissgerman,+  spanish,+  french,+  english, ]{article} \usepackage{xcolor} \usepackage{amsmath,amssymb}@@ -41,12 +47,6 @@ \else \usepackage[bidi=default]{babel} \fi-\babelprovide[main,import]{english}-\babelprovide[import]{ngerman}-\babelprovide[import]{british}-\babelprovide[import]{nswissgerman}-\babelprovide[import]{spanish}-\babelprovide[import]{french} % get rid of language-specific shorthands (see #6817): \let\LanguageShortHands\languageshorthands \def\languageshorthands#1{}