pandoc 3.4 → 3.5
raw patch · 63 files changed
+1963/−1148 lines, 63 filesdep +cryptondep −SHAdep ~commonmarkdep ~commonmark-pandocdep ~djot
Dependencies added: crypton
Dependencies removed: SHA
Dependency ranges changed: commonmark, commonmark-pandoc, djot, texmath
Files
- AUTHORS.md +3/−0
- MANUAL.txt +50/−7
- changelog.md +222/−7
- data/templates/after-header-includes.latex +10/−0
- data/templates/article.jats_publishing +5/−0
- data/templates/common.latex +268/−0
- data/templates/default.beamer +197/−0
- data/templates/default.latex +10/−537
- data/templates/default.openxml +6/−0
- data/templates/fonts.latex +126/−0
- data/templates/hypersetup.latex +30/−0
- data/templates/passoptions.latex +9/−0
- pandoc.cabal +13/−6
- src/Text/Pandoc/App/CommandLineOptions.hs +16/−0
- src/Text/Pandoc/App/Opt.hs +22/−2
- src/Text/Pandoc/App/OutputSettings.hs +2/−0
- src/Text/Pandoc/Class/IO.hs +3/−10
- src/Text/Pandoc/Class/PandocMonad.hs +18/−4
- src/Text/Pandoc/Extensions.hs +4/−1
- src/Text/Pandoc/MediaBag.hs +3/−4
- src/Text/Pandoc/Options.hs +4/−0
- src/Text/Pandoc/PDF.hs +6/−6
- src/Text/Pandoc/Readers/DocBook.hs +7/−1
- src/Text/Pandoc/Readers/Docx.hs +28/−12
- src/Text/Pandoc/Readers/Docx/Parse.hs +10/−3
- src/Text/Pandoc/Readers/DokuWiki.hs +35/−10
- src/Text/Pandoc/Readers/EPUB.hs +12/−5
- src/Text/Pandoc/Readers/Ipynb.hs +7/−7
- src/Text/Pandoc/Readers/LaTeX/Parsing.hs +5/−1
- src/Text/Pandoc/Readers/RTF.hs +2/−2
- src/Text/Pandoc/SelfContained.hs +4/−4
- src/Text/Pandoc/Shared.hs +1/−1
- src/Text/Pandoc/Templates.hs +0/−1
- src/Text/Pandoc/Writers/ANSI.hs +1/−1
- src/Text/Pandoc/Writers/ConTeXt.hs +2/−0
- src/Text/Pandoc/Writers/Docx/OpenXML.hs +66/−4
- src/Text/Pandoc/Writers/DokuWiki.hs +101/−120
- src/Text/Pandoc/Writers/HTML.hs +27/−11
- src/Text/Pandoc/Writers/LaTeX.hs +11/−7
- src/Text/Pandoc/Writers/RST.hs +27/−23
- test/Tests/Readers/DokuWiki.hs +3/−3
- test/Tests/Writers/RST.hs +2/−2
- test/ansi-test.ansi +2/−0
- test/ansi-test.txt +1/−0
- test/command/10185.md +46/−0
- test/command/10236.md +80/−0
- test/command/4564.md +48/−55
- test/command/5898.md +7/−7
- test/command/5899.md +11/−11
- test/command/7863.md +9/−2
- test/command/8863.md +11/−0
- test/command/9472.md +5/−6
- test/command/dokuwiki-quote.md +16/−0
- test/command/lists-inside-definition.md +2/−2
- test/djot-reader.native +43/−107
- test/docbook-reader.docbook +69/−0
- test/docbook-reader.native +119/−0
- test/docbook-xref.native +1/−1
- test/docx/normalize.docx binary
- test/writer.dokuwiki +55/−93
- test/writer.latex +2/−3
- test/writer.rst +53/−53
- test/writers-lang-and-dir.latex +5/−6
AUTHORS.md view
@@ -3,6 +3,7 @@ - Aaron Wolen - Adelar da Silva Queiróz - Agustín Martín Barbero+- Akash Patel - Akos Marton - Albert Krewinkel - Alex Ivkin@@ -247,6 +248,7 @@ - Mark Wright - Martin Joerg - Martin Linn+- Martin Michlmayr - Martín Pozo - Masataka Ogawa - Masayoshi Takahashi@@ -410,6 +412,7 @@ - Wout Gevaert - Xavier Olive - Yan Pashkovsky+- Yehuda Katz - YI - Yoan Blanc - Yuchen Pei
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: September 9, 2024+date: October 5, 2024 --- # Synopsis@@ -869,6 +869,22 @@ of contents. The default is 3 (which means that level-1, 2, and 3 headings will be listed in the contents). +`--lof[=true|false]`, `--list-of-figures[=true|false]`++: Include an automatically generated list of figures (or, in+ some formats, an instruction to create one) in the output+ document. This option has no effect unless `-s/--standalone`+ is used, and it only has an effect on `latex`, `context`, and+ `docx` output.++`--lot[=true|false]`, `--list-of-tables[=true|false]`++: Include an automatically generated list of tables (or, in+ some formats, an instruction to create one) in the output+ document. This option has no effect unless `-s/--standalone`+ is used, and it only has an effect on `latex`, `context`, and+ `docx` output.+ `--strip-comments[=true|false]` : Strip out HTML comments in the Markdown or Textile source,@@ -2026,6 +2042,22 @@ | ``` | ``` | +----------------------------------+-----------------------------------+ | ``` | ``` yaml |+| --list-of-figures | list-of-figures: true |+| ``` | ``` |++----------------------------------+-----------------------------------++| ``` | ``` yaml |+| --lof | lof: true |+| ``` | ``` |++----------------------------------+-----------------------------------++| ``` | ``` yaml |+| --list-of-tables | list-of-tables: true |+| ``` | ``` |++----------------------------------+-----------------------------------++| ``` | ``` yaml |+| --lot | lot: true |+| ``` | ``` |++----------------------------------+-----------------------------------++| ``` | ``` yaml | | --incremental | incremental: true | | ``` | ``` | +----------------------------------+-----------------------------------+@@ -2866,15 +2898,19 @@ `theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme` : beamer themes -`themeoptions`-: options for LaTeX beamer themes (a list).+`themeoptions`, `colorthemeoptions`, `fontthemeoptions`, `innerthemeoptions`, `outerthemeoptions`+: options for LaTeX beamer themes (lists) `titlegraphic`-: image for title slide+: image for title slide: can be a list `titlegraphicoptions` : options for title slide image +`shorttitle`, `shortsubtitle`, `shortauthor`, `shortinstitute`, `shortdate`+: some beamer themes use short versions of the title, subtitle, author,+ institute, date+ ### Variables for PowerPoint These variables control the visual aspects of a slide show that@@ -2974,7 +3010,10 @@ or `numbersections` variable) `beamerarticle`-: produce an article from Beamer slides+: produce an article from Beamer slides. Note: if you set+ this variable, you must specify the beamer writer but use the+ default *LaTeX* template: for example,+ `pandoc -Vbeamerarticle -t beamer --template default.latex`. `handout` : produce a handout version of Beamer slides (with overlays condensed@@ -3078,7 +3117,8 @@ #### Front matter `lof`, `lot`-: include list of figures, list of tables+: include list of figures, list of tables (can also be set using+ `--lof/--list-of-figures`, `--lot/--list-of-tables`) `thanks` : contents of acknowledgments footnote after document title@@ -7262,7 +7302,7 @@ can be modified and used as the argument to `--highlight-style`. To get a JSON version of the `pygments` style, for example: - pandoc --print-highlight-style pygments > my.theme+ pandoc -o my.theme --print-highlight-style pygments Then edit `my.theme` and use it like this: @@ -7274,6 +7314,9 @@ file](https://docs.kde.org/stable5/en/kate/katepart/highlight.html). Before writing your own, have a look at KDE's [repository of syntax definitions](https://github.com/KDE/syntax-highlighting/tree/master/data/syntax).++If you receive an error that pandoc "Could not read highlighting theme",+check that the JSON file is encoded with UTF-8 and has no Byte-Order Mark (BOM). To disable highlighting, use the `--no-highlight` option.
changelog.md view
@@ -1,5 +1,217 @@ # Revision history for pandoc +## pandoc 3.5 (2024-10-04)++ * Add command-line options `--list-of-figures/--lof` and+ `--list-of-tables/--lot` (#10029, Akash Patel).+ Only docx, latex, and context are affected by these options currently.+ Setting the `lof` and `lot` variables will also work for the formats+ that are currently supported.++ * Defaults files: interpolation of environment variables now+ works for `to` and `from` fields (#8024). This is needed because+ these files can contain paths of custom readers/writers.++ * Docx reader:++ + Reset lists after headers in same list `numId` (#10258).+ To accomplish this, we add a Heading constructor to BodyPart and+ include on it all the information list items have.++ * DocBook reader:++ + Parse id, class, and tabstyle on tables (#10181, Erik Rask).+ Add parsing of id (xml:id), class, and tabstyle XML attributes+ for table and informaltable in the DocBook reader.+ The tabstyle value is put in the 'custom-style' attribute.++ * Dokuwiki reader:++ + Be more forgiving about misaligned lists, like dokuwiki itself (#8863).+ + Improve blockquote parsing in dokuwiki. Allow for quoted code blocks.+ + Enable smart extension.+ + Properly parse `--` and `---` as dashes.+ + Fix block quote behavior (#6461). Blockquotes are not really block+ containers in DokuWiki; the lines are interpreted literally (so,+ e.g., you can't start a list), and line breaks are added at the ends.++ * EPUB reader:++ + Fix links to other files in the EPUB, making them internal links+ to a fragment derived from the filename (#10207). There was+ already code to handle links like `#foo`, but not to handle links+ like `ch0001.html#foo`.++ * LaTeX reader:++ + Add em, ex, px, mu to list of units for dimension args (#10212).++ * ANSI writer:++ + Fix subscripts (Evan Silberman).++ * DokuWiki writer:++ + Don't emit `<HTML>` tags (#7413). The use of these tags is now+ strongly discouraged for security reasons, and will be removed.+ We previously used them as a fallback for lists that could not+ be represented using DokuWiki syntax, e.g. ordered lists with+ fancy numbers or lists with multiple blocks in their items.+ We also used them for block quotes with multiple blocks as+ their contents. We now use the `<WRAP>` syntax (from the optional+ WRAP plugin) to handle lists with multiple blocks as their contents.+ A new method of handling block quotes with complex contents+ has the side benefit of also handling nested block quotes,+ which weren't supported before.+ `<HTML>` and `<html>` tags are only for raw HTML blocks and+ inlines, and only if the `raw_html` extension is enabled. (It is+ now a valid extension for `dokuwiki`, though off by default.)++ * Docx writer:++ + Support `--list-of-figures` and `--list-of-tables` (or `lof` and+ `lot` variables) (Akash Patel).++ * HTML writer:++ + Don't emit missing title/lang warnings if templates does not+ contain the `pagetitle` or `lang` variables respectively (#9370).++ * LaTeX writer:++ + Better fix for lists in definition lists (#10241).+ In commit a26ec96d89ccf532f7bca7591c96ba30d8544e4a we added an+ empty `\item[]` to the beginning of a list that occurs first+ in a definition list, to avoid having one item on the line with+ the label. This gave bad results in some cases (#10241) and there+ is a more idiomatic solution anyway: using `\hfill`.+ + Avoid error on `refs` div with empty citations (#10185).+ If there are no citations, don't emit an empty CSLReferences environment.++ * RST writer:++ + Change bullet list hang from 3 to 2. This accords with the style in+ the RST reference docs.+ + Handle cases where indented context starts with block quote (#10236).+ In these cases we emit an empty comment to fix the point from+ which indentation is measured; otherwise the block quote is not+ parsed as a block quote. This affects list items and admonitions.+ + Don't enclose the list table in a `.. table::`; this leads to+ doubled captions (#10226).+ + Fix alignment of list table items corresponding to cells (#10227).++ * JATS template:++ + Support `floats-group` (Albert Krewinkel, see #10196).+ The content of the `floats-group` variable is now rendered in a+ `<floats-group>` element when using the *publishing* or *archiving* tag+ sets.++ * LaTeX and Beamer templates:++ + Split old default.latex into two templates, `default.latex` and+ `default.beamer`, factoring common parts into partials:+ `fonts.latex`, `common.latex`, `passoptions.latex`,+ `hypersetup.latex`, `after-header-includes.latex`.+ + Make `default.beamer` the default template for beamer.+ + Add `shorttitle`, `shortsubtitle`, `shortauthor`, `shortinstitute`,+ `shortdate` variables to beamer template (#10248, Thomas Hodgson).+ + Make `--number-sections` work with beamer (#12045, Thomas Hodgson).+ + Support a list of images for `titlegraphic` in beamer template+ (#10246, Thomas Hodgson). Title graphic options will be+ applied to each title graphic. Images will be separated by `\enspace`.+ + Beamer theme options (#10243)+ + Add theme options to beamer template: `colorthemeoptions`,+ `fontthemeoptions`, `innerthemeoptions`, `outerthemeoptions` (#10243,+ Thomas Hodgson).+ + Don't load amsmath, amssym in beamer template. These are loaded by+ beamer automatically.++ * Text.Pandoc.SelfContained:++ + Improve handling of links to remote CSS (#10261).++ * Text.Pandoc.Class:++ + Allow extracting `data:` URIs even in PandocPure (`--sandbox`)+ (#10249).+ + Export `extractURIData` [API change].++ * Text.Pandoc.PDF:++ + Read `.toc` and `.log` files from output directory (#10186).+ When this is different from the input directory, this is+ where `.toc` and `.log` files are written.++ * Text.Pandoc.Shared:++ + Modify `addPandocAttributes` for changes in commonmark-pandoc.+ The new commonmark-pandoc version automatically adds the+ attribute `wrapper="1"` on all Divs and Spans that+ are introduced just as containers for attributes that belong+ properly to their contents. So we don't need to add the+ attribute here. This gives much better results in some cases.+ Previously the wrapper attribute was being added even for+ explicit Divs and Spans in djot, but it is not needed in these cases.++ * Text.Pandoc.Options:++ + Add `writerListOfFigures` and `writerListOfTables` fields+ to `WriterOptions` (#8245, Akash Patel). [API change]++ * Text.Pandoc.App:++ + Add `optListOfFigures` and `optListOfTables` to `Opt` (#8245)+ [API change].++ * Lua subsystem (Albert Krewinkel):++ + Update List module (#9835). The module now comes with a method+ `:at(index[, def])` that allows to access indices, accepts+ negative indices to count from the end, and will return the+ `def` value as a default if the list has no item at the given position.+ Furthermore, the list constructor `pandoc.List` now accepts iterators.+ E.g., `pandoc.List(text:gmatch '%S+')` returns the list of words+ in `text`.+ + Support character styling via `pandoc.layout`. The `Doc` values+ produced and handled by the `pandoc.layout` module can now+ be styled using `bold`, `italic`, `underlined`, or `strikeout`. The+ style is ignored in normal rendering, but becomes visible when+ rendering to ANSI output. The `pandoc.layout.render` function+ now takes a third parameter that defines the output style,+ either *plain* or *ansi*.+ + It is now possible to return a single filter from a filter file, e.g.+ ``` lua+ -- Switch single- and double quotes+ return {+ Quoted = function (q)+ elem.quotetype = elem.quotetype == 'SingleQuote'+ and 'DoubleQuote' or 'SingleQuote'+ return elem+ end+ }+ ```+ The filter must not contain numerical indexes, or it might be treated+ as a list of filters.+ + Add `list_of_figures` and `list_of_tables` to writer options+ (Akash Patel).++ * Use latest releases of commonmark, commonmark-pandoc, texmath, djot.++ * Stop depending on package SHA (Albert Krewinkel). Use `crypton` instead.++ * `linux/make_artifacts.sh`: add riscv64 support (Olivier Benz).++ * Fix invalid XML in `test/docx/normalize.docx` (#10242).++ * `doc/lua-filters.md`: list functions in `pandoc.utils` alphabetically+ (Albert Krewinkel).++ * MANUAL.txt:++ + Clarify use of `beamerarticle` variable (#10250).+ + Add clarification to address user issues like #6704 (Yehuda Katz).+ ## pandoc 3.4 (2024-09-09) * New output format: `ansi` (for formatted console output) (Evan Silberman).@@ -31,11 +243,11 @@ * RST reader: - + Improve simple table support (#10093). Multiline rows occur- only when the *first* cell is empty; we were previously treating- lines with *any* empty cell as row continuations. In addition, we- no longer wrap multiline cells in Para if they can be represented- as Plain. This is consistent with docutils behavior.+ + Improve simple table support (#10093). Multiline rows occur+ only when the *first* cell is empty; we were previously treating+ lines with *any* empty cell as row continuations. In addition, we+ no longer wrap multiline cells in Para if they can be represented+ as Plain. This is consistent with docutils behavior. * LaTeX reader: @@ -61,12 +273,15 @@ converting both. We now ignore the HTML fallback span, marked with class `katex-html`. + * Docx reader:++ + Add "SuppressAuthor" and "AuthorOnly" to citationMode+ when `+citations` is used (thomjur).+ * New module: Text.Pandoc.Writers.ANSI [API change] (Evan Silberman). * Docx writer: - + Add "SuppressAuthor" and "AuthorOnly" to citationMode- when `+citations` is used (thomjur). + Support `custom-style` attribute for docx table (Sebbones). + Support `--number-offsets`. + Make table/figure rendering sensitive to caption position settings.
+ data/templates/after-header-includes.latex view
@@ -0,0 +1,10 @@+\usepackage{bookmark}+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available+\urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$}+$if(links-as-notes)$+% Make links footnotes instead of hotlinks:+\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}+$endif$+$if(verbatim-in-note)$+\VerbatimFootnotes % allow verbatim text in footnotes+$endif$
data/templates/article.jats_publishing view
@@ -232,5 +232,10 @@ $back$ $endif$ </back>+$if(floats-group)$+<floats-group>+$floats-group$+</floats-group>+$endif$ </article>
+ data/templates/common.latex view
@@ -0,0 +1,268 @@+$if(linestretch)$+\usepackage{setspace}+$endif$+$--+$-- paragraph formatting+$--+$if(indent)$+$else$+\makeatletter+\@ifundefined{KOMAClassName}{% if non-KOMA class+ \IfFileExists{parskip.sty}{%+ \usepackage{parskip}+ }{% else+ \setlength{\parindent}{0pt}+ \setlength{\parskip}{6pt plus 2pt minus 1pt}}+}{% if KOMA class+ \KOMAoptions{parskip=half}}+\makeatother+$endif$+$if(beamer)$+$else$+$if(block-headings)$+% Make \paragraph and \subparagraph free-standing+\makeatletter+\ifx\paragraph\undefined\else+ \let\oldparagraph\paragraph+ \renewcommand{\paragraph}{+ \@ifstar+ \xxxParagraphStar+ \xxxParagraphNoStar+ }+ \newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}+ \newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}+\fi+\ifx\subparagraph\undefined\else+ \let\oldsubparagraph\subparagraph+ \renewcommand{\subparagraph}{+ \@ifstar+ \xxxSubParagraphStar+ \xxxSubParagraphNoStar+ }+ \newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}+ \newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}+\fi+\makeatother+$endif$+$endif$+$--+$-- verbatim in notes+$--+$if(verbatim-in-note)$+\usepackage{fancyvrb}+$endif$+$-- highlighting+$if(listings)$+\usepackage{listings}+\newcommand{\passthrough}[1]{#1}+\lstset{defaultdialect=[5.3]Lua}+\lstset{defaultdialect=[x86masm]Assembler}+$endif$+$if(lhs)$+\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}+$endif$+$if(highlighting-macros)$+$highlighting-macros$+$endif$+$--+$-- tables+$--+$if(tables)$+\usepackage{longtable,booktabs,array}+$if(multirow)$+\usepackage{multirow}+$endif$+\usepackage{calc} % for calculating minipage widths+$if(beamer)$+\usepackage{caption}+% Make caption package work with longtable+\makeatletter+\def\fnum@table{\tablename~\thetable}+\makeatother+$else$+% Correct order of tables after \paragraph or \subparagraph+\usepackage{etoolbox}+\makeatletter+\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}+\makeatother+% Allow footnotes in longtable head/foot+\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}+\makesavenoteenv{longtable}+$endif$+$endif$+$--+$-- graphics+$--+$if(graphics)$+\usepackage{graphicx}+\makeatletter+\newsavebox\pandoc@box+\newcommand*\pandocbounded[1]{% scales image to fit in text height/width+ \sbox\pandoc@box{#1}%+ \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%+ \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%+ \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both+ \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%+ \else\usebox{\pandoc@box}%+ \fi%+}+% Set default figure placement to htbp+\def\fps@figure{htbp}+\makeatother+$endif$+$if(svg)$+\usepackage{svg}+$endif$+$--+$-- strikeout/underline+$--+$if(strikeout)$+\ifLuaTeX+ \usepackage{luacolor}+ \usepackage[soul]{lua-ul}+\else+ \usepackage{soul}+$if(beamer)$+ \makeatletter+ \let\HL\hl+ \renewcommand\hl{% fix for beamer highlighting+ \let\set@color\beamerorig@set@color+ \let\reset@color\beamerorig@reset@color+ \HL}+ \makeatother+$endif$+$if(CJKmainfont)$+ \ifXeTeX+ % soul's \st doesn't work for CJK:+ \usepackage{xeCJKfntef}+ \renewcommand{\st}[1]{\sout{#1}}+ \fi+$endif$+\fi+$endif$+$--+$-- CSL citations+$--+$if(csl-refs)$+% definitions for citeproc citations+\NewDocumentCommand\citeproctext{}{}+\NewDocumentCommand\citeproc{mm}{%+ \begingroup\def\citeproctext{#2}\cite{#1}\endgroup}+\makeatletter+ % allow citations to break across lines+ \let\@cite@ofmt\@firstofone+ % avoid brackets around text for \cite:+ \def\@biblabel#1{}+ \def\@cite#1#2{{#1\if@tempswa , #2\fi}}+\makeatother+\newlength{\cslhangindent}+\setlength{\cslhangindent}{1.5em}+\newlength{\csllabelwidth}+\setlength{\csllabelwidth}{3em}+\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing+ {\begin{list}{}{%+ \setlength{\itemindent}{0pt}+ \setlength{\leftmargin}{0pt}+ \setlength{\parsep}{0pt}+ % turn on hanging indent if param 1 is 1+ \ifodd #1+ \setlength{\leftmargin}{\cslhangindent}+ \setlength{\itemindent}{-1\cslhangindent}+ \fi+ % set entry spacing+ \setlength{\itemsep}{#2\baselineskip}}}+ {\end{list}}+\usepackage{calc}+\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}+\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}+\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}+\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}+$endif$+$--+$-- Babel language support+$--+$if(lang)$+\ifLuaTeX+\usepackage[bidi=basic]{babel}+\else+\usepackage[bidi=default]{babel}+\fi+$if(babel-lang)$+\babelprovide[main,import]{$babel-lang$}+$if(mainfont)$+\ifPDFTeX+\else+\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$}+\fi+$endif$+$endif$+$for(babel-otherlangs)$+\babelprovide[import]{$babel-otherlangs$}+$endfor$+$for(babelfonts/pairs)$+\babelfont[$babelfonts.key$]{rm}{$babelfonts.value$}+$endfor$+% get rid of language-specific shorthands (see #6817):+\let\LanguageShortHands\languageshorthands+\def\languageshorthands#1{}+$if(selnolig-langs)$+\ifLuaTeX+ \usepackage[$for(selnolig-langs)$$it$$sep$,$endfor$]{selnolig} % disable illegal ligatures+\fi+$endif$+$endif$+$--+$-- pagestyle+$--+$if(pagestyle)$+\pagestyle{$pagestyle$}+$endif$+$--+$-- prevent overfull lines+$--+\setlength{\emergencystretch}{3em} % prevent overfull lines+$--+$-- tight lists+$--+\providecommand{\tightlist}{%+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}+$--+$-- subfigure support+$--+$if(subfigure)$+\usepackage{subcaption}+$endif$+$--+$-- text direction support for pdftex+$--+$if(dir)$+\ifPDFTeX+ \TeXXeTstate=1+ \newcommand{\RL}[1]{\beginR #1\endR}+ \newcommand{\LR}[1]{\beginL #1\endL}+ \newenvironment{RTL}{\beginR}{\endR}+ \newenvironment{LTR}{\beginL}{\endL}+\fi+$endif$+$--+$-- bibliography support support for natbib and biblatex+$--+$if(natbib)$+\usepackage[$natbiboptions$]{natbib}+\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}+$endif$+$if(biblatex)$+\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}+$for(bibliography)$+\addbibresource{$bibliography$}+$endfor$+$endif$+$if(nocite-ids)$+\nocite{$for(nocite-ids)$$it$$sep$, $endfor$}+$endif$+$--+$-- csquotes+$--+$if(csquotes)$+\usepackage{csquotes}+$endif$
+ data/templates/default.beamer view
@@ -0,0 +1,197 @@+$passoptions.latex()$+\documentclass[+$if(fontsize)$+ $fontsize$,+$endif$+ ignorenonframetext,+$if(handout)$+ handout,+$endif$+$if(aspectratio)$+ aspectratio=$aspectratio$,+$endif$+$if(babel-lang)$+ $babel-lang$,+$endif$+$for(classoption)$+ $classoption$$sep$,+$endfor$+]{$documentclass$}+$if(geometry)$+\geometry{$for(geometry)$$geometry$$sep$,$endfor$}+$endif$+\newif\ifbibliography+$if(background-image)$+\usebackgroundtemplate{%+ \includegraphics[width=\paperwidth]{$background-image$}%+}+% In beamer background-image does not work well when other images are used, so this is the workaround+\pgfdeclareimage[width=\paperwidth,height=\paperheight]{background}{$background-image$}+\usebackgroundtemplate{\pgfuseimage{background}}+$endif$+\usepackage{pgfpages}+\setbeamertemplate{caption}[numbered]+\setbeamertemplate{caption label separator}{: }+\setbeamercolor{caption name}{fg=normal text.fg}+\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$+$--+$-- section numbering+$--+$if(numbersections)$+$else$+% remove section numbering+\setbeamertemplate{part page}{+ \centering+ \begin{beamercolorbox}[sep=16pt,center]{part title}+ \usebeamerfont{part title}\insertpart\par+ \end{beamercolorbox}+}+\setbeamertemplate{section page}{+ \centering+ \begin{beamercolorbox}[sep=12pt,center]{section title}+ \usebeamerfont{section title}\insertsection\par+ \end{beamercolorbox}+}+\setbeamertemplate{subsection page}{+ \centering+ \begin{beamercolorbox}[sep=8pt,center]{subsection title}+ \usebeamerfont{subsection title}\insertsubsection\par+ \end{beamercolorbox}+}+$endif$+$for(beameroption)$+\setbeameroption{$beameroption$}+$endfor$+$-- Set Beamer theme before user font settings so they can override theme+$if(theme)$+\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}+$endif$+$if(colortheme)$+\usecolortheme[$for(colorthemeoptions)$$colorthemeoptions$$sep$,$endfor$]{$colortheme$}+$endif$+$if(fonttheme)$+\usefonttheme[$for(fontthemeoptions)$$fontthemeoptions$$sep$,$endfor$]{$fonttheme$}+$endif$+$if(mainfont)$+\usefonttheme{serif} % use mainfont rather than sansfont for slide text+$endif$+$if(innertheme)$+\useinnertheme[$for(innerthemeoptions)$$innerthemeoptions$$sep$,$endfor$]{$innertheme$}+$endif$+$if(outertheme)$+\useoutertheme[$for(outerthemeoptions)$$outerthemeoptions$$sep$,$endfor$]{$outertheme$}+$endif$+% Prevent slide breaks in the middle of a paragraph+\widowpenalties 1 10000+\raggedbottom+$if(section-titles)$+\AtBeginPart{+ \frame{\partpage}+}+\AtBeginSection{+ \ifbibliography+ \else+ \frame{\sectionpage}+ \fi+}+\AtBeginSubsection{+ \frame{\subsectionpage}+}+$endif$+$fonts.latex()$+$common.latex()$+$for(header-includes)$+$header-includes$+$endfor$+$after-header-includes.latex()$+$hypersetup.latex()$++$if(title)$+\title$if(shorttitle)$[$shorttitle$]$endif${$title$$if(thanks)$\thanks{$thanks$}$endif$}+$endif$+$if(subtitle)$+\subtitle$if(shortsubtitle)$[$shortsubtitle$]$endif${$subtitle$}+$endif$+\author$if(shortauthor)$[$shortauthor$]$endif${$for(author)$$author$$sep$ \and $endfor$}+\date$if(shortdate)$[$shortdate$]$endif${$date$}+$if(institute)$+\institute$if(shortinstitute)$[$shortinstitute$]$endif${$for(institute)$$institute$$sep$ \and $endfor$}+$endif$+$if(titlegraphic)$+\titlegraphic{+$for(titlegraphic)$+ \includegraphics$if(titlegraphicoptions)$[$for(titlegraphicoptions)$$titlegraphicoptions$$sep$, $endfor$]$endif${$titlegraphic$}$sep$\enspace+$endfor$}+$endif$+$if(logo)$+\logo{\includegraphics{$logo$}}+$endif$++\begin{document}+$if(title)$+\frame{\titlepage}+$if(abstract)$+\begin{abstract}+$abstract$+\end{abstract}+$endif$+$endif$++$for(include-before)$+$include-before$++$endfor$+$if(toc)$+$if(toc-title)$+\renewcommand*\contentsname{$toc-title$}+$endif$+\begin{frame}[allowframebreaks]+$if(toc-title)$+ \frametitle{$toc-title$}+$endif$+ \setcounter{tocdepth}{$toc-depth$}+ \tableofcontents+\end{frame}+\setcounter{tocdepth}{$toc-depth$}+\tableofcontents+}+$endif$+$if(lof)$+\listoffigures+$endif$+$if(lot)$+\listoftables+$endif$+$if(linestretch)$+\setstretch{$linestretch$}+$endif$+$body$++$if(natbib)$+$if(bibliography)$+$if(biblio-title)$+$if(has-chapters)$+\renewcommand\bibname{$biblio-title$}+$else$+\renewcommand\refname{$biblio-title$}+$endif$+$endif$+\begin{frame}[allowframebreaks]{$biblio-title$}+ \bibliographytrue+ \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}+\end{frame}++$endif$+$endif$+$if(biblatex)$+\begin{frame}[allowframebreaks]{$biblio-title$}+ \bibliographytrue+ \printbibliography[heading=none]+\end{frame}++$endif$+$for(include-after)$+$include-after$++$endfor$+\end{document}
data/templates/default.latex view
@@ -1,13 +1,4 @@-% Options for packages loaded elsewhere-\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref}-\PassOptionsToPackage{hyphens}{url}-$if(colorlinks)$-\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}-$endif$-$if(CJKmainfont)$-\PassOptionsToPackage{space}{xeCJK}-$endif$-%+$passoptions.latex()$ \documentclass[ $if(fontsize)$ $fontsize$,@@ -15,549 +6,55 @@ $if(papersize)$ $papersize$paper, $endif$-$if(beamer)$- ignorenonframetext,-$if(handout)$- handout,-$endif$-$if(aspectratio)$- aspectratio=$aspectratio$,-$endif$-$if(babel-lang)$- $babel-lang$,-$endif$-$endif$ $for(classoption)$ $classoption$$sep$, $endfor$ ]{$documentclass$}-$if(beamer)$-$if(background-image)$-\usebackgroundtemplate{%- \includegraphics[width=\paperwidth]{$background-image$}%-}-% In beamer background-image does not work well when other images are used, so this is the workaround-\pgfdeclareimage[width=\paperwidth,height=\paperheight]{background}{$background-image$}-\usebackgroundtemplate{\pgfuseimage{background}}-$endif$-\usepackage{pgfpages}-\setbeamertemplate{caption}[numbered]-\setbeamertemplate{caption label separator}{: }-\setbeamercolor{caption name}{fg=normal text.fg}-\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$-$for(beameroption)$-\setbeameroption{$beameroption$}-$endfor$-% Prevent slide breaks in the middle of a paragraph-\widowpenalties 1 10000-\raggedbottom-$if(section-titles)$-\setbeamertemplate{part page}{- \centering- \begin{beamercolorbox}[sep=16pt,center]{part title}- \usebeamerfont{part title}\insertpart\par- \end{beamercolorbox}-}-\setbeamertemplate{section page}{- \centering- \begin{beamercolorbox}[sep=12pt,center]{section title}- \usebeamerfont{section title}\insertsection\par- \end{beamercolorbox}-}-\setbeamertemplate{subsection page}{- \centering- \begin{beamercolorbox}[sep=8pt,center]{subsection title}- \usebeamerfont{subsection title}\insertsubsection\par- \end{beamercolorbox}-}-\AtBeginPart{- \frame{\partpage}-}-\AtBeginSection{- \ifbibliography- \else- \frame{\sectionpage}- \fi-}-\AtBeginSubsection{- \frame{\subsectionpage}-}-$endif$-$endif$ $if(beamerarticle)$ \usepackage{beamerarticle} % needs to be loaded first $endif$-\usepackage{amsmath,amssymb}-$if(linestretch)$-\usepackage{setspace}-$endif$-\usepackage{iftex}-\ifPDFTeX- \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}- \usepackage[utf8]{inputenc}- \usepackage{textcomp} % provide euro and other symbols-\else % if luatex or xetex-$if(mathspec)$- \ifXeTeX- \usepackage{mathspec} % this also loads fontspec- \else- \usepackage{unicode-math} % this also loads fontspec- \fi-$else$- \usepackage{unicode-math} % this also loads fontspec-$endif$- \defaultfontfeatures{Scale=MatchLowercase}$-- must come before Beamer theme- \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}-\fi-$if(fontfamily)$-$else$-$-- Set default font before Beamer theme so the theme can override it-\usepackage{lmodern}-$endif$-$-- Set Beamer theme before user font settings so they can override theme-$if(beamer)$-$if(theme)$-\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}-$endif$-$if(colortheme)$-\usecolortheme{$colortheme$}-$endif$-$if(fonttheme)$-\usefonttheme{$fonttheme$}-$endif$-$if(mainfont)$-\usefonttheme{serif} % use mainfont rather than sansfont for slide text-$endif$-$if(innertheme)$-\useinnertheme{$innertheme$}-$endif$-$if(outertheme)$-\useoutertheme{$outertheme$}-$endif$-$endif$-$-- User font settings (must come after default font and Beamer theme)-$if(fontfamily)$-\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}-$endif$-\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$- \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$- \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$- \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$}-$endif$-$for(fontfamilies)$- \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}-$endfor$-$if(mathfont)$-$if(mathspec)$- \ifXeTeX- \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}- \else- \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}- \fi-$else$- \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}-$endif$-$endif$-$if(CJKmainfont)$- \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$- \fi-$endif$-$if(luatexjapresetoptions)$- \ifLuaTeX- \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}- \fi-$endif$-$if(CJKmainfont)$- \ifLuaTeX- \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}- \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}- \fi-$endif$-\fi-$if(zero-width-non-joiner)$-%% Support for zero-width non-joiner characters.-\makeatletter-\def\zerowidthnonjoiner{%- % Prevent ligatures and adjust kerning, but still support hyphenating.- \texorpdfstring{%- \TextOrMath{\nobreak\discretionary{-}{}{\kern.03em}%- \ifvmode\else\nobreak\hskip\z@skip\fi}{}%- }{}%-}-\makeatother-\ifPDFTeX- \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}-\else- \catcode`^^^^200c=\active- \protected\def ^^^^200c{\zerowidthnonjoiner}-\fi-%% End of ZWNJ support-$endif$-% Use upquote if available, for straight quotes in verbatim environments-\IfFileExists{upquote.sty}{\usepackage{upquote}}{}-\IfFileExists{microtype.sty}{% use microtype if available- \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}- \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts-}{}-$if(indent)$-$else$-\makeatletter-\@ifundefined{KOMAClassName}{% if non-KOMA class- \IfFileExists{parskip.sty}{%- \usepackage{parskip}- }{% else- \setlength{\parindent}{0pt}- \setlength{\parskip}{6pt plus 2pt minus 1pt}}-}{% if KOMA class- \KOMAoptions{parskip=half}}-\makeatother-$endif$-$if(verbatim-in-note)$-\usepackage{fancyvrb}-$endif$ \usepackage{xcolor} $if(geometry)$-$if(beamer)$-\geometry{$for(geometry)$$geometry$$sep$,$endfor$}-$else$ \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry} $endif$-$endif$-$if(beamer)$-\newif\ifbibliography-$endif$-$if(listings)$-\usepackage{listings}-\newcommand{\passthrough}[1]{#1}-\lstset{defaultdialect=[5.3]Lua}-\lstset{defaultdialect=[x86masm]Assembler}-$endif$-$if(lhs)$-\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}-$endif$-$if(highlighting-macros)$-$highlighting-macros$-$endif$-$if(tables)$-\usepackage{longtable,booktabs,array}-$if(multirow)$-\usepackage{multirow}-$endif$-\usepackage{calc} % for calculating minipage widths-$if(beamer)$-\usepackage{caption}-% Make caption package work with longtable-\makeatletter-\def\fnum@table{\tablename~\thetable}-\makeatother-$else$-% Correct order of tables after \paragraph or \subparagraph-\usepackage{etoolbox}-\makeatletter-\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}-\makeatother-% Allow footnotes in longtable head/foot-\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}-\makesavenoteenv{longtable}-$endif$-$endif$-$if(graphics)$-\usepackage{graphicx}-\makeatletter-\newsavebox\pandoc@box-\newcommand*\pandocbounded[1]{% scales image to fit in text height/width- \sbox\pandoc@box{#1}%- \Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%- \Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%- \ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both- \ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%- \else\usebox{\pandoc@box}%- \fi%-}-% Set default figure placement to htbp-\def\fps@figure{htbp}-\makeatother-$endif$-$if(svg)$-\usepackage{svg}-$endif$-$if(strikeout)$-$-- also used for underline-\ifLuaTeX- \usepackage{luacolor}- \usepackage[soul]{lua-ul}-\else- \usepackage{soul}-$if(beamer)$- \makeatletter- \let\HL\hl- \renewcommand\hl{% fix for beamer highlighting- \let\set@color\beamerorig@set@color- \let\reset@color\beamerorig@reset@color- \HL}- \makeatother-$endif$-$if(CJKmainfont)$- \ifXeTeX- % soul's \st doesn't work for CJK:- \usepackage{xeCJKfntef}- \renewcommand{\st}[1]{\sout{#1}}- \fi-$endif$-\fi-$endif$-\setlength{\emergencystretch}{3em} % prevent overfull lines-\providecommand{\tightlist}{%- \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}+\usepackage{amsmath,amssymb}+$--+$-- section numbering+$-- $if(numbersections)$ \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} $else$ \setcounter{secnumdepth}{-\maxdimen} % remove section numbering $endif$-$if(subfigure)$-\usepackage{subcaption}-$endif$-$if(beamer)$-$else$-$if(block-headings)$-% Make \paragraph and \subparagraph free-standing-\makeatletter-\ifx\paragraph\undefined\else- \let\oldparagraph\paragraph- \renewcommand{\paragraph}{- \@ifstar- \xxxParagraphStar- \xxxParagraphNoStar- }- \newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}- \newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}-\fi-\ifx\subparagraph\undefined\else- \let\oldsubparagraph\subparagraph- \renewcommand{\subparagraph}{- \@ifstar- \xxxSubParagraphStar- \xxxSubParagraphNoStar- }- \newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}- \newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}-\fi-\makeatother-$endif$-$endif$-$if(pagestyle)$-\pagestyle{$pagestyle$}-$endif$-$if(csl-refs)$-% definitions for citeproc citations-\NewDocumentCommand\citeproctext{}{}-\NewDocumentCommand\citeproc{mm}{%- \begingroup\def\citeproctext{#2}\cite{#1}\endgroup}-\makeatletter- % allow citations to break across lines- \let\@cite@ofmt\@firstofone- % avoid brackets around text for \cite:- \def\@biblabel#1{}- \def\@cite#1#2{{#1\if@tempswa , #2\fi}}-\makeatother-\newlength{\cslhangindent}-\setlength{\cslhangindent}{1.5em}-\newlength{\csllabelwidth}-\setlength{\csllabelwidth}{3em}-\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing- {\begin{list}{}{%- \setlength{\itemindent}{0pt}- \setlength{\leftmargin}{0pt}- \setlength{\parsep}{0pt}- % turn on hanging indent if param 1 is 1- \ifodd #1- \setlength{\leftmargin}{\cslhangindent}- \setlength{\itemindent}{-1\cslhangindent}- \fi- % set entry spacing- \setlength{\itemsep}{#2\baselineskip}}}- {\end{list}}-\usepackage{calc}-\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}-\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}-\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}-\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}-$endif$-$if(lang)$-\ifLuaTeX-\usepackage[bidi=basic]{babel}-\else-\usepackage[bidi=default]{babel}-\fi-$if(babel-lang)$-\babelprovide[main,import]{$babel-lang$}-$if(mainfont)$-\ifPDFTeX-\else-\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$$if(mainfontfallback)$,RawFeature={fallback=mainfontfallback}$endif$]{$mainfont$}-\fi-$endif$-$endif$-$for(babel-otherlangs)$-\babelprovide[import]{$babel-otherlangs$}-$endfor$-$for(babelfonts/pairs)$-\babelfont[$babelfonts.key$]{rm}{$babelfonts.value$}-$endfor$-% get rid of language-specific shorthands (see #6817):-\let\LanguageShortHands\languageshorthands-\def\languageshorthands#1{}-$if(selnolig-langs)$-\ifLuaTeX- \usepackage[$for(selnolig-langs)$$it$$sep$,$endfor$]{selnolig} % disable illegal ligatures-\fi-$endif$-$endif$+$fonts.latex()$+$common.latex()$ $for(header-includes)$ $header-includes$ $endfor$-$if(dir)$-\ifPDFTeX- \TeXXeTstate=1- \newcommand{\RL}[1]{\beginR #1\endR}- \newcommand{\LR}[1]{\beginL #1\endL}- \newenvironment{RTL}{\beginR}{\endR}- \newenvironment{LTR}{\beginL}{\endL}-\fi-$endif$-$if(natbib)$-\usepackage[$natbiboptions$]{natbib}-\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}-$endif$-$if(biblatex)$-\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}-$for(bibliography)$-\addbibresource{$bibliography$}-$endfor$-$endif$-$if(nocite-ids)$-\nocite{$for(nocite-ids)$$it$$sep$, $endfor$}-$endif$-$if(csquotes)$-\usepackage{csquotes}-$endif$-\usepackage{bookmark}-\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available-\urlstyle{$if(urlstyle)$$urlstyle$$else$same$endif$}-$if(links-as-notes)$-% Make links footnotes instead of hotlinks:-\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}-$endif$-$if(verbatim-in-note)$-\VerbatimFootnotes % allow verbatim text in footnotes-$endif$-\hypersetup{-$if(title-meta)$- pdftitle={$title-meta$},-$endif$-$if(author-meta)$- pdfauthor={$author-meta$},-$endif$-$if(lang)$- pdflang={$lang$},-$endif$-$if(subject)$- pdfsubject={$subject$},-$endif$-$if(keywords)$- pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},-$endif$-$if(colorlinks)$- colorlinks=true,- linkcolor={$if(linkcolor)$$linkcolor$$else$Maroon$endif$},- filecolor={$if(filecolor)$$filecolor$$else$Maroon$endif$},- citecolor={$if(citecolor)$$citecolor$$else$Blue$endif$},- urlcolor={$if(urlcolor)$$urlcolor$$else$Blue$endif$},-$else$-$if(boxlinks)$-$else$- hidelinks,-$endif$-$endif$- pdfcreator={LaTeX via pandoc}}+$after-header-includes.latex()$+$hypersetup.latex()$ $if(title)$ \title{$title$$if(thanks)$\thanks{$thanks$}$endif$} $endif$ $if(subtitle)$-$if(beamer)$-$else$ \usepackage{etoolbox} \makeatletter \providecommand{\subtitle}[1]{% add subtitle to \maketitle \apptocmd{\@title}{\par {\large #1 \par}}{}{} } \makeatother-$endif$ \subtitle{$subtitle$} $endif$ \author{$for(author)$$author$$sep$ \and $endfor$} \date{$date$}-$if(beamer)$-$if(institute)$-\institute{$for(institute)$$institute$$sep$ \and $endfor$}-$endif$-$if(titlegraphic)$-\titlegraphic{\includegraphics$if(titlegraphicoptions)$[$for(titlegraphicoptions)$$titlegraphicoptions$$sep$, $endfor$]$endif${$titlegraphic$}}-$endif$-$if(logo)$-\logo{\includegraphics{$logo$}}-$endif$-$endif$ \begin{document} $if(has-frontmatter)$ \frontmatter $endif$ $if(title)$-$if(beamer)$-\frame{\titlepage}-$else$ \maketitle-$endif$ $if(abstract)$ \begin{abstract} $abstract$@@ -573,15 +70,6 @@ $if(toc-title)$ \renewcommand*\contentsname{$toc-title$} $endif$-$if(beamer)$-\begin{frame}[allowframebreaks]-$if(toc-title)$- \frametitle{$toc-title$}-$endif$- \setcounter{tocdepth}{$toc-depth$}- \tableofcontents-\end{frame}-$else$ { $if(colorlinks)$ \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$$endif$}@@ -590,7 +78,6 @@ \tableofcontents } $endif$-$endif$ $if(lof)$ \listoffigures $endif$@@ -617,26 +104,12 @@ \renewcommand\refname{$biblio-title$} $endif$ $endif$-$if(beamer)$-\begin{frame}[allowframebreaks]{$biblio-title$}- \bibliographytrue-$endif$- \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}-$if(beamer)$-\end{frame}-$endif$+\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} $endif$ $endif$ $if(biblatex)$-$if(beamer)$-\begin{frame}[allowframebreaks]{$biblio-title$}- \bibliographytrue- \printbibliography[heading=none]-\end{frame}-$else$ \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$-$endif$ $endif$ $for(include-after)$
data/templates/default.openxml view
@@ -50,6 +50,12 @@ $if(toc)$ $toc$ $endif$+$if(lof)$+ $lof$+$endif$+$if(lot)$+ $lot$+$endif$ $body$ $for(include-after)$ $include-after$
+ data/templates/fonts.latex view
@@ -0,0 +1,126 @@+\usepackage{iftex}+\ifPDFTeX+ \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}+ \usepackage[utf8]{inputenc}+ \usepackage{textcomp} % provide euro and other symbols+\else % if luatex or xetex+$if(mathspec)$+ \ifXeTeX+ \usepackage{mathspec} % this also loads fontspec+ \else+ \usepackage{unicode-math} % this also loads fontspec+ \fi+$else$+ \usepackage{unicode-math} % this also loads fontspec+$endif$+ \defaultfontfeatures{Scale=MatchLowercase}$-- must come before Beamer theme+ \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}+\fi+$if(fontfamily)$+$else$+$-- Set default font before Beamer theme so the theme can override it+\usepackage{lmodern}+$endif$+$-- User font settings (must come after default font and Beamer theme)+$if(fontfamily)$+\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}+$endif$+\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$+ \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$+ \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$+ \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$if(monofontfallback)$,RawFeature={fallback=monofontfallback}$endif$]{$monofont$}+$endif$+$for(fontfamilies)$+ \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}+$endfor$+$if(mathfont)$+$if(mathspec)$+ \ifXeTeX+ \setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}+ \else+ \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}+ \fi+$else$+ \setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}+$endif$+$endif$+$if(CJKmainfont)$+ \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$+ \fi+$endif$+$if(luatexjapresetoptions)$+ \ifLuaTeX+ \usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}+ \fi+$endif$+$if(CJKmainfont)$+ \ifLuaTeX+ \usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}+ \setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}+ \fi+$endif$+\fi+$if(zero-width-non-joiner)$+%% Support for zero-width non-joiner characters.+\makeatletter+\def\zerowidthnonjoiner{%+ % Prevent ligatures and adjust kerning, but still support hyphenating.+ \texorpdfstring{%+ \TextOrMath{\nobreak\discretionary{-}{}{\kern.03em}%+ \ifvmode\else\nobreak\hskip\z@skip\fi}{}%+ }{}%+}+\makeatother+\ifPDFTeX+ \DeclareUnicodeCharacter{200C}{\zerowidthnonjoiner}+\else+ \catcode`^^^^200c=\active+ \protected\def ^^^^200c{\zerowidthnonjoiner}+\fi+%% End of ZWNJ support+$endif$+% Use upquote if available, for straight quotes in verbatim environments+\IfFileExists{upquote.sty}{\usepackage{upquote}}{}+\IfFileExists{microtype.sty}{% use microtype if available+ \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts+}{}+
+ data/templates/hypersetup.latex view
@@ -0,0 +1,30 @@+\hypersetup{+$if(title-meta)$+ pdftitle={$title-meta$},+$endif$+$if(author-meta)$+ pdfauthor={$author-meta$},+$endif$+$if(lang)$+ pdflang={$lang$},+$endif$+$if(subject)$+ pdfsubject={$subject$},+$endif$+$if(keywords)$+ pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},+$endif$+$if(colorlinks)$+ colorlinks=true,+ linkcolor={$if(linkcolor)$$linkcolor$$else$Maroon$endif$},+ filecolor={$if(filecolor)$$filecolor$$else$Maroon$endif$},+ citecolor={$if(citecolor)$$citecolor$$else$Blue$endif$},+ urlcolor={$if(urlcolor)$$urlcolor$$else$Blue$endif$},+$else$+$if(boxlinks)$+$else$+ hidelinks,+$endif$+$endif$+ pdfcreator={LaTeX via pandoc}}+
+ data/templates/passoptions.latex view
@@ -0,0 +1,9 @@+% Options for packages loaded elsewhere+\PassOptionsToPackage{unicode$for(hyperrefoptions)$,$hyperrefoptions$$endfor$}{hyperref}+\PassOptionsToPackage{hyphens}{url}+$if(colorlinks)$+\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}+$endif$+$if(CJKmainfont)$+\PassOptionsToPackage{space}{xeCJK}+$endif$
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-version: 3.4+version: 3.5 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md@@ -67,6 +67,7 @@ data/templates/default.openxml data/templates/default.icml data/templates/default.opml+ data/templates/default.beamer data/templates/default.latex data/templates/default.bibtex data/templates/default.biblatex@@ -103,6 +104,12 @@ data/templates/default.typst data/templates/definitions.typst data/templates/template.typst+ data/templates/common.latex+ data/templates/hypersetup.latex+ data/templates/passoptions.latex+ data/templates/fonts.latex+ data/templates/after-header-includes.latex+ -- translations data/translations/*.yaml -- entities@@ -472,7 +479,6 @@ build-depends: xml-light, Glob >= 0.7 && < 0.11, JuicyPixels >= 3.1.6.1 && < 3.4,- SHA >= 1.6 && < 1.7, aeson >= 2.0.1.0 && < 2.3, aeson-pretty >= 0.8.9 && < 0.9, array >= 0.5 && < 0.6,@@ -484,10 +490,11 @@ bytestring >= 0.9 && < 0.13, case-insensitive >= 1.2 && < 1.3, citeproc >= 0.8.1.1 && < 0.9,- commonmark >= 0.2.6 && < 0.3,+ commonmark >= 0.2.6.1 && < 0.3, commonmark-extensions >= 0.2.5.5 && < 0.3,- commonmark-pandoc >= 0.2.2.1 && < 0.3,+ commonmark-pandoc >= 0.2.2.2 && < 0.3, containers >= 0.6.0.1 && < 0.8,+ crypton >= 0.30 && < 1.1, crypton-connection >= 0.3.1 && < 0.5, data-default >= 0.4 && < 0.8, deepseq >= 1.3 && < 1.6,@@ -523,7 +530,7 @@ syb >= 0.1 && < 0.8, tagsoup >= 0.14.6 && < 0.15, temporary >= 1.1 && < 1.4,- texmath >= 0.12.8.10 && < 0.13,+ texmath >= 0.12.8.11 && < 0.13, text >= 1.1.1.0 && < 2.2, text-conversions >= 0.3 && < 0.4, time >= 1.5 && < 1.15,@@ -535,7 +542,7 @@ xml >= 1.3.12 && < 1.4, typst >= 0.6 && < 0.6.1, vector >= 0.12 && < 0.14,- djot >= 0.1.2.1 && < 0.2,+ djot >= 0.1.2.2 && < 0.2, tls >= 2.0.1 && < 2.2, crypton-x509-system >= 1.6.7 && < 1.7
src/Text/Pandoc/App/CommandLineOptions.hs view
@@ -410,6 +410,22 @@ "NUMBER") "" -- "Number of levels to include in TOC" + , Option "" ["lof", "list-of-figures"]+ (OptArg+ (\arg opt -> do+ boolValue <- readBoolFromOptArg "--lof/--list-of-figures" arg+ return opt { optListOfFigures = boolValue })+ "true|false")+ "" -- "Include list of figures"++ , Option "" ["lot", "list-of-tables"]+ (OptArg+ (\arg opt -> do+ boolValue <- readBoolFromOptArg "--lot/--list-of-tables" arg+ return opt { optListOfTables = boolValue })+ "true|false")+ "" -- "Include list of tables"+ , Option "N" ["number-sections"] (OptArg (\arg opt -> do
src/Text/Pandoc/App/Opt.hs view
@@ -107,6 +107,8 @@ , optFrom :: Maybe Text -- ^ Reader format , optTo :: Maybe Text -- ^ Writer format , optTableOfContents :: Bool -- ^ Include table of contents+ , optListOfFigures :: Bool -- ^ Include list of figures+ , optListOfTables :: Bool -- ^ Include list of tables , optShiftHeadingLevelBy :: Int -- ^ Shift heading level by , optTemplate :: Maybe FilePath -- ^ Custom template , optVariables :: Context Text -- ^ Template variables to set@@ -192,6 +194,8 @@ <*> o .:? "from" <*> o .:? "to" <*> o .:? "table-of-contents" .!= optTableOfContents defaultOpts+ <*> o .:? "list-of-figures" .!= optListOfFigures defaultOpts+ <*> o .:? "list-of-tables" .!= optListOfTables defaultOpts <*> o .:? "shift-heading-level-by" .!= optShiftHeadingLevelBy defaultOpts <*> o .:? "template" <*> o .:? "variables" .!= optVariables defaultOpts@@ -308,7 +312,9 @@ => Opt -> StateT DefaultsState m Opt resolveVarsInOpt opt@Opt- { optTemplate = oTemplate+ { optTo = oTo+ , optFrom = oFrom+ , optTemplate = oTemplate , optMetadataFiles = oMetadataFiles , optOutputFile = oOutputFile , optInputFiles = oInputFiles@@ -334,6 +340,8 @@ , optHighlightStyle = oHighlightStyle } = do+ oTo' <- mapM (fmap T.pack . resolveVars . T.unpack) oTo+ oFrom' <- mapM (fmap T.pack . resolveVars . T.unpack) oFrom oTemplate' <- mapM resolveVars oTemplate oMetadataFiles' <- mapM resolveVars oMetadataFiles oOutputFile' <- mapM resolveVars oOutputFile@@ -358,7 +366,9 @@ oCitationAbbreviations' <- mapM resolveVars oCitationAbbreviations oPdfEngine' <- mapM resolveVars oPdfEngine oHighlightStyle' <- mapM (fmap T.pack . resolveVars . T.unpack) oHighlightStyle- return opt{ optTemplate = oTemplate'+ return opt{ optTo = oTo'+ , optFrom = oFrom'+ , optTemplate = oTemplate' , optMetadataFiles = oMetadataFiles' , optOutputFile = oOutputFile' , optInputFiles = oInputFiles'@@ -474,6 +484,14 @@ parseJSON v >>= \x -> return (\o -> o{ optTableOfContents = x }) "toc" -> parseJSON v >>= \x -> return (\o -> o{ optTableOfContents = x })+ "list-of-figures" ->+ parseJSON v >>= \x -> return (\o -> o{ optListOfFigures = x })+ "lof" ->+ parseJSON v >>= \x -> return (\o -> o{ optListOfFigures = x })+ "list-of-tables" ->+ parseJSON v >>= \x -> return (\o -> o{ optListOfTables = x })+ "lot" ->+ parseJSON v >>= \x -> return (\o -> o{ optListOfTables = x }) "from" -> parseJSON v >>= \x -> return (\o -> o{ optFrom = x }) "reader" ->@@ -738,6 +756,8 @@ , optFrom = Nothing , optTo = Nothing , optTableOfContents = False+ , optListOfFigures = False+ , optListOfTables = False , optShiftHeadingLevelBy = 0 , optTemplate = Nothing , optVariables = mempty
src/Text/Pandoc/App/OutputSettings.hs view
@@ -229,6 +229,8 @@ , writerVariables = variables , writerTabStop = optTabStop opts , writerTableOfContents = optTableOfContents opts+ , writerListOfFigures = optListOfFigures opts+ , writerListOfTables = optListOfTables opts , writerHTMLMathMethod = optHTMLMathMethod opts , writerIncremental = optIncremental opts , writerCiteMethod = optCiteMethod opts
src/Text/Pandoc/Class/IO.hs view
@@ -37,7 +37,6 @@ import Control.Monad.Except (throwError) import Control.Monad.IO.Class (MonadIO, liftIO)-import Data.ByteString.Base64 (decodeLenient) import Data.ByteString.Lazy (toChunks) import Data.Text (Text, pack, unpack) import Data.Time (TimeZone, UTCTime)@@ -62,7 +61,7 @@ import System.Random (StdGen) import Text.Pandoc.Class.CommonState (CommonState (..)) import Text.Pandoc.Class.PandocMonad- (PandocMonad, getsCommonState, getMediaBag, report)+ (PandocMonad, getsCommonState, getMediaBag, report, extractURIData) import Text.Pandoc.Definition (Pandoc, Inline (Image)) import Text.Pandoc.Error (PandocError (..)) import Text.Pandoc.Logging (LogMessage (..), messageVerbosity, showLogMessage)@@ -128,14 +127,8 @@ openURL :: (PandocMonad m, MonadIO m) => Text -> m (B.ByteString, Maybe MimeType) openURL u | Just (URI{ uriScheme = "data:",- uriPath = upath }) <- parseURI (T.unpack u) = do- let (mimespec, rest) = break (== ',') $ unEscapeString upath- let contents = UTF8.fromString $ drop 1 rest- case break (== ';') (filter (/= ' ') mimespec) of- (mime, ";base64") ->- return (decodeLenient contents, Just (T.pack mime))- (mime, _) ->- return (contents, Just (T.pack mime))+ uriPath = upath }) <- parseURI (T.unpack u)+ = pure $ extractURIData upath | otherwise = do let toReqHeader (n, v) = (CI.mk (UTF8.fromText n), UTF8.fromText v) customHeaders <- map toReqHeader <$> getsCommonState stRequestHeaders
src/Text/Pandoc/Class/PandocMonad.hs view
@@ -40,6 +40,7 @@ , setUserDataDir , getUserDataDir , fetchItem+ , extractURIData , getInputFiles , setInputFiles , getOutputFile@@ -78,6 +79,8 @@ import Text.Pandoc.Shared (safeRead, makeCanonical, tshow) import Text.Pandoc.URI (uriPathToPath) import Text.Pandoc.Walk (walkM)+import qualified Text.Pandoc.UTF8 as UTF8+import Data.ByteString.Base64 (decodeLenient) import Text.Parsec (ParsecT, getPosition, sourceLine, sourceName) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL@@ -332,8 +335,7 @@ -> m (B.ByteString, Maybe MimeType) downloadOrRead s = do sourceURL <- getsCommonState stSourceURL- case (sourceURL >>= parseURIReference' .- ensureEscaped, ensureEscaped s) of+ case (sourceURL >>= parseURIReference' . ensureEscaped, ensureEscaped s) of (Just u, s') -> -- try fetching from relative path at source case parseURIReference' s' of Just u' -> openURL $ T.pack $ show $ u' `nonStrictRelativeTo` u@@ -345,8 +347,10 @@ Nothing -> openURL s' -- will throw error (Nothing, s') -> case parseURI (T.unpack s') of -- requires absolute URI- Just u' | uriScheme u' == "file:" ->- readLocalFile $ uriPathToPath (T.pack $ uriPath u')+ Just URI{ uriScheme = "file:", uriPath = upath}+ -> readLocalFile $ uriPathToPath (T.pack upath)+ Just URI{ uriScheme = "data:", uriPath = upath}+ -> pure $ extractURIData upath -- We don't want to treat C:/ as a scheme: Just u' | length (uriScheme u') > 2 -> openURL (T.pack $ show u') _ -> readLocalFile fp -- get from local file system@@ -371,6 +375,16 @@ ensureEscaped = T.pack . escapeURIString isAllowedInURI . T.unpack . T.map convertSlash convertSlash '\\' = '/' convertSlash x = x++-- Extract data from a data URI's path component.+extractURIData :: String -> (B.ByteString, Maybe MimeType)+extractURIData upath =+ case break (== ';') (filter (/= ' ') mimespec) of+ (mime', ";base64") -> (decodeLenient contents, Just (T.pack mime'))+ (mime', _) -> (contents, Just (T.pack mime'))+ where+ (mimespec, rest) = break (== ',') $ unEscapeString upath+ contents = UTF8.fromString $ drop 1 rest -- | Checks if the file path is relative to a parent directory. isRelativeToParentDir :: FilePath -> Bool
src/Text/Pandoc/Extensions.hs view
@@ -472,6 +472,7 @@ getDefaultExtensions "markua" = extensionsFromList [] getDefaultExtensions "typst" = extensionsFromList [Ext_citations]+getDefaultExtensions "dokuwiki" = extensionsFromList [Ext_smart] getDefaultExtensions _ = extensionsFromList [Ext_auto_identifiers] @@ -643,7 +644,9 @@ getAll "vimwiki" = autoIdExtensions getAll "dokuwiki" = autoIdExtensions <> extensionsFromList- [ Ext_tex_math_dollars ]+ [ Ext_tex_math_dollars+ , Ext_raw_html+ , Ext_smart ] getAll "tikiwiki" = autoIdExtensions getAll "rst" = autoIdExtensions <> extensionsFromList
src/Text/Pandoc/MediaBag.hs view
@@ -23,20 +23,19 @@ mediaDirectory, mediaItems ) where+import Crypto.Hash (hashWith, SHA1(SHA1)) import qualified Data.ByteString.Lazy as BL import Data.Data (Data) import qualified Data.Map as M import Data.Maybe (fromMaybe, isNothing) import Data.Typeable (Typeable)-import Network.URI (unEscapeString) import System.FilePath import qualified System.FilePath.Posix as Posix import qualified System.FilePath.Windows as Windows import Text.Pandoc.MIME (MimeType, getMimeTypeDef, extensionFromMimeType) import Data.Text (Text) import qualified Data.Text as T-import Data.Digest.Pure.SHA (sha1, showDigest)-import Network.URI (URI (..), parseURI, isURI)+import Network.URI (URI (..), isURI, parseURI, unEscapeString) import Data.List (isInfixOf) data MediaItem =@@ -92,7 +91,7 @@ && not (".." `isInfixOf` fp'') && '%' `notElem` fp'' then fp''- else showDigest (sha1 contents) <> ext+ else show (hashWith SHA1 $ BL.toStrict contents) <> ext fallback = case takeExtension fp'' of ".gz" -> getMimeTypeDef $ dropExtension fp'' _ -> getMimeTypeDef fp''
src/Text/Pandoc/Options.hs view
@@ -309,6 +309,8 @@ , writerVariables :: Context Text -- ^ Variables to set in template , writerTabStop :: Int -- ^ Tabstop for conversion btw spaces and tabs , writerTableOfContents :: Bool -- ^ Include table of contents+ , writerListOfFigures :: Bool -- ^ Include list of figures+ , writerListOfTables :: Bool -- ^ Include list of tables , writerIncremental :: Bool -- ^ True if lists should be incremental , writerHTMLMathMethod :: HTMLMathMethod -- ^ How to print math in HTML , writerNumberSections :: Bool -- ^ Number sections in LaTeX@@ -352,6 +354,8 @@ , writerVariables = mempty , writerTabStop = 4 , writerTableOfContents = False+ , writerListOfFigures = False+ , writerListOfTables = False , writerIncremental = False , writerHTMLMathMethod = PlainMath , writerNumberSections = False
src/Text/Pandoc/PDF.hs view
@@ -20,6 +20,7 @@ import qualified Control.Exception as E import Control.Monad.Trans (MonadIO (..)) import Control.Monad (foldM_)+import Crypto.Hash (hashWith, SHA1(SHA1)) import qualified Data.ByteString as BS import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as BL@@ -52,7 +53,6 @@ import Text.Pandoc.Walk (walkM) import Text.Pandoc.Writers.Shared (getField, metaToContext) import Control.Monad.Catch (MonadMask)-import Data.Digest.Pure.SHA (sha1, showDigest) #ifdef _WINDOWS import Data.List (intercalate) #endif@@ -236,7 +236,7 @@ E.catch (Right pngOut <$ JP.savePngImage pngOut img) $ \(e :: E.SomeException) -> return (Left (tshow e)) where- sha = showDigest (sha1 (UTF8.fromStringLazy fname))+ sha = show (hashWith SHA1 (UTF8.fromString fname)) pngOut = normalise $ tmpdir </> sha <.> "png" pdfOut = normalise $ tmpdir </> sha <.> "pdf" svgIn = normalise fname@@ -423,19 +423,19 @@ (handlePDFProgramNotFound program) report $ MakePDFInfo "LaTeX output" (UTF8.toText $ BL.toStrict out) -- parse log to see if we need to rerun LaTeX- let logFile = replaceExtension file ".log"+ let logFile = replaceExtension outfile ".log" logExists <- fileExists logFile logContents <- if logExists then BL.fromStrict <$> readFileStrict logFile else return mempty let rerunWarnings = checkForRerun logContents tocHash <- do- let tocFile = replaceExtension file ".toc"+ let tocFile = replaceExtension outfile ".toc" tocFileExists <- fileExists tocFile if tocFileExists then do- tocContents <- BL.fromStrict <$> readFileStrict tocFile- pure $ Just $! sha1 tocContents+ tocContents <- readFileStrict tocFile+ pure $ Just $! hashWith SHA1 tocContents else pure Nothing -- compare hash of toc to former hash to see if it changed (#9295) let rerunWarnings' = rerunWarnings ++
src/Text/Pandoc/Readers/DocBook.hs view
@@ -1022,6 +1022,11 @@ items' <- mapM getBlocks items return (mconcat $ intersperse (str "; ") terms', items') parseTable = do+ let elId = attrValue "id" e+ let attrs = case attrValue "tabstyle" e of+ "" -> []+ x -> [("custom-style", x)]+ let classes = T.words $ attrValue "class" e let isCaption x = named "title" x || named "caption" x capt <- case filterChild isCaption e of Just t -> getInlines t@@ -1075,7 +1080,8 @@ Nothing -> replicate numrows ColWidthDefault let toRow = Row nullAttr toHeaderRow l = [toRow l | not (null l)]- return $ table (simpleCaption $ plain capt)+ return $ tableWith (elId,classes,attrs)+ (simpleCaption $ plain capt) (zip aligns widths) (TableHead nullAttr $ toHeaderRow headrows) [TableBody nullAttr 0 [] $ map toRow bodyrows]
src/Text/Pandoc/Readers/Docx.hs view
@@ -669,6 +669,34 @@ | otherwise = c bodyPartToBlocks :: PandocMonad m => BodyPart -> DocxContext m Blocks+bodyPartToBlocks (Heading n style pPr numId lvl mblvlInfo parparts) = do+ ils <- local (\s-> s{docxInHeaderBlock=True})+ (smushInlines <$> mapM parPartToInlines parparts)+ let classes = map normalizeToClassName . delete style+ $ getStyleNames (pStyle pPr)+ hasNumbering <- gets docxNumberedHeadings+ let addNum = if hasNumbering && not (numbered pPr)+ then (++ ["unnumbered"])+ else id+ if T.null numId+ then pure ()+ else do+ -- We check whether this current numId has previously been used,+ -- since Docx expects us to pick up where we left off.+ listState <- gets docxListState+ let start = case M.lookup (numId, lvl) listState of+ Nothing -> case mblvlInfo of+ Nothing -> 1+ Just (Level _ _ _ z) -> fromMaybe 1 z+ Just z -> z + 1+ modify $ \st -> st{ docxListState =+ -- expire all the continuation data for lists of level > this one:+ -- a new level 1 list item resets continuation for level 2++ -- see #10258+ let notExpired (_, lvl') _ = lvl' <= lvl+ in M.insert (numId, lvl) start+ (M.filterWithKey notExpired listState) }+ makeHeaderAnchor $ headerWith ("", addNum classes, []) n ils bodyPartToBlocks (Paragraph pPr parparts) | Just True <- pBidi pPr = do let pPr' = pPr { pBidi = Nothing }@@ -681,18 +709,6 @@ codeBlock $ T.concat $ map parPartToText parparts- | Just (style, n) <- pHeading pPr = do- ils <- local (\s-> s{docxInHeaderBlock=True})- (smushInlines <$> mapM parPartToInlines parparts)- let classes = map normalizeToClassName . delete style- $ getStyleNames (pStyle pPr)-- hasNumbering <- gets docxNumberedHeadings- let addNum = if hasNumbering && not (numbered pPr)- then (++ ["unnumbered"])- else id- makeHeaderAnchor $- headerWith ("", addNum classes, []) n ils | otherwise = do ils <- trimSps . smushInlines <$> mapM parPartToInlines parparts prevParaIls <- gets docxPrevPara
src/Text/Pandoc/Readers/Docx/Parse.hs view
@@ -283,6 +283,8 @@ data BodyPart = Paragraph ParagraphStyle [ParPart]+ | Heading Int ParaStyleName ParagraphStyle T.Text T.Text (Maybe Level)+ [ParPart] | ListItem ParagraphStyle T.Text T.Text (Maybe Level) [ParPart] | Tbl T.Text TblGrid TblLook [Row] | Captioned ParagraphStyle [ParPart] BodyPart@@ -791,13 +793,15 @@ elemToBodyPart ns element | isElem ns "w" "p" element , Just (numId, lvl) <- getNumInfo ns element = do+ lvlInfo <- lookupLevel numId lvl <$> asks envNumbering parstyle <- elemToParagraphStyle ns element <$> asks envParStyles <*> asks envNumbering parparts <- mconcat <$> mapD (elemToParPart ns) (elChildren element) case pHeading parstyle of Nothing -> mkListItem parstyle numId lvl parparts- Just _ -> return $ Paragraph parstyle parparts+ Just (parstylename, lev)+ -> return $ Heading lev parstylename parstyle numId lvl lvlInfo parparts elemToBodyPart ns element | isElem ns "w" "p" element , [Elem ppr] <- elContent element@@ -836,8 +840,11 @@ case pHeading parstyle of Nothing | Just (numId, lvl) <- pNumInfo parstyle -> do mkListItem parstyle numId lvl parparts- _ -> return $ Paragraph parstyle parparts-+ Just (parstylename, lev) -> do+ let (numId, lvl) = fromMaybe ("","") $ pNumInfo parstyle+ lvlInfo <- lookupLevel numId lvl <$> asks envNumbering+ return $ Heading lev parstylename parstyle numId lvl lvlInfo parparts+ Nothing -> return $ Paragraph parstyle parparts elemToBodyPart ns element | isElem ns "w" "tbl" element = do let tblProperties = findChildByName ns "w" "tblPr" element
src/Text/Pandoc/Readers/DokuWiki.hs view
@@ -29,7 +29,7 @@ import Text.Pandoc.Options import Text.Pandoc.Parsing hiding (enclosed) import Text.Pandoc.Shared (trim, stringify, tshow)-import Data.List (isPrefixOf, isSuffixOf)+import Data.List (isPrefixOf, isSuffixOf, groupBy) import qualified Safe -- | Read DokuWiki from an input string and return a Pandoc document.@@ -111,6 +111,7 @@ <|> autoEmail <|> notoc <|> nocache+ <|> smartPunctuation inline <|> str <|> symbol <?> "inline"@@ -443,7 +444,9 @@ many1 ((<>) <$> item <*> fmap mconcat (many continuation)) where continuation = try $ list (" " <> prefix)- item = try $ textStr prefix *> char marker *> char ' ' *>+ item = try $ textStr prefix *>+ optional (char ' ') *> -- see #8863+ char marker *> char ' ' *> (mconcat <$> many1 itemContents <* eol) itemContents = (B.plain . mconcat <$> many1 inline') <|> blockCode@@ -453,15 +456,37 @@ where indentedLine = try $ string " " *> manyTillChar anyChar eol +-- Note that block quotes in dokuwiki parse as lists of hard-break+-- separated lines; see #6461. quote :: PandocMonad m => DWParser m B.Blocks-quote = try $ nestedQuote 0- where- prefix level = count level (char '>')- contents level = nestedQuote level <|> quoteLine- quoteLine = try $ B.plain . B.trimInlines . mconcat <$> many1Till inline' eol- quoteContents level = (<>) <$> contents level <*> quoteContinuation level- quoteContinuation level = mconcat <$> many (try $ prefix level *> contents level)- nestedQuote level = B.blockQuote <$ char '>' <*> quoteContents (level + 1 :: Int)+quote = go <$> many1 blockQuoteLine+ where+ blockQuoteLine = try $ do+ lev <- length <$> many1 (char '>')+ skipMany spaceChar+ contents <- (blockCode <* skipMany spaceChar <* optional eol) <|>+ (B.plain . B.trimInlines . mconcat <$> many1Till inline' eol)+ pure (lev, contents)+ go [] = mempty+ go xs = mconcat $ map go' (groupBy (\(x,_) (y,_) -> (x == 0 && y == 0) ||+ (x > 0 && y > 0)) xs)+ go' [] = mempty+ go' xs@((0,_):_) =+ let (lns, bls) = F.foldl' consolidatePlains (mempty,mempty) (map snd xs)+ in bls <> if lns == mempty+ then mempty+ else B.plain lns+ go' xs = B.blockQuote (go $ map (\(x,y) -> (x - 1, y)) xs)+ consolidatePlains (lns, bls) b =+ case B.toList b of+ [Plain ils] -> ((if lns == mempty+ then B.fromList ils+ else lns <> B.linebreak <> B.fromList ils), bls)+ _ -> (mempty, bls <>+ (if lns == lns+ then mempty+ else B.plain lns)+ <> b) blockRaw :: PandocMonad m => DWParser m B.Blocks blockRaw = try $ do
src/Text/Pandoc/Readers/EPUB.hs view
@@ -29,7 +29,7 @@ import Data.Maybe (mapMaybe) import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TL-import Network.URI (unEscapeString)+import Network.URI (unEscapeString, parseRelativeReference, URI(..)) import System.FilePath (dropFileName, dropFileName, normalise, splitFileName, takeFileName, (</>)) import qualified Text.Pandoc.Builder as B@@ -211,10 +211,17 @@ Span (fixAttrs s as) v fixInlineIRs s (Code as code) = Code (fixAttrs s as) code-fixInlineIRs s (Link as is (T.uncons -> Just ('#', url), tit)) =- Link (fixAttrs s as) is (addHash s url, tit)-fixInlineIRs s (Link as is t) =- Link (fixAttrs s as) is t+fixInlineIRs s (Link as is (url, tit)) =+ case parseRelativeReference (T.unpack url) of+ Just URI{ uriScheme = ""+ , uriAuthority = Nothing+ , uriPath = upath+ , uriQuery = ""+ , uriFragment = '#':ufrag } ->+ Link (fixAttrs s as) is (addHash (if null upath+ then s+ else upath) (T.pack ufrag), tit)+ _ -> Link (fixAttrs s as) is (url, tit) fixInlineIRs _ v = v prependHash :: [Text] -> Inline -> Inline
src/Text/Pandoc/Readers/Ipynb.hs view
@@ -15,9 +15,9 @@ -} module Text.Pandoc.Readers.Ipynb ( readIpynb ) where+import Crypto.Hash (hashWith, SHA1(SHA1)) import Data.Char (isDigit) import Data.Maybe (fromMaybe)-import Data.Digest.Pure.SHA (sha1, showDigest) import Text.Pandoc.Options import Control.Applicative ((<|>)) import qualified Data.Scientific as Scientific@@ -186,16 +186,16 @@ Error _ -> mempty _ -> mempty let metaPairs = jsonMetaToPairs meta- let bl = case d of- BinaryData bs -> BL.fromStrict bs- TextualData t -> BL.fromStrict $ UTF8.fromText t- JsonData v -> encode v+ let bs = case d of+ BinaryData bs' -> bs'+ TextualData t -> UTF8.fromText t+ JsonData v -> BL.toStrict $ encode v -- SHA1 hash for filename- let fname = T.pack (showDigest (sha1 bl)) <>+ let fname = T.pack (show (hashWith SHA1 bs)) <> case extensionFromMimeType mt of Nothing -> "" Just ext -> "." <> ext- insertMedia (T.unpack fname) (Just mt) bl+ insertMedia (T.unpack fname) (Just mt) (BL.fromStrict bs) return $ B.para $ B.imageWith ("",[],metaPairs) fname "" mempty dataBlock ("text/html", TextualData t)
src/Text/Pandoc/Readers/LaTeX/Parsing.hs view
@@ -898,7 +898,11 @@ let s = s1 <> s2 let (num, rest) = T.span (\c -> isDigit c || c == '.') s guard $ T.length num > 0- guard $ rest `elem` ["", "pt","pc","in","bp","cm","mm","dd","cc","sp"]+ guard $ rest `elem`+ ["", "pt","pc","in","bp","cm","mm","dd","cc","sp","ex","em",+ "mu", -- "mu" in math mode only+ "px" -- "px" with pdftex and luatex only+ ] return $ T.pack ['=' | ch] <> minus <> s ignore :: (Monoid a, PandocMonad m) => Text -> ParsecT s u m a
src/Text/Pandoc/Readers/RTF.hs view
@@ -19,6 +19,7 @@ import qualified Data.Sequence as Seq import Control.Monad import Control.Monad.Except (throwError)+import Crypto.Hash (hashWith, SHA1(SHA1)) import Data.List (find, foldl') import Data.Word (Word8, Word16) import Data.Default@@ -35,7 +36,6 @@ import Text.Pandoc.Shared (tshow) import Data.Char (isAlphaNum, chr, isAscii, isLetter, isSpace, ord) import qualified Data.ByteString.Lazy as BL-import Data.Digest.Pure.SHA (sha1, showDigest) import Data.Maybe (mapMaybe, fromMaybe) import Safe (lastMay, initSafe, headDef) -- import Debug.Trace@@ -920,7 +920,7 @@ Nothing -> (Nothing, "") case mimetype of Just mt -> do- let pictname = showDigest (sha1 bytes) <> ext+ let pictname = show (hashWith SHA1 $ BL.toStrict bytes) <> ext insertMedia pictname (Just mt) bytes modifyGroup $ \g -> g{ gImage = Just pict{ picName = T.pack pictname, picBytes = bytes } }
src/Text/Pandoc/SelfContained.hs view
@@ -24,7 +24,7 @@ import qualified Data.ByteString.Lazy as L import qualified Data.Text as T import Data.Char (isAlphaNum, isAscii)-import Data.Digest.Pure.SHA (sha1, showDigest)+import Crypto.Hash (hashWith, SHA1(SHA1)) import Network.URI (escapeURIString) import System.FilePath (takeDirectory, takeExtension, (</>)) import Text.HTML.TagSoup@@ -127,7 +127,8 @@ (("href",dataUri) : [(x,y) | (x,y) <- as, x /= "href"]) : rest Fetched (mime, bs)- | "text/css" `T.isPrefixOf` mime+ | ("text/css" `T.isPrefixOf` mime ||+ fromAttrib "rel" t == "stylesheet") && T.null (fromAttrib "media" t) && not ("</" `B.isInfixOf` bs) -> do rest <- convertTags $@@ -216,8 +217,7 @@ Fetched ("image/svg+xml", bs) | inlineSvgs -> do -- we filter CR in the hash to ensure that Windows -- and non-Windows tests agree:- let hash = T.pack $ take 20 $ showDigest $- sha1 $ L.fromStrict+ let hash = T.pack $ take 20 $ show $ hashWith SHA1 $ B.filter (/='\r') bs return $ Left (hash, getSvgTags (toText bs)) Fetched (mt,bs) -> return $ Right (x, makeDataURI (mt,bs))
@@ -298,7 +298,7 @@ :: forall b . HasAttributes (Cm () b) => [(T.Text, T.Text)] -> b -> b addPandocAttributes [] bs = bs addPandocAttributes kvs bs =- unCm . addAttributes (("wrapper","1"):kvs) $ (Cm bs :: Cm () b)+ unCm . addAttributes kvs $ (Cm bs :: Cm () b) -- | Generate infinite lazy list of markers for an ordered list, -- depending on list attributes.
src/Text/Pandoc/Templates.hs view
@@ -112,7 +112,6 @@ "html" -> getDefaultTemplate "html5" "docbook" -> getDefaultTemplate "docbook5" "epub" -> getDefaultTemplate "epub3"- "beamer" -> getDefaultTemplate "latex" "jats" -> getDefaultTemplate "jats_archiving" "markdown_strict" -> getDefaultTemplate "markdown" "multimarkdown" -> getDefaultTemplate "markdown"
src/Text/Pandoc/Writers/ANSI.hs view
@@ -296,7 +296,7 @@ Nothing -> inlineListToANSI opts lst >>= return . D.parens inlineToANSI opts (Subscript lst) = do- case traverse toSuperscriptInline lst of+ case traverse toSubscriptInline lst of Just xs -> inlineListToANSI opts xs Nothing -> inlineListToANSI opts lst >>= return . D.parens
src/Text/Pandoc/Writers/ConTeXt.hs view
@@ -104,6 +104,8 @@ mblang <- fromBCP47 (getLang options meta) st <- get let context = defField "toc" (writerTableOfContents options)+ $ defField "lof" (writerListOfFigures options)+ $ defField "lot" (writerListOfTables options) $ defField "placelist" (mconcat . intersperse ("," :: Doc Text) $ take (writerTOCDepth options +
src/Text/Pandoc/Writers/Docx/OpenXML.hs view
@@ -23,6 +23,7 @@ import Control.Monad (when, unless) import Control.Applicative ((<|>)) import Control.Monad.Except (catchError)+import Crypto.Hash (hashWith, SHA1(SHA1)) import qualified Data.ByteString.Lazy as BL import Data.Char (isLetter, isSpace) import Text.Pandoc.Char (isCJK)@@ -35,8 +36,6 @@ import qualified Data.Set as Set import qualified Data.Text as T import Data.Text (Text)-import qualified Data.Text.Lazy as TL-import Data.Digest.Pure.SHA (sha1, showDigest) import Skylighting import Text.DocLayout (hcat, vcat, literal, render) import Text.Pandoc.Class (PandocMonad, report, getMediaBag)@@ -44,7 +43,8 @@ import Text.Pandoc.MediaBag (lookupMedia, MediaItem(..)) import qualified Text.Pandoc.Translations as Term import qualified Text.Pandoc.Class.PandocMonad as P-import Text.Pandoc.UTF8 (fromTextLazy)+import qualified Text.Pandoc.Builder as B+import Text.Pandoc.UTF8 (fromText) import Text.Pandoc.Definition import Text.Pandoc.Highlighting (highlight) import Text.Pandoc.Templates (compileDefaultTemplate, renderTemplate)@@ -170,6 +170,56 @@ ]) ]] -- w:sdt +makeLOF :: (PandocMonad m) => WriterOptions -> WS m [Element]+makeLOF opts = do+ let lofCmd = "TOC \\h \\z \\t \"Image Caption\" \\c" :: Text+ lofTitle <- B.toList <$> B.text <$> translateTerm Term.ListOfFigures+ title <- withParaPropM (pStyleM "TOC Heading") (blocksToOpenXML opts [Para lofTitle])+ return+ [mknode "w:sdt" [] [+ mknode "w:sdtPr" [] (+ mknode "w:docPartObj" []+ [mknode "w:docPartGallery" [("w:val","List of Figures")] (),+ mknode "w:docPartUnique" [] ()]+ -- w:docPartObj+ ), -- w:sdtPr+ mknode "w:sdtContent" [] (title ++ [ Elem $+ mknode "w:p" [] (+ mknode "w:r" [] [+ mknode "w:fldChar" [("w:fldCharType","begin"),("w:dirty","true")] (),+ mknode "w:instrText" [("xml:space","preserve")] lofCmd,+ mknode "w:fldChar" [("w:fldCharType","separate")] (),+ mknode "w:fldChar" [("w:fldCharType","end")] ()+ ] -- w:r+ ) -- w:p+ ]) -- w:sdtContent+ ]] -- w:sdt++makeLOT :: (PandocMonad m) => WriterOptions -> WS m [Element]+makeLOT opts = do+ let lotCmd = "TOC \\h \\z \\t \"Table Caption\" \\c" :: Text+ lotTitle <- B.toList <$> B.text <$> translateTerm Term.ListOfTables+ title <- withParaPropM (pStyleM "TOC Heading") (blocksToOpenXML opts [Para lotTitle])+ return+ [mknode "w:sdt" [] [+ mknode "w:sdtPr" [] (+ mknode "w:docPartObj" []+ [mknode "w:docPartGallery" [("w:val","List of Tables")] (),+ mknode "w:docPartUnique" [] ()]+ -- w:docPartObj+ ), -- w:sdtPr+ mknode "w:sdtContent" [] (title ++ [ Elem $+ mknode "w:p" [] (+ mknode "w:r" [] [+ mknode "w:fldChar" [("w:fldCharType","begin"),("w:dirty","true")] (),+ mknode "w:instrText" [("xml:space","preserve")] lotCmd,+ mknode "w:fldChar" [("w:fldCharType","separate")] (),+ mknode "w:fldChar" [("w:fldCharType","end")] ()+ ] -- w:r+ ) -- w:p+ ]) -- w:sdtContent+ ]] -- w:sdt+ -- | Convert Pandoc document to rendered document contents plus two lists of -- OpenXML elements (footnotes and comments). writeOpenXML :: PandocMonad m@@ -178,6 +228,8 @@ writeOpenXML opts (Pandoc meta blocks) = do setupTranslations meta let includeTOC = writerTableOfContents opts || lookupMetaBool "toc" meta+ let includeLOF = writerListOfFigures opts || lookupMetaBool "lof" meta+ let includeLOT = writerListOfTables opts || lookupMetaBool "lot" meta abstractTitle <- case lookupMeta "abstract-title" meta of Just (MetaBlocks bs) -> pure $ stringify bs Just (MetaInlines ils) -> pure $ stringify ils@@ -224,6 +276,12 @@ toc <- if includeTOC then makeTOC opts else return []+ lof <- if includeLOF+ then makeLOF opts+ else return []+ lot <- if includeLOT+ then makeLOT opts+ else return [] metadata <- metaToContext opts (fmap (vcat . map (literal . showContent)) . blocksToOpenXML opts) (fmap (hcat . map (literal . showContent)) . inlinesToOpenXML opts)@@ -231,6 +289,10 @@ let context = resetField "body" body . resetField "toc" (vcat (map (literal . showElement) toc))+ . resetField "lof"+ (vcat (map (literal . showElement) lof))+ . resetField "lot"+ (vcat (map (literal . showElement) lot)) . resetField "title" title . resetField "subtitle" subtitle . resetField "author" author@@ -1019,7 +1081,7 @@ | Just (c, _) <- T.uncons s , isLetter c , T.length s <= 40 = s- | otherwise = T.pack $ 'X' : drop 1 (showDigest (sha1 (fromTextLazy $ TL.fromStrict s)))+ | otherwise = T.pack $ 'X' : drop 1 (show (hashWith SHA1 (fromText s))) maxListLevel :: Int maxListLevel = 8
src/Text/Pandoc/Writers/DokuWiki.hs view
@@ -14,7 +14,7 @@ -} {-- [ ] Implement nested blockquotes (currently only ever does one level)+ [x] Implement nested blockquotes (currently only ever does one level) [x] Implement alignment of text in tables [ ] Implement comments [ ] Work through the Dokuwiki spec, and check I've not missed anything out@@ -32,12 +32,12 @@ import qualified Data.Text as T import Text.Pandoc.Class.PandocMonad (PandocMonad, report) import Text.Pandoc.Definition+import Text.Pandoc.Extensions import Text.Pandoc.ImageSize import Text.Pandoc.Logging import Text.Pandoc.Options (WrapOption (..), WriterOptions (writerTableOfContents,- writerTemplate, writerWrapText))-import Text.Pandoc.Shared (camelCaseToHyphenated, figureDiv, linesToPara,- removeFormatting, trimr, tshow)+ writerTemplate, writerWrapText), isEnabled)+import Text.Pandoc.Shared (figureDiv, linesToPara, removeFormatting, trimr) import Text.Pandoc.URI (escapeURI, isURI) import Text.Pandoc.Templates (renderTemplate) import Text.DocLayout (render, literal)@@ -50,8 +50,8 @@ data WriterEnvironment = WriterEnvironment { stIndent :: Text -- Indent after the marker at the beginning of list items- , stUseTags :: Bool -- True if we should use HTML tags because we're in a complex list , stBackSlashLB :: Bool -- True if we should produce formatted strings with newlines (as in a table cell)+ , stBlockQuoteLevel :: Int -- Block quote level } instance Default WriterState where@@ -59,8 +59,8 @@ instance Default WriterEnvironment where def = WriterEnvironment { stIndent = ""- , stUseTags = False- , stBackSlashLB = False }+ , stBackSlashLB = False+ , stBlockQuoteLevel = 0 } type DokuWiki m = ReaderT WriterEnvironment (StateT WriterState m) @@ -109,21 +109,23 @@ inlineListToDokuWiki opts inlines blockToDokuWiki opts (Para inlines) = do+ bqLevel <- asks stBlockQuoteLevel+ let bqPrefix = case bqLevel of+ 0 -> ""+ n -> T.replicate n ">" <> " " indent <- asks stIndent- useTags <- asks stUseTags contents <- inlineListToDokuWiki opts inlines- return $ if useTags- then "<HTML><p></HTML>" <> contents <> "<HTML></p></HTML>"- else contents <> if T.null indent then "\n" else ""+ return $ bqPrefix <> contents <> if T.null indent then "\n" else "" blockToDokuWiki opts (LineBlock lns) = blockToDokuWiki opts $ linesToPara lns -blockToDokuWiki _ b@(RawBlock f str)+blockToDokuWiki opts b@(RawBlock f str) | f == Format "dokuwiki" = return str -- See https://www.dokuwiki.org/wiki:syntax -- use uppercase HTML tag for block-level content:- | f == Format "html" = return $ "<HTML>\n" <> str <> "\n</HTML>"+ | f == Format "html"+ , isEnabled Ext_raw_html opts = return $ "<HTML>\n" <> str <> "\n</HTML>" | otherwise = "" <$ report (BlockNotRendered b) @@ -136,19 +138,22 @@ let eqs = T.replicate ( 7 - level ) "=" return $ eqs <> " " <> contents <> " " <> eqs <> "\n" -blockToDokuWiki _ (CodeBlock (_,classes,_) str) =- return $ "<code" <>+blockToDokuWiki _ (CodeBlock (_,classes,_) str) = do+ bqLevel <- asks stBlockQuoteLevel+ let bqPrefix = case bqLevel of+ 0 -> ""+ n -> T.replicate n ">" <> " "+ return $ bqPrefix <>+ "<code" <> (case classes of [] -> "" (x:_) -> " " <> fromMaybe x (M.lookup x languageNames)) <> ">\n" <> str <> (if "\n" `T.isSuffixOf` str then "" else "\n") <> "</code>\n" -blockToDokuWiki opts (BlockQuote blocks) = do- contents <- blockListToDokuWiki opts blocks- if isSimpleBlockQuote blocks- then return $ T.unlines $ map ("> " <>) $ T.lines contents- else return $ "<HTML><blockquote>\n" <> contents <> "</blockquote></HTML>"+blockToDokuWiki opts (BlockQuote blocks) =+ local (\st -> st{ stBlockQuoteLevel = stBlockQuoteLevel st + 1 })+ (blockListToDokuWiki opts blocks) blockToDokuWiki opts (Table _ blkCapt specs thead tbody tfoot) = do let (capt, aligns, _, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot@@ -179,37 +184,21 @@ (if null headers' then "" else renderRow "^" headers' <> "\n") <> T.unlines (map (renderRow "|") rows') -blockToDokuWiki opts x@(BulletList items) = do- oldUseTags <- asks stUseTags+blockToDokuWiki opts (BulletList items) = do indent <- asks stIndent backSlash <- asks stBackSlashLB- let useTags = oldUseTags || not (isSimpleList x)- if useTags- then do- contents <- local (\s -> s { stUseTags = True })- (mapM (listItemToDokuWiki opts) items)- return $ "<HTML><ul></HTML>\n" <> vcat contents <> "<HTML></ul></HTML>\n"- else do- contents <- local (\s -> s { stIndent = stIndent s <> " "- , stBackSlashLB = backSlash})+ contents <- local (\s -> s { stIndent = stIndent s <> " "+ , stBackSlashLB = backSlash}) (mapM (listItemToDokuWiki opts) items)- return $ vcat contents <> if T.null indent then "\n" else ""+ return $ vcat contents <> if T.null indent then "\n" else "" -blockToDokuWiki opts x@(OrderedList attribs items) = do- oldUseTags <- asks stUseTags+blockToDokuWiki opts (OrderedList _attribs items) = do indent <- asks stIndent backSlash <- asks stBackSlashLB- let useTags = oldUseTags || not (isSimpleList x)- if useTags- then do- contents <- local (\s -> s { stUseTags = True })- (mapM (orderedListItemToDokuWiki opts) items)- return $ "<HTML><ol" <> listAttribsToString attribs <> "></HTML>\n" <> vcat contents <> "<HTML></ol></HTML>\n"- else do- contents <- local (\s -> s { stIndent = stIndent s <> " "- , stBackSlashLB = backSlash})- (mapM (orderedListItemToDokuWiki opts) items)- return $ vcat contents <> if T.null indent then "\n" else ""+ contents <- local (\s -> s { stIndent = stIndent s <> " "+ , stBackSlashLB = backSlash})+ (mapM (orderedListItemToDokuWiki opts) items)+ return $ vcat contents <> if T.null indent then "\n" else "" blockToDokuWiki opts (Figure attr capt body) = blockToDokuWiki opts $ figureDiv attr capt body@@ -217,67 +206,55 @@ -- TODO Need to decide how to make definition lists work on dokuwiki - I don't think there -- is a specific representation of them. -- TODO This creates double '; ; ' if there is a bullet or ordered list inside a definition list-blockToDokuWiki opts x@(DefinitionList items) = do- oldUseTags <- asks stUseTags+blockToDokuWiki opts (DefinitionList items) = do indent <- asks stIndent backSlash <- asks stBackSlashLB- let useTags = oldUseTags || not (isSimpleList x)- if useTags- then do- contents <- local (\s -> s { stUseTags = True })- (mapM (definitionListItemToDokuWiki opts) items)- return $ "<HTML><dl></HTML>\n" <> vcat contents <> "<HTML></dl></HTML>\n"- else do- contents <- local (\s -> s { stIndent = stIndent s <> " "- , stBackSlashLB = backSlash})- (mapM (definitionListItemToDokuWiki opts) items)- return $ vcat contents <> if T.null indent then "\n" else ""+ contents <- local (\s -> s { stIndent = stIndent s <> " "+ , stBackSlashLB = backSlash})+ (mapM (definitionListItemToDokuWiki opts) items)+ return $ vcat contents <> if T.null indent then "\n" else "" -- Auxiliary functions for lists: --- | Convert ordered list attributes to HTML attribute string-listAttribsToString :: ListAttributes -> Text-listAttribsToString (startnum, numstyle, _) =- let numstyle' = camelCaseToHyphenated $ tshow numstyle- in (if startnum /= 1- then " start=\"" <> tshow startnum <> "\""- else "") <>- (if numstyle /= DefaultStyle- then " style=\"list-style-type: " <> numstyle' <> ";\""- else "")- -- | Convert bullet list item (list of blocks) to DokuWiki. listItemToDokuWiki :: PandocMonad m => WriterOptions -> [Block] -> DokuWiki m Text listItemToDokuWiki opts items = do- useTags <- asks stUseTags- if useTags- then do- contents <- blockListToDokuWiki opts items- return $ "<HTML><li></HTML>" <> contents <> "<HTML></li></HTML>"- else do- bs <- mapM (blockToDokuWiki opts) items- let contents = case items of- [_, CodeBlock _ _] -> T.concat bs- _ -> vcat bs- indent <- asks stIndent- backSlash <- asks stBackSlashLB- let indent' = if backSlash then T.drop 2 indent else indent- return $ indent' <> "* " <> contents+ bqLevel <- asks stBlockQuoteLevel+ let bqPrefix = case bqLevel of+ 0 -> ""+ n -> T.replicate n ">" <> " "+ let useWrap = not (isSimpleListItem items)+ bs <- mapM (blockToDokuWiki opts) items+ let contents = case items of+ [_, CodeBlock _ _] -> T.concat bs+ _ -> vcat bs+ indent <- asks stIndent+ backSlash <- asks stBackSlashLB+ let indent' = if backSlash then T.drop 2 indent else indent+ return $ bqPrefix <> indent' <> "* " <>+ if useWrap+ then "<WRAP>\n" <> contents <> "\n</WRAP>"+ else contents -- | Convert ordered list item (list of blocks) to DokuWiki. -- | TODO Emiminate dreadful duplication of text from listItemToDokuWiki orderedListItemToDokuWiki :: PandocMonad m => WriterOptions -> [Block] -> DokuWiki m Text orderedListItemToDokuWiki opts items = do- contents <- blockListToDokuWiki opts items- useTags <- asks stUseTags- if useTags- then return $ "<HTML><li></HTML>" <> contents <> "<HTML></li></HTML>"- else do- indent <- asks stIndent- backSlash <- asks stBackSlashLB- let indent' = if backSlash then T.drop 2 indent else indent- return $ indent' <> "- " <> contents+ bqLevel <- asks stBlockQuoteLevel+ let bqPrefix = case bqLevel of+ 0 -> ""+ n -> T.replicate n ">" <> " "+ let useWrap = not (isSimpleListItem items)+ contents <- local (\st -> st{ stBlockQuoteLevel = 0 })+ (blockListToDokuWiki opts items)+ indent <- asks stIndent+ backSlash <- asks stBackSlashLB+ let indent' = if backSlash then T.drop 2 indent else indent+ return $ bqPrefix <> indent' <> "- " <>+ if useWrap+ then "<WRAP>\n" <> contents <> "\n</WRAP>"+ else contents -- | Convert definition list item (label, list of blocks) to DokuWiki. definitionListItemToDokuWiki :: PandocMonad m@@ -285,29 +262,24 @@ -> ([Inline],[[Block]]) -> DokuWiki m Text definitionListItemToDokuWiki opts (label, items) = do+ let useWrap = not (all isSimpleListItem items)+ bqLevel <- asks stBlockQuoteLevel+ let bqPrefix = case bqLevel of+ 0 -> ""+ n -> T.replicate n ">" <> " " labelText <- inlineListToDokuWiki opts label- contents <- mapM (blockListToDokuWiki opts) items- useTags <- asks stUseTags- if useTags- then return $ "<HTML><dt></HTML>" <> labelText <> "<HTML></dt></HTML>\n" <>- T.intercalate "\n" (map (\d -> "<HTML><dd></HTML>" <> d <> "<HTML></dd></HTML>") contents)- else do- indent <- asks stIndent- backSlash <- asks stBackSlashLB- let indent' = if backSlash then T.drop 2 indent else indent- return $ indent' <> "* **" <> labelText <> "** " <> T.concat contents---- | True if the list can be handled by simple wiki markup, False if HTML tags will be needed.-isSimpleList :: Block -> Bool-isSimpleList x =- case x of- BulletList items -> all isSimpleListItem items- OrderedList (1, _, _) items -> all isSimpleListItem items- DefinitionList items -> all (all isSimpleListItem . snd) items- _ -> False+ contents <- local (\st -> st{ stBlockQuoteLevel = 0 })+ (mapM (blockListToDokuWiki opts) items)+ indent <- asks stIndent+ backSlash <- asks stBackSlashLB+ let indent' = if backSlash then T.drop 2 indent else indent+ return $ bqPrefix <> indent' <> "* **" <> labelText <> "** " <>+ if useWrap+ then "<WRAP>\n" <> vcat contents <> "\n</WRAP>"+ else T.intercalate "; " contents -- | True if list item can be handled with the simple wiki syntax. False if--- HTML tags will be needed.+-- WRAP tags will be needed. isSimpleListItem :: [Block] -> Bool isSimpleListItem [] = True isSimpleListItem [x, CodeBlock{}] | isPlainOrPara x = True@@ -315,15 +287,21 @@ isSimpleListItem bs && all isSimpleList ys isSimpleListItem (x:ys) | isPlainOrPara x = all isSimpleList ys isSimpleListItem _ = False+--- | True if the list can be handled by simple wiki markup, False if HTML tags will be needed. +isSimpleList :: Block -> Bool+isSimpleList x =+ case x of+ BulletList items -> all isSimpleListItem items+ OrderedList (1, _, _) items -> all isSimpleListItem items+ DefinitionList items -> all (all isSimpleListItem . snd) items+ _ -> False+ isPlainOrPara :: Block -> Bool isPlainOrPara (Plain _) = True isPlainOrPara (Para _) = True isPlainOrPara _ = False -isSimpleBlockQuote :: [Block] -> Bool-isSimpleBlockQuote bs = all isPlainOrPara bs- -- | Concatenates strings with line breaks between them. vcat :: [Text] -> Text vcat = T.intercalate "\n"@@ -353,8 +331,9 @@ (if align' == AlignLeft || align' == AlignCenter then " " else "")- contents <- local (\s -> s { stBackSlashLB = True }) $- blockListToDokuWiki opts item+ contents <- local (\s -> s { stBackSlashLB = True+ , stBlockQuoteLevel = 0 }) $+ blockListToDokuWiki opts item return $ mkcell contents -- | Convert list of Pandoc block elements to DokuWiki.@@ -444,9 +423,10 @@ DisplayMath -> "$$" InlineMath -> "$" -inlineToDokuWiki _ il@(RawInline f str)+inlineToDokuWiki opts il@(RawInline f str) | f == Format "dokuwiki" = return str- | f == Format "html" = return $ "<html>" <> str <> "</html>"+ | f == Format "html"+ , isEnabled Ext_raw_html opts = return $ "<html>" <> str <> "</html>" | otherwise = "" <$ report (InlineNotRendered il) inlineToDokuWiki _ LineBreak = do@@ -483,7 +463,8 @@ return $ "{{" <> source <> imageDims opts attr <> txt <> "}}" inlineToDokuWiki opts (Note contents) = do- contents' <- blockListToDokuWiki opts contents+ contents' <- local (\st -> st{ stBlockQuoteLevel = 0 })+ (blockListToDokuWiki opts contents) return $ "((" <> contents' <> "))" -- note - may not work for notes with multiple blocks
src/Text/Pandoc/Writers/HTML.hs view
@@ -49,6 +49,7 @@ import Text.DocLayout (render, literal, Doc) import Text.Blaze.Internal (MarkupM (Empty), customLeaf, customParent) import Text.DocTemplates (FromContext (lookupContext), Context (..))+import qualified Text.DocTemplates.Internal as DT import Text.Blaze.Html hiding (contents) import Text.Pandoc.Definition import Text.Pandoc.Highlighting (formatHtmlBlock, formatHtml4Block,@@ -240,21 +241,23 @@ Just cols -> render (Just cols) $ layoutMarkup body Just tpl -> do -- warn if empty lang- when (isNothing (getField "lang" context :: Maybe Text)) $+ when (isNothing (getField "lang" context :: Maybe Text) &&+ hasVariable "lang" tpl) $ report NoLangSpecified- -- check for empty pagetitle (context' :: Context Text) <-+ -- check for empty pagetitle case getField "pagetitle" context of Just (s :: Text) | not (T.null s) -> return context- _ -> do- let fallback = T.pack $- case lookupContext "sourcefile"- (writerVariables opts) of- Nothing -> "Untitled"- Just [] -> "Untitled"- Just (x:_) -> takeBaseName $ T.unpack x- report $ NoTitleElement fallback- return $ resetField "pagetitle" (literal fallback) context+ _ | hasVariable "pagetitle" tpl -> do+ let fallback = T.pack $+ case lookupContext "sourcefile"+ (writerVariables opts) of+ Nothing -> "Untitled"+ Just [] -> "Untitled"+ Just (x:_) -> takeBaseName $ T.unpack x+ report $ NoTitleElement fallback+ return $ resetField "pagetitle" (literal fallback) context+ | otherwise -> return context return $ render colwidth $ renderTemplate tpl (defField "body" (layoutMarkup body) context') @@ -1753,3 +1756,16 @@ where escapeURI = T.pack . escapeURIString (not . needsEscaping) . T.unpack needsEscaping c = isSpace c || T.any (== c) "<>|\"{}[]^`" || not (isAscii c)++hasVariable :: Text -> DT.Template a -> Bool+hasVariable var = checkVar+ where+ matches v' = T.intercalate "." (DT.varParts v') == var+ checkVar (DT.Interpolate v) = matches v+ checkVar (DT.Conditional v t1 t2) = matches v || checkVar t1 || checkVar t2+ checkVar (DT.Iterate v t1 t2) = matches v || checkVar t1 || checkVar t2+ checkVar (DT.Nested t) = checkVar t+ checkVar (DT.Partial _ t) = checkVar t+ checkVar (DT.Concat t1 t2) = checkVar t1 || checkVar t2+ checkVar (DT.Literal _) = False+ checkVar DT.Empty = False
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -194,6 +194,8 @@ $ lookupMetaInlines "nocite" meta let context = defField "toc" (writerTableOfContents options) $+ defField "lof" (writerListOfFigures options) $+ defField "lot" (writerListOfTables options) $ defField "toc-depth" (tshow (writerTOCDepth options - if stHasChapters st@@ -375,8 +377,9 @@ then modify $ \st -> st{ stIncremental = True } else when (beamer && "nonincremental" `elem` classes) $ modify $ \st -> st { stIncremental = False }- result <- if identifier == "refs" || -- <- for backwards compatibility- "csl-bib-body" `elem` classes+ result <- if (identifier == "refs" || -- <- for backwards compatibility+ "csl-bib-body" `elem` classes) &&+ (not (null bs)) then do modify $ \st -> st{ stHasCslRefs = True } inner <- blockListToLaTeX bs@@ -523,10 +526,11 @@ let spacing = if isTightList lst then text "\\tightlist" else empty- return $ text ("\\begin{itemize}" <> inc) $$+ return $ -- force list to start on new line if in a defn list+ (if isFirstInDefinition then "\\hfill" else mempty) $$+ text ("\\begin{itemize}" <> inc) $$ spacing $$ -- force list at beginning of definition to start on new line- (if isFirstInDefinition then "\\item[]" else mempty) $$ vcat items $$ "\\end{itemize}" blockToLaTeX (OrderedList _ []) = return empty -- otherwise latex error@@ -574,12 +578,12 @@ let spacing = if isTightList lst then text "\\tightlist" else empty- return $ text ("\\begin{enumerate}" <> inc)+ return $ -- force list at beginning of definition to start on new line+ (if isFirstInDefinition then "\\hfill" else mempty)+ $$ text ("\\begin{enumerate}" <> inc) $$ stylecommand $$ resetcounter $$ spacing- -- force list at beginning of definition to start on new line- $$ (if isFirstInDefinition then "\\item[]" else mempty) $$ vcat items $$ "\\end{enumerate}" blockToLaTeX (DefinitionList []) = return empty
src/Text/Pandoc/Writers/RST.hs view
@@ -254,12 +254,17 @@ -> ".. " <> literal cl <> "::" cls -> ".. container::" <> space <> literal (T.unwords (filter (/= "container") cls))+ -- if contents start with block quote, we need to insert+ -- an empty comment to fix the indentation point (#10236)+ let contents' = case bs of+ BlockQuote{}:_-> ".." $+$ contents+ _ -> contents return $ blankline $$ admonition $$ (if T.null ident then blankline else " :name: " <> literal ident $$ blankline) $$- nest 3 contents $$+ nest 3 contents' $$ blankline blockToRST (Plain inlines) = inlineListToRST inlines blockToRST (Para inlines)@@ -351,7 +356,7 @@ | otherwise = renderGrid tbl <- rendered return $ blankline $$- (if null caption+ (if null caption || isList then tbl else (".. table:: " <> caption') $$ blankline $$ nest 3 tbl) $$ blankline@@ -421,7 +426,12 @@ bulletListItemToRST :: PandocMonad m => [Block] -> RST m (Doc Text) bulletListItemToRST items = do contents <- blockListToRST items- return $ hang 3 "- " contents $$+ -- if a list item starts with block quote, we need to insert+ -- an empty comment to fix the indentation point (#10236)+ let contents' = case items of+ BlockQuote{}:_-> ".." $+$ contents+ _ -> contents+ return $ hang 2 "- " contents' $$ if null items || (endsWithPlain items && not (endsWithList items)) then cr else blankline@@ -434,7 +444,12 @@ orderedListItemToRST marker items = do contents <- blockListToRST items let marker' = marker <> " "- return $ hang (T.length marker') (literal marker') contents $$+ -- if a list item starts with block quote, we need to insert+ -- an empty comment to fix the indentation point (#10236)+ let contents' = case items of+ BlockQuote{}:_-> ".." $+$ contents+ _ -> contents+ return $ hang (T.length marker') (literal marker') contents' $$ if null items || (endsWithPlain items && not (endsWithList items)) then cr else blankline@@ -450,7 +465,12 @@ definitionListItemToRST (label, defs) = do label' <- inlineListToRST label contents <- liftM vcat $ mapM blockListToRST defs- return $ nowrap label' $$ nest 3 (nestle contents) $$+ -- if definition list starts with block quote, we need to insert+ -- an empty comment to fix the indentation point (#10236)+ let contents' = case defs of+ (BlockQuote{}:_):_ -> ".." $+$ contents+ _ -> contents+ return $ nowrap label' $$ nest 3 (nestle contents') $$ if isTightList defs then cr else blankline@@ -547,24 +567,8 @@ toColumns :: Int -> Double -> Int toColumns t p = round (p * fromIntegral t) listTableContent :: PandocMonad m => [[[Block]]] -> RST m (Doc Text)- listTableContent = joinTable joinDocsM joinDocsM .- mapTable blockListToRST- -- joinDocsM adapts joinDocs in order to work in the `RST m` monad- joinDocsM :: PandocMonad m => [RST m (Doc Text)] -> RST m (Doc Text)- joinDocsM = fmap joinDocs . sequence- -- joinDocs will be used to join cells and to join rows- joinDocs :: [Doc Text] -> Doc Text- joinDocs items = blankline $$- (chomp . vcat . map formatItem) items $$- blankline- formatItem :: Doc Text -> Doc Text- formatItem i = hang 3 "- " (i <> cr)- -- apply a function to all table cells changing their type- mapTable :: (a -> b) -> [[a]] -> [[b]]- mapTable = map . map- -- function hor to join cells and function ver to join rows- joinTable :: ([a] -> a) -> ([a] -> a) -> [[a]] -> a- joinTable hor ver = ver . map hor+ listTableContent = fmap vcat .+ mapM (fmap (hang 2 (text "* ") . vcat) . mapM bulletListItemToRST) transformInlines :: [Inline] -> [Inline] transformInlines = insertBS .
test/Tests/Readers/DokuWiki.hs view
@@ -269,9 +269,9 @@ , ">> baz" , "> bat" ] =?>- blockQuote (plain "foo" <>- plain "no space is required after >" <>- plain "bar" <>+ blockQuote (plain (text "foo" <> linebreak <>+ text "no space is required after >" <> linebreak <>+ text "bar") <> blockQuote (plain "baz") <> plain "bat") , "Code block" =:
test/Tests/Writers/RST.hs view
@@ -32,7 +32,7 @@ tests = [ testGroup "rubrics" [ "in list item" =: bulletList [header 2 (text "foo")] =?>- "- .. rubric:: foo"+ "- .. rubric:: foo" , "in definition list item" =: definitionList [(text "foo", [header 2 (text "bar"), para $ text "baz"])] =?>@@ -60,7 +60,7 @@ [ "a list is closed by a comment before a quote" =: -- issue 4248 bulletList [plain "bulleted"] <> blockQuote (plain "quoted") =?> unlines- [ "- bulleted"+ [ "- bulleted" , "" , ".." , ""
test/ansi-test.ansi view
@@ -111,6 +111,8 @@ small caps +We see a log₁₀ reduction in 2⁹ seconds.+ ──────────────────── 1. Here’s the note.[0m]8;;\
test/ansi-test.txt view
@@ -120,3 +120,4 @@ [small caps]{.smallcaps} +We see a log~10~ reduction in 2^9^ seconds.
+ test/command/10185.md view
@@ -0,0 +1,46 @@+```+% pandoc -t latex --citeproc+Lorem ipsum++# References++::: {#refs}+:::+^D+Lorem ipsum++\section{References}\label{references}++\phantomsection\label{refs}+```++```+% pandoc -t latex --citeproc+---+references:+- id: foo+ type: book+ title: The Title+ author: John Doe+...++Lorem ipsum [@foo].++# References++::: {#refs}+:::+^D+Lorem ipsum (John Doe, n.d.).++\section{References}\label{references}++\phantomsection\label{refs}+\begin{CSLReferences}{1}{0}+\bibitem[\citeproctext]{ref-foo}+John Doe. n.d. \emph{The Title}.++\end{CSLReferences}++```+
+ test/command/10236.md view
@@ -0,0 +1,80 @@+```+% pandoc -t rst+- > test+ >+ > para 2+^D+- ..++ test++ para 2+```++```+% pandoc -t rst+1. > test+ >+ > para 2+^D+1. ..++ test++ para 2+```++```+% pandoc -t rst+::: caution+> test+:::+^D+.. caution::++ ..++ test+```++```+% pandoc -f native -t rst --list-tables+[ Table+ ( "" , [] , [] )+ (Caption Nothing [])+ [ ( AlignDefault , ColWidth 0.26 ) ]+ (TableHead ( "" , [] , [] ) [])+ [ TableBody+ ( "" , [] , [] )+ (RowHeadColumns 0)+ []+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ BlockQuote+ [ Para [ Emph [ Str "Level" , Space , Str "0:" ] ]+ , Para+ [ Emph [ Str "Incomplete" , Space , Str "process" ]+ ]+ ]+ ]+ ]+ ]+ ]+ (TableFoot ( "" , [] , [] ) [])+]+^D+.. list-table::+ :widths: 19++ * - ..++ *Level 0:*++ *Incomplete process*+```+
test/command/4564.md view
@@ -1,65 +1,58 @@ ``` % pandoc -f native -t rst --list-tables-[BlockQuote- [Table ("",[],[]) (Caption Nothing- [])- [(AlignDefault,ColWidth 0.1527777777777778)- ,(AlignDefault,ColWidth 0.1388888888888889)- ,(AlignDefault,ColWidth 0.16666666666666666)- ,(AlignDefault,ColWidth 0.375)]- (TableHead ("",[],[])+[Table ("",[],[]) (Caption Nothing+ [Plain [Str "Here",Space,Str "is",Space,Str "a",Space,Str "caption."]])+ [(AlignDefault,ColWidth 0.1527777777777778)+ ,(AlignDefault,ColWidth 0.1388888888888889)+ ,(AlignDefault,ColWidth 0.16666666666666666)+ ,(AlignDefault,ColWidth 0.375)]+ (TableHead ("",[],[])+ [Row ("",[],[])+ [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "Centered",SoftBreak,Str "Header"]]+ ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "Left",SoftBreak,Str "Aligned"]]+ ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "Right",SoftBreak,Str "Aligned"]]+ ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "Default",Space,Str "aligned"]]]])+ [(TableBody ("",[],[]) (RowHeadColumns 0)+ [] [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Centered",SoftBreak,Str "Header"]]+ [Plain [Str "First"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Left",SoftBreak,Str "Aligned"]]+ [Plain []] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Right",SoftBreak,Str "Aligned"]]+ [Plain [Str "12.0"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Default",Space,Str "aligned"]]]])- [(TableBody ("",[],[]) (RowHeadColumns 0)- []- [Row ("",[],[])- [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "First"]]- ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "row"]]- ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "12.0"]]- ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]- ,Row ("",[],[])- [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Second"]]- ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "row"]]- ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "5.0"]]- ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)- [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]])]- (TableFoot ("",[],[])- [])]]+ [Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",SoftBreak,Str "spans",Space,Str "multiple",Space,Str "lines."]]]+ ,Row ("",[],[])+ [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "Second"]]+ ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "row"]]+ ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "5.0"]]+ ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)+ [Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]])]+ (TableFoot ("",[],[])+ [])] ^D- .. list-table::- :widths: 11 10 12 27- :header-rows: 1-- - -- - Centered Header- - Left Aligned- - Right Aligned- - Default aligned- - -- - First- - row- - 12.0- - Example of a row that spans multiple lines.- - +.. list-table:: Here is a caption.+ :widths: 11 10 12 27+ :header-rows: 1 - - Second- - row- - 5.0- - Here’s another one. Note the blank line between rows.+ * - Centered Header+ - Left Aligned+ - Right Aligned+ - Default aligned+ * - First+ - + - 12.0+ - Example of a row that spans multiple lines.+ * - Second+ - row+ - 5.0+ - Here’s another one. Note the blank line between rows. ```
test/command/5898.md view
@@ -24,13 +24,13 @@ </body> </html> ^D-- A list of stuff with a table inside+- A list of stuff with a table inside - ===== ====== =====- First Second Third- ===== ====== =====- First Second Third- ===== ====== =====+ ===== ====== =====+ First Second Third+ ===== ====== =====+ First Second Third+ ===== ====== ===== -- Another list item+- Another list item ```
test/command/5899.md view
@@ -35,17 +35,17 @@ </body> </html> ^D-- A list of stuff with a table inside+- 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+- Another list item ```
test/command/7863.md view
@@ -10,10 +10,17 @@ Text ^D [ Div- ( "" , [] , [ ( "data-pos" , "8:1-9:1" ) ] )+ ( ""+ , []+ , [ ( "wrapper" , "1" ) , ( "data-pos" , "8:1-9:1" ) ]+ ) [ Para [ Span- ( "" , [] , [ ( "data-pos" , "8:1-8:5" ) ] ) [ Str "Text" ]+ ( ""+ , []+ , [ ( "wrapper" , "1" ) , ( "data-pos" , "8:1-8:5" ) ]+ )+ [ Str "Text" ] ] ] ]
+ test/command/8863.md view
@@ -0,0 +1,11 @@+```+% pandoc -f dokuwiki -t native+ * item 1+ * item 1.1+^D+[ BulletList+ [ [ Plain [ Str "item" , Space , Str "1" ] ]+ , [ Plain [ Str "item" , Space , Str "1.1" ] ]+ ]+]+```
test/command/9472.md view
@@ -11,10 +11,11 @@ % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url}-% \documentclass[ ]{article}+\usepackage{xcolor} \usepackage{amsmath,amssymb}+\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc}@@ -45,11 +46,6 @@ }{% if KOMA class \KOMAoptions{parskip=half}} \makeatother-\usepackage{xcolor}-\setlength{\emergencystretch}{3em} % prevent overfull lines-\providecommand{\tightlist}{%- \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \ifLuaTeX \usepackage[bidi=basic]{babel} \else@@ -63,6 +59,9 @@ \ifLuaTeX \usepackage[german]{selnolig} % disable illegal ligatures \fi+\setlength{\emergencystretch}{3em} % prevent overfull lines+\providecommand{\tightlist}{%+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \usepackage{bookmark} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \urlstyle{same}
+ test/command/dokuwiki-quote.md view
@@ -0,0 +1,16 @@+```+% pandoc -f dokuwiki -t native+> <code>some+code+</code>+>> ok+> then+> more+^D+[ BlockQuote+ [ CodeBlock ( "" , [] , [] ) "some\ncode\n"+ , BlockQuote [ Plain [ Str "ok" ] ]+ , Plain [ Str "then" , LineBreak , Str "more" ]+ ]+]+```
test/command/lists-inside-definition.md view
@@ -12,10 +12,10 @@ \begin{description} \tightlist \item[Definition]+\hfill \begin{enumerate} \def\labelenumi{\arabic{enumi}.} \tightlist-\item[] \item list \item@@ -56,9 +56,9 @@ \begin{description} \tightlist \item[Definition]+\hfill \begin{itemize} \tightlist-\item[] \item list \item
test/djot-reader.native view
@@ -1,10 +1,7 @@ Pandoc Meta { unMeta = fromList [] } [ Div- ( "Pandoc-Test-Suite"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "Pandoc-Test-Suite" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Pandoc Test Suite" ] , Para [ Str "John MacFarlane" , SoftBreak , Str "Anonymous" ]@@ -18,13 +15,10 @@ , HorizontalRule ] , Div- ( "headers" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "headers" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Headers" ] , Div- ( "level-2-with-an-embedded-link"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "level-2-with-an-embedded-link" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] )@@ -35,57 +29,45 @@ ( "/url" , "" ) ] , Div- ( "level-3-with-emphasis"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "level-3-with-emphasis" , [ "section" ] , [] ) [ Header 3 ( "" , [] , [] ) [ Str "Level 3 with " , Emph [ Str "emphasis" ] ] , Div- ( "level-4"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "level-4" , [ "section" ] , [] ) [ Header 4 ( "" , [] , [] ) [ Str "Level 4" ] , Div- ( "level-5"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "level-5" , [ "section" ] , [] ) [ Header 5 ( "" , [] , [] ) [ Str "Level 5" ] ] ] ] ] ] , Div- ( "level-1" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "level-1" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Level 1" ] , Div- ( "level-2-with-emphasis"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "level-2-with-emphasis" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Level 2 with " , Emph [ Str "emphasis" ] ] , Div- ( "level-3" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "level-3" , [ "section" ] , [] ) [ Header 3 ( "" , [] , [] ) [ Str "Level 3" ] , Para [ Str "with no blank line" ] ] ] , Div- ( "level-2" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "level-2" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Level 2" ] , Para [ Str "with no blank line" ] , HorizontalRule ] ] , Div- ( "paragraphs" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "paragraphs" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Paragraphs" ] , Para [ Str "Here\8217s a regular paragraph." ] , Para@@ -106,7 +88,7 @@ , HorizontalRule ] , Div- ( "block-quotes" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "block-quotes" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Block Quotes" ] , Para [ Str "E-mail style:" ] , BlockQuote@@ -132,7 +114,7 @@ , HorizontalRule ] , Div- ( "code-blocks" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "code-blocks" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Code Blocks" ] , Para [ Str "Code:" ] , CodeBlock@@ -145,10 +127,10 @@ , HorizontalRule ] , Div- ( "lists" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "lists" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Lists" ] , Div- ( "unordered" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "unordered" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Unordered" ] , Para [ Str "Asterisks tight:" ] , BulletList@@ -188,7 +170,7 @@ ] ] , Div- ( "ordered" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "ordered" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Ordered" ] , Para [ Str "Tight:" ] , OrderedList@@ -232,7 +214,7 @@ ] ] , Div- ( "nested" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "nested" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Nested" ] , BulletList [ [ Plain [ Str "Tab" ]@@ -271,10 +253,7 @@ ] ] , Div- ( "tabs-and-spaces"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "tabs-and-spaces" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Tabs and spaces" ] , BulletList [ [ Para [ Str "this is a list item indented with tabs" ]@@ -297,10 +276,7 @@ ] ] , Div- ( "fancy-list-markers"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "fancy-list-markers" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Fancy list markers" ] , OrderedList ( 2 , Decimal , TwoParens )@@ -365,10 +341,7 @@ ] ] , Div- ( "definition-lists"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "definition-lists" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Definition Lists" ] , Para [ Str "Tight using spaces:" ] , DefinitionList@@ -409,11 +382,11 @@ , [ [ Para [ Str "orange fruit" ] , CodeBlock ( "" , [ "" ] , [] ) "{ orange code block }\n"+ , BlockQuote [ Para [ Str "orange block quote" ] ] ] ] ) ]- , BlockQuote [ Para [ Str "orange block quote" ] ] , Para [ Str "Multiple definitions, tight:" ] , DefinitionList [ ( [ Str "apple" ]@@ -453,7 +426,7 @@ ] ] , Div- ( "html-blocks" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "html-blocks" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "HTML Blocks" ] , Para [ Str "Simple block on one line:" ] , Div ( "" , [] , [] ) [ Para [ Str "foo" ] ]@@ -495,10 +468,7 @@ , HorizontalRule ] , Div- ( "inline-markup"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "inline-markup" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Inline Markup" ] , Para [ Str "This is "@@ -580,10 +550,7 @@ , HorizontalRule ] , Div- ( "smart-quotes-ellipses-dashes"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "smart-quotes-ellipses-dashes" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Smart quotes, ellipses, dashes" ] , Para@@ -645,7 +612,7 @@ , HorizontalRule ] , Div- ( "latex" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "latex" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "LaTeX" ] , BulletList [ []@@ -701,10 +668,7 @@ , HorizontalRule ] , Div- ( "special-characters"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "special-characters" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Special Characters" ] , Para [ Str "Here is some unicode:" ] , BulletList@@ -738,10 +702,10 @@ , HorizontalRule ] , Div- ( "links" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "links" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Links" ] , Div- ( "explicit" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "explicit" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Explicit" ] , Para [ Str "Just a "@@ -750,10 +714,7 @@ ] , Para [ Link- ( ""- , []- , [ ( "wrapper" , "1" ) , ( "title" , "title" ) ]- )+ ( "" , [] , [ ( "title" , "title" ) ] ) [ Str "URL and title" ] ( "/url/" , "" ) , Str "."@@ -762,9 +723,7 @@ [ Link ( "" , []- , [ ( "wrapper" , "1" )- , ( "title" , "title preceded by two spaces" )- ]+ , [ ( "title" , "title preceded by two spaces" ) ] ) [ Str "URL and title" ] ( "/url/" , "" )@@ -774,9 +733,7 @@ [ Link ( "" , []- , [ ( "wrapper" , "1" )- , ( "title" , "title preceded by a tab" )- ]+ , [ ( "title" , "title preceded by a tab" ) ] ) [ Str "URL and title" ] ( "/url/" , "" )@@ -786,9 +743,7 @@ [ Link ( "" , []- , [ ( "wrapper" , "1" )- , ( "title" , "title with \"quotes\" in it" )- ]+ , [ ( "title" , "title with \"quotes\" in it" ) ] ) [ Str "URL and title" ] ( "/url/" , "" )@@ -797,9 +752,7 @@ [ Link ( "" , []- , [ ( "wrapper" , "1" )- , ( "title" , "title with single quotes" )- ]+ , [ ( "title" , "title with single quotes" ) ] ) [ Str "URL and title" ] ( "/url/" , "" )@@ -822,7 +775,7 @@ ] ] , Div- ( "reference" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "reference" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Reference" ] , Para [ Str "Foo "@@ -863,9 +816,7 @@ , Link ( "" , []- , [ ( "wrapper" , "1" )- , ( "title" , "Title with \"quotes\" inside" )- ]+ , [ ( "title" , "Title with \"quotes\" inside" ) ] ) [ Str "bar" ] ( "/url/" , "" )@@ -876,9 +827,7 @@ , Link ( "" , []- , [ ( "wrapper" , "1" )- , ( "title" , "Title with \"quote\" inside" )- ]+ , [ ( "title" , "Title with \"quote\" inside" ) ] ) [ Str "biz" ] ( "/url/" , "" )@@ -886,10 +835,7 @@ ] ] , Div- ( "with-ampersands"- , [ "section" ]- , [ ( "wrapper" , "1" ) ]- )+ ( "with-ampersands" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "With ampersands" ] , Para [ Str "Here\8217s a "@@ -904,10 +850,7 @@ "Here\8217s a link with an amersand in the link text:" , SoftBreak , Link- ( ""- , []- , [ ( "wrapper" , "1" ) , ( "title" , "AT&T" ) ]- )+ ( "" , [] , [ ( "title" , "AT&T" ) ] ) [ Str "AT&T" ] ( "http://att.com/" , "" ) , Str "."@@ -930,7 +873,7 @@ ] ] , Div- ( "autolinks" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "autolinks" , [ "section" ] , [] ) [ Header 2 ( "" , [] , [] ) [ Str "Autolinks" ] , Para [ Str "With an ampersand: "@@ -976,7 +919,7 @@ ] ] , Div- ( "images" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "images" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Images" ] , Para [ Str "From "@@ -987,18 +930,11 @@ ( "" , [] , [] ) [ Para [ Image- ( ""- , []- , [ ( "wrapper" , "1" )- , ( "title" , "Voyage dans la Lune" )- ]- )+ ( "" , [] , [ ( "title" , "Voyage dans la Lune" ) ] ) [ Str "lalune" ] ( "lalune.jpg" , "" ) ]- , Div- ( "" , [ "caption" ] , [ ( "wrapper" , "1" ) ] )- [ Para [ Str "lalune" ] ]+ , Div ( "" , [ "caption" ] , [] ) [ Para [ Str "lalune" ] ] ] , Para [ Str "Here is a movie "@@ -1009,7 +945,7 @@ , HorizontalRule ] , Div- ( "footnotes" , [ "section" ] , [ ( "wrapper" , "1" ) ] )+ ( "footnotes" , [ "section" ] , [] ) [ Header 1 ( "" , [] , [] ) [ Str "Footnotes" ] , Para [ Str "Here is a footnote reference,"
test/docbook-reader.docbook view
@@ -1406,6 +1406,75 @@ </tgroup> </table> <para>+ Table with attributes+ </para>+ <table xml:id="mytableid1" class="mytableclass1 mytableclass2" tabstyle="mytabstyle1">+ <title>+ Attribute table caption+ </title>+ <tgroup>+ <thead>+ <th>+ <para>+ header cell 1+ </para>+ </th>+ <th>+ <para>+ header cell 2+ </para>+ </th>+ </thead>+ <tbody>+ <tr>+ <td>+ <para>+ body cell 1+ </para>+ </td>+ <td>+ <para>+ body cell 2+ </para>+ </td>+ </tr>+ </tbody>+ </tgroup>+ </table>+ <para>+ Table with attributes, without caption+ </para>+ <informaltable xml:id="mytableid2" class="mytableclass3 mytableclass4" tabstyle="mytabstyle2">+ <tgroup>+ <thead>+ <th>+ <para>+ header cell 1+ </para>+ </th>+ <th>+ <para>+ header cell 2+ </para>+ </th>+ </thead>+ <tbody>+ <tr>+ <td>+ <para>+ body cell 1+ </para>+ </td>+ <td>+ <para>+ body cell 2+ </para>+ </td>+ </tr>+ </tbody>+ </tgroup>+ </informaltable>+ <para> Multiline table without caption: </para> <informaltable>
test/docbook-reader.native view
@@ -2561,6 +2561,125 @@ ] (TableFoot ( "" , [] , [] ) []) , Para+ [ Str "Table"+ , Space+ , Str "with"+ , Space+ , Str "attributes"+ ]+ , Table+ ( "mytableid1"+ , [ "mytableclass1" , "mytableclass2" ]+ , [ ( "custom-style" , "mytabstyle1" ) ]+ )+ (Caption+ Nothing+ [ Plain+ [ Str "Attribute"+ , Space+ , Str "table"+ , Space+ , Str "caption"+ ]+ ])+ [ ( AlignDefault , ColWidthDefault )+ , ( AlignDefault , ColWidthDefault )+ ]+ (TableHead ( "" , [] , [] ) [])+ [ TableBody+ ( "" , [] , [] )+ (RowHeadColumns 0)+ []+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Para+ [ Str "body"+ , Space+ , Str "cell"+ , Space+ , Str "1"+ ]+ ]+ , Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Para+ [ Str "body"+ , Space+ , Str "cell"+ , Space+ , Str "2"+ ]+ ]+ ]+ ]+ ]+ (TableFoot ( "" , [] , [] ) [])+ , Para+ [ Str "Table"+ , Space+ , Str "with"+ , Space+ , Str "attributes,"+ , Space+ , Str "without"+ , Space+ , Str "caption"+ ]+ , Table+ ( "mytableid2"+ , [ "mytableclass3" , "mytableclass4" ]+ , [ ( "custom-style" , "mytabstyle2" ) ]+ )+ (Caption Nothing [])+ [ ( AlignDefault , ColWidthDefault )+ , ( AlignDefault , ColWidthDefault )+ ]+ (TableHead ( "" , [] , [] ) [])+ [ TableBody+ ( "" , [] , [] )+ (RowHeadColumns 0)+ []+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Para+ [ Str "body"+ , Space+ , Str "cell"+ , Space+ , Str "1"+ ]+ ]+ , Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Para+ [ Str "body"+ , Space+ , Str "cell"+ , Space+ , Str "2"+ ]+ ]+ ]+ ]+ ]+ (TableFoot ( "" , [] , [] ) [])+ , Para [ Str "Multiline" , Space , Str "table"
test/docbook-xref.native view
@@ -310,7 +310,7 @@ ] ] , Table- ( "" , [] , [] )+ ( "table01" , [] , [] ) (Caption Nothing [ Plain
test/docx/normalize.docx view
binary file changed (14622 → 14672 bytes)
test/writer.dokuwiki view
@@ -48,26 +48,25 @@ > This is a block quote. It is pretty short. -<HTML><blockquote>-Code in a block quote:+> Code in a block quote: -<code>+> <code> sub status { print "working"; } </code> -A list:+> A list: - - item one- - item two+> - item one+> - item two -Nested block quotes:+> Nested block quotes: -> nested+>> nested -> nested-</blockquote></HTML>+>> nested+ This should not be a block quote: 2 > 1. And a following paragraph.@@ -168,11 +167,12 @@ Multiple paragraphs: -<HTML><ol style="list-style-type: decimal;"></HTML>-<HTML><li></HTML><HTML><p></HTML>Item 1, graf one.<HTML></p></HTML>-<HTML><p></HTML>Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.<HTML></p></HTML><HTML></li></HTML>-<HTML><li></HTML><HTML><p></HTML>Item 2.<HTML></p></HTML><HTML></li></HTML>-<HTML><li></HTML><HTML><p></HTML>Item 3.<HTML></p></HTML><HTML></li></HTML><HTML></ol></HTML>+ - <WRAP>+Item 1, graf one.+Item 1. graf two. The quick brown fox jumped over the lazy dog’s back.+</WRAP>+ - Item 2.+ - Item 3. ===== Nested ===== @@ -207,32 +207,28 @@ ===== Fancy list markers ===== -<HTML><ol start="2" style="list-style-type: decimal;"></HTML>-<HTML><li></HTML><HTML><p></HTML>begins with 2<HTML></p></HTML><HTML></li></HTML>-<HTML><li></HTML><HTML><p></HTML>and now 3<HTML></p></HTML>-<HTML><p></HTML>with a continuation<HTML></p></HTML>-<HTML><ol start="4" style="list-style-type: lower-roman;"></HTML>-<HTML><li></HTML>sublist with roman numerals, starting with 4<HTML></li></HTML>-<HTML><li></HTML>more items-<HTML><ol style="list-style-type: upper-alpha;"></HTML>-<HTML><li></HTML>a subsublist<HTML></li></HTML>-<HTML><li></HTML>a subsublist<HTML></li></HTML><HTML></ol></HTML>-<HTML></li></HTML><HTML></ol></HTML>-<HTML></li></HTML><HTML></ol></HTML>+ - begins with 2+ - <WRAP>+and now 3+with a continuation+ - sublist with roman numerals, starting with 4+ - more items+ - a subsublist+ - a subsublist+</WRAP> Nesting: -<HTML><ol style="list-style-type: upper-alpha;"></HTML>-<HTML><li></HTML>Upper Alpha-<HTML><ol style="list-style-type: upper-roman;"></HTML>-<HTML><li></HTML>Upper Roman.-<HTML><ol start="6" style="list-style-type: decimal;"></HTML>-<HTML><li></HTML>Decimal start with 6-<HTML><ol start="3" style="list-style-type: lower-alpha;"></HTML>-<HTML><li></HTML>Lower alpha with paren<HTML></li></HTML><HTML></ol></HTML>-<HTML></li></HTML><HTML></ol></HTML>-<HTML></li></HTML><HTML></ol></HTML>-<HTML></li></HTML><HTML></ol></HTML>+ - <WRAP>+Upper Alpha+ - <WRAP>+Upper Roman.+ - <WRAP>+Decimal start with 6+ - Lower alpha with paren+</WRAP>+</WRAP>+</WRAP> Autonumbering: @@ -271,32 +267,32 @@ Multiple blocks with italics: -<HTML><dl></HTML>-<HTML><dt></HTML>//apple//<HTML></dt></HTML>-<HTML><dd></HTML><HTML><p></HTML>red fruit<HTML></p></HTML>-<HTML><p></HTML>contains seeds, crisp, pleasant to taste<HTML></p></HTML><HTML></dd></HTML>-<HTML><dt></HTML>//orange//<HTML></dt></HTML>-<HTML><dd></HTML><HTML><p></HTML>orange fruit<HTML></p></HTML>+ * **//apple//** <WRAP>+red fruit+contains seeds, crisp, pleasant to taste+</WRAP>+ * **//orange//** <WRAP>+orange fruit <code> { orange code block } </code> -> <HTML><p></HTML>orange block quote<HTML></p></HTML>-<HTML></dd></HTML><HTML></dl></HTML>+> orange block quote+</WRAP> Multiple definitions, tight: - * **apple** red fruitcomputer- * **orange** orange fruitbank+ * **apple** red fruit; computer+ * **orange** orange fruit; bank Multiple definitions, loose: - * **apple** red fruitcomputer- * **orange** orange fruitbank+ * **apple** red fruit; computer+ * **orange** orange fruit; bank Blank line after term, indented marker, alternate markers: - * **apple** red fruitcomputer+ * **apple** red fruit; computer * **orange** orange fruit - sublist - sublist@@ -318,23 +314,11 @@ Interpreted markdown in a table: -<HTML>-<table>-<tr>-<td>-</HTML>+ This is //emphasized//-<HTML>-</td>-<td>-</HTML>+ And this is **strong**-<HTML>-</td>-</tr>-</table>-<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>-</HTML>+ Here’s a simple block: foo@@ -362,20 +346,10 @@ This should just be an HTML comment: -<HTML>-<!-- Comment -->-</HTML>+ Multiline: -<HTML>-<!---Blah-Blah--->-<!--- This is another comment.--->-</HTML>+ Code block: <code>@@ -384,9 +358,7 @@ Just plain comment, with trailing spaces on the line: -<HTML>-<!-- foo -->-</HTML>+ Code: <code>@@ -395,18 +367,8 @@ Hr’s: -<HTML>-<hr>-<hr />-<hr />-<hr>-<hr />-<hr />-<hr class="foo" id="bar" />-<hr class="foo" id="bar" />-<hr class="foo" id="bar">-</HTML> + ---- ====== Inline Markup ======@@ -644,7 +606,7 @@ )) > Notes can go in quotes.((In quote.-> ))+)) - And in list items.((In list.))
test/writer.latex view
@@ -1,10 +1,11 @@ % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url}-% \documentclass[ ]{article}+\usepackage{xcolor} \usepackage{amsmath,amssymb}+\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc}@@ -36,7 +37,6 @@ \KOMAoptions{parskip=half}} \makeatother \usepackage{fancyvrb}-\usepackage{xcolor} \usepackage{graphicx} \makeatletter \newsavebox\pandoc@box@@ -61,7 +61,6 @@ \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \usepackage{bookmark} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \urlstyle{same}
test/writer.rst view
@@ -133,45 +133,45 @@ Asterisks tight: -- asterisk 1-- asterisk 2-- asterisk 3+- asterisk 1+- asterisk 2+- asterisk 3 Asterisks loose: -- asterisk 1+- asterisk 1 -- asterisk 2+- asterisk 2 -- asterisk 3+- asterisk 3 Pluses tight: -- Plus 1-- Plus 2-- Plus 3+- Plus 1+- Plus 2+- Plus 3 Pluses loose: -- Plus 1+- Plus 1 -- Plus 2+- Plus 2 -- Plus 3+- Plus 3 Minuses tight: -- Minus 1-- Minus 2-- Minus 3+- Minus 1+- Minus 2+- Minus 3 Minuses loose: -- Minus 1+- Minus 1 -- Minus 2+- Minus 2 -- Minus 3+- Minus 3 Ordered -------@@ -217,20 +217,20 @@ Nested ------ -- Tab+- Tab - - Tab+ - Tab - - Tab+ - Tab Here’s another: 1. First 2. Second: - - Fee- - Fie- - Foe+ - Fee+ - Fie+ - Foe 3. Third @@ -240,22 +240,22 @@ 2. Second: - - Fee- - Fie- - Foe+ - Fee+ - Fie+ - Foe 3. Third Tabs and spaces --------------- -- this is a list item indented with tabs+- this is a list item indented with tabs -- this is a list item indented with spaces+- this is a list item indented with spaces - - this is an example list item indented with tabs+ - this is an example list item indented with tabs - - this is an example list item indented with spaces+ - this is an example list item indented with spaces Fancy list markers ------------------@@ -610,24 +610,24 @@ LaTeX ===== -- :raw-latex:`\cite[22-23]{smith.1899}`-- :math:`2+2=4`-- :math:`x \in y`-- :math:`\alpha \wedge \omega`-- :math:`223`-- :math:`p`-Tree-- Here’s some display math:+- :raw-latex:`\cite[22-23]{smith.1899}`+- :math:`2+2=4`+- :math:`x \in y`+- :math:`\alpha \wedge \omega`+- :math:`223`+- :math:`p`-Tree+- Here’s some display math: - .. math:: \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}-- Here’s one that has a line break in it: :math:`\alpha + \omega \times x^2`.+ .. math:: \frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}+- Here’s one that has a line break in it: :math:`\alpha + \omega \times x^2`. These shouldn’t be math: -- To get the famous equation, write ``$e = mc^2$``.-- $22,000 is a *lot* of money. So is $34,000. (It worked if “lot” is- emphasized.)-- Shoes ($20) and socks ($5).-- Escaped ``$``: $73 *this should be emphasized* 23$.+- To get the famous equation, write ``$e = mc^2$``.+- $22,000 is a *lot* of money. So is $34,000. (It worked if “lot” is+ emphasized.)+- Shoes ($20) and socks ($5).+- Escaped ``$``: $73 *this should be emphasized* 23$. Here’s a LaTeX table: @@ -646,11 +646,11 @@ Here is some unicode: -- I hat: Î-- o umlaut: ö-- section: §-- set membership: ∈-- copyright: ©+- I hat: Î+- o umlaut: ö+- section: §+- set membership: ∈+- copyright: © AT&T has an ampersand in their name. @@ -762,9 +762,9 @@ With an ampersand: http://example.com/?foo=1&bar=2 -- In a list?-- http://example.com/-- It should.+- In a list?+- http://example.com/+- It should. An e-mail address: nobody@nowhere.net
test/writers-lang-and-dir.latex view
@@ -1,10 +1,11 @@ % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url}-% \documentclass[ ]{article}+\usepackage{xcolor} \usepackage{amsmath,amssymb}+\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc}@@ -35,11 +36,6 @@ }{% if KOMA class \KOMAoptions{parskip=half}} \makeatother-\usepackage{xcolor}-\setlength{\emergencystretch}{3em} % prevent overfull lines-\providecommand{\tightlist}{%- \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{-\maxdimen} % remove section numbering \ifLuaTeX \usepackage[bidi=basic]{babel} \else@@ -57,6 +53,9 @@ \ifLuaTeX \usepackage[english,german]{selnolig} % disable illegal ligatures \fi+\setlength{\emergencystretch}{3em} % prevent overfull lines+\providecommand{\tightlist}{%+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \ifPDFTeX \TeXXeTstate=1 \newcommand{\RL}[1]{\beginR #1\endR}