pandoc 3.1.2 → 3.1.3
raw patch · 82 files changed
+2060/−466 lines, 82 filesdep +typstdep +vectordep ~texmath
Dependencies added: typst, vector
Dependency ranges changed: texmath
Files
- AUTHORS.md +12/−0
- CONTRIBUTING.md +4/−3
- INSTALL.md +6/−7
- MANUAL.txt +44/−19
- README.md +3/−2
- changelog.md +184/−0
- data/odt/Configurations2/accelerator/current.xml +0/−0
- data/odt/META-INF/manifest.xml +2/−6
- data/odt/Thumbnails/thumbnail.png binary
- data/odt/content.xml +1/−1
- data/odt/meta.xml +1/−1
- data/odt/settings.xml +0/−2
- data/odt/styles.xml +1/−1
- data/templates/default.epub2 +1/−1
- data/templates/default.epub3 +1/−1
- data/templates/default.latex +1/−1
- data/templates/default.opendocument +1/−1
- data/templates/default.typst +2/−10
- data/templates/styles.html +4/−1
- data/translations/cs.yaml +1/−1
- data/translations/pl.yaml +1/−1
- man/pandoc.1 +57/−25
- pandoc.cabal +8/−6
- src/Text/Pandoc/Data.hs +0/−3
- src/Text/Pandoc/Format.hs +1/−0
- src/Text/Pandoc/ImageSize.hs +10/−2
- src/Text/Pandoc/PDF.hs +2/−1
- src/Text/Pandoc/Parsing/General.hs +0/−1
- src/Text/Pandoc/Readers.hs +3/−0
- src/Text/Pandoc/Readers/DocBook.hs +2/−0
- src/Text/Pandoc/Readers/Docx.hs +2/−2
- src/Text/Pandoc/Readers/HTML.hs +12/−5
- src/Text/Pandoc/Readers/JATS.hs +92/−48
- src/Text/Pandoc/Readers/LaTeX/Table.hs +1/−1
- src/Text/Pandoc/Readers/Markdown.hs +1/−1
- src/Text/Pandoc/Readers/ODT/ContentReader.hs +2/−0
- src/Text/Pandoc/Readers/Org/Blocks.hs +11/−12
- src/Text/Pandoc/Readers/RST.hs +3/−2
- src/Text/Pandoc/Readers/RTF.hs +2/−1
- src/Text/Pandoc/Readers/Typst.hs +520/−0
- src/Text/Pandoc/Readers/Typst/Math.hs +376/−0
- src/Text/Pandoc/Readers/Typst/Parsing.hs +61/−0
- src/Text/Pandoc/Writers/EPUB.hs +0/−1
- src/Text/Pandoc/Writers/HTML.hs +1/−1
- src/Text/Pandoc/Writers/Jira.hs +3/−13
- src/Text/Pandoc/Writers/LaTeX/Table.hs +55/−35
- src/Text/Pandoc/Writers/Markdown/Inline.hs +2/−1
- src/Text/Pandoc/Writers/MediaWiki.hs +10/−1
- src/Text/Pandoc/Writers/Ms.hs +3/−1
- src/Text/Pandoc/Writers/ODT.hs +5/−5
- src/Text/Pandoc/Writers/OpenDocument.hs +11/−9
- src/Text/Pandoc/Writers/Typst.hs +15/−26
- test/Tests/Readers/Docx.hs +1/−1
- test/Tests/Readers/Org/Block/Figure.hs +8/−6
- test/Tests/Writers/Docx.hs +1/−1
- test/command/6288.md +1/−3
- test/command/6792.md +1/−1
- test/command/8204.md +12/−0
- test/command/8256.md +34/−0
- test/command/8738.md +6/−0
- test/command/8764.md +50/−0
- test/command/8777.md +8/−0
- test/command/8789.md +42/−0
- test/command/tasklist.md +14/−12
- test/docx/block_quotes.docx binary
- test/docx/block_quotes.native +11/−0
- test/docx/block_quotes_parse_indent.native +0/−8
- test/docx/golden/block_quotes.docx binary
- test/epub/features.native +3/−3
- test/jats-reader.native +106/−0
- test/jats-reader.xml +52/−0
- test/lhs-test.html +4/−1
- test/lhs-test.html+lhs +4/−1
- test/s5-basic.html +4/−1
- test/s5-fancy.html +4/−1
- test/s5-inserts.html +4/−1
- test/tables/planets.latex +4/−4
- test/tables/students.latex +3/−3
- test/writer.html4 +4/−1
- test/writer.html5 +4/−1
- test/writer.opendocument +1/−1
- test/writer.typst +133/−154
AUTHORS.md view
@@ -21,6 +21,7 @@ - Anabra - Anders Waldenborg - Andreas Lööw+- Andreas Scherer - Andres Freund - Andrew Dunning - Andy Morris@@ -62,6 +63,7 @@ - Cédric Couralet - Cezary Drożak - Charanjit Singh+- Charlotte Koch - Chris Black - Christian Conkle - Christian Christiansen@@ -117,6 +119,7 @@ - Francesco Mazzoli - Francesco Occhipinti - François Gannaz+- Frank Seifferth - Frederik Elwert - Freiric Barral - Freirich Raabe@@ -230,6 +233,7 @@ - Mathias Walter - Mathieu Boespflug - Mathieu Duponchelle+- Matt Dodson - Matthew Doty - Matthew Eddey - Matthew Pickering@@ -244,6 +248,7 @@ - Michael Peyton Jones - Michael Reed - Michael Snoyman+- Michael Stahl - Michael Thompson - Mike Tzou - Mikołaj Machowski@@ -262,6 +267,7 @@ - Nikolay Yakimov - Nils Carlson - Nixon Enraght-Moony+- Noah Malmed - Nokome Bentley - OCzarnecki - Ola Wolska@@ -318,6 +324,7 @@ - Simon Schuster - Siphalor - Stefan Dresselhaus+- Stephan Meijer - Stephen Altamirano - Sukil Etxenike - Sukka@@ -338,6 +345,7 @@ - Todd Sifleet - TomBen - Tom Leese+- Toni Dietze - Tristan Stenner - Tristan de Cacqueray - Tuong Nguyen Manh@@ -400,6 +408,7 @@ - obcat - oltolm - oquechy+- perro tuerto - qerub - quasicomputational - ricnorr@@ -407,6 +416,7 @@ - roblabla - rodja.trappe - rski+- sdhoward - shreevatsa.public - takahashim - taotieren@@ -414,9 +424,11 @@ - tgkokk - the-solipsist - thsutton+- thron7 - timo-a - vijayphoenix - vkraven+- wgevaert - wiefling - willj-dev - wuffi
CONTRIBUTING.md view
@@ -213,9 +213,10 @@ 9. It is better not to introduce new dependencies. Dependencies on external C libraries should especially be avoided. -10. We aim for compatibility with ghc versions from 8.0 to the- latest release. All pull requests and commits are tested- automatically on GitHub Actions.+10. We aim for compatibility with at least the last three+ released ghc versions, and sometimes more. Currently pandoc+ can be compiled on ghc 8.6 an higher. All pull requests and+ commits are tested automatically on GitHub Actions. Tests -----
INSTALL.md view
@@ -37,7 +37,7 @@ Or, you can install pandoc using [winget](https://github.com/microsoft/winget-pkgs): - winget install pandoc+ winget install --source winget --exact --id JohnMacFarlane.Pandoc Using multiple installation methods can result in two separate installations of pandoc; it is recommended to properly uninstall@@ -235,11 +235,10 @@ on linux/unix/macOS and in `%APPDATA%\cabal\bin` on Windows. Make sure this directory is in your path. - If you want to install a modified or development version- of pandoc instead, switch to the source directory and do- as above, but without the 'pandoc':-- cabal install+ If you want to install a modified or development version of+ pandoc instead, switch to the source directory before running+ the above command -- cabal will use the local code for all+ projects mentioned in the `cabal.project`. 4. You should now be able to run `pandoc`: @@ -377,7 +376,7 @@ [MiKTeX]: https://miktex.org/ [librsvg]: https://wiki.gnome.org/Projects/LibRsvg [Python]: https://www.python.org-[NetBSD]: https://pkgsrc.se/wip/pandoc+[NetBSD]: https://pkgsrc.se/converters/pandoc [NixOS]: https://nixos.org/nixos/packages.html [Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv= [Ubuntu]: https://packages.ubuntu.com/pandoc
MANUAL.txt view
@@ -1,7 +1,7 @@ --- title: Pandoc User's Guide author: John MacFarlane-date: March 26, 2023+date: June 6, 2023 --- # Synopsis@@ -268,6 +268,7 @@ - `textile` ([Textile]) - `tikiwiki` ([TikiWiki markup]) - `twiki` ([TWiki markup])+ - `typst` ([typst]) - `vimwiki` ([Vimwiki]) - the path of a custom Lua reader, see [Custom readers and writers] below :::@@ -381,7 +382,9 @@ looking at the output of `pandoc --version`. Data files placed in this directory (for example, `reference.odt`, `reference.docx`, `epub.css`, `templates`) will override- pandoc's normal defaults.+ pandoc's normal defaults. (Note that the user data directory+ is not created by pandoc, so you will need to create it yourself+ if you want to make use of it.) `-d` *FILE*, `--defaults=`*FILE* @@ -2177,7 +2180,7 @@ opening and closing delimiter must match in each case. The opening delimiter may be followed by one or more spaces or tabs, which will be ignored. The closing delimiter may-be followed by one or more spaces or tabs, which will be+be preceded by one or more spaces or tabs, which will be ignored. To include a literal `$` in the document, use `$$`.@@ -3089,7 +3092,7 @@ `toc` : include table of contents (can also be set using `--toc/--table-of-contents`)- + `urlstyle` : typeface style for links without link text, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`@@ -4166,6 +4169,8 @@ #. one #. two +Note: the '`#`' ordered list marker doesn't work with `commonmark`.+ #### Extension: `startnum` #### Pandoc also pays attention to the type of list marker used, and to the@@ -4485,7 +4490,7 @@ | Temperature +-------+----------+ | 1961-1990 | mean | 14 °C | | +-------+----------+- | | min | 56.7 °C |+ | | max | 56.7 °C | +-------------+-------+----------+ A table header may contain more than one row:@@ -4878,18 +4883,6 @@ feas*ible*, not feas*able*. -### Highlighting ###--To highlight text, use the `mark` class:-- [Mark]{.mark}--Or, without the `bracketed_spans` extension (but with `native_spans`):-- <span class="mark">Mark</span>--This will work in html output.- ### Strikeout ### #### Extension: `strikeout` ####@@ -4976,7 +4969,19 @@ This will work in all output formats that support small caps. +### Highlighting ### +To highlight text, use the `mark` class:++ [Mark]{.mark}++Or, without the `bracketed_spans` extension (but with `native_spans`):++ <span class="mark">Mark</span>++This will work in all output formats that support highlighting.++ ## Math #### Extension: `tex_math_dollars` ####@@ -5433,6 +5438,10 @@ starts with a fence containing at least three consecutive colons plus some attributes. The attributes may optionally be followed by another string of consecutive colons.++Note: the `commonmark` parser doesn't permit colons after+the attributes.+ The attribute syntax is exactly as in fenced code blocks (see [Extension: `fenced_code_attributes`]). As with fenced code blocks, one can use either attributes in curly braces@@ -5876,6 +5885,22 @@ Oxygen is O~2. +#### Extension: `wikilinks_title_after_pipe` ####++Pandoc supports multiple markdown wikilink syntaxes, regardless of+whether the title is before or after the pipe.++Using `--from=markdown+wikilinks_title_after_pipe` results in+```[[Wiki]]+[[URL|title]]+```++while using `--from=markdown+wikilinks_title_before_pipe` results+in+```[[Wiki]]+[[title|URL]]+```+ ## Markdown variants In addition to pandoc's extended Markdown, the following Markdown@@ -5911,7 +5936,7 @@ To use this feature, you will need to have -- a document containing citations (see [Extension: `citations`]);+- a document containing citations (see [Citation syntax]); - a source of bibliographic data: either an external bibliography file or a list of `references` in the document's YAML metadata; - optionally, a [CSL] citation style.@@ -7202,7 +7227,7 @@ [Lua]: https://www.lua.org [lpeg]: http://www.inf.puc-rio.br/~roberto/lpeg/-[djot-writer.lua]: https://github.com/jgm/djot/blob/main/djot-writer.lua+[djot-writer.lua]: https://github.com/jgm/djot.lua/blob/main/djot-writer.lua # Reproducible builds
README.md view
@@ -90,11 +90,12 @@ - `rst` ([reStructuredText](https://docutils.sourceforge.io/docs/ref/rst/introduction.html)) - `t2t` ([txt2tags](https://txt2tags.org))-- `textile` ([Textile](https://www.promptworks.com/textile))+- `textile` ([Textile](https://textile-lang.com)) - `tikiwiki` ([TikiWiki markup](https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax)) - `twiki` ([TWiki markup](https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules))+- `typst` ([typst](https://typst.app)) - `vimwiki` ([Vimwiki](https://vimwiki.github.io)) - the path of a custom Lua reader, see [Custom readers and writers](https://pandoc.org/MANUAL.html#custom-readers-and-writers)@@ -186,7 +187,7 @@ - `rtf` ([Rich Text Format](https://en.wikipedia.org/wiki/Rich_Text_Format)) - `texinfo` ([GNU Texinfo](https://www.gnu.org/software/texinfo/))-- `textile` ([Textile](https://www.promptworks.com/textile))+- `textile` ([Textile](https://textile-lang.com)) - `slideous` ([Slideous](https://goessner.net/articles/slideous/) HTML and JavaScript slide show) - `slidy` ([Slidy](https://www.w3.org/Talks/Tools/Slidy2/) HTML and
changelog.md view
@@ -1,5 +1,189 @@ # Revision history for pandoc +## pandoc 3.1.3 (2023-06-07)++ * New output format: `typst`.++ * New module: Text.Pandoc.Readers.Typst [API change].++ * DocBook reader:++ + Support more emphasis roles (Albert Krewinkel).+ The role "bf" is taken to indicate "bold face", i.e.,+ "strongly emphasized" text, while "underline" leads to+ underlined text.++ * JATS reader:++ + Improve title and label parsing in the JATS reader (#8718,+ Noah Malmed.)+ + Add rowspan, colspan and alignment to cells in jats table+ reader (#8408, Noah Malmed)++ * Org reader (Albert Krewinkel):++ + Require abstract environment to use lowercase.+ + Treat `#+NAME` as synonym for `#+LABEL` (#8578).++ * ODT reader:++ + Allow lists in table cells (#8892).+ + Allow frames inside spans (#8886).++ * RST reader:++ + Fix sorting on anonymous keys (#8877). This fixes a link+ resolution bug bug affecting RST documents with anonymous links.++ * HTML reader:++ + Fix iframe with data URI of an image (#8856).+ In this case we don't want to try to parse the data at the URL.+ Instead, create an image inside a div.++ * RTF reader:++ + Fix bug in table parsing (#8767). In certain cases, text before a+ table was being incorporated into the table itself.++ * Docx reader:++ + Introduce support for Intense Quote (Stephan Meijer).++ * Markdown reader:++ + Disallow escaping of `~` and `"` in `markdown_strict` (#8777,+ Albert Krewinkel). This matches the behavior of the legacy+ `Markdown.pl` as well as what is described in the manual.++ * LaTeX reader: ignore args to column type in `\multicolumn` (#8789).++ * HTML writer:++ + Use first paragraph in task item as checkbox label (#8729, Albert+ Krewinkel).++ * Ms writer:++ + Coerce titles to inlines (#8835). Block-level formatting is not+ allowed inside `.TL`.++ * LaTeX writer:++ + Fix width for multicolumn simple table (#8831).++ * Jira writer:++ + Use first code block class as highlighting language (#8814, Albert+ Krewinkel). The writer no longer searches the list of+ classes for a known programming language but always uses+ the first class in that list as the language identifier.++ * OpenDocument writer:++ + Handle row header column cells as header cells (#8764, Michael Stahl).+ + Fix invalid `text:p` inside `text:p` from meta (#8256).++ * ODT writer:++ + Don't add settings.xml (Michael Stahl). This will cause defaults+ to be used, which is what we want.+ + Don't add unnecessary Configurations2 directory (Michael Stahl).+ + Don't add thumbnail (Michael Stahl).+ + Put `manifest.version` on directory file-entry (Michael Stahl).+ See ODF 1.3 part 2, 4.16.14.1.+ + Stop validator complaints by producing ODF 1.3 (Michael Stahl).++ * MediaWiki writer:++ + Remove links from inside links in mediawiki writer (#8739,+ Wout Gevaert).++ * Typst writer:++ + Omit bibliography if `citations` not enabled (#8763).+ With this change, the typst writer will omit the `#bibliography`+ command when `citations` is not enabled. (If you want to use+ pandoc's own `--citeproc`, you should combine it with+ `-t typst-citations` to disable native typst citations.+ + Use `<..>` for labels, create internal links.+ + Use `#footnote` for notes (#8893).+ + Fix alignment issue in lists. It's an aesthetic issue+ only; the first line had an extra space indent after the+ list marker.++ * Commonmark writer:++ + Use shortcut reference links: commonmark supports these.++ * EPUB template: add `lang` attribute to `<html>` (Gabriel Lewertoski).++ * Template styles.html: fix task-list styling in reveal.js+ (#8731, Albert Krewinkel).++ * LaTeX template: Fix `\babelfont` (#8728).++ * Text.Pandoc.Parsing:++ + Remove unnecessary 'spaces' in `parseFromString`.++ * Text.Pandoc.ImageSize: Drop BOM at start of SVG if present.+ Otherwise our code can fail to determine image size.++ * Lua subsystem:++ + Fix value of PANDOC_SCRIPT_FILE for custom readers & writers+ (#8781, Albert Krewinkel). The value did not hold the actual+ file path for scripts in the *custom* folder of the datadir.++ * Fix YAML in translation files for `cs` and `pl` (#8787).++ * Fix pdf output via typst (#8754). One must now use `typst+ compile` rather than `typst`.++ * MANUAL.txt:++ + Added note that the user will need to create the user data+ dir (#8727).+ + Add `wikilinks` to non-default extensions (Ilona).+ + Update link to custom djot writer (Albert Krewinkel).+ + Better link to citation syntax.+ + Fix typo (sdhoward).+ + Note that `#` fancy list markers don't work with commonmark (#8772,+ William Lupton).+ + Add commonmark `fenced_div` note (#8773, William Lupton).+ + Move highlighting documentation, with minor adjustments+ (William Lupton).+ + Fix inaccurate statement about spaces and tabs in template+ syntax+ (Frank Seifferth).++ * Update documentation for org-mode (Christian Christiansen, #8716).++ * doc/lua-filter.md:++ + Fix typos (#8734, perro tuerto).+ + Fix anchor (Toni Dietze).+ + Use full field name in example (#8857, Matt Dodson).+ + Fix copy-paste error (#8798, thron7).++ * CONTRIBUTING.md: update info on ghc versions.++ * INSTALL.md:++ + Fix cabal install instructions (Albert Krewinkel).+ + Use more relevant link to NetBSD/pkgsrc entry (Charlotte Koch).+ + Fix Windows install instructions for winget (#8799).++ * Tests: Rename test/docx/block_quotes_parse_indent.native for+ consistency (Stephan Meijer).++ * Add `tls` constraint on cabal.project. This is needed to+ avoid problems caused by the transition to `crypton`.++ * Require texmath 0.12.8.++ ## pandoc 3.1.2 (2023-03-26) * Add a Lua REPL (Albert Krewinkel). This can be started
− data/odt/Configurations2/accelerator/current.xml
data/odt/META-INF/manifest.xml view
@@ -1,12 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?>-<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">- <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.text"/>+<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.3">+ <manifest:file-entry manifest:full-path="/" manifest:version="1.3" manifest:media-type="application/vnd.oasis.opendocument.text"/> <manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/>- <manifest:file-entry manifest:full-path="settings.xml" manifest:media-type="text/xml"/> <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/>- <manifest:file-entry manifest:full-path="Thumbnails/thumbnail.png" manifest:media-type="image/png"/> <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/>- <manifest:file-entry manifest:full-path="Configurations2/accelerator/current.xml" manifest:media-type=""/>- <manifest:file-entry manifest:full-path="Configurations2/" manifest:media-type="application/vnd.sun.xml.ui.configuration"/> <manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/> </manifest:manifest>
− data/odt/Thumbnails/thumbnail.png
binary file changed (785 → absent bytes)
data/odt/content.xml view
@@ -1,2 +1,2 @@ <?xml version="1.0" encoding="UTF-8"?>-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"><office:scripts/><office:font-face-decls><style:font-face style:name="StarSymbol" svg:font-family="StarSymbol"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Lucida Sans Unicode" svg:font-family="'Lucida Sans Unicode'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Footer"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/></style:style></office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="Standard">Hello World!</text:p></office:text></office:body></office:document-content>+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.3"><office:scripts/><office:font-face-decls><style:font-face style:name="StarSymbol" svg:font-family="StarSymbol"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Courier New" svg:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/><style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Lucida Sans Unicode" svg:font-family="'Lucida Sans Unicode'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Footer"><style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/></style:style></office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:p text:style-name="Standard">Hello World!</text:p></office:text></office:body></office:document-content>
data/odt/meta.xml view
@@ -6,7 +6,7 @@ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#"- office:version="1.2">+ office:version="1.3"> <office:meta> <meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0"
− data/odt/settings.xml
@@ -1,2 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>-<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" office:version="1.2"><office:settings><config:config-item-set config:name="ooo:view-settings"><config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item><config:config-item config:name="ViewAreaLeft" config:type="int">0</config:config-item><config:config-item config:name="ViewAreaWidth" config:type="int">21747</config:config-item><config:config-item config:name="ViewAreaHeight" config:type="int">10874</config:config-item><config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item><config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item><config:config-item-map-indexed config:name="Views"><config:config-item-map-entry><config:config-item config:name="ViewId" config:type="string">view2</config:config-item><config:config-item config:name="ViewLeft" config:type="int">3041</config:config-item><config:config-item config:name="ViewTop" config:type="int">3041</config:config-item><config:config-item config:name="VisibleLeft" config:type="int">0</config:config-item><config:config-item config:name="VisibleTop" config:type="int">0</config:config-item><config:config-item config:name="VisibleRight" config:type="int">21745</config:config-item><config:config-item config:name="VisibleBottom" config:type="int">10873</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item><config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item><config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item><config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item></config:config-item-map-entry></config:config-item-map-indexed></config:config-item-set><config:config-item-set config:name="ooo:configuration-settings"><config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item><config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item><config:config-item config:name="Rsid" config:type="int">1473719</config:config-item><config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item><config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item><config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item><config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item><config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseCommand" config:type="string"/><config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item><config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item><config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item><config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item><config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item><config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item><config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item><config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item><config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item><config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item><config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item><config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item><config:config-item config:name="PrintEmptyPages" config:type="boolean">false</config:config-item><config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item><config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item><config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item><config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item><config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item><config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item><config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item><config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item><config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item><config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item><config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item><config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item><config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item><config:config-item config:name="RsidRoot" config:type="int">1473719</config:config-item><config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item><config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item><config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item><config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item><config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/><config:config-item config:name="PrinterSetup" config:type="base64Binary"/><config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item><config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item><config:config-item config:name="PrinterName" config:type="string"/><config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item><config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item><config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item><config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item><config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item><config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item><config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item><config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item><config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item><config:config-item config:name="PrintFaxName" config:type="string"/><config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item><config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item><config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item><config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item><config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item><config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item><config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item><config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item><config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/><config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item><config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item><config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item><config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item><config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item><config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item></config:config-item-set></office:settings></office:document-settings>
data/odt/styles.xml view
@@ -27,7 +27,7 @@ xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"-xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">+xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.3"> <office:font-face-decls> <style:font-face style:name="StarSymbol" svg:font-family="StarSymbol" />
data/templates/default.epub2 view
@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">-<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ xml:lang="$lang$"$endif$>+<html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" />
data/templates/default.epub3 view
@@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html>-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$> <head> <meta charset="utf-8" /> <meta name="generator" content="pandoc" />
data/templates/default.latex view
@@ -363,7 +363,7 @@ $if(mainfont)$ \ifPDFTeX \else-\babelfont[$babel-lang$]{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}+\babelfont{rm}[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} \fi $endif$ $endif$
data/templates/default.opendocument view
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" ?>-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.2">+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.3"> <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>
data/templates/default.typst view
@@ -82,16 +82,7 @@ $body$ -$if(notes)$-#v(1em)-#block[-#horizontalrule-#set text(size: .88em)-#v(3pt) // otherwise first note marker is swallowed, bug?--$notes$-]-$endif$+$if(citations)$ $if(bibliographystyle)$ #set bibliography(style: "$bibliographystyle$")@@ -100,6 +91,7 @@ #bibliography("$bibliography$") $endfor$+$endif$ $for(include-after)$ $include-after$
data/templates/styles.html view
@@ -176,8 +176,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}-ul.task-list{list-style: none;}+/* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
data/translations/cs.yaml view
@@ -1,7 +1,7 @@ Abstract: Abstrakt Appendix: Dodatek Bibliography: Literatura-Cc: Na vědomí:+Cc: 'Na vědomí:' Chapter: Kapitola Contents: Obsah Encl: Příloha
data/translations/pl.yaml view
@@ -1,7 +1,7 @@ Abstract: Streszczenie Appendix: Dodatek Bibliography: Bibliografia-Cc: Kopie:+Cc: 'Kopie:' Chapter: Rozdział Contents: Spis treści Encl: Załącznik
man/pandoc.1 view
@@ -1,4 +1,4 @@-.\" Automatically generated by Pandoc 3.0.1+.\" Automatically generated by Pandoc 3.1.2 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font.@@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\}-.TH "Pandoc User\[cq]s Guide" "" "March 26, 2023" "pandoc 3.1.2" ""+.TH "Pandoc User\[cq]s Guide" "" "June 6, 2023" "pandoc 3.1.3" "" .hy .SH NAME pandoc - general markup converter@@ -321,6 +321,8 @@ .IP \[bu] 2 \f[V]twiki\f[R] (TWiki markup) .IP \[bu] 2+\f[V]typst\f[R] (typst)+.IP \[bu] 2 \f[V]vimwiki\f[R] (Vimwiki) .IP \[bu] 2 the path of a custom Lua reader, see Custom readers and writers below@@ -499,6 +501,8 @@ Data files placed in this directory (for example, \f[V]reference.odt\f[R], \f[V]reference.docx\f[R], \f[V]epub.css\f[R], \f[V]templates\f[R]) will override pandoc\[cq]s normal defaults.+(Note that the user data directory is not created by pandoc, so you will+need to create it yourself if you want to make use of it.) .TP \f[V]-d\f[R] \f[I]FILE\f[R], \f[V]--defaults=\f[R]\f[I]FILE\f[R] Specify a set of default option settings.@@ -2195,7 +2199,7 @@ closing delimiter must match in each case. The opening delimiter may be followed by one or more spaces or tabs, which will be ignored.-The closing delimiter may be followed by one or more spaces or tabs,+The closing delimiter may be preceded by one or more spaces or tabs, which will be ignored. .PP To include a literal \f[V]$\f[R] in the document, use \f[V]$$\f[R].@@ -4431,6 +4435,9 @@ #. two \f[R] .fi+.PP+Note: the `\f[V]#\f[R]' ordered list marker doesn\[cq]t work with+\f[V]commonmark\f[R]. .SS Extension: \f[V]startnum\f[R] .PP Pandoc also pays attention to the type of list marker used, and to the@@ -4826,7 +4833,7 @@ | Temperature +-------+----------+ | 1961-1990 | mean | 14 °C | | +-------+----------+-| | min | 56.7 °C |+| | max | 56.7 °C | +-------------+-------+----------+ \f[R] .fi@@ -5341,26 +5348,6 @@ feas*ible*, not feas*able*. \f[R] .fi-.SS Highlighting-.PP-To highlight text, use the \f[V]mark\f[R] class:-.IP-.nf-\f[C]-[Mark]{.mark}-\f[R]-.fi-.PP-Or, without the \f[V]bracketed_spans\f[R] extension (but with-\f[V]native_spans\f[R]):-.IP-.nf-\f[C]-<span class=\[dq]mark\[dq]>Mark</span>-\f[R]-.fi-.PP-This will work in html output. .SS Strikeout .SS Extension: \f[V]strikeout\f[R] .PP@@ -5486,6 +5473,26 @@ .fi .PP This will work in all output formats that support small caps.+.SS Highlighting+.PP+To highlight text, use the \f[V]mark\f[R] class:+.IP+.nf+\f[C]+[Mark]{.mark}+\f[R]+.fi+.PP+Or, without the \f[V]bracketed_spans\f[R] extension (but with+\f[V]native_spans\f[R]):+.IP+.nf+\f[C]+<span class=\[dq]mark\[dq]>Mark</span>+\f[R]+.fi+.PP+This will work in all output formats that support highlighting. .SS Math .SS Extension: \f[V]tex_math_dollars\f[R] .PP@@ -6054,6 +6061,10 @@ plus some attributes. The attributes may optionally be followed by another string of consecutive colons.+.PP+Note: the \f[V]commonmark\f[R] parser doesn\[cq]t permit colons after+the attributes.+.PP The attribute syntax is exactly as in fenced code blocks (see Extension: \f[V]fenced_code_attributes\f[R]). As with fenced code blocks, one can use either attributes in curly@@ -6556,6 +6567,27 @@ Oxygen is O\[ti]2. \f[R] .fi+.SS Extension: \f[V]wikilinks_title_after_pipe\f[R]+.PP+Pandoc supports multiple markdown wikilink syntaxes, regardless of+whether the title is before or after the pipe.+.PP+Using \f[V]--from=markdown+wikilinks_title_after_pipe\f[R] results in+.IP+.nf+\f[C]+[[URL|title]]+\f[R]+.fi+.PP+while using \f[V]--from=markdown+wikilinks_title_before_pipe\f[R]+results in+.IP+.nf+\f[C]+[[title|URL]]+\f[R]+.fi .SS Markdown variants .PP In addition to pandoc\[cq]s extended Markdown, the following Markdown@@ -6605,7 +6637,7 @@ .PP To use this feature, you will need to have .IP \[bu] 2-a document containing citations (see Extension: \f[V]citations\f[R]);+a document containing citations (see Citation syntax); .IP \[bu] 2 a source of bibliographic data: either an external bibliography file or a list of \f[V]references\f[R] in the document\[cq]s YAML metadata;
pandoc.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: pandoc-version: 3.1.2+version: 3.1.3 build-type: Simple license: GPL-2.0-or-later license-file: COPYING.md@@ -125,9 +125,6 @@ data/odt/styles.xml data/odt/content.xml data/odt/meta.xml- data/odt/settings.xml- data/odt/Configurations2/accelerator/current.xml- data/odt/Thumbnails/thumbnail.png data/odt/META-INF/manifest.xml -- source files for reference.pptx data/pptx/_rels/.rels@@ -518,7 +515,7 @@ syb >= 0.1 && < 0.8, tagsoup >= 0.14.6 && < 0.15, temporary >= 1.1 && < 1.4,- texmath >= 0.12.7 && < 0.13,+ texmath >= 0.12.8 && < 0.13, text >= 1.1.1.0 && < 2.1, text-conversions >= 0.3 && < 0.4, time >= 1.5 && < 1.14,@@ -527,7 +524,9 @@ yaml >= 0.11 && < 0.12, zip-archive >= 0.4.3 && < 0.5, zlib >= 0.5 && < 0.7,- xml >= 1.3.12 && < 1.4+ xml >= 1.3.12 && < 1.4,+ typst >= 0.1 && < 0.2,+ vector >= 0.12 && < 0.14 if !os(windows) build-depends: unix >= 2.4 && < 2.9@@ -583,6 +582,7 @@ Text.Pandoc.Readers.Ipynb, Text.Pandoc.Readers.CSV, Text.Pandoc.Readers.RTF,+ Text.Pandoc.Readers.Typst, Text.Pandoc.Writers, Text.Pandoc.Writers.Native, Text.Pandoc.Writers.DocBook,@@ -683,6 +683,8 @@ Text.Pandoc.Readers.LaTeX.Parsing, Text.Pandoc.Readers.LaTeX.SIunitx, Text.Pandoc.Readers.LaTeX.Table,+ Text.Pandoc.Readers.Typst.Parsing,+ Text.Pandoc.Readers.Typst.Math, Text.Pandoc.Readers.ODT.Base, Text.Pandoc.Readers.ODT.Namespaces, Text.Pandoc.Readers.ODT.StyleReader,
src/Text/Pandoc/Data.hs view
@@ -123,9 +123,6 @@ "styles.xml", "content.xml", "meta.xml",- "settings.xml",- "Configurations2/accelerator/current.xml",- "Thumbnails/thumbnail.png", "META-INF/manifest.xml"] let pathToEntry path = do epochtime <- floor `fmap` getPOSIXTime contents <- (BL.fromChunks . (:[])) `fmap`
src/Text/Pandoc/Format.hs view
@@ -220,6 +220,7 @@ ".text" -> defFlavor "markdown" ".textile" -> defFlavor "textile" ".tsv" -> defFlavor "tsv"+ ".typ" -> defFlavor "typst" ".txt" -> defFlavor "markdown" ".typ" -> defFlavor "typst" ".wiki" -> defFlavor "mediawiki"
src/Text/Pandoc/ImageSize.hs view
@@ -97,6 +97,12 @@ (T.unsnoc -> Just (xs, '.')) -> xs xs -> xs +dropBOM :: ByteString -> ByteString+dropBOM bs =+ if "\xEF\xBB\xBF" `B.isPrefixOf` bs+ then B.drop 3 bs+ else bs+ imageType :: ByteString -> Maybe ImageType imageType img = case B.take 4 img of "\x89\x50\x4e\x47" -> return Png@@ -116,7 +122,9 @@ "\x01\x00\x00\x00" | B.take 4 (B.drop 40 img) == " EMF" -> return Emf- _ -> mzero+ "\xEF\xBB\xBF<" -- BOM before svg+ -> imageType (B.drop 3 img)+ _ -> mzero findSvgTag :: ByteString -> Bool findSvgTag img = "<svg" `B.isInfixOf` img || "<SVG" `B.isInfixOf` img@@ -333,7 +341,7 @@ svgSize :: WriterOptions -> ByteString -> Maybe ImageSize svgSize opts img = do doc <- either (const mzero) return $ parseXMLElement- $ TL.fromStrict $ UTF8.toText img+ $ TL.fromStrict $ UTF8.toText $ dropBOM img let viewboxSize = do vb <- findAttrBy (== QName "viewBox" Nothing Nothing) doc [_,_,w,h] <- mapM safeRead (T.words vb)
src/Text/Pandoc/PDF.hs view
@@ -95,7 +95,8 @@ "typst" -> do source <- writer opts doc verbosity <- getVerbosity- liftIO $ toPdfViaTempFile verbosity program pdfargs (:[]) source+ liftIO $+ toPdfViaTempFile verbosity program ("compile":pdfargs) (:[]) source "pdfroff" -> do source <- writer opts doc let paperargs =
src/Text/Pandoc/Parsing/General.hs view
@@ -421,7 +421,6 @@ setInput $ toSources str setPosition $ initialPos $ sourceName oldPos <> "_chunk" result <- parser- spaces setInput oldInput setPosition oldPos return result
src/Text/Pandoc/Readers.hs view
@@ -60,6 +60,7 @@ , readEndNoteXML , readRIS , readRTF+ , readTypst -- * Miscellaneous , getReader , getDefaultExtensions@@ -109,6 +110,7 @@ import Text.Pandoc.Readers.EndNote import Text.Pandoc.Readers.RIS import Text.Pandoc.Readers.RTF+import Text.Pandoc.Readers.Typst import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Sources (ToSources(..), sourcesToText) @@ -160,6 +162,7 @@ ,("endnotexml" , TextReader readEndNoteXML) ,("ris" , TextReader readRIS) ,("rtf" , TextReader readRTF)+ ,("typst" , TextReader readTypst) ] -- | Retrieve reader, extensions based on format spec (format+extensions).
src/Text/Pandoc/Readers/DocBook.hs view
@@ -1294,9 +1294,11 @@ return $ linkWith attr href "" ils' "foreignphrase" -> innerInlines emph "emphasis" -> case attrValue "role" e of+ "bf" -> innerInlines strong "bold" -> innerInlines strong "strong" -> innerInlines strong "strikethrough" -> innerInlines strikeout+ "underline" -> innerInlines underline _ -> innerInlines emph "footnote" -> note . mconcat <$> mapM parseBlock (elContent e)
src/Text/Pandoc/Readers/Docx.hs view
@@ -23,7 +23,7 @@ - [X] Para - [X] CodeBlock (styled with `SourceCode`)- - [X] BlockQuote (styled with `Quote`, `BlockQuote`, or, optionally,+ - [X] BlockQuote (styled with `Quote`, `BlockQuote`, `Intense Quote` or, optionally, indented) - [X] OrderedList - [X] BulletList@@ -244,7 +244,7 @@ isBlockQuote :: ParStyle -> Bool isBlockQuote = isInheritedFromStyles [- "Quote", "Block Text", "Block Quote", "Block Quotation"+ "Quote", "Block Text", "Block Quote", "Block Quotation", "Intense Quote" ] runElemToInlines :: RunElem -> Inlines
src/Text/Pandoc/Readers/HTML.hs view
@@ -476,11 +476,18 @@ if T.null url then ignore $ renderTags' [tag, TagClose "iframe"] else catchError- (do (bs, _) <- openURL url- let inp = UTF8.toText bs- opts <- readerOpts <$> getState- Pandoc _ contents <- readHtml opts inp- return $ B.divWith ("",["iframe"],[]) $ B.fromList contents)+ (do (bs, mbMime) <- openURL url+ case mbMime of+ Just mt+ | "text/html" `T.isPrefixOf` mt -> do+ let inp = UTF8.toText bs+ opts <- readerOpts <$> getState+ Pandoc _ contents <- readHtml opts inp+ return $ B.divWith ("",["iframe"],[]) $ B.fromList contents+ | "image/" `T.isPrefixOf` mt -> do+ return $ B.divWith ("",["iframe"],[]) $+ B.plain $ B.image url "" mempty+ _ -> return $ B.divWith ("",["iframe"],[("src", url)]) $ mempty) (\e -> do logMessage $ CouldNotFetchResource url (renderError e) ignore $ renderTags' [tag, TagClose "iframe"])
src/Text/Pandoc/Readers/JATS.hs view
@@ -161,23 +161,42 @@ then return mempty else return $ plain $ trimInlines $ text s parseBlock (CRef x) = return $ plain $ str $ T.toUpper x-parseBlock (Elem e) =+parseBlock (Elem e) = do+ sectionLevel <- gets jatsSectionLevel+ let parseBlockWithHeader = wrapWithHeader (sectionLevel+1) (getBlocks e)+ case qName (elName e) of "p" -> parseMixed para (elContent e) "code" -> codeBlockWithLang "preformat" -> codeBlockWithLang- "disp-quote" -> parseBlockquote- "list" -> case attrValue "list-type" e of- "bullet" -> bulletList <$> listitems- listType -> do- let start = fromMaybe 1 $- (filterElement (named "list-item") e- >>= filterElement (named "label"))- >>= safeRead . textContent- orderedListWith (start, parseListStyleType listType, DefaultDelim)- <$> listitems- "def-list" -> definitionList <$> deflistitems- "sec" -> gets jatsSectionLevel >>= sect . (+1)+ "disp-quote" -> wrapWithHeader (sectionLevel+1) parseBlockquote+ "list" -> wrapWithHeader (sectionLevel+1) parseList+ "def-list" -> wrapWithHeader (sectionLevel+1) (definitionList <$> deflistitems)+ "sec" -> parseBlockWithHeader+ "abstract" -> parseBlockWithHeader+ "ack" -> parseBlockWithHeader+ "answer" -> parseBlockWithHeader+ "answer-set" -> parseBlockWithHeader+ "app" -> parseBlockWithHeader+ "app-group" -> parseBlockWithHeader+ "author-comment" -> parseBlockWithHeader+ "author-notes" -> parseBlockWithHeader+ "back" -> parseBlockWithHeader+ "bio" -> parseBlockWithHeader+ "explanation" -> parseBlockWithHeader+ "glossary" -> parseBlockWithHeader+ "kwd-group" -> parseBlockWithHeader+ "list-item" -> parseBlockWithHeader+ "notes" -> parseBlockWithHeader+ "option" -> parseBlockWithHeader+ "question" -> parseBlockWithHeader+ "question-preamble" -> parseBlockWithHeader+ "question-wrap-group" -> parseBlockWithHeader+ "statement" -> parseBlockWithHeader+ "supplement" -> parseBlockWithHeader+ "table-wrap-foot" -> parseBlockWithHeader+ "trans-abstract" -> parseBlockWithHeader+ "verse-group" -> parseBlockWithHeader "graphic" -> para <$> getGraphic Nothing e "journal-meta" -> parseMetadata e "article-meta" -> parseMetadata e@@ -194,7 +213,7 @@ inFigure <- gets jatsInFigure if inFigure -- handled by parseFigure then return mempty- else divWith (attrValue "id" e, ["caption"], []) <$> sect 6+ else divWith (attrValue "id" e, ["caption"], []) <$> wrapWithHeader 6 (getBlocks e) "fn-group" -> parseFootnoteGroup "ref-list" -> parseRefList e "?xml" -> return mempty@@ -223,6 +242,18 @@ mapM parseInline (elContent z) contents <- getBlocks e return $ blockQuote (contents <> attrib)+ parseList = do+ case attrValue "list-type" e of+ "bullet" -> bulletList <$> listitems+ listType -> do+ let start =+ fromMaybe 1 $+ ( filterElement (named "list-item") e+ >>= filterElement (named "label")+ )+ >>= safeRead . textContent+ orderedListWith (start, parseListStyleType listType, DefaultDelim)+ <$> listitems parseListStyleType "roman-lower" = LowerRoman parseListStyleType "roman-upper" = UpperRoman parseListStyleType "alpha-lower" = LowerAlpha@@ -268,26 +299,29 @@ Just c -> filterChildren isColspec c _ -> filterChildren isColspec e' let isRow x = named "row" x || named "tr" x- headrows <- case filterChild (named "thead") e' of- Just h -> case filterChild isRow h of- Just x -> parseRow x- Nothing -> return []- Nothing -> return []- bodyrows <- case filterChild (named "tbody") e' of- Just b -> mapM parseRow- $ filterChildren isRow b- Nothing -> mapM parseRow- $ filterChildren isRow e'++ -- list of header cell elements+ let headRowElements = case filterChild (named "thead") e' of+ Just h -> maybe [] parseElement (filterChild isRow h)+ Nothing -> []+ -- list of list of body cell elements+ let bodyRowElements = case filterChild (named "tbody") e' of+ Just b -> map parseElement $ filterChildren isRow b+ Nothing -> map parseElement $ filterChildren isRow e' let toAlignment c = case findAttr (unqual "align") c of Just "left" -> AlignLeft Just "right" -> AlignRight Just "center" -> AlignCenter _ -> AlignDefault+ let toColSpan element = fromMaybe 1 $+ findAttr (unqual "colspan") element >>= safeRead+ let toRowSpan element = fromMaybe 1 $+ findAttr (unqual "rowspan") element >>= safeRead let toWidth c = do w <- findAttr (unqual "colwidth") c n <- safeRead $ "0" <> T.filter (\x -> isDigit x || x == '.') w if n > 0 then Just n else Nothing- let numrows = foldl' max 0 $ map length bodyrows+ let numrows = foldl' max 0 $ map length bodyRowElements let aligns = case colspecs of [] -> replicate numrows AlignDefault cs -> map toAlignment cs@@ -298,33 +332,43 @@ Just ws' -> let tot = sum ws' in ColWidth . (/ tot) <$> ws' Nothing -> replicate numrows ColWidthDefault- let toRow = Row nullAttr . map simpleCell- toHeaderRow l = [toRow l | not (null l)]++ let parseCell = parseMixed plain . elContent+ let elementToCell element = cell+ (toAlignment element)+ (RowSpan $ toRowSpan element)+ (ColSpan $ toColSpan element)+ <$> (parseCell element)+ let rowElementsToCells elements = mapM elementToCell elements+ let toRow = fmap (Row nullAttr) . rowElementsToCells+ toHeaderRow element = sequence $ [toRow element | not (null element)]++ headerRow <- toHeaderRow headRowElements+ bodyRows <- mapM toRow bodyRowElements return $ table (simpleCaption $ plain capt) (zip aligns widths)- (TableHead nullAttr $ toHeaderRow headrows)- [TableBody nullAttr 0 [] $ map toRow bodyrows]+ (TableHead nullAttr headerRow)+ [TableBody nullAttr 0 [] bodyRows] (TableFoot nullAttr []) isEntry x = named "entry" x || named "td" x || named "th" x- parseRow = mapM (parseMixed plain . elContent) . filterChildren isEntry- sect n = do isbook <- gets jatsBook- let n' = if isbook || n == 0 then n + 1 else n- labelText <- case filterChild (named "label") e of- Just t -> (<> ("." <> space)) <$>- getInlines t- Nothing -> return mempty- headerText <- case filterChild (named "title") e `mplus`- (filterChild (named "info") e >>=- filterChild (named "title")) of- Just t -> (labelText <>) <$>- getInlines t- Nothing -> return mempty- oldN <- gets jatsSectionLevel- modify $ \st -> st{ jatsSectionLevel = n }- b <- getBlocks e- let ident = attrValue "id" e- modify $ \st -> st{ jatsSectionLevel = oldN }- return $ headerWith (ident,[],[]) n' headerText <> b+ parseElement = filterChildren isEntry+ wrapWithHeader n mBlocks = do+ isBook <- gets jatsBook+ let n' = if isBook || n == 0 then n + 1 else n+ headerText <- case filterChild (named "title") e `mplus`+ (filterChild (named "info") e >>=+ filterChild (named "title")) of+ Just t -> getInlines t+ Nothing -> return mempty+ oldN <- gets jatsSectionLevel+ modify $ \st -> st{ jatsSectionLevel = n }+ blocks <- mBlocks+ let ident = attrValue "id" e+ modify $ \st -> st{ jatsSectionLevel = oldN }+ return $ (if+ headerText == mempty+ then mempty+ else headerWith (ident,[],[]) n' headerText) <> blocks getInlines :: PandocMonad m => Element -> JATS m Inlines getInlines e' = trimInlines . mconcat <$>
src/Text/Pandoc/Readers/LaTeX/Table.hs view
@@ -189,7 +189,7 @@ cellAlignment = skipMany (symbol '|') *> alignment <* skipMany (symbol '|') where alignment = do- c <- untoken <$> singleChar+ c <- untoken <$> singleChar <* optional braced -- ignore args return $ case c of "l" -> AlignLeft "r" -> AlignRight
src/Text/Pandoc/Readers/Markdown.hs view
@@ -1556,7 +1556,7 @@ (guardEnabled Ext_all_symbols_escapable >> satisfy (not . isAlphaNum)) <|> (guardEnabled Ext_angle_brackets_escapable >> oneOf "\\`*_{}[]()>#+-.!~\"<>")- <|> oneOf "\\`*_{}[]()>#+-.!~\""+ <|> oneOf "\\`*_{}[]()>#+-.!" escapedNewline :: PandocMonad m => MarkdownParser m (F Inlines) escapedNewline = do
src/Text/Pandoc/Readers/ODT/ContentReader.hs view
@@ -597,6 +597,7 @@ , read_line_break , read_tab , read_link+ , read_frame , read_note , read_citation , read_bookmark@@ -792,6 +793,7 @@ read_table_cell = matchingElement NsTable "table-cell" $ liftA (compactify.(:[])) $ matchChildContent' [ read_paragraph+ , read_list ] ----------------------
src/Text/Pandoc/Readers/Org/Blocks.hs view
@@ -32,11 +32,11 @@ import Text.Pandoc.Options import Text.Pandoc.Shared (compactify, compactifyDL, safeRead) -import Control.Monad (foldM, guard, mplus, mzero, void)+import Control.Monad (foldM, guard, mzero, void) import Data.Char (isSpace) import Data.Default (Default) import Data.Functor (($>))-import Data.List (foldl')+import Data.List (find, foldl') import Data.Maybe (fromMaybe, isJust, isNothing) import Data.Text (Text) import Data.List.NonEmpty (nonEmpty)@@ -97,7 +97,6 @@ -- | Attributes that may be added to figures (like a name or caption). data BlockAttributes = BlockAttributes { blockAttrName :: Maybe Text- , blockAttrLabel :: Maybe Text , blockAttrCaption :: Maybe (F Inlines) , blockAttrKeyValues :: [(Text, Text)] }@@ -129,13 +128,11 @@ guard $ all (isBlockAttr . fst) kv let caption = foldl' (appendValues "caption") Nothing kv let kvAttrs = foldl' (appendValues "attr_html") Nothing kv- let name = lookup "name" kv- let label = lookup "label" kv+ let name = snd <$> find ((`elem` ["name", "label"]) . fst) (reverse kv) caption' <- traverse (parseFromString inlines . (<> "\n")) caption kvAttrs' <- parseFromString keyValues . (<> "\n") $ fromMaybe mempty kvAttrs return BlockAttributes { blockAttrName = name- , blockAttrLabel = label , blockAttrCaption = caption' , blockAttrKeyValues = kvAttrs' }@@ -191,8 +188,11 @@ "quote" -> parseBlockLines (fmap B.blockQuote) "verse" -> verseBlock "src" -> codeBlock blockAttrs- "abstract"-> metadataBlock- _ -> parseBlockLines $+ _ ->+ -- case-sensitive checks+ case blkType of+ "abstract" -> metadataBlock+ _ -> parseBlockLines $ let (ident, classes, kv) = attrFromBlockAttributes blockAttrs in fmap $ B.divWith (ident, classes ++ [blkType], kv) where@@ -484,13 +484,12 @@ imageBlock isFigure figAttrs imgSrc = let figName = fromMaybe mempty $ blockAttrName figAttrs- figLabel = fromMaybe mempty $ blockAttrLabel figAttrs figCaption = fromMaybe mempty $ blockAttrCaption figAttrs figKeyVals = blockAttrKeyValues figAttrs- attr = (figLabel, mempty, figKeyVals)+ attr = (figName, mempty, figKeyVals) in if isFigure then (\c -> B.figureWith attr (B.simpleCaption (B.plain c))- (B.plain $ B.image imgSrc figName mempty))+ (B.plain $ B.image imgSrc "" mempty)) <$> figCaption else B.para . B.imageWith attr imgSrc figName <$> figCaption @@ -651,7 +650,7 @@ let caption = fromMaybe mempty (blockAttrCaption blockAttrs) let orgTbl = normalizeTable <$> rowsToTable rows- let identMb = blockAttrName blockAttrs `mplus` blockAttrLabel blockAttrs+ let identMb = blockAttrName blockAttrs let attr = (fromMaybe mempty identMb, [], blockAttrKeyValues blockAttrs) return $ orgToPandocTable attr <$> orgTbl <*> caption
src/Text/Pandoc/Readers/RST.hs view
@@ -25,6 +25,7 @@ import Data.Sequence (ViewR (..), viewr) import Data.Text (Text) import qualified Data.Text as T+import Text.Printf (printf) import Text.Pandoc.Builder (Blocks, Inlines, fromList, setMeta, trimInlines) import qualified Text.Pandoc.Builder as B import Text.Pandoc.Class.PandocMonad (PandocMonad, fetchItem, getTimestamp)@@ -1164,14 +1165,14 @@ updateState $ \s -> s{ stateSubstitutions = M.insert key il $ stateSubstitutions s } -anonymousKey :: Monad m => RSTParser m ()+anonymousKey :: PandocMonad m => RSTParser m () anonymousKey = try $ do oneOfStrings [".. __:", "__"] src <- targetURI -- we need to ensure that the keys are ordered by occurrence in -- the document. numKeys <- M.size . stateKeys <$> getState- let key = toKey $ "_" <> T.pack (show numKeys)+ let key = toKey $ "_" <> T.pack (printf "%04d" numKeys) updateState $ \s -> s { stateKeys = M.insert key ((src,""), nullAttr) $ stateKeys s }
src/Text/Pandoc/Readers/RTF.hs view
@@ -541,7 +541,8 @@ TableRow (curCell : cs) : rs [] -> [TableRow [curCell]] -- shouldn't happen , sCurrentCell = mempty }- ControlWord "intbl" _ -> bs <$ modifyGroup (\g -> g{ gInTable = True })+ ControlWord "intbl" _ ->+ emitBlocks bs <* modifyGroup (\g -> g{ gInTable = True }) ControlWord "plain" _ -> bs <$ modifyGroup (const def) ControlWord "lquote" _ -> bs <$ addText "\x2018" ControlWord "rquote" _ -> bs <$ addText "\x2019"
+ src/Text/Pandoc/Readers/Typst.hs view
@@ -0,0 +1,520 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE ScopedTypeVariables #-}++{- |+ Module : Text.Pandoc.Readers.Typst+ Copyright : Copyright (C) 2023 John MacFarlane+ License : GNU GPL, version 2 or above++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Reads and evaluates a Typst document as a Pandoc AST.+-}+module Text.Pandoc.Readers.Typst+ ( readTypst+ )+where++import Text.Pandoc.Class+import Text.Pandoc.Sources+import Text.Pandoc.Options+import Text.Pandoc.Definition+import Typst ( parseTypst, evaluateTypst )+import Text.Pandoc.Error (PandocError(..))+import Control.Monad.Except (throwError)+import Control.Monad (MonadPlus (mplus), void)+import qualified Data.Foldable as F+import qualified Data.Map as M+import Data.Maybe (catMaybes, fromMaybe, isNothing)+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq+import Data.Text (Text)+import qualified Data.Text as T+import qualified Data.Vector as V+import qualified Text.Pandoc.Builder as B+import Text.Pandoc.Walk+import Text.Parsec+import Text.TeXMath (writeTeX)+import Text.TeXMath.Shared (getSpaceChars)+import Text.Pandoc.Readers.Typst.Math (pMathMany)+import Text.Pandoc.Readers.Typst.Parsing (pTok, warn, chunks, getField, P)+import Typst.Methods (applyPureFunction, formatNumber)+import Typst.Types+++-- | Read Typst from an input string and return a Pandoc document.+readTypst :: (PandocMonad m, ToSources a)+ => ReaderOptions -> a -> m Pandoc+readTypst _opts inp = do+ let sources = toSources inp+ let inputName = case sources of+ Sources ((pos, _):_) -> sourceName pos+ _ -> ""+ case parseTypst inputName (sourcesToText sources) of+ Left e -> throwError $ PandocParseError $ T.pack $ show e+ Right parsed ->+ evaluateTypst readFileStrict inputName parsed >>=+ either (throwError . PandocParseError . T.pack . show) pure >>=+ runParserT pPandoc () inputName . F.toList >>=+ either (throwError . PandocParseError . T.pack . show) pure++pPandoc :: PandocMonad m => P m B.Pandoc+pPandoc = B.doc <$> pBlocks++pBlocks :: PandocMonad m => P m B.Blocks+pBlocks = mconcat <$> many pBlock++pBlock :: PandocMonad m => P m B.Blocks+pBlock = pPara <|> pBlockElt++pBlockElt :: PandocMonad m => P m B.Blocks+pBlockElt = pTok isBlock >>= handleBlock++pSpace :: PandocMonad m => P m Content+pSpace = pTok+ ( \case+ Txt t | T.all (== ' ') t -> True+ _ -> False+ )+++pLab :: PandocMonad m => P m Text+pLab = try $ do+ optional pSpace+ Lab t <- pTok+ ( \case+ Lab _ -> True+ _ -> False+ )+ pure t++handleBlock :: PandocMonad m => Content -> P m B.Blocks+handleBlock tok = do+ -- check for following label+ mbident <- option Nothing $ Just <$> pLab+ case tok of+ Txt {} -> fail "pBlockElt encountered Txt"+ Lab {} -> pure mempty+ Elt "heading" _ fields -> do+ body <- getField "body" fields+ lev <- getField "level" fields <|> pure 1+ B.headerWith (fromMaybe "" mbident,[],[]) lev <$> pWithContents pInlines body+ Elt "list" _ fields -> do+ children <- V.toList <$> getField "children" fields+ B.bulletList <$> mapM (pWithContents pBlocks) children+ Elt "list.item" _ fields ->+ getField "body" fields >>= pWithContents pBlocks+ Elt "enum" _ fields -> do+ children <- V.toList <$> getField "children" fields+ mbstart <- getField "start" fields+ start <- case mbstart of+ Nothing -> pure 1+ Just x+ | x >= 0 -> pure x+ | otherwise -> fail "number must be positive"+ (numbering :: Text) <- getField "numbering" fields `mplus` pure ""+ let (sty, delim) =+ case numbering of+ "1." -> (B.Decimal, B.Period)+ "1)" -> (B.Decimal, B.OneParen)+ "(1)" -> (B.Decimal, B.TwoParens)+ "a." -> (B.LowerAlpha, B.Period)+ "a)" -> (B.LowerAlpha, B.OneParen)+ "(a)" -> (B.LowerAlpha, B.TwoParens)+ "A." -> (B.UpperAlpha, B.Period)+ "A)" -> (B.UpperAlpha, B.OneParen)+ "(A)" -> (B.UpperAlpha, B.TwoParens)+ "i." -> (B.LowerRoman, B.Period)+ "i)" -> (B.LowerRoman, B.OneParen)+ "(i)" -> (B.LowerRoman, B.TwoParens)+ "I." -> (B.UpperRoman, B.Period)+ "I)" -> (B.UpperRoman, B.OneParen)+ "(I)" -> (B.UpperRoman, B.TwoParens)+ _ -> (B.DefaultStyle, B.DefaultDelim)+ let listAttr = (start, sty, delim)+ B.orderedListWith listAttr <$> mapM (pWithContents pBlocks) children+ Elt "enum.item" _ fields ->+ getField "body" fields >>= pWithContents pBlocks+ Elt "terms" _ fields -> do+ children <- V.toList <$> getField "children" fields+ B.definitionList+ <$> mapM+ ( \case+ VTermItem t d -> do+ t' <- pWithContents pInlines t+ d' <- pWithContents pBlocks d+ pure (t', [d'])+ _ -> pure (mempty, [])+ )+ children+ Elt "terms.item" _ fields ->+ getField "body" fields >>= pWithContents pBlocks+ Elt "raw" _ fields -> do+ txt <- getField "text" fields+ mblang <- getField "lang" fields+ let attr = (fromMaybe "" mbident, maybe [] (\l -> [l]) mblang, [])+ pure $ B.codeBlockWith attr txt+ Elt "parbreak" _ _ -> pure mempty+ Elt "block" _ fields ->+ B.divWith (fromMaybe "" mbident, [], [])+ <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "place" pos fields -> do+ warn "Ignoring parameters of place"+ handleBlock (Elt "block" pos fields)+ Elt "columns" _ fields -> do+ (cnt :: Integer) <- getField "count" fields+ B.divWith ("", ["columns-flow"], [("count", T.pack (show cnt))])+ <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "rect" _ fields ->+ B.divWith ("", ["rect"], []) <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "circle" _ fields ->+ B.divWith ("", ["circle"], []) <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "ellipse" _ fields ->+ B.divWith ("", ["ellipse"], []) <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "polygon" _ fields ->+ B.divWith ("", ["polygon"], []) <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "square" _ fields ->+ B.divWith ("", ["square"], []) <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "align" _ fields -> do+ alignment <- getField "alignment" fields+ B.divWith ("", [], [("align", repr alignment)])+ <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "stack" _ fields -> do+ (dir :: Direction) <- getField "dir" fields `mplus` pure Ltr+ rawchildren <- getField "children" fields+ children <-+ mapM+ ( \case+ val@(VFraction {}) ->+ pure $ B.divWith ("", [], [("space", repr val)]) mempty+ val -> fromVal val >>= pWithContents pBlocks+ )+ (V.toList rawchildren)+ pure $+ B.divWith ("", [], [("stack", repr (VDirection dir))]) $+ mconcat $+ map (B.divWith ("", [], [])) children+ Elt "grid" _ fields -> do+ children <- getField "children" fields >>= mapM (pWithContents pBlocks) . V.toList+ (columns :: Val) <- getField "columns" fields+ let toWidth (VFraction f) = Just (floor $ 1000 * f)+ toWidth _ = Nothing+ let normalizeWidths xs =+ let givenwidths = catMaybes xs+ (totgivenwidth :: Int) = sum givenwidths+ avgwidth = totgivenwidth `div` length givenwidths+ totwidth = avgwidth * length xs+ in if null givenwidths+ then replicate (length xs) B.ColWidthDefault+ else+ map+ ( \case+ Just x -> B.ColWidth (fromIntegral x / fromIntegral totwidth)+ Nothing ->+ B.ColWidth (fromIntegral avgwidth / fromIntegral totwidth)+ )+ xs+ widths <- case columns of+ VInteger x -> pure $ replicate (fromIntegral x) B.ColWidthDefault+ VArray x -> pure $ normalizeWidths $ map toWidth (V.toList x)+ VNone -> pure [B.ColWidthDefault]+ _ -> fail $ "Could not determine number of columns: " <> show columns+ let numcols = length widths+ align <- getField "align" fields+ let toAlign (VAlignment (Just horiz) _) =+ case horiz of+ HorizStart -> B.AlignLeft+ HorizLeft -> B.AlignLeft+ HorizEnd -> B.AlignRight+ HorizRight -> B.AlignRight+ HorizCenter -> B.AlignCenter+ toAlign _ = B.AlignDefault+ aligns <-+ case align of+ VAlignment {} -> pure $ replicate numcols (toAlign align)+ VArray v -> pure $ map toAlign (V.toList v)+ VFunction _ _ f -> do+ mapM+ ( \colnum -> case applyPureFunction+ f+ [VInteger colnum, VInteger 0] of+ Success x -> pure $ toAlign x+ Failure e -> fail e+ )+ [0 .. (fromIntegral numcols - 1)]+ _ -> pure $ replicate numcols B.AlignDefault+ let colspecs = zip (aligns ++ repeat B.AlignDefault) widths+ let rows =+ map (B.Row B.nullAttr) $+ chunks numcols $+ map+ ( B.Cell+ B.nullAttr+ B.AlignDefault+ (B.RowSpan 1)+ (B.ColSpan 1)+ . B.toList+ )+ children+ pure $+ B.tableWith+ (fromMaybe "" mbident, [], [])+ (B.Caption mempty mempty)+ colspecs+ (B.TableHead B.nullAttr [])+ [B.TableBody B.nullAttr 0 [] rows]+ (B.TableFoot B.nullAttr [])+ Elt "table" pos fields -> handleBlock (Elt "grid" pos fields)+ Elt "figure" _ fields -> do+ body <- getField "body" fields >>= pWithContents pBlocks+ (mbCaption :: Maybe (Seq Content)) <- getField "caption" fields+ (caption :: B.Blocks) <- maybe mempty (pWithContents pBlocks) mbCaption+ pure $ case B.toList body of+ [B.Table attr _ colspecs thead tbodies tfoot] ->+ B.singleton+ (B.Table attr (B.Caption Nothing (B.toList caption)) colspecs thead tbodies tfoot)+ _ -> B.figureWith (fromMaybe "" mbident, [], [])+ (B.Caption Nothing (B.toList caption)) body+ Elt "line" _ fields+ | isNothing+ ( M.lookup "start" fields+ >> M.lookup "end" fields+ >> M.lookup "angle" fields+ ) -> do+ pure $ B.horizontalRule+ Elt "numbering" _ fields -> do+ numStyle <- getField "numbering" fields+ (nums :: V.Vector Integer) <- getField "numbers" fields+ let toText v = fromMaybe "" $ fromVal v+ let toNum n =+ case numStyle of+ VString t -> formatNumber t (fromIntegral n)+ VFunction _ _ f ->+ case applyPureFunction f [VInteger n] of+ Success x -> toText x+ Failure _ -> "?"+ _ -> "?"+ pure $ B.plain . B.text . mconcat . map toNum $ V.toList nums+ Elt "footnote.entry" _ fields ->+ getField "body" fields >>= pWithContents pBlocks+ Elt (Identifier tname) _ _ -> do+ warn ("Skipping unknown block element " <> tname)+ pure mempty++pPara :: PandocMonad m => P m B.Blocks+pPara =+ B.para . B.trimInlines . mconcat <$> (many1 pInline <* optional pParBreak)++pParBreak :: PandocMonad m => P m ()+pParBreak =+ void $+ pTok+ ( \case+ Elt "parbreak" _ _ -> True+ _ -> False+ )++isInline :: Content -> Bool+isInline (Lab {}) = True+isInline (Txt {}) = True+isInline x = not (isBlock x)++isBlock :: Content -> Bool+isBlock (Txt {}) = False+isBlock (Lab {}) = True+isBlock (Elt name _ fields) =+ case name of+ "align" -> True+ "bibliography" -> True+ "block" -> True+ "circle" -> True+ "colbreak" -> True+ "columns" -> True+ "csv" -> True+ "ellipse" -> True+ "enum" -> True+ "enum.item" -> True+ "figure" -> True+ "grid" -> True+ "heading" -> True+ "json" -> True+ "line" -> True+ "list" -> True+ "list.item" -> True+ "numbering" -> True+ "footnote.entry" -> True+ "outline" -> True+ "page" -> True+ "pagebreak" -> True+ "par" -> True+ "parbreak" -> True+ "place" -> True+ "polygon" -> True+ "raw" -> M.lookup "block" fields == Just (VBoolean True)+ "read" -> True+ "rect" -> True+ "square" -> True+ "stack" -> True+ "table" -> True+ "terms" -> True+ "terms.item" -> True+ "toml" -> True+ "v" -> True+ "xml" -> True+ "yaml" -> True+ _ -> False++pWithContents :: PandocMonad m => P m a -> Seq Content -> P m a+pWithContents pa cs = do+ inp <- getInput+ setInput $ F.toList cs+ res <- pa+ setInput inp+ pure res++pInlines :: PandocMonad m => P m B.Inlines+pInlines = mconcat <$> many pInline++pInline :: PandocMonad m => P m B.Inlines+pInline = pTok isInline >>= handleInline++handleInline :: PandocMonad m => Content -> P m B.Inlines+handleInline tok =+ case tok of+ Txt t -> pure $ B.text t+ Lab name -> pure $ B.spanWith (name, [], []) mempty+ Elt "ref" _ fields -> do+ VLabel target <- getField "target" fields+ supplement' <- getField "supplement" fields+ supplement <- case supplement' of+ VAuto -> -- TODO for now, until we can locate the element+ pure $ B.text ("[" <> target <> "]")+ VContent cs -> pWithContents pInlines cs+ VFunction _ _ _f -> -- TODO for now, until we can locate the element+ pure $ B.text ("[" <> target <> "]")+ _ -> pure mempty+ pure $ B.linkWith ("", ["ref"], []) ("#" <> target) "" supplement+ Elt "linebreak" _ _ -> pure B.linebreak+ Elt "text" _ fields -> do+ body <- getField "body" fields+ (mbweight :: Maybe Text) <- getField "weight" fields+ case mbweight of+ Just "bold" -> B.strong <$> pWithContents pInlines body+ _ -> pWithContents pInlines body+ Elt "raw" _ fields -> B.code <$> getField "text" fields+ Elt "footnote" _ fields ->+ B.note <$> (getField "body" fields >>= pWithContents pBlocks)+ Elt "cite" _ fields -> do+ keys <- V.toList <$> getField "keys" fields+ let toCitation key =+ B.Citation+ { B.citationId = key,+ B.citationPrefix = mempty,+ B.citationSuffix = mempty,+ B.citationMode = B.NormalCitation,+ B.citationNoteNum = 0,+ B.citationHash = 0+ }+ let citations = map toCitation keys+ pure $ B.cite citations (B.text $ "[" <> T.intercalate "," keys <> "]")+ Elt "lower" _ fields -> do+ body <- getField "text" fields+ walk (modString T.toLower) <$> pWithContents pInlines body+ Elt "upper" _ fields -> do+ body <- getField "text" fields+ walk (modString T.toUpper) <$> pWithContents pInlines body+ Elt "emph" _ fields -> do+ body <- getField "body" fields+ B.emph <$> pWithContents pInlines body+ Elt "strong" _ fields -> do+ body <- getField "body" fields+ B.strong <$> pWithContents pInlines body+ Elt "sub" _ fields -> do+ body <- getField "body" fields+ B.subscript <$> pWithContents pInlines body+ Elt "super" _ fields -> do+ body <- getField "body" fields+ B.superscript <$> pWithContents pInlines body+ Elt "strike" _ fields -> do+ body <- getField "body" fields+ B.strikeout <$> pWithContents pInlines body+ Elt "smallcaps" _ fields -> do+ body <- getField "body" fields+ B.smallcaps <$> pWithContents pInlines body+ Elt "underline" _ fields -> do+ body <- getField "body" fields+ B.underline <$> pWithContents pInlines body+ Elt "link" _ fields -> do+ dest <- getField "dest" fields+ src <- case dest of+ VString t -> pure t+ VLabel t -> pure $ "#" <> t+ VDict _ -> do+ warn "Unable to link to location, linking to #"+ pure "#"+ _ -> fail $ "Expected string or label for dest"+ body <- getField "body" fields+ description <-+ if null body+ then+ pure $+ B.text $+ if "mailto:" `T.isPrefixOf` src+ then T.drop 7 src+ else+ if "tel:" `T.isPrefixOf` src+ then T.drop 4 src+ else src+ else pWithContents pInlines body+ pure $ B.link src "" description+ Elt "image" _ fields -> do+ path <- getField "path" fields+ alt <- (B.text <$> getField "alt" fields) `mplus` pure mempty+ (mbwidth :: Maybe Text) <-+ fmap (renderLength False) <$> getField "width" fields+ (mbheight :: Maybe Text) <-+ fmap (renderLength False) <$> getField "height" fields+ let attr =+ ( "",+ [],+ maybe [] (\x -> [("width", x)]) mbwidth+ ++ maybe [] (\x -> [("height", x)]) mbheight+ )+ pure $ B.imageWith attr path "" alt+ Elt "box" _ fields -> do+ body <- getField "body" fields+ B.spanWith ("", ["box"], []) <$> pWithContents pInlines body+ Elt "h" _ fields -> do+ amount <- getField "amount" fields `mplus` pure (LExact 1 LEm)+ let em = case amount of+ LExact x LEm -> toRational x+ _ -> case amount <> LExact 0 LPt of -- force to Pt+ LExact x LPt -> toRational x / 12+ _ -> 1 / 3 -- guess!+ pure $ B.text $ getSpaceChars em+ Elt "style" _ fields -> do+ Function f <- getField "func" fields+ case applyPureFunction (Function f) [VStyles] of+ Success (VContent cs) -> pWithContents pInlines cs+ Success x -> pure $ B.text $ repr x+ Failure e -> fail e+ Elt "math.equation" _ fields -> do+ body <- getField "body" fields+ display <- getField "block" fields+ (if display then B.displayMath else B.math) . writeTeX <$> pMathMany body+ Elt (Identifier tname) _ _+ | "math." `T.isPrefixOf` tname ->+ B.math . writeTeX <$> pMathMany (Seq.singleton tok)+ Elt (Identifier tname) _ _ -> do+ warn ("Skipping unknown inline element " <> tname)+ pure mempty++modString :: (Text -> Text) -> B.Inline -> B.Inline+modString f (B.Str t) = B.Str (f t)+modString _ x = x
+ src/Text/Pandoc/Readers/Typst/Math.hs view
@@ -0,0 +1,376 @@+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}++module Text.Pandoc.Readers.Typst.Math+ ( pMathMany+ )+where++import Control.Monad (MonadPlus (mplus))+import Data.Char (isAlphaNum, isDigit)+import Data.List (intercalate)+import qualified Data.Map as M+import Data.Maybe (fromMaybe)+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq+import Data.Text (Text)+import qualified Data.Text as T+import qualified Data.Vector as V+import Text.Pandoc.Parsing ( many )+import Text.Pandoc.Class ( PandocMonad )+import Text.TeXMath.Types+ ( Alignment (..),+ Exp (..),+ FractionType (..),+ TeXSymbolType (..),+ TextType (..),+ )+import Text.TeXMath.Unicode.ToTeX (getSymbolType)+import Text.Pandoc.Readers.Typst.Parsing+ ( P, pTok, warn, pWithContents, getField, chunks )+import Typst.Types++-- import Debug.Trace++withGroup :: [Exp] -> Exp+withGroup [x] = x+withGroup xs = EGrouped xs++data AttachmentStyle = Limits | Scripts+ deriving (Eq, Show)++getAttachmentStyle :: PandocMonad m => M.Map Identifier Val -> P m (Maybe AttachmentStyle)+getAttachmentStyle fields = do+ (base :: Seq Content) <- getField "base" fields+ case base of+ [Elt "limits" _ _] -> pure $ Just Limits+ [Elt "scripts" _ _] -> pure $ Just Scripts+ _ -> pure Nothing++pMath :: PandocMonad m => P m Exp+pMath = pTok (const True) >>= handleMath++handleMath :: PandocMonad m => Content -> P m Exp+handleMath tok =+ case tok of+ Lab t -> do+ warn ("skipping label " <> t)+ pure (EGrouped [])+ Txt t+ | T.any isDigit t -> pure $ ENumber t+ | T.length t == 1 ->+ case T.unpack t of+ [c] | not (isAlphaNum c) -> pure $ ESymbol (getSymbolType c) t+ _ -> pure $ EIdentifier t+ | otherwise -> pure $ EText TextNormal t+ Elt "math.dif" _ _ -> pure $ EIdentifier "d"+ Elt "math.Dif" _ _ -> pure $ EIdentifier "D"+ Elt "math.equation" _ fields -> getField "body" fields >>= pMathGrouped+ Elt "text" _ fields -> do+ body <- getField "body" fields+ (mbweight :: Maybe Text) <- getField "weight" fields+ case mbweight of+ Just "bold" -> EStyled TextBold <$> pMathMany body+ _ -> pMathGrouped body+ Elt "math.op" _ fields -> EMathOperator <$> getField "text" fields+ Elt "math.frac" _ fields -> do+ num <- getField "num" fields >>= pMathGrouped+ denom <- getField "denom" fields >>= pMathGrouped+ pure $ EFraction NormalFrac num denom+ Elt "math.accent" _ fields -> do+ base <- getField "base" fields >>= pMathGrouped+ acc <- getField "accent" fields >>= pMathGrouped+ let acc' = case acc of+ ESymbol _ t -> ESymbol Accent t+ _ -> acc+ pure $ EOver False base acc'+ Elt "math.attach" _ fields -> do+ attachmentStyle <- getAttachmentStyle fields+ base <- getField "base" fields >>= pMathGrouped+ t' <- getField "t" fields+ b' <- getField "b" fields+ tr' <- getField "tr" fields+ tl' <- getField "tl" fields+ br' <- getField "br" fields+ bl' <- getField "bl" fields+ let limits = attachmentStyle == Just Limits+ let (mbt, mbtr) =+ case (t', tr') of+ (Just top, Just topright) -> (Just top, Just topright)+ (Just top, Nothing)+ | limits -> (Just top, Nothing)+ | otherwise -> (Nothing, Just top)+ (Nothing, Just topright) -> (Nothing, Just topright)+ (Nothing, Nothing) -> (Nothing, Nothing)+ let (mbb, mbbr) =+ case (b', br') of+ (Just bot, Just botright) -> (Just bot, Just botright)+ (Just bot, Nothing)+ | limits -> (Just bot, Nothing)+ | otherwise -> (Nothing, Just bot)+ (Nothing, Just topright) -> (Nothing, Just topright)+ (Nothing, Nothing) -> (Nothing, Nothing)+ let dummy = EGrouped []+ let addPrefix x =+ case (tl', bl') of+ (Nothing, Nothing) -> pure x+ (Just top, Nothing) -> do+ res <- ESuper dummy <$> pMathGrouped top+ pure $ EGrouped [res, x]+ (Nothing, Just bot) -> do+ res <- ESub dummy <$> pMathGrouped bot+ pure $ EGrouped [res, x]+ (Just top, Just bot) -> do+ res <- ESubsup dummy <$> pMathGrouped bot <*> pMathGrouped top+ pure $ EGrouped [res, x]++ base' <- case (mbtr, mbbr) of+ (Nothing, Nothing) -> pure base+ (Nothing, Just br) -> ESub base <$> pMathGrouped br+ (Just tr, Nothing) -> ESuper base <$> pMathGrouped tr+ (Just tr, Just br) -> ESubsup base <$> pMathGrouped br <*> pMathGrouped tr++ suffix <- case (mbt, mbb) of+ (Nothing, Nothing) -> pure base'+ (Nothing, Just bot) -> EUnder False base' <$> pMathGrouped bot+ (Just top, Nothing) -> EOver False base' <$> pMathGrouped top+ (Just top, Just bot) -> EUnderover False base' <$> pMathGrouped bot <*> pMathGrouped top++ addPrefix suffix+ Elt "math.serif" _ fields ->+ EStyled TextNormal <$> (getField "body" fields >>= pMathMany)+ Elt "math.sans" _ fields ->+ EStyled TextSansSerif <$> (getField "body" fields >>= pMathMany)+ Elt "math.frak" _ fields ->+ EStyled TextFraktur <$> (getField "body" fields >>= pMathMany)+ Elt "math.mono" _ fields ->+ EStyled TextMonospace <$> (getField "body" fields >>= pMathMany)+ Elt "math.cal" _ fields ->+ EStyled TextScript <$> (getField "body" fields >>= pMathMany)+ Elt "math.bb" _ fields ->+ EStyled TextDoubleStruck <$> (getField "body" fields >>= pMathMany)+ Elt "math.upright" _ fields ->+ EStyled TextNormal <$> (getField "body" fields >>= pMathMany)+ Elt "math.bold" _ fields ->+ EStyled TextBold <$> (getField "body" fields >>= pMathMany)+ Elt "math.italic" _ fields ->+ EStyled TextItalic <$> (getField "body" fields >>= pMathMany)+ Elt "math.underline" _ fields ->+ EUnder False+ <$> (getField "body" fields >>= pMathGrouped)+ <*> pure (ESymbol TUnder "_")+ Elt "math.overline" _ fields ->+ EUnder False+ <$> (getField "body" fields >>= pMathGrouped)+ <*> pure (ESymbol TOver "\175")+ Elt "math.underbrace" _ fields -> do+ mbAnn <- getField "annotation" fields+ body <- getField "body" fields >>= pMathGrouped+ let x = EUnder False body (ESymbol TUnder "\9183")+ case mbAnn of+ Nothing -> pure x+ Just ann -> EUnder False x <$> pMathGrouped ann+ Elt "math.overbrace" _ fields -> do+ mbAnn <- getField "annotation" fields+ body <- getField "body" fields >>= pMathGrouped+ let x = EOver False body (ESymbol TOver "\9182")+ case mbAnn of+ Nothing -> pure x+ Just ann -> EOver False x <$> pMathGrouped ann+ Elt "math.underbracket" _ fields -> do+ mbAnn <- getField "annotation" fields+ body <- getField "body" fields >>= pMathGrouped+ let x = EUnder False body (ESymbol TUnder "\9141")+ case mbAnn of+ Nothing -> pure x+ Just ann -> EUnder False x <$> pMathGrouped ann+ Elt "math.overbracket" _ fields -> do+ mbAnn <- getField "annotation" fields+ body <- getField "body" fields >>= pMathGrouped+ let x = EOver False body (ESymbol TOver "\9140")+ case mbAnn of+ Nothing -> pure x+ Just ann -> EOver False x <$> pMathGrouped ann+ Elt "math.scripts" _ fields -> getField "body" fields >>= pMathGrouped+ Elt "math.limits" _ fields -> getField "body" fields >>= pMathGrouped+ Elt "math.root" _ fields -> do+ mbindex <- getField "index" fields+ radicand <- getField "radicand" fields >>= pMathGrouped+ case mbindex of+ Nothing -> pure $ ESqrt radicand+ Just index -> do+ index' <- pMathGrouped index+ pure $ ERoot index' radicand+ Elt "math.sqrt" _ fields ->+ ESqrt <$> (getField "radicand" fields >>= pMathGrouped)+ Elt "math.abs" _ fields -> do+ body <- getField "body" fields >>= pMathGrouped+ pure $ EDelimited "|" "|" [Right body]+ Elt "math.floor" _ fields -> do+ body <- getField "body" fields >>= pMathGrouped+ pure $ EDelimited "\8970" "\8971" [Right body]+ Elt "math.ceil" _ fields -> do+ body <- getField "body" fields >>= pMathGrouped+ pure $ EDelimited "\8968" "\8969" [Right body]+ Elt "math.norm" _ fields -> do+ body <- getField "body" fields >>= pMathGrouped+ pure $ EDelimited "\8741" "\8741" [Right body]+ Elt "math.round" _ fields -> do+ body <- getField "body" fields >>= pMathGrouped+ pure $ EDelimited "\8970" "\8969" [Right body]+ Elt "math.lr" _ fields -> do+ bodyparts <- getField "body" fields >>= mapM pMathMany . V.toList+ let rawbody = intercalate [ESymbol Pun ","] bodyparts+ let (op, rest) =+ case rawbody of+ (ESymbol _ t : xs) -> (t, xs)+ _ -> ("", rawbody)+ let (body, cl) =+ case reverse rest of+ (ESymbol _ t : _) -> (map Right (init rest), t)+ _ -> (map Right rest, "")+ pure $ EDelimited op cl body+ Elt "math.binom" _ fields -> do+ up <- getField "upper" fields >>= pMathGrouped+ low <- getField "lower" fields >>= pMathGrouped+ pure $ EDelimited "(" ")" [Right (EFraction NoLineFrac up low)]+ Elt "math.cases" _ fields -> do+ (delim :: Maybe Text) <- getField "delim" fields+ (children :: [Seq Content]) <-+ map valToContent . V.toList <$> getField "children" fields+ let isAlignPoint (Elt "math.alignpoint" _ _) = True+ isAlignPoint _ = False+ let formatRow vs = case Seq.breakl isAlignPoint vs of+ (xs, ys) -> do+ case Seq.viewl ys of+ _ Seq.:< rest -> do+ xs' <- pMathMany xs+ ys' <- pMathMany rest+ pure [xs', ys']+ _ -> (: []) <$> pMathMany vs+ rows <- mapM formatRow children+ pure $+ EDelimited+ (fromMaybe "{" delim)+ ""+ [Right (EArray [AlignLeft, AlignLeft] rows)]+ Elt "math.vec" _ fields -> do+ (op, cl) <- arrayDelims fields+ rows <-+ getField "children" fields+ >>= mapM (fmap (: []) . pMathMany) . V.toList+ pure $+ EDelimited+ op+ cl+ [Right (EArray [AlignCenter] rows)]+ Elt "math.mat" _ fields -> do+ (op, cl) <- arrayDelims fields+ let formatCell x = do+ let content = valToContent x+ let align = case Seq.viewl content of+ Elt "math.alignpoint" _ _ Seq.:< _ -> AlignLeft+ _ -> case Seq.viewr content of+ _ Seq.:> Elt "math.alignpoint" _ _ -> AlignRight+ _ -> AlignCenter+ exp' <- pMathMany content+ pure (align, exp')+ let formatRow (VArray vs) = mapM formatCell (V.toList vs)+ formatRow _ = fail "mat expected array"+ (rawrows :: V.Vector Val) <- getField "rows" fields+ rows <- mapM formatRow (V.toList rawrows)+ let aligns =+ case rows of+ [] -> []+ (r : _) -> map fst r+ pure $+ EDelimited+ op+ cl+ [Right (EArray aligns (map (map snd) rows))]+ Elt "hide" _ fields -> do+ EPhantom <$> (getField "body" fields >>= pMathGrouped)+ Elt "h" _ fields -> do+ amount <- getField "amount" fields+ let em = case amount of+ LExact x LEm -> toRational x+ _ -> case amount <> LExact 0 LPt of -- force to Pt+ LExact x LPt -> toRational x / 12+ _ -> 1 / 3 -- guess!+ pure $ ESpace em+ Elt "grid" _ fields -> do+ children <- getField "children" fields >>= mapM pMathMany . V.toList+ (columns :: Val) <- getField "columns" fields+ numcols <- case columns of+ VInteger x -> pure $ fromIntegral x+ VArray x -> pure $ V.length x+ VNone -> pure 1+ _ -> fail $ "Could not determine number of columns: " <> show columns+ let rows = chunks numcols children+ pure $ EArray (replicate numcols AlignLeft) rows+ Elt "table" pos fields -> handleMath (Elt "grid" pos fields)+ Elt "link" _ fields -> do+ body <- getField "body" fields+ warn "Hyperlinks not supported in math"+ pMathGrouped body+ Elt (Identifier name) _ fields -> do+ body <- getField "body" fields `mplus` pure mempty+ warn ("Ignoring unsupported " <> name)+ pMathGrouped body++arrayDelims :: PandocMonad m => M.Map Identifier Val -> P m (Text, Text)+arrayDelims fields = do+ (mbdelim :: Maybe Text) <- getField "delim" fields+ pure $ case mbdelim of+ Just "(" -> ("(", ")")+ Just "[" -> ("[", "]")+ Just "{" -> ("{", "}")+ Just "|" -> ("|", "|")+ Just "||" -> ("\8741", "\8741")+ _ -> ("(", ")")++pMathMany :: PandocMonad m => Seq Content -> P m [Exp]+pMathMany cs = do+ -- check for "alignpoint" and "linebreak" elements+ -- and use an array structure for alignment+ let lns = splitOnLinebreaks cs+ case lns of+ [] -> pure []+ [ln] | not (any isAlignpoint ln) -> pWithContents (many pMath) ln+ _ -> do+ rows <- mapM (mapM (pWithContents (many pMath)) . splitOnAlignpoints) lns+ let numcols = maximum $ map length rows+ let cols = take numcols $ AlignRight : cycle [AlignLeft, AlignRight]+ pure [EArray cols rows]++pMathGrouped :: PandocMonad m => Seq Content -> P m Exp+pMathGrouped = fmap withGroup . pMathMany++splitOnLinebreaks :: Seq Content -> [Seq Content]+splitOnLinebreaks xs =+ if Seq.null bs+ then+ if null as+ then []+ else [as]+ else as : splitOnLinebreaks (Seq.drop 1 bs)+ where+ (as, bs) = Seq.breakl isLinebreak xs+ isLinebreak (Elt "linebreak" _ _) = True+ isLinebreak _ = False++splitOnAlignpoints :: Seq Content -> [Seq Content]+splitOnAlignpoints xs =+ if Seq.null bs+ then+ if null as+ then []+ else [as]+ else as : splitOnAlignpoints (Seq.drop 1 bs)+ where+ (as, bs) = Seq.breakl isAlignpoint xs++isAlignpoint :: Content -> Bool+isAlignpoint (Elt "math.alignpoint" _ _) = True+isAlignpoint _ = False
+ src/Text/Pandoc/Readers/Typst/Parsing.hs view
@@ -0,0 +1,61 @@+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}++module Text.Pandoc.Readers.Typst.Parsing+ ( P,+ pTok,+ pWithContents,+ warn,+ getField,+ chunks,+ )+where+import Control.Monad (MonadPlus)+import Control.Monad.Reader (lift)+import qualified Data.Foldable as F+import qualified Data.Map as M+import Data.Maybe (fromMaybe)+import Data.Sequence (Seq)+import Data.Text (Text)+import Text.Parsec+ ( ParsecT, getInput, setInput, tokenPrim )+import Typst.Types+ ( Identifier, Content(Elt), FromVal(..), Val(VNone) )+import Text.Pandoc.Class.PandocMonad ( PandocMonad, report )+import Text.Pandoc.Logging (LogMessage(..))++type P m a = ParsecT [Content] () m a++pTok :: PandocMonad m => (Content -> Bool) -> P m Content+pTok f = tokenPrim show showPos match+ where+ showPos _oldpos (Elt _ (Just pos) _) _ = pos+ showPos oldpos _ _ = oldpos+ match x | f x = Just x+ match _ = Nothing++warn :: PandocMonad m => Text -> P m ()+warn msg = lift $ report $ IgnoredElement msg++pWithContents :: PandocMonad m => P m a -> Seq Content -> P m a+pWithContents pa cs = do+ inp <- getInput+ setInput $ F.toList cs+ res <- pa+ setInput inp+ pure res++-- | Get field value from element, defaulting to VNone.+getField ::+ (MonadFail m, MonadPlus m, FromVal a) =>+ Identifier ->+ M.Map Identifier Val ->+ m a+getField name fields = fromVal $ fromMaybe VNone $ M.lookup name fields++-- | Split a list into chunks of a given size. The last chunk may be smaller.+chunks :: Int -> [a] -> [[a]]+chunks _ [] = []+chunks n xs = take n xs : chunks n (drop n xs)
src/Text/Pandoc/Writers/EPUB.hs view
@@ -251,7 +251,6 @@ | name == "description" = md { epubDescription = Just $ strContent e } | name == "type" = md { epubType = Just $ strContent e } | name == "format" = md { epubFormat = Just $ strContent e }- | name == "type" = md { epubType = Just $ strContent e } | name == "publisher" = md { epubPublisher = Just $ strContent e } | name == "source" = md { epubSource = Just $ strContent e } | name == "relation" = md { epubRelation = Just $ strContent e }
src/Text/Pandoc/Writers/HTML.hs view
@@ -501,7 +501,7 @@ checkbox' = H.input ! A.type_ "checkbox" isContents <- inlineListToHtml opts is bsContents <- blockListToHtml opts bs- return $ constr (checkbox >> isContents) >>+ return $ constr (H.label (checkbox >> isContents)) >> (if null bs then mempty else nl) >> bsContents
src/Text/Pandoc/Writers/Jira.hs view
@@ -18,7 +18,6 @@ module Text.Pandoc.Writers.Jira ( writeJira ) where import Control.Monad.Reader (ReaderT, ask, asks, runReaderT) import Control.Monad.State.Strict (StateT, evalStateT, gets, modify)-import Data.Foldable (find) import Data.Text (Text) import Text.Jira.Parser (plainText) import Text.Jira.Printer (prettyBlocks, prettyInlines)@@ -133,9 +132,9 @@ -> JiraConverter m [Jira.Block] toJiraCode (ident, classes, _attribs) code = do return . addAnchor ident . singleton $- case find (\c -> T.toLower c `elem` knownLanguages) classes of- Nothing -> Jira.NoFormat mempty code- Just l -> Jira.Code (Jira.Language l) mempty code+ case classes of+ [] -> Jira.NoFormat mempty code+ l:_ -> Jira.Code (Jira.Language l) mempty code -- | Prepends an anchor with the given identifier. addAnchor :: Text -> [Jira.Block] -> [Jira.Block]@@ -328,12 +327,3 @@ modify $ \s -> s { stNotes = thisnote : curNotes } return . singleton . Jira.Str $ "[" <> T.pack (show newnum) <> "]"---- | Language codes recognized by jira-knownLanguages :: [Text]-knownLanguages =- [ "actionscript", "ada", "applescript", "bash", "c", "c#", "c++"- , "css", "erlang", "go", "groovy", "haskell", "html", "java", "javascript"- , "json", "lua", "nyan", "objc", "perl", "php", "python", "r", "ruby"- , "scala", "sql", "swift", "visualbasic", "xml", "yaml"- ]
src/Text/Pandoc/Writers/LaTeX/Table.hs view
@@ -47,6 +47,11 @@ tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do let (Ann.Table (ident, _, _) caption specs thead tbodies tfoot) = tbl CaptionDocs capt captNotes <- captionToLaTeX inlnsToLaTeX caption ident+ let isSimpleTable = all (all isSimpleCell) $ mconcat+ [ headRows thead+ , concatMap bodyRows tbodies+ , footRows tfoot+ ] let removeNote (Note _) = Span ("", [], []) [] removeNote x = x let colCount = ColumnCount $ length specs@@ -56,7 +61,7 @@ -- making the caption part of the first head. The downside is that we must -- duplicate the header rows for this. head' <- do- let mkHead = headToLaTeX blksToLaTeX colCount+ let mkHead = headToLaTeX blksToLaTeX isSimpleTable colCount case (not $ isEmpty capt, not $ isEmptyHead thead) of (False, False) -> return "\\toprule\\noalign{}" (False, True) -> mkHead thead@@ -66,20 +71,21 @@ firsthead <- mkHead thead repeated <- mkHead (walk removeNote thead) return $ capt $$ firsthead $$ "\\endfirsthead" $$ repeated- rows' <- mapM (rowToLaTeX blksToLaTeX colCount BodyCell) $+ rows' <- mapM (rowToLaTeX blksToLaTeX isSimpleTable colCount BodyCell) $ mconcat (map bodyRows tbodies) foot' <- if isEmptyFoot tfoot then pure empty else do- lastfoot <- mapM (rowToLaTeX blksToLaTeX colCount BodyCell) $- footRows tfoot+ lastfoot <- mapM+ (rowToLaTeX blksToLaTeX isSimpleTable colCount BodyCell) $+ footRows tfoot pure $ "\\midrule\\noalign{}" $$ vcat lastfoot modify $ \s -> s{ stTable = True } notes <- notesToLaTeX <$> gets stNotes beamer <- gets stBeamer return $ "\\begin{longtable}[]" <>- braces ("@{}" <> colDescriptors tbl <> "@{}")+ braces ("@{}" <> colDescriptors isSimpleTable tbl <> "@{}") -- the @{} removes extra space at beginning and end $$ head' $$ "\\endhead"@@ -102,20 +108,26 @@ $$ captNotes $$ notes +isSimpleCell :: Ann.Cell -> Bool+isSimpleCell (Ann.Cell _ _ (Cell _attr _align _rowspan _colspan blocks)) =+ case blocks of+ [Para _] -> True+ [Plain _] -> True+ [] -> True+ _ -> False+++ -- | Total number of columns in a table. newtype ColumnCount = ColumnCount Int -- | Creates column descriptors for the table.-colDescriptors :: Ann.Table -> Doc Text-colDescriptors (Ann.Table _attr _caption specs thead tbodies tfoot) =+colDescriptors :: Bool -> Ann.Table -> Doc Text+colDescriptors isSimpleTable+ (Ann.Table _attr _caption specs _thead _tbodies _tfoot) = let (aligns, widths) = unzip specs defaultWidthsOnly = all (== ColWidthDefault) widths- isSimpleTable = all (all isSimpleCell) $ mconcat- [ headRows thead- , concatMap bodyRows tbodies- , footRows tfoot- ] relativeWidths = if defaultWidthsOnly then replicate (length specs)@@ -136,13 +148,6 @@ ((numcols - 1) * 2) width - isSimpleCell (Ann.Cell _ _ (Cell _attr _align _rowspan _colspan blocks)) =- case blocks of- [Para _] -> True- [Plain _] -> True- [] -> True- _ -> False- toRelWidth ColWidthDefault = 0 toRelWidth (ColWidth w) = w @@ -188,24 +193,29 @@ headToLaTeX :: PandocMonad m => BlocksWriter m+ -> Bool -> ColumnCount -> Ann.TableHead -> LW m (Doc Text)-headToLaTeX blocksWriter colCount (Ann.TableHead _attr headerRows) = do+headToLaTeX blocksWriter isSimpleTable+ colCount (Ann.TableHead _attr headerRows) = do rowsContents <-- mapM (rowToLaTeX blocksWriter colCount HeaderCell . headerRowCells)+ mapM (rowToLaTeX blocksWriter isSimpleTable+ colCount HeaderCell . headerRowCells) headerRows return ("\\toprule\\noalign{}" $$ vcat rowsContents $$ "\\midrule\\noalign{}") -- | Converts a row of table cells into a LaTeX row. rowToLaTeX :: PandocMonad m => BlocksWriter m+ -> Bool -> ColumnCount -> CellType -> [Ann.Cell] -> LW m (Doc Text)-rowToLaTeX blocksWriter colCount celltype row = do- cellsDocs <- mapM (cellToLaTeX blocksWriter colCount celltype) (fillRow row)+rowToLaTeX blocksWriter isSimpleTable colCount celltype row = do+ cellsDocs <- mapM (cellToLaTeX blocksWriter isSimpleTable+ colCount celltype) (fillRow row) return $ hsep (intersperse "&" cellsDocs) <> " \\\\" -- | Pads row with empty cells to adjust for rowspans above this row.@@ -280,11 +290,12 @@ cellToLaTeX :: PandocMonad m => BlocksWriter m+ -> Bool -> ColumnCount -> CellType -> Ann.Cell -> LW m (Doc Text)-cellToLaTeX blockListToLaTeX colCount celltype annotatedCell = do+cellToLaTeX blockListToLaTeX isSimpleTable colCount celltype annotatedCell = do let (Ann.Cell specs colnum cell) = annotatedCell let colWidths = NonEmpty.map snd specs let hasWidths = NonEmpty.head colWidths /= ColWidthDefault@@ -329,7 +340,8 @@ let inMultiColumn x = case colspan of (ColSpan 1) -> x (ColSpan n) ->- let colDescr = multicolumnDescriptor align+ let colDescr = multicolumnDescriptor isSimpleTable+ align colWidths colCount colnum@@ -346,17 +358,19 @@ return . inMultiColumn . inMultiRow $ result -- | Returns the width of a cell spanning @n@ columns.-multicolumnDescriptor :: Alignment+multicolumnDescriptor :: Bool+ -> Alignment -> NonEmpty ColWidth -> ColumnCount -> Ann.ColNumber -> Text-multicolumnDescriptor align+multicolumnDescriptor isSimpleTable+ align colWidths (ColumnCount numcols) (Ann.ColNumber colnum) = let toWidth = \case- ColWidthDefault -> 0+ ColWidthDefault -> (1 / fromIntegral numcols) ColWidth x -> x colspan = length colWidths width = sum $ NonEmpty.map toWidth colWidths@@ -364,13 +378,19 @@ -- no column separators at beginning of first and end of last column. skipColSep = "@{}" :: String in T.pack $- printf "%s>{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.4f} + %d\\tabcolsep}%s"- (if colnum == 0 then skipColSep else "")- (T.unpack (alignCommand align))- (2 * (numcols - 1))- width- (2 * (colspan - 1))- (if colnum + colspan >= numcols then skipColSep else "")+ if isSimpleTable+ then printf "%s%s%s"+ (if colnum == 0 then skipColSep else "")+ (T.unpack (colAlign align))+ (if colnum + colspan >= numcols then skipColSep else "")++ else printf "%s>{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.4f} + %d\\tabcolsep}%s"+ (if colnum == 0 then skipColSep else "")+ (T.unpack (alignCommand align))+ (2 * (numcols - 1))+ width+ (2 * (colspan - 1))+ (if colnum + colspan >= numcols then skipColSep else "") -- | Perform a conversion, assuming that the context is a minipage. inMinipage :: Monad m => LW m a -> LW m a
src/Text/Pandoc/Writers/Markdown/Inline.hs view
@@ -657,7 +657,8 @@ let useRefLinks = writerReferenceLinks opts && not useAuto shortcutable <- asks envRefShortcutable let useShortcutRefLinks = shortcutable &&- isEnabled Ext_shortcut_reference_links opts+ (variant == Commonmark ||+ isEnabled Ext_shortcut_reference_links opts) reftext <- if useRefLinks then literal <$> getReference attr linktext (src, tit) else return mempty
src/Text/Pandoc/Writers/MediaWiki.hs view
@@ -26,6 +26,7 @@ import Text.Pandoc.ImageSize import Text.Pandoc.Logging import Text.Pandoc.Options+import Text.Pandoc.Walk import Text.DocLayout (render, literal) import Text.Pandoc.Shared import Text.Pandoc.URI@@ -470,7 +471,7 @@ inlineToMediaWiki Space = return " " inlineToMediaWiki (Link _ txt (src, _)) = do- label <- inlineListToMediaWiki txt+ label <- inlineListToMediaWiki (removeLinks txt) case txt of [Str s] | isURI src && escapeURI s == src -> return src _ -> return $ if isURI src@@ -503,6 +504,14 @@ modify (\s -> s { stNotes = True }) return $ "<ref>" <> stripTrailingNewlines contents' <> "</ref>" -- note - does not work for notes with multiple blocks++-- We need to remove links from link text, because an <a> element is+-- not allowed inside another <a> element.+removeLinks :: [Inline] -> [Inline]+removeLinks = walk go+ where+ go (Link _ ils _) = SmallCaps ils+ go x = x highlightingLangs :: Set.Set Text highlightingLangs = Set.fromList [
src/Text/Pandoc/Writers/Ms.hs view
@@ -63,6 +63,7 @@ let colwidth = if writerWrapText opts == WrapAuto then Just $ writerColumns opts else Nothing+ title <- chomp <$> inlineListToMs' opts (lookupMetaInlines "title" meta) metadata <- metaToContext opts (blockListToMs opts) (fmap chomp . inlineListToMs' opts)@@ -82,7 +83,8 @@ $ defField "toc" (writerTableOfContents opts) $ defField "title-meta" titleMeta $ defField "author-meta" (T.intercalate "; " authorsMeta)- $ defField "highlighting-macros" highlightingMacros metadata+ $ defField "highlighting-macros" highlightingMacros+ $ resetField "title" title metadata return $ render colwidth $ case writerTemplate opts of Nothing -> main
src/Text/Pandoc/Writers/ODT.hs view
@@ -113,7 +113,6 @@ Just m -> selfClosingTag "manifest:file-entry" [("manifest:media-type", m) ,("manifest:full-path", T.pack fp)- ,("manifest:version", "1.2") ] let files = [ ent | ent <- filesInArchive archive, not ("META-INF" `isPrefixOf` ent) ]@@ -125,9 +124,10 @@ $$ inTags True "manifest:manifest" [("xmlns:manifest","urn:oasis:names:tc:opendocument:xmlns:manifest:1.0")- ,("manifest:version","1.2")] ( selfClosingTag "manifest:file-entry"+ ,("manifest:version","1.3")] ( selfClosingTag "manifest:file-entry" [("manifest:media-type","application/vnd.oasis.opendocument.text")- ,("manifest:full-path","/")]+ ,("manifest:full-path","/")+ ,("manifest:version", "1.3")] $$ vcat ( map toFileEntry files ) $$ vcat ( map toFileEntry formulas ) )@@ -157,7 +157,7 @@ ,("xmlns:meta","urn:oasis:names:tc:opendocument:xmlns:meta:1.0") ,("xmlns:ooo","http://openoffice.org/2004/office") ,("xmlns:grddl","http://www.w3.org/2003/g/data-view#")- ,("office:version","1.2")] ( inTags True "office:meta" []+ ,("office:version","1.3")] ( inTags True "office:meta" [] ( metaTag "meta:generator" ("Pandoc/" <> pandocVersionText) $$ metaTag "dc:title" (stringify title)@@ -297,7 +297,7 @@ ,("xmlns:xlink","http://www.w3.org/1999/xlink") ,("xmlns:config","urn:oasis:names:tc:opendocument:xmlns:config:1.0") ,("xmlns:ooo","http://openoffice.org/2004/office")- ,("office:version","1.2")] (+ ,("office:version","1.3")] ( inTagsSimple "office:settings" $ inTags False "config:config-item-set" [("config:name", "ooo:configuration-settings")] $
src/Text/Pandoc/Writers/OpenDocument.hs view
@@ -255,7 +255,7 @@ collectBlockIdent _ = [] modify $ \s -> s{ stIdentTypes = query collectBlockIdent blocks } m <- metaToContext opts- (blocksToOpenDocument opts)+ (inlinesToOpenDocument opts . blocksToInlines) (fmap chomp . inlinesToOpenDocument opts) meta' b <- blocksToOpenDocument opts blocks@@ -442,7 +442,7 @@ then numberedTableCaption ident else unNumberedCaption "TableCaption" th <- colHeadsToOpenDocument o (map fst paraHStyles) thead- tr <- mapM (tableBodyToOpenDocument o (map fst paraStyles)) tbodies+ tr <- mapM (tableBodyToOpenDocument o (map fst paraHStyles) (map fst paraStyles)) tbodies let tableDoc = inTags True "table:table" [ ("table:name" , name) , ("table:style-name", name)@@ -506,19 +506,21 @@ vcat <$> mapM (tableItemToOpenDocument o "TableHeaderRowCell") (zip ns c) tableBodyToOpenDocument:: PandocMonad m- => WriterOptions -> [Text] -> Ann.TableBody+ => WriterOptions -> [Text] -> [Text] -> Ann.TableBody -> OD m (Doc Text)-tableBodyToOpenDocument o ns tb =+tableBodyToOpenDocument o headns bodyns tb = let (Ann.TableBody _ _ _ r) = tb- in vcat <$> mapM (tableRowToOpenDocument o ns) r+ in vcat <$> mapM (tableRowToOpenDocument o headns bodyns) r tableRowToOpenDocument :: PandocMonad m- => WriterOptions -> [Text] -> Ann.BodyRow+ => WriterOptions -> [Text] -> [Text] -> Ann.BodyRow -> OD m (Doc Text)-tableRowToOpenDocument o ns r =- let (Ann.BodyRow _ _ _ c ) = r++tableRowToOpenDocument o headns bodyns r =+ let (Ann.BodyRow _ _ rowheaders cs) = r in inTagsIndented "table:table-row" . vcat <$>- mapM (tableItemToOpenDocument o "TableRowCell") (zip ns c)+ mapM (tableItemToOpenDocument o "TableRowCell")+ ((zip headns rowheaders) ++ (zip (drop (length rowheaders) bodyns) cs)) colspanAttrib :: ColSpan -> [(Text, Text)] colspanAttrib cs =
src/Text/Pandoc/Writers/Typst.hs view
@@ -1,11 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE BangPatterns #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE TupleSections #-}-{-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeApplications #-}-{-# LANGUAGE ViewPatterns #-} {- | Module : Text.Pandoc.Writers.Typst Copyright : Copyright (C) 2023 John MacFarlane@@ -43,8 +38,7 @@ writeTypst options document = evalStateT (pandocToTypst options document) WriterState{ stOptions = options,- stEscapeContext = NormalContext,- stNotes = [] }+ stEscapeContext = NormalContext } data EscapeContext = NormalContext | TermContext deriving (Show, Eq)@@ -52,9 +46,7 @@ data WriterState = WriterState { stOptions :: WriterOptions,- stEscapeContext :: EscapeContext,- stNotes :: [Doc Text]- }+ stEscapeContext :: EscapeContext } type TW m = StateT WriterState m @@ -69,15 +61,11 @@ (fmap chomp . inlinesToTypst) meta main <- blocksToTypst blocks- noteContents <- reverse <$> gets stNotes- let notes = vsep $ zipWith- (\(num :: Int) cont ->- "#endnote" <> parens (brackets (text (show num))- <> ", " <> brackets (chomp cont <> cr)))- [1..] noteContents let context = defField "body" main- $ defField "notes" notes $ defField "toc" (writerTableOfContents options)+ $ (if isEnabled Ext_citations options+ then defField "citations" True+ else id) $ (case lookupMetaString "lang" meta of "" -> id lang ->@@ -146,14 +134,14 @@ text (show start) )) $$ x $$ "]"- items' <- mapM (fmap chomp . listItemToTypst 2 ("+ ")) items+ items' <- mapM (fmap chomp . listItemToTypst 2 ("+")) items return $ addBlock (if isTightList items then vcat items' else vsep items') $$ blankline BulletList items -> do- items' <- mapM (fmap chomp . listItemToTypst 2 "- ") items+ items' <- mapM (fmap chomp . listItemToTypst 2 "-") items return $ (if isTightList items then vcat items' else vsep items') $$ blankline@@ -209,6 +197,7 @@ defns' <- mapM blocksToTypst defns return $ nowrap ("/ " <> term' <> ": " <> "#block[") $$ chomp (vcat defns') $$ "]"+ listItemToTypst :: PandocMonad m => Int -> Doc Text -> [Block] -> TW m (Doc Text) listItemToTypst ind marker blocks = do contents <- blocksToTypst blocks@@ -275,7 +264,10 @@ else inlinesToTypst inlines Link _attrs inlines (src,_tit) -> do contents <- inlinesToTypst inlines- return $ "#link" <> parens (doubleQuoted src) <>+ let dest = case T.uncons src of+ Just ('#', ident) -> "<" <> literal ident <> ">"+ _ -> doubleQuoted src+ return $ "#link" <> parens dest <> if render Nothing contents == src then mempty else nowrap $ brackets contents@@ -284,12 +276,9 @@ let height' = maybe mempty ((", height: " <>) . literal) $ lookup "height" kvs return $ "#image(" <> doubleQuoted src <> width' <> height' <> ")"- Note blocks -> do -- currently typst has no footnotes!- -- TODO create endnotes with manual typesetting+ Note blocks -> do contents <- blocksToTypst blocks- modify $ \st -> st{ stNotes = contents : stNotes st }- num <- text . show . length <$> gets stNotes- return $ "#super" <> brackets num+ return $ "#footnote" <> brackets (chomp contents) textstyle :: PandocMonad m => Doc Text -> [Inline] -> TW m (Doc Text) textstyle s inlines = (s <>) . brackets <$> inlinesToTypst inlines@@ -324,7 +313,7 @@ toLabel ident = if T.null ident then mempty- else "#label" <> parens (doubleQuotes (literal ident))+ else "<" <> literal ident <> ">" doubleQuoted :: Text -> Doc Text doubleQuoted = doubleQuotes . literal . escape
test/Tests/Readers/Docx.hs view
@@ -316,7 +316,7 @@ , testCompare "blockquotes (parsing indent as blockquote)" "docx/block_quotes.docx"- "docx/block_quotes_parse_indent.native"+ "docx/block_quotes.native" , testCompare "blockquotes (parsing indent relative to the indent of the parent style as blockquote)" "docx/relative_indentation_blockquotes.docx"
test/Tests/Readers/Org/Block/Figure.hs view
@@ -26,8 +26,9 @@ , "#+name: ed" , "[[file:edward.jpg]]" ] =?>- figure (plainCaption "A courageous man.")- (plain $ image "edward.jpg" "ed" "")+ figureWith ("ed", mempty, mempty)+ (plainCaption "A courageous man.")+ (plain $ image "edward.jpg" mempty "") , "Figure with no name" =: T.unlines [ "#+caption: I've been through the desert on this"@@ -41,8 +42,9 @@ , "#+name: fig:redqueen" , "[[./the-red-queen.jpg]]" ] =?>- figure (plainCaption "Used as a metapher in evolutionary biology.")- (plain $ image "./the-red-queen.jpg" "fig:redqueen" "")+ figureWith ("fig:redqueen", mempty, mempty)+ (plainCaption "Used as a metapher in evolutionary biology.")+ (plain $ image "./the-red-queen.jpg" mempty "") , "Figure with HTML attributes" =: T.unlines [ "#+caption: mah brain just explodid"@@ -53,8 +55,8 @@ let kv = [("style", "color: blue"), ("role", "button")] name = "lambdacat" capt = plain "mah brain just explodid"- in figureWith (mempty, mempty, kv) (simpleCaption capt)- (plain $ image "lambdacat.jpg" name "")+ in figureWith (name, mempty, kv) (simpleCaption capt)+ (plain $ image "lambdacat.jpg" mempty "") , "LaTeX attributes are ignored" =: T.unlines [ "#+caption: Attribute after caption"
test/Tests/Writers/Docx.hs view
@@ -110,7 +110,7 @@ , docxTest "blockquotes" def- "docx/block_quotes_parse_indent.native"+ "docx/block_quotes.native" "docx/golden/block_quotes.docx" , docxTest "tables"
test/command/6288.md view
@@ -4,7 +4,5 @@ <label>I</label><title>Introduction</title> </sec> ^D-[ Header- 1 ( "" , [] , [] ) [ Str "I." , Space , Str "Introduction" ]-]+[ Header 1 ( "" , [] , [] ) [ Str "Introduction" ] ] ```
test/command/6792.md view
@@ -17,7 +17,7 @@ [])] ^D <?xml version="1.0" encoding="utf-8" ?>-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.2">+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.3"> <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>
test/command/8204.md view
@@ -37,3 +37,15 @@ Main text ```++Uppercase ABSTRACT environment is not moved to metadata.+```+% pandoc --from=org --to=markdown --standalone+#+BEGIN_ABSTRACT+Some text.+#+END_ABSTRACT+^D+::: ABSTRACT+Some text.+:::+```
+ test/command/8256.md view
@@ -0,0 +1,34 @@+```+% pandoc -t opendocument -s++---+title: |+ This *is* \+ a test+author: Someone+---++Testing.+^D+<?xml version="1.0" encoding="utf-8" ?>+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.3">+ <office:font-face-decls>+ <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" />+ </office:font-face-decls>+ <office:automatic-styles>+ <style:style style:name="T1" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>+ <style:style style:name="fr2" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="center" style:horizontal-rel="paragraph-content" style:wrap="none" /></style:style>+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Formula"><style:graphic-properties style:vertical-pos="middle" style:vertical-rel="text" /></style:style>+ </office:automatic-styles>+<office:body>+<office:text>+<text:p text:style-name="Title">This+<text:span text:style-name="T1">is</text:span><text:line-break />a+test</text:p>+<text:p text:style-name="Author">Someone</text:p>+<text:p text:style-name="Text_20_body">Testing.</text:p>+</office:text>+</office:body>+</office:document-content>+```+
+ test/command/8738.md view
@@ -0,0 +1,6 @@+```+% pandoc -f native -t mediawiki+[Link ("",[],[]) [Link ("",[],[]) [Str "test"] ("https://bar.example.com",""),Str "Test"] ("https://foo.example.com","")]+^D+[https://foo.example.com testTest]+```
+ test/command/8764.md view
@@ -0,0 +1,50 @@+```+% pandoc -f html -t opendocument+<table>+ <tbody>+ <tr>+ <th>Header</th>+ <td>Normal cell (column 2)</td>+ <td>Normal cell (column 3)</td>+ </tr>+ <tr>+ <td>Normal cell (column 1)</td>+ <td>Normal cell (column 2)</td>+ <td>Normal cell (column 3)</td>+ </tr>+ </tbody>+</table>+^D+<table:table table:name="Table1" table:style-name="Table1">+ <table:table-column table:style-name="Table1.A" />+ <table:table-column table:style-name="Table1.B" />+ <table:table-column table:style-name="Table1.C" />+ <table:table-row>+ <table:table-cell table:style-name="TableRowCell" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Header</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="TableRowCell" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Normal cell (column+ 2)</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="TableRowCell" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Normal cell (column+ 3)</text:p>+ </table:table-cell>+ </table:table-row>+ <table:table-row>+ <table:table-cell table:style-name="TableRowCell" office:value-type="string">+ <text:p text:style-name="Table_20_Heading">Normal cell (column+ 1)</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="TableRowCell" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Normal cell (column+ 2)</text:p>+ </table:table-cell>+ <table:table-cell table:style-name="TableRowCell" office:value-type="string">+ <text:p text:style-name="Table_20_Contents">Normal cell (column+ 3)</text:p>+ </table:table-cell>+ </table:table-row>+</table:table>+```
+ test/command/8777.md view
@@ -0,0 +1,8 @@+# Backslash escapes in markdown_strict++```+% pandoc --from=markdown_strict -t html+These are not escaped: \~ \"+^D+<p>These are not escaped: \~ \"</p>+```
+ test/command/8789.md view
@@ -0,0 +1,42 @@+# `\multicolumn` with column-type `p`++```+% pandoc --from=latex --to=html+\begin{tabular}{rrll}+ \toprule+ \textbf{First} & \textbf{Second} & \textbf{Third} & \textbf{Fourth} \\ \toprule+ 160 & 1 & test & test \\\midrule+ 160 & 2 & \multicolumn{2}{p{12cm}}{\textit{This is a test:}+ \begin{equation*}+ a^2+b^2 = c^2+ \end{equation*}+ }\\+\bottomrule+\end{tabular}+^D+<table>+<thead>+<tr class="header">+<th style="text-align: right;"><strong>First</strong></th>+<th style="text-align: right;"><strong>Second</strong></th>+<th style="text-align: left;"><strong>Third</strong></th>+<th style="text-align: left;"><strong>Fourth</strong></th>+</tr>+</thead>+<tbody>+<tr class="odd">+<td style="text-align: right;">160</td>+<td style="text-align: right;">1</td>+<td style="text-align: left;">test</td>+<td style="text-align: left;">test</td>+</tr>+<tr class="even">+<td style="text-align: right;">160</td>+<td style="text-align: right;">2</td>+<td colspan="2" style="text-align: left;"><em>This is a test:</em> <span+class="math display"><em>a</em><sup>2</sup> + <em>b</em><sup>2</sup> = <em>c</em><sup>2</sup></span></td>+</tr>+</tbody>+</table>++```
test/command/tasklist.md view
@@ -6,8 +6,8 @@ - [x] bar ^D <ul class="task-list">-<li><input type="checkbox" />foo</li>-<li><input type="checkbox" checked="" />bar</li>+<li><label><input type="checkbox" />foo</label></li>+<li><label><input type="checkbox" checked="" />bar</label></li> </ul> ``` @@ -20,12 +20,12 @@ - [ ] bim ^D <ul class="task-list">-<li><input type="checkbox" checked="" />foo+<li><label><input type="checkbox" checked="" />foo</label> <ul class="task-list">-<li><input type="checkbox" />bar</li>-<li><input type="checkbox" checked="" />baz</li>+<li><label><input type="checkbox" />bar</label></li>+<li><label><input type="checkbox" checked="" />baz</label></li> </ul></li>-<li><input type="checkbox" />bim</li>+<li><label><input type="checkbox" />bim</label></li> </ul> ``` @@ -53,21 +53,23 @@ - [x] checked ^D <ul>-<li><input type="checkbox" />unchecked</li>+<li><label><input type="checkbox" />unchecked</label></li> <li>plain item</li>-<li><input type="checkbox" checked="" />checked</li>+<li><label><input type="checkbox" checked="" />checked</label></li> </ul> <p>paragraph</p> <ol type="1">-<li><input type="checkbox" />ordered unchecked</li>+<li><label><input type="checkbox" />ordered unchecked</label></li> <li>[] plain item</li>-<li><input type="checkbox" checked="" />ordered checked</li>+<li><label><input type="checkbox" checked="" />ordered+checked</label></li> </ol> <p>paragraph</p> <ul class="task-list">-<li><p><input type="checkbox" />list item with a</p>+<li><p><label><input type="checkbox" />list item with a</label></p> <p>second paragraph</p></li>-<li><p><input type="checkbox" checked="" />checked</p></li>+<li><p><label><input type="checkbox"+checked="" />checked</label></p></li> </ul> ```
test/docx/block_quotes.docx view
binary file changed (28138 → 12153 bytes)
+ test/docx/block_quotes.native view
@@ -0,0 +1,11 @@+[Header 2 ("some-block-quotes-in-different-ways",[],[]) [Str "Some",Space,Str "block",Space,Str "quotes,",Space,Str "in",Space,Str "different",Space,Str "ways"]+,Para [Str "This",Space,Str "is",Space,Str "the",Space,Str "proper",Space,Str "way,",Space,Str "with",Space,Str "a",Space,Str "style"]+,BlockQuote+ [Para [Str "I",Space,Str "don\8217t",Space,Str "know",Space,Str "why",Space,Str "this",Space,Str "would",Space,Str "be",Space,Str "in",Space,Str "italics,",Space,Str "but",Space,Str "so",Space,Str "it",Space,Str "appears",Space,Str "to",Space,Str "be",Space,Str "on",Space,Str "my",Space,Str "screen."]]+,Para [Str "And",Space,Str "this",Space,Str "is",Space,Str "also",Space,Str "a",Space,Str "proper",Space,Str "way,",Space,Str "with",Space,Str "a",Space,Str "different", Space, Str "style"]+,BlockQuote+ [Para [Str "This",Space,Str "is",Space,Str "called",Space,Str "the",Space,Str "Intense",Space,Str "Quote",Space,Str "style."]]+,Para [Str "And",Space,Str "this",Space,Str "is",Space,Str "the",Space,Str "way",Space,Str "that",Space,Str "most",Space,Str "people",Space,Str "do",Space,Str "it:"]+,BlockQuote+ [Para [Str "I",Space,Str "just",Space,Str "indented",Space,Str "this,",Space,Str "so",Space,Str "it",Space,Str "looks",Space,Str "like",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "I",Space,Str "think",Space,Str "this",Space,Str "is",Space,Str "how",Space,Str "most",Space,Str "people",Space,Str "do",Space,Str "block",Space,Str "quotes",Space,Str "in",Space,Str "their",Space,Str "documents."]]+,Para [Str "And",Space,Str "back",Space,Str "to",Space,Str "the",Space,Str "normal",Space,Str "style."]]
− test/docx/block_quotes_parse_indent.native
@@ -1,8 +0,0 @@-[Header 2 ("some-block-quotes-in-different-ways",[],[]) [Str "Some",Space,Str "block",Space,Str "quotes,",Space,Str "in",Space,Str "different",Space,Str "ways"]-,Para [Str "This",Space,Str "is",Space,Str "the",Space,Str "proper",Space,Str "way,",Space,Str "with",Space,Str "a",Space,Str "style"]-,BlockQuote- [Para [Str "I",Space,Str "don\8217t",Space,Str "know",Space,Str "why",Space,Str "this",Space,Str "would",Space,Str "be",Space,Str "in",Space,Str "italics,",Space,Str "but",Space,Str "so",Space,Str "it",Space,Str "appears",Space,Str "to",Space,Str "be",Space,Str "on",Space,Str "my",Space,Str "screen."]]-,Para [Str "And",Space,Str "this",Space,Str "is",Space,Str "the",Space,Str "way",Space,Str "that",Space,Str "most",Space,Str "people",Space,Str "do",Space,Str "it:"]-,BlockQuote- [Para [Str "I",Space,Str "just",Space,Str "indented",Space,Str "this,",Space,Str "so",Space,Str "it",Space,Str "looks",Space,Str "like",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "I",Space,Str "think",Space,Str "this",Space,Str "is",Space,Str "how",Space,Str "most",Space,Str "people",Space,Str "do",Space,Str "block",Space,Str "quotes",Space,Str "in",Space,Str "their",Space,Str "documents."]]-,Para [Str "And",Space,Str "back",Space,Str "to",Space,Str "the",Space,Str "normal",Space,Str "style."]]
test/docx/golden/block_quotes.docx view
binary file changed (10025 → 10062 bytes)
test/epub/features.native view
@@ -1184,7 +1184,7 @@ , Plain [ Math DisplayMath- "c = \\overset{\\text{complex\\ number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\mspace{20mu} a\\mspace{20mu}}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}"+ "c = \\overset{\\text{complex number}}{\\overbrace{\\underset{\\text{real}}{\\underbrace{\\mspace{20mu} a\\mspace{20mu}}} + \\underset{\\text{imaginary}}{\\underbrace{\\quad b{\\mathbb{i}}\\quad}}}}" ] , Para [ Str "The"@@ -1281,7 +1281,7 @@ , Plain [ Math DisplayMath- "\\begin{matrix}\n & {\\operatorname{cov}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{L})} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{add}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cov}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{L})} & \\\\\n\\end{matrix}"+ "\\begin{matrix}\n & {\\operatorname{cov}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cof}(\\mathcal{L})} & \\longrightarrow & 2^{\\aleph_{0}} \\\\\n & \\uparrow & & \\uparrow & & \\uparrow & & \\uparrow & & \\\\\n & {\\mathfrak{b}} & \\longrightarrow & {\\mathfrak{d}} & & & & & & \\\\\n & \\uparrow & & \\uparrow & & & & & & \\\\\n\\aleph_{1} & \\longrightarrow & {\\operatorname{add}(\\mathcal{L})} & \\longrightarrow & {\\operatorname{add}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{cov}(\\mathcal{K})} & \\longrightarrow & {\\operatorname{non}(\\mathcal{L})} & \n\\end{matrix}" ] , Para [ Str "The"@@ -1352,7 +1352,7 @@ , Plain [ Math DisplayMath- "{\1583(\1587)} = \\left\\{ \\begin{matrix}\n{\\sum\\limits_{\1646 = 1}^{\1589}\1587^{\1646}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 > 0} \\\\\n{\\int_{1}^{\1589}{\1587^{\1646}\1569\1587}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 \\in \1605} \\\\\n{{\1591\1575}\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)} \\\\\n\\end{matrix} \\right."+ "{\1583(\1587)} = \\left\\{ \\begin{matrix}\n{\\sum\\limits_{\1646 = 1}^{\1589}\1587^{\1646}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 > 0} \\\\\n{\\int_{1}^{\1589}{\1587^{\1646}\1569\1587}} & {\\text{\1573\1584\1575\1603\1575\1606}\1587 \\in \1605} \\\\\n{{\1591\1575}\\pi} & {\\text{\1594\1610\1585\1584\1604\1603}\\left( \\text{\1605\1593}\\pi \\simeq 3,141 \\right)}\n\\end{matrix} \\right." ] , Para [ Str "The"
test/jats-reader.native view
@@ -226,7 +226,23 @@ , LineBreak , Str "here." ]+ , Header 1 ( "statements" , [] , [] ) [ Str "Statements" ] , Header+ 2 ( "" , [] , [] ) [ Str "CAP" , Space , Str "TITLE" ]+ , Para+ [ Str "Some"+ , Space+ , Str "text"+ , Space+ , Str "to"+ , Space+ , Str "make"+ , Space+ , Str "this"+ , Space+ , Str "regular"+ ]+ , Header 1 ( "block-quotes" , [] , [] ) [ Str "Block" , Space , Str "Quotes" ]@@ -2788,6 +2804,96 @@ (RowSpan 1) (ColSpan 1) [ Para [ Str "6" ] ]+ ]+ ]+ ]+ (TableFoot ( "" , [] , [] ) [])+ , Header+ 2+ ( "table-with-spans-and-alignments" , [] , [] )+ [ Str "Tables"+ , Space+ , Str "with"+ , Space+ , Str "spans"+ , Space+ , Str "and"+ , Space+ , Str "alignments"+ ]+ , Table+ ( "" , [] , [] )+ (Caption Nothing [])+ [ ( AlignLeft , ColWidthDefault )+ , ( AlignLeft , ColWidthDefault )+ , ( AlignLeft , ColWidthDefault )+ ]+ (TableHead+ ( "" , [] , [] )+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 2)+ [ Para [ Str "1" ] ]+ , Cell+ ( "" , [] , [] )+ AlignRight+ (RowSpan 1)+ (ColSpan 1)+ [ Para [ Str "2" ] ]+ ]+ ])+ [ TableBody+ ( "" , [] , [] )+ (RowHeadColumns 0)+ []+ [ Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 2)+ [ Para [ Str "1" ] ]+ , Cell+ ( "" , [] , [] )+ AlignLeft+ (RowSpan 1)+ (ColSpan 1)+ [ Para [ Str "2" ] ]+ ]+ , Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 2)+ (ColSpan 1)+ [ Para [ Str "4" ] ]+ , Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Para [ Str "5" ] ]+ , Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 1)+ [ Para [ Str "6" ] ]+ ]+ , Row+ ( "" , [] , [] )+ [ Cell+ ( "" , [] , [] )+ AlignDefault+ (RowSpan 1)+ (ColSpan 2)+ [ Para [ Str "7" ] ] ] ] ]
test/jats-reader.xml view
@@ -69,6 +69,14 @@ <p>Here's one with a bullet. * criminey.</p> <p>There should be a hard line break<break />here.</p> </sec>+<sec id="statements">+ <title> Statements </title>+ <statement>+ <label> A label for a statment</label>+ <title> CAP TITLE </title>+ <p> Some text to make this regular </p>+ </statement>+</sec> <sec id="block-quotes"> <title>Block Quotes</title> <p>E-mail style:</p>@@ -1146,6 +1154,50 @@ <td> <p>6</p> </td>+ </tr>+ </tbody>+ </table>+ </sec>+ <sec id="table-with-spans-and-alignments">+ <title>Tables with spans and alignments</title>+ <table>+ <col align="left" />+ <col align="left" />+ <col align="left" />+ <thead>+ <tr>+ <td colspan="2">+ <p>1</p>+ </td>+ <td align="right">+ <p>2</p>+ </td>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td colspan="2">+ <p>1</p>+ </td>+ <td align="left">+ <p>2</p>+ </td>+ </tr>+ <tr>+ <td rowspan="2">+ <p>4</p>+ </td>+ <td>+ <p>5</p>+ </td>+ <td>+ <p>6</p>+ </td>+ </tr>+ <tr>+ <td colspan="2">+ <p>7</p>+ </td> </tr> </tbody> </table>
test/lhs-test.html view
@@ -152,8 +152,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/lhs-test.html+lhs view
@@ -152,8 +152,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/s5-basic.html view
@@ -16,8 +16,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/s5-fancy.html view
@@ -16,8 +16,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/s5-inserts.html view
@@ -14,8 +14,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/tables/planets.latex view
@@ -1,14 +1,14 @@ \begin{longtable}[]{@{}cclrrrrrrrrl@{}} \caption{Data about the planets of our solar system.}\tabularnewline \toprule\noalign{}-\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%+\multicolumn{2}{@{}c}{% } & Name & Mass (10\^{}24kg) & Diameter (km) & Density (kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun (10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \midrule\noalign{} \endfirsthead \toprule\noalign{}-\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%+\multicolumn{2}{@{}c}{% } & Name & Mass (10\^{}24kg) & Diameter (km) & Density (kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun (10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\@@ -16,7 +16,7 @@ \endhead \bottomrule\noalign{} \endlastfoot-\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%+\multicolumn{2}{@{}c}{% \multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 & 4,879 & 5427 & 3.7 & 4222.6 & 57.9 & 167 & 0 & Closest to the Sun \\ & & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0 & \\@@ -29,7 +29,7 @@ & \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 & 2872.5 & -195 & 27 & \\ & & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\-\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%+\multicolumn{2}{@{}c}{% Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 & 153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\ \end{longtable}
test/tables/students.latex view
@@ -20,15 +20,15 @@ \endhead \bottomrule\noalign{} \endlastfoot-\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%+\multicolumn{2}{@{}l@{}}{% Computer Science} \\ 3741255 & Jones, Martha \\ 4077830 & Pierce, Benjamin \\ 5151701 & Kirk, James \\-\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%+\multicolumn{2}{@{}l@{}}{% Russian Literature} \\ 3971244 & Nim, Victor \\-\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%+\multicolumn{2}{@{}l@{}}{% Astrophysics} \\ 4100332 & Petrov, Alexandra \\ 4100332 & Toyota, Hiroko \\
test/writer.html4 view
@@ -155,8 +155,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/writer.html5 view
@@ -155,8 +155,11 @@ div.columns{display: flex; gap: min(4vw, 1.5em);} div.column{flex: auto; overflow-x: auto;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}- ul.task-list{list-style: none;}+ /* The extra [class] is a hack that increases specificity enough to+ override a similar rule in reveal.js */+ ul.task-list[class]{list-style: none;} ul.task-list li input[type="checkbox"] {+ font-size: inherit; width: 0.8em; margin: 0 0.8em 0.2em -1.6em; vertical-align: middle;
test/writer.opendocument view
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" ?>-<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.2">+<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.3"> <office:font-face-decls> <style:font-face style:name="Courier New" style:font-family-generic="modern" style:font-pitch="fixed" svg:font-family="'Courier New'" /> </office:font-face-decls>
test/writer.typst view
@@ -109,31 +109,31 @@ #horizontalrule = Headers-#label("headers")+<headers> == Level 2 with an #link("/url")[embedded link]-#label("level-2-with-an-embedded-link")+<level-2-with-an-embedded-link> === Level 3 with #emph[emphasis]-#label("level-3-with-emphasis")+<level-3-with-emphasis> ==== Level 4-#label("level-4")+<level-4> ===== Level 5-#label("level-5")+<level-5> = Level 1-#label("level-1")+<level-1> == Level 2 with #emph[emphasis]-#label("level-2-with-emphasis")+<level-2-with-emphasis> === Level 3-#label("level-3")+<level-3> with no blank line == Level 2-#label("level-2")+<level-2> with no blank line #horizontalrule = Paragraphs-#label("paragraphs")+<paragraphs> Here’s a regular paragraph. In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.@@ -148,7 +148,7 @@ #horizontalrule = Block Quotes-#label("block-quotes")+<block-quotes> E-mail style: #blockquote[@@ -166,8 +166,8 @@ A list: -+ item one-+ item two++ item one++ item two Nested block quotes: @@ -187,7 +187,7 @@ #horizontalrule = Code Blocks-#label("code-blocks")+<code-blocks> Code: ```@@ -211,146 +211,146 @@ #horizontalrule = Lists-#label("lists")+<lists> == Unordered-#label("unordered")+<unordered> 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-#label("ordered")+<ordered> Tight: -+ First-+ Second-+ Third++ First++ Second++ Third and: -+ One-+ Two-+ Three++ One++ Two++ Three Loose using tabs: -+ First++ First -+ Second++ Second -+ Third++ Third and using spaces: -+ One++ One -+ Two++ Two -+ Three++ Three Multiple paragraphs: -+ Item 1, graf one.++ Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. -+ Item 2.++ Item 2. -+ Item 3.++ Item 3. == Nested-#label("nested")-- Tab- - Tab- - Tab+<nested>+- Tab+ - Tab+ - Tab Here’s another: -+ First-+ Second:- - Fee- - Fie- - Foe-+ Third++ First++ Second:+ - Fee+ - Fie+ - Foe++ Third Same thing but with paragraphs: -+ First++ First -+ Second:++ Second: - - Fee- - Fie- - Foe+ - Fee+ - Fie+ - Foe -+ Third++ Third == Tabs and spaces-#label("tabs-and-spaces")-- this is a list item indented with tabs+<tabs-and-spaces>+- 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-#label("fancy-list-markers")+<fancy-list-markers> #block[ #set enum(numbering: "(1)", start: 2)-+ begins with 2++ begins with 2 -+ and now 3++ and now 3 with a continuation #block[ #set enum(numbering: "i.", start: 4)- + sublist with roman numerals, starting with 4- + more items+ + sublist with roman numerals, starting with 4+ + more items #block[ #set enum(numbering: "(A)", start: 1)- + a subsublist- + a subsublist+ + a subsublist+ + a subsublist ] ] ]@@ -359,16 +359,16 @@ #block[ #set enum(numbering: "A.", start: 1)-+ Upper Alpha++ Upper Alpha #block[ #set enum(numbering: "I.", start: 1)- + Upper Roman.+ + Upper Roman. #block[ #set enum(numbering: "(1)", start: 6)- + Decimal start with 6+ + Decimal start with 6 #block[ #set enum(numbering: "a)", start: 3)- + Lower alpha with paren+ + Lower alpha with paren ] ] ]@@ -376,9 +376,9 @@ Autonumbering: -+ Autonumber.-+ More.- + Nested.++ Autonumber.++ More.+ + Nested. Should not be a list item: @@ -389,7 +389,7 @@ #horizontalrule = Definition Lists-#label("definition-lists")+<definition-lists> Tight using spaces: / apple: #block[@@ -489,12 +489,12 @@ / orange: #block[ orange fruit -+ sublist-+ sublist++ sublist++ sublist ] = HTML Blocks-#label("html-blocks")+<html-blocks> Simple block on one line: foo@@ -551,7 +551,7 @@ #horizontalrule = Inline Markup-#label("inline-markup")+<inline-markup> This is #emph[emphasized], and so #emph[is this]. This is #strong[strong], and so #strong[is this].@@ -580,7 +580,7 @@ #horizontalrule = Smart quotes, ellipses, dashes-#label("smart-quotes-ellipses-dashes")+<smart-quotes-ellipses-dashes> "Hello," said the spider. "'Shelob' is my name." 'A', 'B', and 'C' are letters.@@ -601,38 +601,38 @@ #horizontalrule = LaTeX-#label("latex")-- -- $2 plus 2 eq 4$-- $x in y$-- $alpha and omega$-- $223$-- $p$-Tree-- Here’s some display math:+<latex>+-+- $2 plus 2 eq 4$+- $x in y$+- $alpha and omega$+- $223$+- $p$-Tree+- Here’s some display math: $ frac(d, d x) f lr((x)) eq lim_(h arrow.r 0) frac(f lr((x plus h)) minus f lr((x)), h) $-- Here’s one that has a line break in it: $alpha plus omega times x^2$.+- Here’s one that has a line break in it: $alpha plus omega times x^2$. These shouldn’t be math: -- To get the famous equation, write `$e = mc^2$`.-- \$22,000 is a #emph[lot] of money. So is \$34,000. (It worked if "lot" is+- To get the famous equation, write `$e = mc^2$`.+- \$22,000 is a #emph[lot] of money. So is \$34,000. (It worked if "lot" is emphasized.)-- Shoes (\$20) and socks (\$5).-- Escaped `$`: \$73 #emph[this should be emphasized] 23\$.+- Shoes (\$20) and socks (\$5).+- Escaped `$`: \$73 #emph[this should be emphasized] 23\$. Here’s a LaTeX table: #horizontalrule = Special Characters-#label("special-characters")+<special-characters> 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. @@ -679,9 +679,9 @@ #horizontalrule = Links-#label("links")+<links> == Explicit-#label("explicit")+<explicit> Just a #link("/url/")[URL]. #link("/url/")[URL and title].@@ -701,7 +701,7 @@ #link("")[Empty]. == Reference-#label("reference")+<reference> Foo #link("/url/")[bar]. With #link("/url/")[embedded \[brackets\]].@@ -725,7 +725,7 @@ Foo #link("/url/")[biz]. == With ampersands-#label("with-ampersands")+<with-ampersands> Here’s a #link("http://example.com/?foo=1&bar=2")[link with an ampersand in the URL]. @@ -736,13 +736,13 @@ Here’s an #link("/script?foo=1&bar=2")[inline link in pointy braces]. == Autolinks-#label("autolinks")+<autolinks> With an ampersand: #link("http://example.com/?foo=1&bar=2")[http://example.com/?foo\=1&bar\=2] -- In a list?-- #link("http://example.com/")-- It should.+- In a list?+- #link("http://example.com/")+- It should. An e-mail address: #link("mailto:nobody@nowhere.net")[nobody\@nowhere.net] @@ -759,7 +759,7 @@ #horizontalrule = Images-#label("images")+<images> From "Voyage dans la Lune" by Georges Melies (1902): #figure([#image("lalune.jpg")],@@ -773,30 +773,10 @@ #horizontalrule = Footnotes-#label("footnotes")-Here is a footnote reference,#super[1] and another.#super[2] This should-#emph[not] be a footnote reference, because it contains a space.\[^my note\]-Here is an inline note.#super[3]--#blockquote[-Notes can go in quotes.#super[4]-]--+ And in list items.#super[5]--This paragraph should not be part of the note, as it is not indented.--#v(1em)-#block[-#horizontalrule-#set text(size: .88em)-#v(3pt) // otherwise first note marker is swallowed, bug?--#endnote([1], [Here is the footnote. It can go anywhere after the footnote-reference. It need not be placed at the end of the document.-])--#endnote([2], [Here’s the long note. This one contains multiple blocks.+<footnotes>+Here is a footnote reference,#footnote[Here is the footnote. It can go anywhere+after the footnote reference. It need not be placed at the end of the document.]+and another.#footnote[Here’s the long note. This one contains multiple blocks. Subsequent blocks are indented to show that they belong to the footnote (as with list items).@@ -806,17 +786,16 @@ ``` If you want, you can indent every line, but you can also be lazy and just indent-the first line of each block.-])--#endnote([3], [This is #emph[easier] to type. Inline notes may contain+the first line of each block.] This should #emph[not] be a footnote reference,+because it contains a space.\[^my note\] Here is an inline note.#footnote[This+is #emph[easier] to type. Inline notes may contain #link("http://google.com")[links] and `]` verbatim characters, as well as-\[bracketed text\].-])--#endnote([4], [In quote.-])+\[bracketed text\].] -#endnote([5], [In list.-])+#blockquote[+Notes can go in quotes.#footnote[In quote.] ]+++ And in list items.#footnote[In list.]++This paragraph should not be part of the note, as it is not indented.