diff options
author | ickc <ickc@users.noreply.github.com> | 2016-05-09 19:24:40 -0700 |
---|---|---|
committer | ickc <ickc@users.noreply.github.com> | 2016-05-09 19:24:40 -0700 |
commit | 0ae60a91535a8f55f3061f36fdb3a54f6ddda85d (patch) | |
tree | f0c74ae411967ed5f67bd8b0bdf175ee5ca964ab | |
parent | 846fa8704618e7e544313f5b3b627ccb6e65b550 (diff) | |
parent | f7601297f0ff184a59efdc3ea279137fc6012eef (diff) | |
download | pandoc-0ae60a91535a8f55f3061f36fdb3a54f6ddda85d.tar.gz |
Merge pull request #1 from jgm/master
Merge from jgm's master
70 files changed, 2786 insertions, 457 deletions
diff --git a/.travis.yml b/.travis.yml index 9c031216f..3c3ff3425 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,7 +108,7 @@ script: - | case "$BUILD" in stack) - stack --no-terminal $ARGS test --haddock --no-haddock-deps + stack --no-terminal $ARGS test --haddock --no-haddock-deps --ghc-options="-Wall -fno-warn-unused-do-bind -Werror" ;; cabal) cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror" @@ -119,7 +119,7 @@ script: # cabal sdist fails on cabal 1.16: cabal sdist || [ "$CABALVER" == "1.16" ] SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && \ - (cd dist && cabal install --force-reinstalls "$SRC_TGZ" || \ + (cd dist && cabal install --enable-tests --force-reinstalls "$SRC_TGZ" || \ [ "$CABALVER" == "1.16" ]) ;; esac @@ -22,7 +22,7 @@ markup], [Haddock markup], [OPML], [Emacs Org mode], [DocBook], [OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup], [DokuWiki markup], [Haddock markup], [EPUB] (v2 or v3), [FictionBook2], [Textile], [groff man] pages, [Emacs Org mode], -[AsciiDoc], [InDesign ICML], [TEI XML], and [Slidy], [Slideous], [DZSlides], +[AsciiDoc], [InDesign ICML], [TEI Simple], and [Slidy], [Slideous], [DZSlides], [reveal.js] or [S5] HTML slide shows. It can also produce [PDF] output on systems where LaTeX, ConTeXt, or `wkhtmltopdf` is installed. @@ -273,26 +273,26 @@ General options (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt), `man` (groff man), `mediawiki` (MediaWiki markup), `dokuwiki` (DokuWiki markup), `textile` (Textile), `org` (Emacs Org mode), - `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` (DocBook), - `opendocument` (OpenDocument), `odt` (OpenOffice text document), - `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text - format), `epub` (EPUB v2 book), `epub3` (EPUB v3), `fb2` - (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml` (InDesign - ICML), `tei` (TEI Simple), `slidy` (Slidy HTML and javascript slide - show), `slideous` (Slideous HTML and javascript slide show), - `dzslides` (DZSlides HTML5 + javascript slide show), `revealjs` - (reveal.js HTML5 + javascript slide show), `s5` (S5 HTML and javascript - slide show), or the path of a custom lua writer (see [Custom - writers], below). Note that `odt`, `epub`, and - `epub3` output will not be directed to *stdout*; an output - filename must be specified using the `-o/--output` option. If - `+lhs` is appended to `markdown`, `rst`, `latex`, `beamer`, - `html`, or `html5`, the output will be rendered as literate - Haskell source: see [Literate Haskell - support], below. Markdown syntax - extensions can be individually enabled or disabled by appending - `+EXTENSION` or `-EXTENSION` to the format name, as described - above under `-f`. + `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` (DocBook 4), + `docbook5` (DocBook 5), `opendocument` (OpenDocument), `odt` + (OpenOffice text document), `docx` (Word docx), `haddock` + (Haddock markup), `rtf` (rich text format), `epub` (EPUB v2 + book), `epub3` (EPUB v3), `fb2` (FictionBook2 e-book), + `asciidoc` (AsciiDoc), `icml` (InDesign ICML), `tei` (TEI + Simple), `slidy` (Slidy HTML and javascript slide show), + `slideous` (Slideous HTML and javascript slide show), + `dzslides` (DZSlides HTML5 + javascript slide show), + `revealjs` (reveal.js HTML5 + javascript slide show), `s5` + (S5 HTML and javascript slide show), or the path of a custom + lua writer (see [Custom writers], below). Note that `odt`, + `epub`, and `epub3` output will not be directed to *stdout*; + an output filename must be specified using the `-o/--output` + option. If `+lhs` is appended to `markdown`, `rst`, `latex`, + `beamer`, `html`, or `html5`, the output will be rendered as + literate Haskell source: see [Literate Haskell support], + below. Markdown syntax extensions can be individually + enabled or disabled by appending `+EXTENSION` or + `-EXTENSION` to the format name, as described above under `-f`. `-o` *FILE*, `--output=`*FILE* @@ -388,6 +388,14 @@ Reader options require different kinds of images. Currently this option only affects the Markdown and LaTeX readers. +`--file-scope` + +: Parse each file individually before combining for multifile + documents. This will allow footnotes in different files with the + same identifiers to work as expected. If this option is set, + footnotes and links will not work across files. Reading binary + files (docx, odt, epub) implies `--file-scope`. + `--filter=`*EXECUTABLE* : Specify an executable to be used as a filter transforming the @@ -530,16 +538,16 @@ General writer options `--columns=`*NUMBER* -: Specify length of lines in characters (for text wrapping). - This affects only the generated source code, not the layout on - the rendered page. +: Specify length of lines in characters. This affects text wrapping + in the generated source code (see `--wrap`). It also affects + calculation of column widths for plain text tables (see [Tables] below). `--toc`, `--table-of-contents` : Include an automatically generated table of contents (or, in - the case of `latex`, `context`, and `rst`, an instruction to create + the case of `latex`, `context`, `docx`, and `rst`, an instruction to create one) in the output document. This option has no effect on `man`, - `docbook`, `slidy`, `slideous`, `s5`, `docx`, or `odt` output. + `docbook`, `docbook5`, `slidy`, `slideous`, `s5`, or `odt` output. `--toc-depth=`*NUMBER* @@ -901,7 +909,7 @@ Math rendering in HTML `--mathml`[`=`*URL*] -: Convert TeX math to [MathML] (in `docbook` as well as `html` and `html5`). +: Convert TeX math to [MathML] (in `docbook`, `docbook5`, `html` and `html5`). In standalone `html` output, a small javascript (or a link to such a script if a *URL* is supplied) will be inserted that allows the MathML to be viewed on some browsers. @@ -997,9 +1005,15 @@ where *FORMAT* is the name of the output format. A custom template can be specified using the `--template` option. You can also override the system default templates for a given output format *FORMAT* by putting a file `templates/default.*FORMAT*` in the user data -directory (see `--data-dir`, above). *Exceptions:* For `odt` output, -customize the `default.opendocument` template. For `pdf` output, -customize the `default.latex` template. +directory (see `--data-dir`, above). *Exceptions:* + +- For `odt` output, customize the `default.opendocument` + template. +- For `pdf` output, customize the `default.latex` template + (or the `default.beamer` template, if you use `-t beamer`, + or the `default.context` template, if you use `-t context`). +- `docx` has no template (however, you can use + `--reference-docx` to customize the output). Templates contain *variables*, which allow for the inclusion of arbitrary information at any point in the file. Variables may be set @@ -1033,6 +1047,10 @@ as the following: `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`, `scrreprt`, `scrbook`).[^subtitle] +`institute` +: author affiliations (in LaTeX and Beamer only). Can be a + list, when there are multiple authors. + `abstract` : document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx @@ -1573,21 +1591,26 @@ CSS. #### Extension: `implicit_header_references` #### Pandoc behaves as if reference links have been defined for each header. -So, instead of +So, to link to a header - [header identifiers](#header-identifiers-in-html) + # Header identifiers in HTML you can simply write - [header identifiers] + [Header identifiers in HTML] or - [header identifiers][] + [Header identifiers in HTML][] or - [the section on header identifiers][header identifiers] + [the section on header identifiers][header identifiers in + HTML] + +instead of giving the identifier explicitly: + + [Header identifiers in HTML](#header-identifiers-in-html) If there are multiple headers with identical text, the corresponding reference will link to the first one only, and you will need to use explicit diff --git a/appveyor.yml b/appveyor.yml index 00a1aab34..f2fe828fa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,38 +1,19 @@ -install: -- cmd: 'git submodule update --init' -- ps: | - choco install haskellplatform -version 2014.2.0.0 -y - # Haskell Platfrom package doesn't update PATH for the current shell instance +cache: +- "c:\\sr" # stack root, short paths == fewer problems - $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\bin" - $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\lib\extralibs\bin" - $env:Path += ";${env:ProgramFiles}\Haskell Platform\2014.2.0.0\mingw\bin" - # choco install wixtoolset - cabal sandbox init - $env:Path += ";.\.cabal-sandbox\bin" - cabal update - cabal install --force hsb2hs +build: off -build_script: -- cmd: | - cabal install --force --enable-tests -fembed_data_files +before_test: +- curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386 +- 7z x stack.zip stack.exe -# after_build: -# - cmd: | -# cabal install -fembed_data_files pandoc-citeproc -# strip .\.cabal-sandbox\bin\pandoc.exe -# strip .\.cabal-sandbox\bin\pandoc-citeproc.exe -# .\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.html -S README -o README.html -# .\.cabal-sandbox\bin\pandoc.exe -s --template data\templates\default.rtf COPYING -t rtf -S -o COPYING.rtf -# copy COPYRIGHT COPYRIGHT.txt -# for /f "tokens=2 delims= " %%a in ('.\.cabal-sandbox\bin\pandoc --version') do ( set "VERSION=%%a" && exit ) -# if "%VERSION%" == "" ( echo "Error: could not determine version number." && exit /b 1 ) -# cd windows -# echo Creating msi... -# candle -dVERSION=%VERSION% pandoc.wxs -# if %errorlevel% neq 0 exit /b %errorlevel% -# light -sw1076 -ext WixUIExtension -ext WixUtilExtension -out pandoc-%VERSION%-windows.msi pandoc.wixobj +clone_folder: "c:\\stack" +environment: + global: + STACK_ROOT: "c:\\sr" test_script: -- cmd: | - cabal test +- stack setup > nul +# The ugly echo "" hack is to avoid complaints about 0 being an invalid file +# descriptor +- echo "" | stack --no-terminal test @@ -1,3 +1,170 @@ +pandoc (1.17.0.3) + + * LaTeX writer: Fixed position of label in figures (#2813). + Previously the label wasn't in the right place, and `\ref` + wouldn't work properly. + * Added .tei test files to pandoc.cabal so they'll be included + in tarball (#2811). + * Updated copyright dates. + +pandoc (1.17.0.2) + + * Fixed serious regression in `htmlInBalanced`, which caused + newlines to be omitted in some raw HTML blocks in Markdown + (#2804). + +pandoc (1.17.0.1) + + * File scope is no longer used when there are no input files (i.e., + when input comes from stdin). Previously file scope was triggered + when the `json` reader was specified and input came from `stdin`, + and this caused no output to be produced. (Fix due to Jesse Rosenthal; + thanks to Fedor Sheremetyev for calling the bug to our attention.) + * Improved documentation of templates (#2797). + +pandoc (1.17) + + * Added `--file-scope` option (Jesse Rosenthal). + By default pandoc operates on multiple files by first concatenating + them (around extra line breaks) and then processing the joined file. So + it only parses a multi-file document at the document scope. This has the + benefit that footnotes and links can be in different files, but for + some purposes it is useful to parse the individual files first + and then combine their outputs (e.g. when the files use footnotes + or links with the same labels). The `--file-scope` option causes + pandoc to parse the files first, and then combine the parsed output, + instead of combining before parsing. `--file-scope` is selected + automatically for binary input files (which cannot be concatenated) + and for pandoc json. + + * Add TEI Writer (Chris Forster) and `tei` output format. + + * Added a general `ByteStringReader` with warnings, used by the docx + reader (API change, Jesse Rosenthal). + + * Add `readDocxWithWarnings` (API change, Jesse Rosenthal). + + * Changed type of `Shared.uniqueIdent`'s argument from `[String]` + to `Set String.` This avoids performance problems in documents with + many identically named headers (API change, #2671). + + * Removed `tex_math_single_backslash` from `markdown_github` options + (#2707). + + * Make language extensions as well as full language names + trigger syntax highlighting. For example, `py` will now work as + well as `python` (jgm/highlighting-kate#83). + + * Added `institute` variable to latex, beamer templates (Fraser + Tweedale, Josef Svenningsson). + + * Docx reader (Jesse Rosenthal): + + + Handle alternate content. Some word functions (especially graphics) + give various choices for content so there can be backwards compatibility. + + Don't turn numbered headers into lists. + + Docx Reader: Add state to the parser, for warnings + + Update feature checklist in source code. + + Get rid of `Modifiable` typeclass. + + Add tests for adjacent hyperlinks. + + Add a "Link" modifier to `Reducible`. We want to make sure that + links have their spaces removed, and are appropriately smushed + together (#2689). + + * HTML reader: + + + Fixed behavior of base tag (#2777). + If the base path does not end with slash, the last component + will be replaced. E.g. base = `http://example.com/foo` + combines with `bar.html` to give `http://example.com/bar.html`. + If the href begins with a slash, the whole path of the base + is replaced. E.g. base = `http://example.com/foo/` combines + with `/bar.html` to give `http://example.com/bar.html`. + + Rewrote `htmlInBalanced`. This version avoids an exponential + performance problem with `<script>` tags, and it should be faster + in general (#2730). + + Properly handle an empty cell in a simple table (#2718). + + Handle multiple `<meta>` tags with same name. Put them in a list + in the metadata so they are all preserved, rather than (as before) + throwing out all but one.. + + * Markdown reader: + + + Improved pipe table parsing (#2765). + + Allow `+` separators in pipe table cells. We already allowed + them in the header, but not in the body rows, for some reason. + This gives compatibility with org-mode tables. + + Don't cross line boundary parsing pipe table row. + Previously an Emph element could be parsed across the newline + at the end of the pipe table row. + + Use `htmlInBalanced` for `rawVerbatimBlock`, for better + performance (#2730). + + Fixed bug with smart quotes around tex math. + + * LaTeX reader: + + + Handle interior `$` characters in math (#2743). For example, + `$$\hbox{$i$}$$`. + + `inlineCommand` now gobbles an empty `{}` after any command (#2687). + This gives better results when people write e.g. `\TeX{}` in Markdown. + + Properly handle LaTeX "math" environment as inline math (#2171). + + * Textile reader: Support `>`, `<`, `=`, `<>` text alignment attributes. + Closes #2674. + + * Org reader (Albert Krewinkel): + + + Prefix even empty figure names with "fig:" (#2643). The + convention used by pandoc for figures is to mark them by prefixing + the name with `fig:`. The org reader failed to do this if a figure + had no name. + + Refactor link-target processing (#2684). + + * ConTeXt writer: Fix whitespace at line beginning in line blocks (#2744). + Thanks to @c-foster. + + * HTML writer: Don't include alignment attribute for default table columns. + Previously these were given "left" alignment. Better to leave off + alignment attributes altogether (#2694). + + * Markdown writer: Use hyphens for YAML metadata block bottom line, for + better compatibility with other Markdown flavors (Henrik Tramberend). + + * LaTeX writer: + + + Use image identifier to create a label and hypertarget for + figures (Mauro Bieg). + + Avoid double toprule in headerless table with caption (#2742). + + Clean up options parser (Jesse Rosenthal). + + Treat `memoir` template with `article` option as article, instead + of treating all `memoir` templates as books. + + Allow more flexible table alignment (Henrik Tramberend, #2665). + New default is not to include `[c]` option (which is the default + anyway if no positioning is specified). Now LaTeX emplates can + control the overall table alignment in a document by setting the + longtable length variables `LTleft` and `LTright`. For example, + `\setlength\LTleft\parindent\setlength\LTright\fill` + will create left-aligned tables that respect paragraph indentation. + + * Docx writer: Handle image alt text (#2754, Mauro Bieg). + + * Org writer - pass through RawInline with format "org". + + * DokuWiki writer: use `$$` for display math. + + * Custom writer: Pass attributes parameter to CaptionedImage (#2697). + + * Make protocol-relative URIs work again (#2737). + + * make_osx_package.sh: Use env variable for developer id certs. + + * Raise `tagsoup` lower bound to 0.13.7 to fix entity-related + problems (#2734). + + * Allow `zip-archive` 0.3. + + * Allow `aeson` 0.11. + pandoc (1.16.0.2) * Depend on deepseq rather than deepseq-generics (fpco/stackage#1096). diff --git a/data/templates b/data/templates -Subproject 40175cfc59cfaaf1ec159cdf5ff580fc6d3b2f0 +Subproject 63471c3b8cc2e30ccd92f46b2bc40521960fa06 diff --git a/deb/stack.yaml b/deb/stack.yaml index 9986ead40..bf320c12f 100644 --- a/deb/stack.yaml +++ b/deb/stack.yaml @@ -13,6 +13,9 @@ flags: debug: false packages: - '..' -- 'https://hackage.haskell.org/package/pandoc-citeproc-0.9/pandoc-citeproc-0.9.tar.gz' +- 'https://hackage.haskell.org/package/pandoc-citeproc-0.9.1.1/pandoc-citeproc-0.9.1.1.tar.gz' extra-deps: -resolver: lts-5.2 +- 'aeson-0.11.1.1' +- 'texmath-0.8.5' +- 'highlighting-kate-0.6.2' +resolver: lts-5.8 diff --git a/make_osx_package.sh b/make_osx_package.sh index 89f97025b..4a9f03b95 100755 --- a/make_osx_package.sh +++ b/make_osx_package.sh @@ -53,7 +53,7 @@ $LOCALBIN/pandoc --data data -t html5 -s COPYING -o $RESOURCES/license.html echo Signing pandoc executable... -codesign --force --sign ${DEVELOPER_ID_APPLICATION} $DEST/bin/pandoc +codesign --force --sign "${DEVELOPER_ID_APPLICATION}" $DEST/bin/pandoc # make sure it's valid... returns nonzero exit code if it isn't: spctl --assess --type execute $DEST/bin/pandoc @@ -61,8 +61,10 @@ echo Creating OSX package... # remove old package first rm -rf $BASE.pkg +sed -e "s/PANDOCVERSION/$VERSION/" osx/distribution.xml.in > osx/distribution.xml + pkgbuild --root $DIST/pandoc --identifier net.johnmacfarlane.pandoc --version 1.13 --ownership recommended $DIST/pandoc.pkg -productbuild --distribution osx/distribution.xml --resources $DIST/Resources --package-path $DIST --version $VERSION --sign ${DEVELOPER_ID_INSTALLER} $BASE-osx.pkg +productbuild --distribution osx/distribution.xml --resources $DIST/Resources --package-path $DIST --version $VERSION --sign "${DEVELOPER_ID_INSTALLER}" $BASE-osx.pkg # verify signature spctl --assess --type install $BASE-osx.pkg diff --git a/man/pandoc.1 b/man/pandoc.1 index 9aeb046d4..372673d84 100644 --- a/man/pandoc.1 +++ b/man/pandoc.1 @@ -1,5 +1,5 @@ .\"t -.TH PANDOC 1 "January 12, 2016" "pandoc 1.16.0.2" +.TH PANDOC 1 "January 12, 2016" "pandoc 1.17.0.3" .SH NAME pandoc - general markup converter .SH SYNOPSIS @@ -18,8 +18,8 @@ reStructuredText, XHTML, HTML5, LaTeX (including \f[C]beamer\f[] slide shows), ConTeXt, RTF, OPML, DocBook, OpenDocument, ODT, Word docx, GNU Texinfo, MediaWiki markup, DokuWiki markup, Haddock markup, EPUB (v2 or v3), FictionBook2, Textile, groff man pages, Emacs Org mode, AsciiDoc, -InDesign ICML, and Slidy, Slideous, DZSlides, reveal.js or S5 HTML slide -shows. +InDesign ICML, TEI Simple, and Slidy, Slideous, DZSlides, reveal.js or +S5 HTML slide shows. It can also produce PDF output on systems where LaTeX, ConTeXt, or \f[C]wkhtmltopdf\f[] is installed. .PP @@ -253,11 +253,12 @@ Specify output format. (Haddock markup), \f[C]rtf\f[] (rich text format), \f[C]epub\f[] (EPUB v2 book), \f[C]epub3\f[] (EPUB v3), \f[C]fb2\f[] (FictionBook2 e\-book), \f[C]asciidoc\f[] (AsciiDoc), \f[C]icml\f[] (InDesign ICML), -\f[C]slidy\f[] (Slidy HTML and javascript slide show), \f[C]slideous\f[] -(Slideous HTML and javascript slide show), \f[C]dzslides\f[] (DZSlides -HTML5 + javascript slide show), \f[C]revealjs\f[] (reveal.js HTML5 + -javascript slide show), \f[C]s5\f[] (S5 HTML and javascript slide show), -or the path of a custom lua writer (see Custom writers, below). +\f[C]tei\f[] (TEI Simple), \f[C]slidy\f[] (Slidy HTML and javascript +slide show), \f[C]slideous\f[] (Slideous HTML and javascript slide +show), \f[C]dzslides\f[] (DZSlides HTML5 + javascript slide show), +\f[C]revealjs\f[] (reveal.js HTML5 + javascript slide show), \f[C]s5\f[] +(S5 HTML and javascript slide show), or the path of a custom lua writer +(see Custom writers, below). Note that \f[C]odt\f[], \f[C]epub\f[], and \f[C]epub3\f[] output will not be directed to \f[I]stdout\f[]; an output filename must be specified using the \f[C]\-o/\-\-output\f[] option. @@ -401,6 +402,15 @@ Currently this option only affects the Markdown and LaTeX readers. .RS .RE .TP +.B \f[C]\-\-file\-scope\f[] +Parse each file individually before combining for multifile documents. +This will allow footnotes in different files with the same identifiers +to work as expected. +If this option is set, footnotes and links will not work across files. +Reading binary files (docx, odt, epub) implies \f[C]\-\-file\-scope\f[]. +.RS +.RE +.TP .B \f[C]\-\-filter=\f[]\f[I]EXECUTABLE\f[] Specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written. @@ -501,7 +511,7 @@ This option only affects the docx and epub readers. .TP .B \f[C]\-s\f[], \f[C]\-\-standalone\f[] Produce output with an appropriate header and footer (e.g. -a standalone HTML, LaTeX, or RTF file, not a fragment). +a standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option is set automatically for \f[C]pdf\f[], \f[C]epub\f[], \f[C]epub3\f[], \f[C]fb2\f[], \f[C]docx\f[], and \f[C]odt\f[] output. .RS @@ -582,11 +592,10 @@ rendered page. .TP .B \f[C]\-\-toc\f[], \f[C]\-\-table\-of\-contents\f[] Include an automatically generated table of contents (or, in the case of -\f[C]latex\f[], \f[C]context\f[], and \f[C]rst\f[], an instruction to -create one) in the output document. +\f[C]latex\f[], \f[C]context\f[], \f[C]docx\f[], and \f[C]rst\f[], an +instruction to create one) in the output document. This option has no effect on \f[C]man\f[], \f[C]docbook\f[], -\f[C]slidy\f[], \f[C]slideous\f[], \f[C]s5\f[], \f[C]docx\f[], or -\f[C]odt\f[] output. +\f[C]slidy\f[], \f[C]slideous\f[], \f[C]s5\f[], or \f[C]odt\f[] output. .RS .RE .TP @@ -642,7 +651,7 @@ Implies \f[C]\-\-standalone\f[]. Include contents of \f[I]FILE\f[], verbatim, at the end of the document body (before the \f[C]</body>\f[] tag in HTML, or the \f[C]\\end{document}\f[] command in LaTeX). -This option can be be used repeatedly to include multiple files. +This option can be used repeatedly to include multiple files. They will be included in the order specified. Implies \f[C]\-\-standalone\f[]. .RS @@ -702,7 +711,8 @@ ATX headers. Treat top\-level headers as chapters in LaTeX, ConTeXt, and DocBook output. When the LaTeX document class is set to \f[C]report\f[], \f[C]book\f[], -or \f[C]memoir\f[], this option is implied. +or \f[C]memoir\f[] (unless the \f[C]article\f[] option is specified), +this option is implied. If \f[C]beamer\f[] is the output format, top\-level headers will become \f[C]\\part{..}\f[]. .RS @@ -809,7 +819,7 @@ Implies \f[C]\-\-standalone\f[]. .TP .B \f[C]\-c\f[] \f[I]URL\f[], \f[C]\-\-css=\f[]\f[I]URL\f[] Link to a CSS style sheet. -This option can be be used repeatedly to include multiple files. +This option can be used repeatedly to include multiple files. They will be included in the order specified. .RS .RE @@ -1149,9 +1159,18 @@ You can also override the system default templates for a given output format \f[I]FORMAT\f[] by putting a file \f[C]templates/default.*FORMAT*\f[] in the user data directory (see \f[C]\-\-data\-dir\f[], above). -\f[I]Exceptions:\f[] For \f[C]odt\f[] output, customize the -\f[C]default.opendocument\f[] template. -For \f[C]pdf\f[] output, customize the \f[C]default.latex\f[] template. +\f[I]Exceptions:\f[] +.IP \[bu] 2 +For \f[C]odt\f[] output, customize the \f[C]default.opendocument\f[] +template. +.IP \[bu] 2 +For \f[C]pdf\f[] output, customize the \f[C]default.latex\f[] template +(or the \f[C]default.beamer\f[] template, if you use +\f[C]\-t\ beamer\f[], or the \f[C]default.context\f[] template, if you +use \f[C]\-t\ context\f[]). +.IP \[bu] 2 +\f[C]docx\f[] has no template (however, you can use +\f[C]\-\-reference\-docx\f[] to customize the output). .PP Templates contain \f[I]variables\f[], which allow for the inclusion of arbitrary information at any point in the file. @@ -1191,6 +1210,12 @@ docx; renders in LaTeX only when using a document class that supports .RS .RE .TP +.B \f[C]institute\f[] +author affiliations (in LaTeX and Beamer only). +Can be a list, when there are multiple authors. +.RS +.RE +.TP .B \f[C]abstract\f[] document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx .RS @@ -1260,7 +1285,7 @@ a list of other languages used in the document in the YAML metadata, according to BCP 47. For example: \f[C]otherlangs:\ [en\-GB,\ fr]\f[]. This is automatically generated from the \f[C]lang\f[] attributes in all -\f[C]span\f[]s and \f[C]div\f[]s but can be overriden. +\f[C]span\f[]s and \f[C]div\f[]s but can be overridden. Currently only used by LaTeX through the generated \f[C]babel\-otherlangs\f[] and \f[C]polyglossia\-otherlangs\f[] variables. @@ -4214,8 +4239,7 @@ variants are supported: .RE .TP .B \f[C]markdown_github\f[] (GitHub\-Flavored Markdown) -\f[C]pipe_tables\f[], \f[C]raw_html\f[], -\f[C]tex_math_single_backslash\f[], \f[C]fenced_code_blocks\f[], +\f[C]pipe_tables\f[], \f[C]raw_html\f[], \f[C]fenced_code_blocks\f[], \f[C]auto_identifiers\f[], \f[C]ascii_identifiers\f[], \f[C]backtick_code_blocks\f[], \f[C]autolink_bare_uris\f[], \f[C]intraword_underscores\f[], \f[C]strikeout\f[], diff --git a/osx/distribution.xml b/osx/distribution.xml.in index 346fe06fe..145fc0f21 100644 --- a/osx/distribution.xml +++ b/osx/distribution.xml.in @@ -11,7 +11,7 @@ <options hostArchitectures="x86_64" /> <!-- List all component packages --> <pkg-ref id="net.johnmacfarlane.pandoc" - version="1.16.0.2" + version="PANDOCVERSION" auth="root">pandoc.pkg</pkg-ref> <!-- List them again here. They can now be organized as a hierarchy if you want. --> diff --git a/osx/stack.yaml b/osx/stack.yaml index 50a90f9d6..c29a7f45b 100644 --- a/osx/stack.yaml +++ b/osx/stack.yaml @@ -16,6 +16,9 @@ ghc-options: highlighting-kate: '-pgmP cpphs -optP--cpp' packages: - '..' -- 'https://hackage.haskell.org/package/pandoc-citeproc-0.9/pandoc-citeproc-0.9.tar.gz' +- 'https://hackage.haskell.org/package/pandoc-citeproc-0.9.1.1/pandoc-citeproc-0.9.1.1.tar.gz' extra-deps: -resolver: lts-5.2 +- 'aeson-0.11.1.1' +- 'texmath-0.8.5' +- 'highlighting-kate-0.6.2' +resolver: lts-5.8 diff --git a/pandoc.cabal b/pandoc.cabal index b76d5d6f4..e8252293b 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -1,10 +1,10 @@ Name: pandoc -Version: 1.17 +Version: 1.17.1 Cabal-Version: >= 1.10 Build-Type: Custom License: GPL License-File: COPYING -Copyright: (c) 2006-2015 John MacFarlane +Copyright: (c) 2006-2016 John MacFarlane Author: John MacFarlane <jgm@berkeley.edu> Maintainer: John MacFarlane <jgm@berkeley.edu> Bug-Reports: https://github.com/jgm/pandoc/issues @@ -39,6 +39,7 @@ Data-Files: data/templates/default.html data/templates/default.html5 data/templates/default.docbook + data/templates/default.docbook5 data/templates/default.tei data/templates/default.beamer data/templates/default.opendocument @@ -145,6 +146,7 @@ Extra-Source-Files: tests/s5-inserts.html tests/tables.context tests/tables.docbook + tests/tables.docbook5 tests/tables.dokuwiki tests/tables.icml tests/tables.html @@ -153,6 +155,7 @@ Extra-Source-Files: tests/tables.plain tests/tables.markdown tests/tables.mediawiki + tests/tables.tei tests/tables.textile tests/tables.opendocument tests/tables.org @@ -167,6 +170,7 @@ Extra-Source-Files: tests/writer.latex tests/writer.context tests/writer.docbook + tests/writer.docbook5 tests/writer.html tests/writer.man tests/writer.markdown @@ -180,6 +184,7 @@ Extra-Source-Files: tests/writer.rst tests/writer.icml tests/writer.rtf + tests/writer.tei tests/writer.texinfo tests/writer.fb2 tests/writer.opml @@ -255,7 +260,7 @@ Library text >= 0.11 && < 1.3, zip-archive >= 0.2.3.4 && < 0.4, HTTP >= 4000.0.5 && < 4000.4, - texmath >= 0.8.4.1 && < 0.9, + texmath >= 0.8.6.2 && < 0.9, xml >= 1.3.12 && < 1.4, random >= 1 && < 1.2, extensible-exceptions >= 0.1 && < 0.2, @@ -265,7 +270,7 @@ Library base64-bytestring >= 0.1 && < 1.1, zlib >= 0.5 && < 0.7, highlighting-kate >= 0.6.1 && < 0.7, - data-default >= 0.4 && < 0.6, + data-default >= 0.4 && < 0.7, temporary >= 1.1 && < 1.3, blaze-html >= 0.5 && < 0.9, blaze-markup >= 0.5.1 && < 0.8, @@ -1,6 +1,6 @@ {-# LANGUAGE CPP, TupleSections #-} {- -Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Main - Copyright : Copyright (C) 2006-2015 John MacFarlane + Copyright : Copyright (C) 2006-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley@edu> @@ -79,7 +79,7 @@ type Transform = Pandoc -> Pandoc copyrightMessage :: String copyrightMessage = intercalate "\n" [ "", - "Copyright (C) 2006-2015 John MacFarlane", + "Copyright (C) 2006-2016 John MacFarlane", "Web: http://pandoc.org", "This is free software; see the source for copying conditions.", "There is no warranty, not even for merchantability or fitness", @@ -215,6 +215,7 @@ data Opt = Opt , optExtractMedia :: Maybe FilePath -- ^ Path to extract embedded media , optTrace :: Bool -- ^ Print debug information , optTrackChanges :: TrackChanges -- ^ Accept or reject MS Word track-changes. + , optFileScope :: Bool -- ^ Parse input files before combining , optKaTeXStylesheet :: Maybe String -- ^ Path to stylesheet for KaTeX , optKaTeXJS :: Maybe String -- ^ Path to js file for KaTeX } @@ -278,6 +279,7 @@ defaultOpts = Opt , optExtractMedia = Nothing , optTrace = False , optTrackChanges = AcceptChanges + , optFileScope = False , optKaTeXStylesheet = Nothing , optKaTeXJS = Nothing } @@ -387,6 +389,11 @@ options = "accept|reject|all") "" -- "Accepting or reject MS Word track-changes."" + , Option "" ["file-scope"] + (NoArg + (\opt -> return opt { optFileScope = True })) + "" -- "Parse input files before combining" + , Option "" ["extract-media"] (ReqArg (\arg opt -> @@ -829,7 +836,7 @@ options = , Option "" ["mathjax"] (OptArg (\arg opt -> do - let url' = fromMaybe "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" arg + let url' = fromMaybe "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML" arg return opt { optHTMLMathMethod = MathJax url'}) "URL") "" -- "Use MathJax for HTML math" @@ -1117,6 +1124,7 @@ convertWithOpts opts args = do , optExtractMedia = mbExtractMedia , optTrace = trace , optTrackChanges = trackChanges + , optFileScope = fileScope , optKaTeXStylesheet = katexStylesheet , optKaTeXJS = katexJS } = opts @@ -1269,6 +1277,7 @@ convertWithOpts opts args = do , readerDefaultImageExtension = defaultImageExtension , readerTrace = trace , readerTrackChanges = trackChanges + , readerFileScope = fileScope } when (not (isTextFormat format) && outputFile == "-") $ @@ -1301,13 +1310,26 @@ convertWithOpts opts args = do then handleIncludes else return . Right - (doc, media) <- fmap handleError $ - case reader of + let sourceToDoc :: [FilePath] -> IO (Pandoc, MediaBag) + sourceToDoc sources' = fmap handleError $ + case reader of StringReader r-> do - srcs <- convertTabs . intercalate "\n" <$> readSources sources + srcs <- convertTabs . intercalate "\n" <$> readSources sources' doc <- handleIncludes' srcs either (return . Left) (\s -> fmap (,mempty) <$> r readerOpts s) doc - ByteStringReader r -> readFiles sources >>= r readerOpts + ByteStringReader r -> readFiles sources' >>= r readerOpts + + -- We parse first if (1) fileScope is set, (2), it's a binary + -- reader, or (3) we're reading JSON. This is easier to do of an AND + -- of negatives as opposed to an OR of positives, so we do default + -- parsing if it's a StringReader AND (fileScope is set AND it's not + -- a JSON reader). + (doc, media) <- case reader of + (StringReader _) | not fileScope && readerName' /= "json" -> + sourceToDoc sources + _ | null sources -> sourceToDoc sources + _ -> do pairs <- mapM (\s -> sourceToDoc [s]) sources + return (mconcat $ map fst pairs, mconcat $ map snd pairs) let writerOptions = def { writerStandalone = standalone', writerTemplate = templ, diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs index 4b2397eb9..0330c46e2 100644 --- a/src/Text/Pandoc.hs +++ b/src/Text/Pandoc.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ScopedTypeVariables, FlexibleInstances #-} {- -Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc - Copyright : Copyright (C) 2006-2015 John MacFarlane + Copyright : Copyright (C) 2006-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> @@ -223,6 +223,14 @@ mkStringReaderWithWarnings r = StringReader $ \o s -> mkBSReader :: (ReaderOptions -> BL.ByteString -> Either PandocError (Pandoc, MediaBag)) -> Reader mkBSReader r = ByteStringReader (\o s -> return $ r o s) +mkBSReaderWithWarnings :: (ReaderOptions -> BL.ByteString -> Either PandocError (Pandoc, MediaBag, [String])) -> Reader +mkBSReaderWithWarnings r = ByteStringReader $ \o s -> + case r o s of + Left err -> return $ Left err + Right (doc, mediaBag, warnings) -> do + mapM_ warn warnings + return $ Right (doc, mediaBag) + -- | Association list of formats and readers. readers :: [(String, Reader)] readers = [ ("native" , StringReader $ \_ s -> return $ readNative s) @@ -243,7 +251,7 @@ readers = [ ("native" , StringReader $ \_ s -> return $ readNative s) ,("latex" , mkStringReader readLaTeX) ,("haddock" , mkStringReader readHaddock) ,("twiki" , mkStringReader readTWiki) - ,("docx" , mkBSReader readDocx) + ,("docx" , mkBSReaderWithWarnings readDocxWithWarnings) ,("odt" , mkBSReader readOdt) ,("t2t" , mkStringReader readTxt2TagsNoMacros) ,("epub" , mkBSReader readEPUB) @@ -283,6 +291,8 @@ writers = [ writeHtmlString o{ writerSlideVariant = RevealJsSlides , writerHtml5 = True }) ,("docbook" , PureStringWriter writeDocbook) + ,("docbook5" , PureStringWriter $ \o -> + writeDocbook o{ writerDocbook5 = True }) ,("opml" , PureStringWriter writeOPML) ,("opendocument" , PureStringWriter writeOpenDocument) ,("latex" , PureStringWriter writeLaTeX) diff --git a/src/Text/Pandoc/Asciify.hs b/src/Text/Pandoc/Asciify.hs index c183458e4..8eb1ba663 100644 --- a/src/Text/Pandoc/Asciify.hs +++ b/src/Text/Pandoc/Asciify.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2013-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2013-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Asciify - Copyright : Copyright (C) 2013-2015 John MacFarlane + Copyright : Copyright (C) 2013-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs index 0a4e08175..792098b35 100644 --- a/src/Text/Pandoc/Error.hs +++ b/src/Text/Pandoc/Error.hs @@ -1,6 +1,6 @@ {-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-} {- -Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} {- | Module : Text.Pandoc.Error - Copyright : Copyright (C) 2006-2015 John MacFarlane + Copyright : Copyright (C) 2006-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Highlighting.hs b/src/Text/Pandoc/Highlighting.hs index ecfef1832..1b9e92ae2 100644 --- a/src/Text/Pandoc/Highlighting.hs +++ b/src/Text/Pandoc/Highlighting.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2008-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2008-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Highlighting - Copyright : Copyright (C) 2008-2015 John MacFarlane + Copyright : Copyright (C) 2008-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs index 571fdd665..90dfbb5fb 100644 --- a/src/Text/Pandoc/ImageSize.hs +++ b/src/Text/Pandoc/ImageSize.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings, ScopedTypeVariables, CPP #-} {-# OPTIONS_GHC -fno-warn-type-defaults #-} {- - Copyright (C) 2011-2015 John MacFarlane <jgm@berkeley.edu> + Copyright (C) 2011-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ {- | Module : Text.Pandoc.ImageSize -Copyright : Copyright (C) 2011-2015 John MacFarlane +Copyright : Copyright (C) 2011-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/MIME.hs b/src/Text/Pandoc/MIME.hs index 6fd9ac373..1164e04b3 100644 --- a/src/Text/Pandoc/MIME.hs +++ b/src/Text/Pandoc/MIME.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2011-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2011-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.MIME - Copyright : Copyright (C) 2011-2015 John MacFarlane + Copyright : Copyright (C) 2011-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 333f499fb..701cd8bd1 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -1,6 +1,6 @@ {-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-} {- -Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2012-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Options - Copyright : Copyright (C) 2012-2015 John MacFarlane + Copyright : Copyright (C) 2012-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> @@ -264,6 +264,7 @@ data ReaderOptions = ReaderOptions{ , readerDefaultImageExtension :: String -- ^ Default extension for images , readerTrace :: Bool -- ^ Print debugging info , readerTrackChanges :: TrackChanges + , readerFileScope :: Bool -- ^ Parse before combining } deriving (Show, Read, Data, Typeable, Generic) instance Default ReaderOptions @@ -280,6 +281,7 @@ instance Default ReaderOptions , readerDefaultImageExtension = "" , readerTrace = False , readerTrackChanges = AcceptChanges + , readerFileScope = False } -- @@ -355,6 +357,7 @@ data WriterOptions = WriterOptions , writerSourceURL :: Maybe String -- ^ Absolute URL + directory of 1st source file , writerUserDataDir :: Maybe FilePath -- ^ Path of user data directory , writerCiteMethod :: CiteMethod -- ^ How to print cites + , writerDocbook5 :: Bool -- ^ Produce DocBook5 , writerHtml5 :: Bool -- ^ Produce HTML5 , writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML , writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show @@ -401,6 +404,7 @@ instance Default WriterOptions where , writerSourceURL = Nothing , writerUserDataDir = Nothing , writerCiteMethod = Citeproc + , writerDocbook5 = False , writerHtml5 = False , writerHtmlQTags = False , writerBeamer = False diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index da4ee4e33..4dbe1f000 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings, CPP, ScopedTypeVariables #-} {- -Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2012-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.PDF - Copyright : Copyright (C) 2012-2015 John MacFarlane + Copyright : Copyright (C) 2012-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 325231846..7bf827019 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -5,7 +5,7 @@ , MultiParamTypeClasses , FlexibleInstances #-} {- -Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Parsing - Copyright : Copyright (C) 2006-2015 John MacFarlane + Copyright : Copyright (C) 2006-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index 88b7dd09e..f3ef0ef10 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -1,6 +1,6 @@ {-# LANGUAGE GeneralizedNewtypeDeriving, CPP #-} {- -Copyright (C) 2010-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2010-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111(-1)307 USA {- | Module : Text.Pandoc.Pretty - Copyright : Copyright (C) 2010-2015 John MacFarlane + Copyright : Copyright (C) 2010-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Process.hs b/src/Text/Pandoc/Process.hs index e5245638d..bc71f1392 100644 --- a/src/Text/Pandoc/Process.hs +++ b/src/Text/Pandoc/Process.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2013-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2013-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Process - Copyright : Copyright (C) 2013-2015 John MacFarlane + Copyright : Copyright (C) 2013-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index eb71d8dd8..9c7c3b264 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -50,8 +50,7 @@ implemented, [-] means partially implemented): * Inlines - [X] Str - - [X] Emph (From italics. `underline` currently read as span. In - future, it might optionally be emph as well) + - [X] Emph (italics and underline both read as Emph) - [X] Strong - [X] Strikeout - [X] Superscript @@ -62,16 +61,16 @@ implemented, [-] means partially implemented): - [X] Code (styled with `VerbatimChar`) - [X] Space - [X] LineBreak (these are invisible in Word: entered with Shift-Return) - - [ ] Math + - [X] Math - [X] Link (links to an arbitrary bookmark create a span with the target as id and "anchor" class) - - [-] Image (Links to path in archive. Future option for - data-encoded URI likely.) + - [X] Image - [X] Note (Footnotes and Endnotes are silently combined.) -} module Text.Pandoc.Readers.Docx - ( readDocx + ( readDocxWithWarnings + , readDocx ) where import Codec.Archive.Zip @@ -98,14 +97,23 @@ import qualified Data.Sequence as Seq (null) import Text.Pandoc.Error import Text.Pandoc.Compat.Except +readDocxWithWarnings :: ReaderOptions + -> B.ByteString + -> Either PandocError (Pandoc, MediaBag, [String]) +readDocxWithWarnings opts bytes + | Right archive <- toArchiveOrFail bytes + , Right (docx, warnings) <- archiveToDocxWithWarnings archive = do + (meta, blks, mediaBag) <- docxToOutput opts docx + return (Pandoc meta blks, mediaBag, warnings) +readDocxWithWarnings _ _ = + Left (ParseFailure "couldn't parse docx file") + readDocx :: ReaderOptions -> B.ByteString -> Either PandocError (Pandoc, MediaBag) -readDocx opts bytes = - case archiveToDocx (toArchive bytes) of - Right docx -> (\(meta, blks, mediaBag) -> (Pandoc meta blks, mediaBag)) - <$> (docxToOutput opts docx) - Left _ -> Left (ParseFailure "couldn't parse docx file") +readDocx opts bytes = do + (pandoc, mediaBag, _) <- readDocxWithWarnings opts bytes + return (pandoc, mediaBag) data DState = DState { docxAnchorMap :: M.Map String String , docxMediaBag :: MediaBag diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index eec8b12c9..7265ef8dd 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -50,6 +50,7 @@ module Text.Pandoc.Readers.Docx.Parse ( Docx(..) , Row(..) , Cell(..) , archiveToDocx + , archiveToDocxWithWarnings ) where import Codec.Archive.Zip import Text.XML.Light @@ -60,6 +61,7 @@ import Data.Bits ((.|.)) import qualified Data.ByteString.Lazy as B import qualified Text.Pandoc.UTF8 as UTF8 import Control.Monad.Reader +import Control.Monad.State import Control.Applicative ((<|>)) import qualified Data.Map as M import Text.Pandoc.Compat.Except @@ -81,16 +83,20 @@ data ReaderEnv = ReaderEnv { envNotes :: Notes } deriving Show +data ReaderState = ReaderState { stateWarnings :: [String] } + deriving Show + + data DocxError = DocxError | WrongElem deriving Show instance Error DocxError where noMsg = WrongElem -type D = ExceptT DocxError (Reader ReaderEnv) +type D = ExceptT DocxError (ReaderT ReaderEnv (State ReaderState)) -runD :: D a -> ReaderEnv -> Either DocxError a -runD dx re = runReader (runExceptT dx) re +runD :: D a -> ReaderEnv -> ReaderState -> (Either DocxError a, ReaderState) +runD dx re rs = runState (runReaderT (runExceptT dx) re) rs maybeToD :: Maybe a -> D a maybeToD (Just a) = return a @@ -257,7 +263,10 @@ type Author = String type ChangeDate = String archiveToDocx :: Archive -> Either DocxError Docx -archiveToDocx archive = do +archiveToDocx archive = fst <$> archiveToDocxWithWarnings archive + +archiveToDocxWithWarnings :: Archive -> Either DocxError (Docx, [String]) +archiveToDocxWithWarnings archive = do let notes = archiveToNotes archive numbering = archiveToNumbering archive rels = archiveToRelationships archive @@ -265,8 +274,12 @@ archiveToDocx archive = do (styles, parstyles) = archiveToStyles archive rEnv = ReaderEnv notes numbering rels media Nothing styles parstyles InDocument - doc <- runD (archiveToDocument archive) rEnv - return $ Docx doc + rState = ReaderState { stateWarnings = [] } + (eitherDoc, st) = runD (archiveToDocument archive) rEnv rState + case eitherDoc of + Right doc -> Right (Docx doc, stateWarnings st) + Left e -> Left e + archiveToDocument :: Archive -> D Document @@ -576,12 +589,14 @@ elemToBodyPart ns element sty <- asks envParStyles let parstyle = elemToParagraphStyle ns element sty parparts <- mapD (elemToParPart ns) (elChildren element) - case pNumInfo parstyle of - Just (numId, lvl) -> do - num <- asks envNumbering - let levelInfo = lookupLevel numId lvl num - return $ ListItem parstyle numId lvl levelInfo parparts - Nothing -> return $ Paragraph parstyle parparts + -- Word uses list enumeration for numbered headings, so we only + -- want to infer a list from the styles if it is NOT a heading. + case pHeading parstyle of + Nothing | Just (numId, lvl) <- pNumInfo parstyle -> do + num <- asks envNumbering + let levelInfo = lookupLevel numId lvl num + return $ ListItem parstyle numId lvl levelInfo parparts + _ -> return $ Paragraph parstyle parparts elemToBodyPart ns element | isElem ns "w" "tbl" element = do let caption' = findChild (elemName ns "w" "tblPr") element @@ -646,14 +661,14 @@ elemToParPart ns element | isElem ns "w" "r" element = elemToRun ns element >>= (\r -> return $ PlainRun r) elemToParPart ns element - | isElem ns "w" "ins" element + | isElem ns "w" "ins" element || isElem ns "w" "moveTo" element , Just cId <- findAttr (elemName ns "w" "id") element , Just cAuthor <- findAttr (elemName ns "w" "author") element , Just cDate <- findAttr (elemName ns "w" "date") element = do runs <- mapD (elemToRun ns) (elChildren element) return $ Insertion cId cAuthor cDate runs elemToParPart ns element - | isElem ns "w" "del" element + | isElem ns "w" "del" element || isElem ns "w" "moveFrom" element , Just cId <- findAttr (elemName ns "w" "id") element , Just cAuthor <- findAttr (elemName ns "w" "author") element , Just cDate <- findAttr (elemName ns "w" "date") element = do @@ -702,36 +717,58 @@ elemToExtent drawingElem = getDim at = findElement (QName "extent" (Just wp_ns) (Just "wp")) drawingElem >>= findAttr (QName at Nothing Nothing) >>= safeRead -elemToRun :: NameSpaces -> Element -> D Run -elemToRun ns element - | isElem ns "w" "r" element - , Just drawingElem <- findChild (elemName ns "w" "drawing") element = + +childElemToRun :: NameSpaces -> Element -> D Run +childElemToRun ns element + | isElem ns "w" "drawing" element = let a_ns = "http://schemas.openxmlformats.org/drawingml/2006/main" - drawing = findElement (QName "blip" (Just a_ns) (Just "a")) drawingElem + drawing = findElement (QName "blip" (Just a_ns) (Just "a")) element >>= findAttr (QName "embed" (lookup "r" ns) (Just "r")) in case drawing of Just s -> expandDrawingId s >>= - (\(fp, bs) -> return $ InlineDrawing fp bs $ elemToExtent drawingElem) + (\(fp, bs) -> return $ InlineDrawing fp bs $ elemToExtent element) Nothing -> throwError WrongElem -elemToRun ns element - | isElem ns "w" "r" element - , Just ref <- findChild (elemName ns "w" "footnoteReference") element - , Just fnId <- findAttr (elemName ns "w" "id") ref = do +childElemToRun ns element + | isElem ns "w" "footnoteReference" element + , Just fnId <- findAttr (elemName ns "w" "id") element = do notes <- asks envNotes case lookupFootnote fnId notes of Just e -> do bps <- local (\r -> r {envLocation=InFootnote}) $ mapD (elemToBodyPart ns) (elChildren e) return $ Footnote bps Nothing -> return $ Footnote [] -elemToRun ns element - | isElem ns "w" "r" element - , Just ref <- findChild (elemName ns "w" "endnoteReference") element - , Just enId <- findAttr (elemName ns "w" "id") ref = do +childElemToRun ns element + | isElem ns "w" "endnoteReference" element + , Just enId <- findAttr (elemName ns "w" "id") element = do notes <- asks envNotes case lookupEndnote enId notes of Just e -> do bps <- local (\r -> r {envLocation=InEndnote}) $ mapD (elemToBodyPart ns) (elChildren e) return $ Endnote bps Nothing -> return $ Endnote [] +childElemToRun _ _ = throwError WrongElem + +elemToRun :: NameSpaces -> Element -> D Run +elemToRun ns element + | isElem ns "w" "r" element + , Just altCont <- findChild (elemName ns "mc" "AlternateContent") element = + do let choices = findChildren (elemName ns "mc" "Choice") altCont + choiceChildren = map head $ filter (not . null) $ map elChildren choices + outputs <- mapD (childElemToRun ns) choiceChildren + case outputs of + r : _ -> return r + [] -> throwError WrongElem +elemToRun ns element + | isElem ns "w" "r" element + , Just drawingElem <- findChild (elemName ns "w" "drawing") element = + childElemToRun ns drawingElem +elemToRun ns element + | isElem ns "w" "r" element + , Just ref <- findChild (elemName ns "w" "footnoteReference") element = + childElemToRun ns ref +elemToRun ns element + | isElem ns "w" "r" element + , Just ref <- findChild (elemName ns "w" "endnoteReference") element = + childElemToRun ns ref elemToRun ns element | isElem ns "w" "r" element = do runElems <- elemToRunElems ns element @@ -940,3 +977,4 @@ elemToRunElems _ _ = throwError WrongElem setFont :: Maybe Font -> ReaderEnv -> ReaderEnv setFont f s = s{envFont = f} + diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index 07d282708..144ba9ca2 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -19,7 +19,7 @@ import Text.Pandoc.Compat.Except (MonadError, throwError, runExcept, Except) import Text.Pandoc.Compat.Monoid ((<>)) import Text.Pandoc.MIME (MimeType) import qualified Text.Pandoc.Builder as B -import Codec.Archive.Zip ( Archive (..), toArchive, fromEntry +import Codec.Archive.Zip ( Archive (..), toArchiveOrFail, fromEntry , findEntryByPath, Entry) import qualified Data.ByteString.Lazy as BL (ByteString) import System.FilePath ( takeFileName, (</>), dropFileName, normalise @@ -39,7 +39,9 @@ import Text.Pandoc.Error type Items = M.Map String (FilePath, MimeType) readEPUB :: ReaderOptions -> BL.ByteString -> Either PandocError (Pandoc, MediaBag) -readEPUB opts bytes = runEPUB (archiveToEPUB opts $ toArchive bytes) +readEPUB opts bytes = case toArchiveOrFail bytes of + Right archive -> runEPUB $ archiveToEPUB opts $ archive + Left _ -> Left $ ParseFailure "Couldn't extract ePub file" runEPUB :: Except PandocError a -> Either PandocError a runEPUB = runExcept diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 69df13aac..8ee5da543 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -63,7 +63,7 @@ import Debug.Trace (trace) import Text.TeXMath (readMathML, writeTeX) import Data.Default (Default (..), def) import Control.Monad.Reader (Reader,ask, asks, local, runReader) -import Network.URI (isURI) +import Network.URI (URI, parseURIReference, nonStrictRelativeTo) import Text.Pandoc.Error import Text.Pandoc.CSS (foldOrElse, pickStyleAttrProps) import Text.Pandoc.Compat.Monoid ((<>)) @@ -103,7 +103,7 @@ data HTMLState = HTMLState { parserState :: ParserState, noteTable :: [(String, Blocks)], - baseHref :: Maybe String, + baseHref :: Maybe URI, identifiers :: Set.Set String, headerMap :: M.Map Inlines String } @@ -145,15 +145,9 @@ pHead = pInTags "head" $ pTitle <|> pMetaTag <|> pBaseTag <|> (mempty <$ pAnyTag return mempty pBaseTag = do bt <- pSatisfy (~== TagOpen "base" []) - let baseH = fromAttrib "href" bt - if null baseH - then return mempty - else do - let baseH' = case reverse baseH of - '/':_ -> baseH - _ -> baseH ++ "/" - updateState $ \st -> st{ baseHref = Just baseH' } - return mempty + updateState $ \st -> st{ baseHref = + parseURIReference $ fromAttrib "href" bt } + return mempty block :: TagParser Blocks block = do @@ -610,9 +604,9 @@ pLink = try $ do tag <- pSatisfy $ tagOpenLit "a" (const True) mbBaseHref <- baseHref <$> getState let url' = fromAttrib "href" tag - let url = case (isURI url', mbBaseHref) of - (False, Just h) -> h ++ url' - _ -> url' + let url = case (parseURIReference url', mbBaseHref) of + (Just rel, Just bs) -> show (rel `nonStrictRelativeTo` bs) + _ -> url' let title = fromAttrib "title" tag let uid = fromAttrib "id" tag let cls = words $ fromAttrib "class" tag @@ -624,9 +618,9 @@ pImage = do tag <- pSelfClosing (=="img") (isJust . lookup "src") mbBaseHref <- baseHref <$> getState let url' = fromAttrib "src" tag - let url = case (isURI url', mbBaseHref) of - (False, Just h) -> h ++ url' - _ -> url' + let url = case (parseURIReference url', mbBaseHref) of + (Just rel, Just bs) -> show (rel `nonStrictRelativeTo` bs) + _ -> url' let title = fromAttrib "title" tag let alt = fromAttrib "alt" tag let uid = fromAttrib "id" tag @@ -945,7 +939,7 @@ htmlInBalanced f = try $ do (TagClose _ : TagPosition er ec : _) -> do let ls = er - sr let cs = ec - sc - lscontents <- concat <$> count ls anyLine + lscontents <- unlines <$> count ls anyLine cscontents <- count cs anyChar (_,closetag) <- htmlTag (~== TagClose tn) return (lscontents ++ cscontents ++ closetag) @@ -977,11 +971,20 @@ htmlTag :: Monad m htmlTag f = try $ do lookAhead (char '<') inp <- getInput - let (next : rest) = canonicalizeTags $ parseTagsOptions - parseOptions{ optTagWarning = True } inp + let (next : _) = canonicalizeTags $ parseTagsOptions + parseOptions{ optTagWarning = False } inp guard $ f next + let handleTag tagname = do + -- <www.boe.es/buscar/act.php?id=BOE-A-1996-8930#a66> + -- should NOT be parsed as an HTML tag, see #2277 + guard $ not ('.' `elem` tagname) + -- <https://example.org> should NOT be a tag either. + -- tagsoup will parse it as TagOpen "https:" [("example.org","")] + guard $ not (null tagname) + guard $ last tagname /= ':' + rendered <- manyTill anyChar (char '>') + return (next, rendered ++ ">") case next of - TagWarning _ -> fail "encountered TagWarning" TagComment s | "<!--" `isPrefixOf` inp -> do count (length s + 4) anyChar @@ -989,13 +992,9 @@ htmlTag f = try $ do char '>' return (next, "<!--" ++ s ++ "-->") | otherwise -> fail "bogus comment mode, HTML5 parse error" - _ -> do - -- we get a TagWarning on things like - -- <www.boe.es/buscar/act.php?id=BOE-A-1996-8930#a66> - -- which should NOT be parsed as an HTML tag, see #2277 - guard $ not $ hasTagWarning rest - rendered <- manyTill anyChar (char '>') - return (next, rendered ++ ">") + TagOpen tagname _attr -> handleTag tagname + TagClose tagname -> handleTag tagname + _ -> mzero mkAttr :: [(String, String)] -> Attr mkAttr attr = (attribsId, attribsClasses, attribsKV) diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 587726084..e43714526 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -122,9 +122,6 @@ inList = do ctx <- stateParserContext <$> getState guard (ctx == ListItemState) -isNull :: F Inlines -> Bool -isNull ils = B.isNull $ runF ils def - spnl :: Parser [Char] st () spnl = try $ do skipSpaces @@ -188,31 +185,38 @@ charsInBalancedBrackets openBrackets = -- document structure -- -titleLine :: MarkdownParser (F Inlines) -titleLine = try $ do +rawTitleBlockLine :: MarkdownParser String +rawTitleBlockLine = do char '%' skipSpaces - res <- many $ (notFollowedBy newline >> inline) - <|> try (endline >> whitespace) - newline + first <- anyLine + rest <- many $ try $ do spaceChar + notFollowedBy blankline + skipSpaces + anyLine + return $ trim $ unlines (first:rest) + +titleLine :: MarkdownParser (F Inlines) +titleLine = try $ do + raw <- rawTitleBlockLine + res <- parseFromString (many inline) raw return $ trimInlinesF $ mconcat res authorsLine :: MarkdownParser (F [Inlines]) authorsLine = try $ do - char '%' - skipSpaces - authors <- sepEndBy (many (notFollowedBy (satisfy $ \c -> - c == ';' || c == '\n') >> inline)) - (char ';' <|> - try (newline >> notFollowedBy blankline >> spaceChar)) - newline - return $ sequence $ filter (not . isNull) $ map (trimInlinesF . mconcat) authors + raw <- rawTitleBlockLine + let sep = (char ';' <* spaces) <|> newline + let pAuthors = sepEndBy + (trimInlinesF . mconcat <$> many + (try $ notFollowedBy sep >> inline)) + sep + sequence <$> parseFromString pAuthors raw dateLine :: MarkdownParser (F Inlines) dateLine = try $ do - char '%' - skipSpaces - trimInlinesF . mconcat <$> manyTill inline newline + raw <- rawTitleBlockLine + res <- parseFromString (many inline) raw + return $ trimInlinesF $ mconcat res titleBlock :: MarkdownParser () titleBlock = pandocTitleBlock <|> mmdTitleBlock @@ -1354,16 +1358,18 @@ pipeTable = try $ do nonindentSpaces lookAhead nonspaceChar (heads,(aligns, seplengths)) <- (,) <$> pipeTableRow <*> pipeBreak + let heads' = take (length aligns) <$> heads lines' <- many pipeTableRow + let lines'' = map (take (length aligns) <$>) lines' let maxlength = maximum $ - map (\x -> length . stringify $ runF x def) (heads : lines') + map (\x -> length . stringify $ runF x def) (heads' : lines'') numColumns <- getOption readerColumns let widths = if maxlength > numColumns then map (\len -> fromIntegral (len + 1) / fromIntegral numColumns) seplengths else replicate (length aligns) 0.0 - return $ (aligns, widths, heads, sequence lines') + return $ (aligns, widths, heads', sequence lines'') sepPipe :: MarkdownParser () sepPipe = try $ do @@ -1372,25 +1378,27 @@ sepPipe = try $ do -- parse a row, also returning probable alignments for org-table cells pipeTableRow :: MarkdownParser (F [Blocks]) -pipeTableRow = do +pipeTableRow = try $ do + scanForPipe skipMany spaceChar openPipe <- (True <$ char '|') <|> return False - let cell = mconcat <$> - many (notFollowedBy (blankline <|> char '|') >> inline) - first <- cell - rest <- many $ sepPipe *> cell + -- split into cells + let chunk = void (code <|> rawHtmlInline <|> escapedChar <|> rawLaTeXInline') + <|> void (noneOf "|\n\r") + let cellContents = ((trim . snd) <$> withRaw (many chunk)) >>= + parseFromString pipeTableCell + cells <- cellContents `sepEndBy1` (char '|') -- surrounding pipes needed for a one-column table: - guard $ not (null rest && not openPipe) - optional (char '|') + guard $ not (length cells == 1 && not openPipe) blankline - let cells = sequence (first:rest) - return $ do - cells' <- cells - return $ map - (\ils -> - case trimInlines ils of - ils' | B.isNull ils' -> mempty - | otherwise -> B.plain $ ils') cells' + return $ sequence cells + +pipeTableCell :: MarkdownParser (F Blocks) +pipeTableCell = do + result <- many inline + if null result + then return mempty + else return $ B.plain . mconcat <$> sequence result pipeTableHeaderPart :: Parser [Char] st (Alignment, Int) pipeTableHeaderPart = try $ do diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index 950497992..d3cee08e2 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -225,7 +225,7 @@ table = do Nothing -> 1.0 caption <- option mempty tableCaption optional rowsep - hasheader <- option False $ True <$ (lookAhead (char '!')) + hasheader <- option False $ True <$ (lookAhead (skipSpaces *> char '!')) (cellspecs',hdr) <- unzip <$> tableRow let widths = map ((tableWidth *) . snd) cellspecs' let restwidth = tableWidth - sum widths diff --git a/src/Text/Pandoc/Readers/Odt.hs b/src/Text/Pandoc/Readers/Odt.hs index a925c1d84..68e89263c 100644 --- a/src/Text/Pandoc/Readers/Odt.hs +++ b/src/Text/Pandoc/Readers/Odt.hs @@ -59,7 +59,9 @@ readOdt _ bytes = case bytesToOdt bytes of -- bytesToOdt :: B.ByteString -> Either PandocError Pandoc -bytesToOdt bytes = archiveToOdt $ toArchive bytes +bytesToOdt bytes = case toArchiveOrFail bytes of + Right archive -> archiveToOdt archive + Left _ -> Left $ ParseFailure "Couldn't parse odt file." -- archiveToOdt :: Archive -> Either PandocError Pandoc diff --git a/src/Text/Pandoc/Readers/Org.hs b/src/Text/Pandoc/Readers/Org.hs index 7dd611be3..5a50a8f34 100644 --- a/src/Text/Pandoc/Readers/Org.hs +++ b/src/Text/Pandoc/Readers/Org.hs @@ -35,6 +35,7 @@ import Text.Pandoc.Builder ( Inlines, Blocks, HasMeta(..), trimInlines ) import Text.Pandoc.Definition import Text.Pandoc.Compat.Monoid ((<>)) +import Text.Pandoc.Error import Text.Pandoc.Options import qualified Text.Pandoc.Parsing as P import Text.Pandoc.Parsing hiding ( F, unF, askF, asksF, runF @@ -49,7 +50,7 @@ import qualified Text.TeXMath.Readers.MathML.EntityMap as MathMLEntityMap import Control.Arrow (first) import Control.Monad (foldM, guard, liftM, liftM2, mplus, mzero, when) import Control.Monad.Reader (Reader, runReader, ask, asks, local) -import Data.Char (isAlphaNum, toLower) +import Data.Char (isAlphaNum, isSpace, toLower) import Data.Default import Data.List (intersperse, isPrefixOf, isSuffixOf) import qualified Data.Map as M @@ -57,8 +58,6 @@ import qualified Data.Set as Set import Data.Maybe (fromMaybe, isJust) import Network.HTTP (urlEncode) -import Text.Pandoc.Error - -- | Parse org-mode string and return a Pandoc document. readOrg :: ReaderOptions -- ^ Reader options -> String -- ^ String to parse (assuming @'\n'@ line endings) @@ -391,6 +390,9 @@ lookupBlockAttribute key = type BlockProperties = (Int, String) -- (Indentation, Block-Type) +updateIndent :: BlockProperties -> Int -> BlockProperties +updateIndent (_, blkType) indent = (indent, blkType) + orgBlock :: OrgParser (F Blocks) orgBlock = try $ do blockProp@(_, blkType) <- blockHeaderStart @@ -407,11 +409,23 @@ orgBlock = try $ do _ -> withParsed (fmap $ divWithClass blkType) blockHeaderStart :: OrgParser (Int, String) -blockHeaderStart = try $ (,) <$> indent <*> blockType +blockHeaderStart = try $ (,) <$> indentation <*> blockType where - indent = length <$> many spaceChar blockType = map toLower <$> (stringAnyCase "#+begin_" *> orgArgWord) +indentation :: OrgParser Int +indentation = try $ do + tabStop <- getOption readerTabStop + s <- many spaceChar + return $ spaceLength tabStop s + +spaceLength :: Int -> String -> Int +spaceLength tabStop s = (sum . map charLen) s + where + charLen ' ' = 1 + charLen '\t' = tabStop + charLen _ = 0 + withRaw' :: (String -> F Blocks) -> BlockProperties -> OrgParser (F Blocks) withRaw' f blockProp = (ignHeaders *> (f <$> rawBlockContent blockProp)) @@ -450,7 +464,8 @@ codeBlock blkProp = do skipSpaces (classes, kv) <- codeHeaderArgs <|> (mempty <$ ignHeaders) id' <- fromMaybe "" <$> lookupBlockAttribute "name" - content <- rawBlockContent blkProp + leadingIndent <- lookAhead indentation + content <- rawBlockContent (updateIndent blkProp leadingIndent) resultsContent <- followingResultsBlock let includeCode = exportsCode kv let includeResults = exportsResults kv @@ -472,7 +487,7 @@ rawBlockContent (indent, blockType) = try $ unlines . map commaEscaped <$> manyTill indentedLine blockEnder where indentedLine = try $ ("" <$ blankline) <|> (indentWith indent *> anyLine) - blockEnder = try $ indentWith indent *> stringAnyCase ("#+end_" <> blockType) + blockEnder = try $ skipSpaces *> stringAnyCase ("#+end_" <> blockType) parsedBlockContent :: BlockProperties -> OrgParser (F Blocks) parsedBlockContent blkProps = try $ do @@ -758,9 +773,13 @@ data OrgTableRow = OrgContentRow (F [Blocks]) | OrgAlignRow [Alignment] | OrgHlineRow +-- OrgTable is strongly related to the pandoc table ADT. Using the same +-- (i.e. pandoc-global) ADT would mean that the reader would break if the +-- global structure was to be changed, which would be bad. The final table +-- should be generated using a builder function. Column widths aren't +-- implemented yet, so they are not tracked here. data OrgTable = OrgTable - { orgTableColumns :: Int - , orgTableAlignments :: [Alignment] + { orgTableAlignments :: [Alignment] , orgTableHeader :: [Blocks] , orgTableRows :: [[Blocks]] } @@ -776,7 +795,7 @@ table = try $ do orgToPandocTable :: OrgTable -> Inlines -> Blocks -orgToPandocTable (OrgTable _ aligns heads lns) caption = +orgToPandocTable (OrgTable aligns heads lns) caption = B.table caption (zip aligns $ repeat 0) heads lns tableStart :: OrgParser Char @@ -787,18 +806,19 @@ tableRows = try $ many (tableAlignRow <|> tableHline <|> tableContentRow) tableContentRow :: OrgParser OrgTableRow tableContentRow = try $ - OrgContentRow . sequence <$> (tableStart *> manyTill tableContentCell newline) + OrgContentRow . sequence <$> (tableStart *> many1Till tableContentCell newline) tableContentCell :: OrgParser (F Blocks) tableContentCell = try $ - fmap B.plain . trimInlinesF . mconcat <$> many1Till inline endOfCell - -endOfCell :: OrgParser Char -endOfCell = try $ char '|' <|> lookAhead newline + fmap B.plain . trimInlinesF . mconcat <$> manyTill inline endOfCell tableAlignRow :: OrgParser OrgTableRow -tableAlignRow = try $ - OrgAlignRow <$> (tableStart *> manyTill tableAlignCell newline) +tableAlignRow = try $ do + tableStart + cells <- many1Till tableAlignCell newline + -- Empty rows are regular (i.e. content) rows, not alignment rows. + guard $ any (/= AlignDefault) cells + return $ OrgAlignRow cells tableAlignCell :: OrgParser Alignment tableAlignCell = @@ -813,65 +833,61 @@ tableAlignCell = where emptyCell = try $ skipSpaces *> endOfCell tableAlignFromChar :: OrgParser Alignment -tableAlignFromChar = try $ choice [ char 'l' *> return AlignLeft - , char 'c' *> return AlignCenter - , char 'r' *> return AlignRight - ] +tableAlignFromChar = try $ + choice [ char 'l' *> return AlignLeft + , char 'c' *> return AlignCenter + , char 'r' *> return AlignRight + ] tableHline :: OrgParser OrgTableRow tableHline = try $ OrgHlineRow <$ (tableStart *> char '-' *> anyLine) +endOfCell :: OrgParser Char +endOfCell = try $ char '|' <|> lookAhead newline + rowsToTable :: [OrgTableRow] -> F OrgTable -rowsToTable = foldM (flip rowToContent) zeroTable - where zeroTable = OrgTable 0 mempty mempty mempty - -normalizeTable :: OrgTable - -> OrgTable -normalizeTable (OrgTable cols aligns heads lns) = - let aligns' = fillColumns aligns AlignDefault - heads' = if heads == mempty - then mempty - else fillColumns heads (B.plain mempty) - lns' = map (`fillColumns` B.plain mempty) lns - fillColumns base padding = take cols $ base ++ repeat padding - in OrgTable cols aligns' heads' lns' +rowsToTable = foldM rowToContent emptyTable + where emptyTable = OrgTable mempty mempty mempty +normalizeTable :: OrgTable -> OrgTable +normalizeTable (OrgTable aligns heads rows) = OrgTable aligns' heads rows + where + refRow = if heads /= mempty + then heads + else if rows == mempty then mempty else head rows + cols = length refRow + fillColumns base padding = take cols $ base ++ repeat padding + aligns' = fillColumns aligns AlignDefault -- One or more horizontal rules after the first content line mark the previous -- line as a header. All other horizontal lines are discarded. -rowToContent :: OrgTableRow - -> OrgTable - -> F OrgTable -rowToContent OrgHlineRow t = maybeBodyToHeader t -rowToContent (OrgAlignRow as) t = setLongestRow as =<< setAligns as t -rowToContent (OrgContentRow rf) t = do - rs <- rf - setLongestRow rs =<< appendToBody rs t - -setLongestRow :: [a] - -> OrgTable - -> F OrgTable -setLongestRow rs t = - return t{ orgTableColumns = max (length rs) (orgTableColumns t) } - -maybeBodyToHeader :: OrgTable - -> F OrgTable -maybeBodyToHeader t = case t of - OrgTable{ orgTableHeader = [], orgTableRows = b:[] } -> - return t{ orgTableHeader = b , orgTableRows = [] } - _ -> return t - -appendToBody :: [Blocks] - -> OrgTable +rowToContent :: OrgTable + -> OrgTableRow -> F OrgTable -appendToBody r t = return t{ orgTableRows = orgTableRows t ++ [r] } +rowToContent orgTable row = + case row of + OrgHlineRow -> return singleRowPromotedToHeader + OrgAlignRow as -> return . setAligns $ as + OrgContentRow cs -> appendToBody cs + where + singleRowPromotedToHeader :: OrgTable + singleRowPromotedToHeader = case orgTable of + OrgTable{ orgTableHeader = [], orgTableRows = b:[] } -> + orgTable{ orgTableHeader = b , orgTableRows = [] } + _ -> orgTable -setAligns :: [Alignment] - -> OrgTable - -> F OrgTable -setAligns aligns t = return $ t{ orgTableAlignments = aligns } + setAligns :: [Alignment] -> OrgTable + setAligns aligns = orgTable{ orgTableAlignments = aligns } + + appendToBody :: F [Blocks] -> F OrgTable + appendToBody frow = do + newRow <- frow + let oldRows = orgTableRows orgTable + -- NOTE: This is an inefficient O(n) operation. This should be changed + -- if performance ever becomes a problem. + return orgTable{ orgTableRows = oldRows ++ [newRow] } -- @@ -1565,14 +1581,14 @@ inlineLaTeX = try $ do parseAsMathMLSym :: String -> Maybe Inlines parseAsMathMLSym cs = B.str <$> MathMLEntityMap.getUnicode (clean cs) - -- dropWhileEnd would be nice here, but it's not available before base 4.5 - where clean = reverse . dropWhile (`elem` ("{}" :: String)) . reverse . drop 1 + -- drop initial backslash and any trailing "{}" + where clean = dropWhileEnd (`elem` ("{}" :: String)) . drop 1 state :: ParserState state = def{ stateOptions = def{ readerParseRaw = True }} - texMathToPandoc inp = (maybeRight $ readTeX inp) >>= - writePandoc DisplayInline + texMathToPandoc :: String -> Maybe [Inline] + texMathToPandoc cs = (maybeRight $ readTeX cs) >>= writePandoc DisplayInline maybeRight :: Either a b -> Maybe b maybeRight = either (const Nothing) Just @@ -1582,11 +1598,18 @@ inlineLaTeXCommand = try $ do rest <- getInput case runParser rawLaTeXInline def "source" rest of Right (RawInline _ cs) -> do - let len = length cs + -- drop any trailing whitespace, those are not be part of the command as + -- far as org mode is concerned. + let cmdNoSpc = dropWhileEnd isSpace cs + let len = length cmdNoSpc count len anyChar - return cs + return cmdNoSpc _ -> mzero +-- Taken from Data.OldList. +dropWhileEnd :: (a -> Bool) -> [a] -> [a] +dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) [] + smart :: OrgParser (F Inlines) smart = do getOption readerSmart >>= guard diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 390a7a21a..d08d636df 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -1,6 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {- -Copyright (C) 2011-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2011-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.SelfContained - Copyright : Copyright (C) 2011-2015 John MacFarlane + Copyright : Copyright (C) 2011-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 075d76847..d6b088338 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -2,7 +2,7 @@ FlexibleContexts, ScopedTypeVariables, PatternGuards, ViewPatterns #-} {- -Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Shared - Copyright : Copyright (C) 2006-2015 John MacFarlane + Copyright : Copyright (C) 2006-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Slides.hs b/src/Text/Pandoc/Slides.hs index 1a27ab5ac..e19dba3e2 100644 --- a/src/Text/Pandoc/Slides.hs +++ b/src/Text/Pandoc/Slides.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2012-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2012-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Slides - Copyright : Copyright (C) 2012-2015 John MacFarlane + Copyright : Copyright (C) 2012-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs index a010433fa..925925872 100644 --- a/src/Text/Pandoc/Templates.hs +++ b/src/Text/Pandoc/Templates.hs @@ -1,7 +1,7 @@ {-# LANGUAGE TypeSynonymInstances, FlexibleInstances, CPP, OverloadedStrings, GeneralizedNewtypeDeriving #-} {- -Copyright (C) 2009-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2009-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.Templates - Copyright : Copyright (C) 2009-2015 John MacFarlane + Copyright : Copyright (C) 2009-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs index de3314a0d..87ed5312b 100644 --- a/src/Text/Pandoc/UTF8.hs +++ b/src/Text/Pandoc/UTF8.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} {- -Copyright (C) 2010-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2010-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.UTF8 - Copyright : Copyright (C) 2010-2015 John MacFarlane + Copyright : Copyright (C) 2010-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/UUID.hs b/src/Text/Pandoc/UUID.hs index 463be044c..5d05fa303 100644 --- a/src/Text/Pandoc/UUID.hs +++ b/src/Text/Pandoc/UUID.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2010-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2010-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.UUID - Copyright : Copyright (C) 2010-2015 John MacFarlane + Copyright : Copyright (C) 2010-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 498e2d10f..8d54d62bd 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -279,7 +279,17 @@ blockListToConTeXt lst = liftM vcat $ mapM blockToConTeXt lst -- | Convert list of inline elements to ConTeXt. inlineListToConTeXt :: [Inline] -- ^ Inlines to convert -> State WriterState Doc -inlineListToConTeXt lst = liftM hcat $ mapM inlineToConTeXt lst +inlineListToConTeXt lst = liftM hcat $ mapM inlineToConTeXt $ addStruts lst + -- We add a \strut after a line break that precedes a space, + -- or the space gets swallowed + where addStruts (LineBreak : s : xs) | isSpacey s = + LineBreak : RawInline (Format "context") "\\strut " : s : + addStruts xs + addStruts (x:xs) = x : addStruts xs + addStruts [] = [] + isSpacey Space = True + isSpacey (Str ('\160':_)) = True + isSpacey _ = False -- | Convert inline element to ConTeXt inlineToConTeXt :: Inline -- ^ Inline to convert diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 2aaebf99f..9acfe289a 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -112,10 +112,15 @@ elementToDocbook opts lvl (Sec _ _num (id',_,_) title elements) = else elements tag = case lvl of n | n == 0 -> "chapter" - | n >= 1 && n <= 5 -> "sect" ++ show n + | n >= 1 && n <= 5 -> if writerDocbook5 opts + then "section" + else "sect" ++ show n | otherwise -> "simplesect" - in inTags True tag [("id", writerIdentifierPrefix opts ++ id') | - not (null id')] $ + idAttr = [("id", writerIdentifierPrefix opts ++ id') | not (null id')] + nsAttr = if writerDocbook5 opts && lvl == 0 then [("xmlns", "http://docbook.org/ns/docbook")] + else [] + attribs = nsAttr ++ idAttr + in inTags True tag attribs $ inTagsSimple "title" (inlinesToDocbook opts title) $$ vcat (map (elementToDocbook opts (lvl + 1)) elements') @@ -227,9 +232,11 @@ blockToDocbook opts (OrderedList (start, numstyle, _) (first:rest)) = blockToDocbook opts (DefinitionList lst) = let attribs = [("spacing", "compact") | isTightList $ concatMap snd lst] in inTags True "variablelist" attribs $ deflistItemsToDocbook opts lst -blockToDocbook _ (RawBlock f str) +blockToDocbook opts (RawBlock f str) | f == "docbook" = text str -- raw XML block - | f == "html" = text str -- allow html for backwards compatibility + | f == "html" = if writerDocbook5 opts + then empty -- No html in Docbook5 + else text str -- allow html for backwards compatibility | otherwise = empty blockToDocbook _ HorizontalRule = empty -- not semantic blockToDocbook opts (Table caption aligns widths headers rows) = @@ -344,7 +351,9 @@ inlineToDocbook opts (Link attr txt (src, _)) | otherwise = (if isPrefixOf "#" src then inTags False "link" $ ("linkend", drop 1 src) : idAndRole attr - else inTags False "ulink" $ ("url", src) : idAndRole attr ) $ + else if writerDocbook5 opts + then inTags False "link" $ ("xlink:href", src) : idAndRole attr + else inTags False "ulink" $ ("url", src) : idAndRole attr ) $ inlinesToDocbook opts txt inlineToDocbook opts (Image attr _ (src, tit)) = let titleDoc = if null tit diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 150e19043..a841e1b66 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -1103,7 +1103,7 @@ inlineToOpenXML opts (Link _ txt (src,_)) = do M.insert src i extlinks } return i return [ mknode "w:hyperlink" [("r:id",id')] contents ] -inlineToOpenXML opts (Image attr alt (src, tit)) = do +inlineToOpenXML opts (Image attr alt (src, _)) = do -- first, check to see if we've already done this image pageWidth <- gets stPrintWidth imgs <- gets stImages @@ -1154,7 +1154,7 @@ inlineToOpenXML opts (Image attr alt (src, tit)) = do mknode "wp:inline" [] [ mknode "wp:extent" [("cx",show xemu),("cy",show yemu)] () , mknode "wp:effectExtent" [("b","0"),("l","0"),("r","0"),("t","0")] () - , mknode "wp:docPr" [("descr",tit),("id","1"),("name","Picture")] () + , mknode "wp:docPr" [("descr",stringify alt),("id","1"),("name","Picture")] () , graphic ] let imgext = case mt >>= extensionFromMimeType of Just x -> '.':x diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs index f1088b158..56e2b9027 100644 --- a/src/Text/Pandoc/Writers/DokuWiki.hs +++ b/src/Text/Pandoc/Writers/DokuWiki.hs @@ -452,8 +452,11 @@ inlineToDokuWiki _ (Code _ str) = inlineToDokuWiki _ (Str str) = return $ escapeString str -inlineToDokuWiki _ (Math _ str) = return $ "$" ++ str ++ "$" +inlineToDokuWiki _ (Math mathType str) = return $ delim ++ str ++ delim -- note: str should NOT be escaped + where delim = case mathType of + DisplayMath -> "$$" + InlineMath -> "$" inlineToDokuWiki _ (RawInline f str) | f == Format "dokuwiki" = return str diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 804dbb926..90f502f6f 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -667,7 +667,8 @@ writeEPUB opts doc@(Pandoc meta _) = do ] ] else [] - let navData = renderHtml $ writeHtml opts' + let navData = renderHtml $ writeHtml + opts'{ writerVariables = ("navpage","true"):vars } (Pandoc (setMeta "title" (walk removeNote $ fromList $ docTitle' meta) nullMeta) (navBlocks ++ landmarks)) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index c5b6a6db2..d8b8384e7 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -855,13 +855,12 @@ inlineToHtml opts inline = (Note contents) | writerIgnoreNotes opts -> return mempty | otherwise -> do - st <- get - let notes = stNotes st + notes <- gets stNotes let number = (length notes) + 1 let ref = show number htmlContents <- blockListToNote opts ref contents -- push contents onto front of notes - put $ st {stNotes = (htmlContents:notes)} + modify $ \st -> st {stNotes = (htmlContents:notes)} let revealSlash = ['/' | writerSlideVariant opts == RevealJsSlides] let link = H.a ! A.href (toValue $ "#" ++ diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 4e4279ec5..804e0febc 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -39,8 +39,10 @@ import Text.Pandoc.Templates import Text.Printf ( printf ) import Network.URI ( isURI, unEscapeString ) import Data.Aeson (object, (.=), FromJSON) -import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse, nub, nubBy ) -import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord ) +import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse, + nub, nubBy, foldl' ) +import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, + ord, isAlphaNum ) import Data.Maybe ( fromMaybe, isJust, catMaybes ) import qualified Data.Text as T import Control.Applicative ((<|>)) @@ -223,7 +225,7 @@ pandocToLaTeX options (Pandoc meta blocks) = do ++ poly ++ "}{##2}}}\n" else "\\newcommand{\\text" ++ poly ++ "}[2][]{\\foreignlanguage{" ++ babel ++ "}{#2}}\n" ++ - "\\newenvironment{" ++ poly ++ "}[1]{\\begin{otherlanguage}{" + "\\newenvironment{" ++ poly ++ "}[2][]{\\begin{otherlanguage}{" ++ babel ++ "}}{\\end{otherlanguage}}\n" ) -- eliminate duplicates that have same polyglossia name @@ -403,25 +405,28 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst -- title beginning with fig: indicates that the image is a figure -blockToLaTeX (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do +blockToLaTeX (Para [Image attr@(ident, _, _) txt (src,'f':'i':'g':':':tit)]) = do inNote <- gets stInNote modify $ \st -> st{ stInMinipage = True, stNotes = [] } capt <- inlineListToLaTeX txt notes <- gets stNotes modify $ \st -> st{ stInMinipage = False, stNotes = [] } + -- We can't have footnotes in the list of figures, so remove them: captForLof <- if null notes then return empty else brackets <$> inlineListToLaTeX (walk deNote txt) img <- inlineToLaTeX (Image attr txt (src,tit)) let footnotes = notesToLaTeX notes + lab <- labelFor ident + let caption = "\\caption" <> captForLof <> braces capt <> lab + figure <- hypertarget ident (cr <> + "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$ + caption $$ "\\end{figure}" <> cr) return $ if inNote -- can't have figures in notes then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}" - else "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$ - ("\\caption" <> captForLof <> braces capt) $$ - "\\end{figure}" $$ - footnotes + else figure $$ footnotes -- . . . indicates pause in beamer slides blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do beamer <- writerBeamer `fmap` gets stOptions @@ -468,23 +473,27 @@ blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do st <- get let params = if writerListings (stOptions st) then (case getListingsLanguage classes of - Just l -> [ "language=" ++ l ] + Just l -> [ "language=" ++ mbBraced l ] Nothing -> []) ++ [ "numbers=left" | "numberLines" `elem` classes || "number" `elem` classes || "number-lines" `elem` classes ] ++ [ (if key == "startFrom" then "firstnumber" - else key) ++ "=" ++ attr | + else key) ++ "=" ++ mbBraced attr | (key,attr) <- keyvalAttr ] ++ (if identifier == "" then [] else [ "label=" ++ ref ]) else [] + mbBraced x = if not (all isAlphaNum x) + then "{" <> x <> "}" + else x printParams | null params = empty - | otherwise = brackets $ hcat (intersperse ", " (map text params)) + | otherwise = brackets $ hcat (intersperse ", " + (map text params)) return $ flush ("\\begin{lstlisting}" <> printParams $$ text str $$ "\\end{lstlisting}") $$ cr let highlightedCodeBlock = @@ -505,7 +514,8 @@ blockToLaTeX (RawBlock f x) blockToLaTeX (BulletList []) = return empty -- otherwise latex error blockToLaTeX (BulletList lst) = do incremental <- gets stIncremental - let inc = if incremental then "[<+->]" else "" + beamer <- writerBeamer `fmap` gets stOptions + let inc = if beamer && incremental then "[<+->]" else "" items <- mapM listItemToLaTeX lst let spacing = if isTightList lst then text "\\tightlist" @@ -571,18 +581,21 @@ blockToLaTeX (Header level (id',classes,_) lst) = do blockToLaTeX (Table caption aligns widths heads rows) = do headers <- if all null heads then return empty - else ($$ "\\midrule\n") `fmap` - (tableRowToLaTeX True aligns widths) heads + else do + contents <- (tableRowToLaTeX True aligns widths) heads + return ("\\toprule" $$ contents $$ "\\midrule") let endhead = if all null heads then empty else text "\\endhead" + let endfirsthead = if all null heads + then empty + else text "\\endfirsthead" captionText <- inlineListToLaTeX caption let capt = if isEmpty captionText then empty - else text "\\caption" <> braces captionText - <> "\\tabularnewline\n\\toprule\n" - <> headers - <> "\\endfirsthead" + else text "\\caption" <> braces captionText <> "\\tabularnewline" + $$ headers + $$ endfirsthead rows' <- mapM (tableRowToLaTeX False aligns widths) rows let colDescriptors = text $ concat $ map toColDescriptor aligns modify $ \s -> s{ stTable = True } @@ -590,7 +603,7 @@ blockToLaTeX (Table caption aligns widths heads rows) = do braces ("@{}" <> colDescriptors <> "@{}") -- the @{} removes extra space at beginning and end $$ capt - $$ "\\toprule" + $$ (if all null heads then "\\toprule" else empty) $$ headers $$ endhead $$ vcat rows' @@ -662,8 +675,7 @@ tableCellToLaTeX header (width, align, blocks) = do AlignDefault -> "\\raggedright" return $ ("\\begin{minipage}" <> valign <> braces (text (printf "%.2f\\columnwidth" width)) <> - (halign <> "\\strut" <> cr <> cellContents <> cr) <> - "\\strut\\end{minipage}") $$ + (halign <> cr <> cellContents <> cr) <> "\\end{minipage}") $$ notesToLaTeX notes notesToLaTeX :: [Doc] -> Doc @@ -712,10 +724,9 @@ sectionHeader :: Bool -- True for unnumbered -> Int -> [Inline] -> State WriterState Doc -sectionHeader unnumbered ref level lst = do +sectionHeader unnumbered ident level lst = do txt <- inlineListToLaTeX lst - lab <- text `fmap` toLabel ref - plain <- stringToLaTeX TextString $ foldl (++) "" $ map stringify lst + plain <- stringToLaTeX TextString $ concatMap stringify lst let noNote (Note _) = Str "" noNote x = x let lstNoNotes = walk noNote lst @@ -737,16 +748,6 @@ sectionHeader unnumbered ref level lst = do book <- gets stBook opts <- gets stOptions let level' = if book || writerChapters opts then level - 1 else level - internalLinks <- gets stInternalLinks - let refLabel x = (if ref `elem` internalLinks - then text "\\hypertarget" - <> braces lab - <> braces x - else x) - let headerWith x y = refLabel $ text x <> y <> - if null ref - then empty - else text "\\label" <> braces lab let sectionType = case level' of 0 | writerBeamer opts -> "part" | otherwise -> "chapter" @@ -762,16 +763,34 @@ sectionHeader unnumbered ref level lst = do -- needed for \paragraph, \subparagraph in quote environment -- see http://tex.stackexchange.com/questions/169830/ else empty + lab <- labelFor ident + stuffing' <- hypertarget ident $ text ('\\':sectionType) <> stuffing <> lab return $ if level' > 5 then txt - else prefix $$ - headerWith ('\\':sectionType) stuffing + else prefix $$ stuffing' $$ if unnumbered then "\\addcontentsline{toc}" <> braces (text sectionType) <> braces txtNoNotes else empty +hypertarget :: String -> Doc -> State WriterState Doc +hypertarget ident x = do + ref <- text `fmap` toLabel ident + internalLinks <- gets stInternalLinks + return $ + if ident `elem` internalLinks + then text "\\hypertarget" + <> braces ref + <> braces x + else x + +labelFor :: String -> State WriterState Doc +labelFor "" = return empty +labelFor ident = do + ref <- text `fmap` toLabel ident + return $ text "\\label" <> braces ref + -- | Convert list of inline elements to LaTeX. inlineListToLaTeX :: [Inline] -- ^ Inlines to convert -> State WriterState Doc @@ -1019,7 +1038,7 @@ citationsToNatbib (c:cs) | citationMode c == AuthorInText = do citationsToNatbib cits = do cits' <- mapM convertOne cits - return $ text "\\citetext{" <> foldl combineTwo empty cits' <> text "}" + return $ text "\\citetext{" <> foldl' combineTwo empty cits' <> text "}" where combineTwo a b | isEmpty a = b | otherwise = a <> text "; " <> b @@ -1068,7 +1087,7 @@ citationsToBiblatex (one:[]) citationsToBiblatex (c:cs) = do args <- mapM convertOne (c:cs) - return $ text cmd <> foldl (<>) empty args + return $ text cmd <> foldl' (<>) empty args where cmd = case citationMode c of AuthorInText -> "\\textcites" @@ -1112,7 +1131,7 @@ toPolyglossiaEnv l = -- Takes a list of the constituents of a BCP 47 language code and -- converts it to a Polyglossia (language, options) tuple --- http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/polyglossia/polyglossia.pdf +-- http://mirrors.ctan.org/macros/latex/contrib/polyglossia/polyglossia.pdf toPolyglossia :: [String] -> (String, String) toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria") toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq") @@ -1140,17 +1159,21 @@ toPolyglossia ("en":"UK":_) = ("english", "variant=british") toPolyglossia ("en":"US":_) = ("english", "variant=american") toPolyglossia ("grc":_) = ("greek", "variant=ancient") toPolyglossia ("hsb":_) = ("usorbian", "") +toPolyglossia ("la":"x":"classic":_) = ("latin", "variant=classic") toPolyglossia ("sl":_) = ("slovenian", "") toPolyglossia x = (commonFromBcp47 x, "") -- Takes a list of the constituents of a BCP 47 language code and -- converts it to a Babel language string. --- http://mirrors.concertpass.com/tex-archive/macros/latex/required/babel/base/babel.pdf --- Note that the PDF unfortunately does not contain a complete list of supported languages. +-- http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf +-- List of supported languages (slightly outdated): +-- http://tug.ctan.org/language/hyph-utf8/doc/generic/hyph-utf8/hyphenation.pdf toBabel :: [String] -> String toBabel ("de":"1901":_) = "german" toBabel ("de":"AT":"1901":_) = "austrian" toBabel ("de":"AT":_) = "naustrian" +toBabel ("de":"CH":"1901":_) = "swissgerman" +toBabel ("de":"CH":_) = "nswissgerman" toBabel ("de":_) = "ngerman" toBabel ("dsb":_) = "lowersorbian" toBabel ("el":"polyton":_) = "polutonikogreek" @@ -1164,6 +1187,7 @@ toBabel ("fr":"CA":_) = "canadien" toBabel ("fra":"aca":_) = "acadian" toBabel ("grc":_) = "polutonikogreek" toBabel ("hsb":_) = "uppersorbian" +toBabel ("la":"x":"classic":_) = "classiclatin" toBabel ("sl":_) = "slovene" toBabel x = commonFromBcp47 x @@ -1172,12 +1196,15 @@ toBabel x = commonFromBcp47 x -- https://tools.ietf.org/html/bcp47#section-2.1 commonFromBcp47 :: [String] -> String commonFromBcp47 [] = "" -commonFromBcp47 ("pt":"BR":_) = "brazilian" +commonFromBcp47 ("pt":"BR":_) = "brazilian" +commonFromBcp47 ("sr":"Cyrl":_) = "serbianc" +commonFromBcp47 ("zh":"Latn":"pinyin":_) = "pinyin" commonFromBcp47 x = fromIso $ head x where fromIso "af" = "afrikaans" fromIso "am" = "amharic" fromIso "ar" = "arabic" + fromIso "as" = "assamese" fromIso "ast" = "asturian" fromIso "bg" = "bulgarian" fromIso "bn" = "bengali" @@ -1201,12 +1228,13 @@ commonFromBcp47 x = fromIso $ head x fromIso "fur" = "friulan" fromIso "ga" = "irish" fromIso "gd" = "scottish" + fromIso "gez" = "ethiopic" fromIso "gl" = "galician" fromIso "he" = "hebrew" fromIso "hi" = "hindi" fromIso "hr" = "croatian" - fromIso "hy" = "armenian" fromIso "hu" = "magyar" + fromIso "hy" = "armenian" fromIso "ia" = "interlingua" fromIso "id" = "indonesian" fromIso "ie" = "interlingua" @@ -1214,6 +1242,7 @@ commonFromBcp47 x = fromIso $ head x fromIso "it" = "italian" fromIso "jp" = "japanese" fromIso "km" = "khmer" + fromIso "kmr" = "kurmanji" fromIso "kn" = "kannada" fromIso "ko" = "korean" fromIso "la" = "latin" @@ -1229,6 +1258,7 @@ commonFromBcp47 x = fromIso $ head x fromIso "no" = "norsk" fromIso "nqo" = "nko" fromIso "oc" = "occitan" + fromIso "pa" = "panjabi" fromIso "pl" = "polish" fromIso "pms" = "piedmontese" fromIso "pt" = "portuguese" @@ -1245,6 +1275,7 @@ commonFromBcp47 x = fromIso $ head x fromIso "ta" = "tamil" fromIso "te" = "telugu" fromIso "th" = "thai" + fromIso "ti" = "ethiopic" fromIso "tk" = "turkmen" fromIso "tr" = "turkish" fromIso "uk" = "ukrainian" diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs index 20086ed19..e57a6fc11 100644 --- a/src/Text/Pandoc/Writers/Org.hs +++ b/src/Text/Pandoc/Writers/Org.hs @@ -170,7 +170,7 @@ blockToOrg (Table caption' _ _ headers rows) = do map ((+2) . numChars) $ transpose (headers' : rawRows) -- FIXME: Org doesn't allow blocks with height more than 1. let hpipeBlocks blocks = hcat [beg, middle, end] - where h = maximum (map height blocks) + where h = maximum (1 : map height blocks) sep' = lblock 3 $ vcat (map text $ replicate h " | ") beg = lblock 2 $ vcat (map text $ replicate h "| ") end = lblock 2 $ vcat (map text $ replicate h " |") diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs index 70d8efba6..4cc2141b4 100644 --- a/src/Text/Pandoc/XML.hs +++ b/src/Text/Pandoc/XML.hs @@ -1,5 +1,5 @@ {- -Copyright (C) 2006-2015 John MacFarlane <jgm@berkeley.edu> +Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc.XML - Copyright : Copyright (C) 2006-2015 John MacFarlane + Copyright : Copyright (C) 2006-2016 John MacFarlane License : GNU GPL, version 2 or above Maintainer : John MacFarlane <jgm@berkeley.edu> diff --git a/stack.full.yaml b/stack.full.yaml index 2d752d531..892598860 100644 --- a/stack.full.yaml +++ b/stack.full.yaml @@ -11,5 +11,10 @@ packages: - '.' - '../pandoc-citeproc' - '../pandoc-types' +- '../cmark-hs' +- '../zip-archive' - '../texmath' -resolver: lts-5.2 +extra-deps: +- 'aeson-0.11.1.1' +- 'highlighting-kate-0.6.2' +resolver: lts-5.8 diff --git a/stack.yaml b/stack.yaml index 21ff7bff7..108e40f27 100644 --- a/stack.yaml +++ b/stack.yaml @@ -7,9 +7,12 @@ flags: network-uri: true packages: - '.' -extra-deps: [] +extra-deps: +- texmath-0.8.6.2 +- data-default-0.6.0 +- data-default-instances-base-0.1.0 # to compile against aeson 0.11.0.0: # - 'aeson-0.11.0.0' # - 'fail-4.9.0.0' # - 'pandoc-types-1.16.1' -resolver: lts-5.2 +resolver: lts-5.8 diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs index 36bb3398e..4e0eb46a4 100644 --- a/tests/Tests/Old.hs +++ b/tests/Tests/Old.hs @@ -57,7 +57,7 @@ tests = [ testGroup "markdown" "tables.txt" "tables.native" , test "pipe tables" ["-r", "markdown", "-w", "native", "--columns=80"] "pipe-tables.txt" "pipe-tables.native" - , test "more" ["-r", "markdown", "-w", "native", "-S"] + , test "more" ["-r", "markdown", "-w", "native", "-s", "-S"] "markdown-reader-more.txt" "markdown-reader-more.native" , lhsReaderTest "markdown+lhs" ] @@ -108,6 +108,9 @@ tests = [ testGroup "markdown" , test "reader" ["-r", "docbook", "-w", "native", "-s"] "docbook-xref.docbook" "docbook-xref.native" ] + , testGroup "docbook5" + [ testGroup "writer" $ writerTests "docbook5" + ] , testGroup "native" [ testGroup "writer" $ writerTests "native" , test "reader" ["-r", "native", "-w", "native", "-s"] diff --git a/tests/Tests/Readers/Docx.hs b/tests/Tests/Readers/Docx.hs index 9284d165a..aeb6bf939 100644 --- a/tests/Tests/Readers/Docx.hs +++ b/tests/Tests/Readers/Docx.hs @@ -169,10 +169,14 @@ tests = [ testGroup "inlines" "docx/already_auto_ident.docx" "docx/already_auto_ident.native" , testCompare - "numbered headers automatically made into list" + "single numbered item not made into list" "docx/numbered_header.docx" "docx/numbered_header.native" , testCompare + "enumerated headers not made into numbered list" + "docx/enumerated_headings.docx" + "docx/enumerated_headings.native" + , testCompare "i18n blocks (headers and blockquotes)" "docx/i18n_blocks.docx" "docx/i18n_blocks.native" @@ -262,6 +266,18 @@ tests = [ testGroup "inlines" "keep deletion (all)" "docx/track_changes_deletion.docx" "docx/track_changes_deletion_all.native" + , testCompareWithOpts def{readerTrackChanges=AcceptChanges} + "move text (accept)" + "docx/track_changes_move.docx" + "docx/track_changes_move_accept.native" + , testCompareWithOpts def{readerTrackChanges=RejectChanges} + "move text (reject)" + "docx/track_changes_move.docx" + "docx/track_changes_move_reject.native" + , testCompareWithOpts def{readerTrackChanges=AllChanges} + "move text (all)" + "docx/track_changes_move.docx" + "docx/track_changes_move_all.native" ] , testGroup "media" [ testMediaBag diff --git a/tests/Tests/Readers/HTML.hs b/tests/Tests/Readers/HTML.hs index 2eb87a2f3..ff27b8aed 100644 --- a/tests/Tests/Readers/HTML.hs +++ b/tests/Tests/Readers/HTML.hs @@ -15,11 +15,14 @@ html = handleError . readHtml def tests :: [Test] tests = [ testGroup "base tag" [ test html "simple" $ - "<head><base href=\"http://www.w3schools.com/images\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?> + "<head><base href=\"http://www.w3schools.com/images/foo\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?> plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman")) , test html "slash at end of base" $ "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?> plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman")) + , test html "slash at beginning of href" $ + "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"/stickman.gif\" alt=\"Stickman\"></head>" =?> + plain (image "http://www.w3schools.com/stickman.gif" "" (text "Stickman")) , test html "absolute URL" $ "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"http://example.com/stickman.gif\" alt=\"Stickman\"></head>" =?> plain (image "http://example.com/stickman.gif" "" (text "Stickman")) diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index b095ac60a..17682fb32 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -308,6 +308,10 @@ tests = "\\textit{Emphasised}" =?> para (emph "Emphasised") + , "Inline LaTeX command with spaces" =: + "\\emph{Emphasis mine}" =?> + para (emph "Emphasis mine") + , "Inline LaTeX math symbol" =: "\\tau" =?> para (emph "τ") @@ -328,6 +332,10 @@ tests = "\\copy" =?> para "©" + , "MathML symbols, space separated" =: + "\\ForAll \\Auml" =?> + para "∀ Ä" + , "LaTeX citation" =: "\\cite{Coffee}" =?> let citation = Citation @@ -941,7 +949,7 @@ tests = , "Empty table" =: "||" =?> - simpleTable' 1 mempty mempty + simpleTable' 1 mempty [[mempty]] , "Glider Table" =: unlines [ "| 1 | 0 | 0 |" @@ -996,6 +1004,17 @@ tests = , [ plain "dynamic", plain "Lisp" ] ] + , "Table with empty cells" =: + "|||c|" =?> + simpleTable' 3 mempty [[mempty, mempty, plain "c"]] + + , "Table with empty rows" =: + unlines [ "| first |" + , "| |" + , "| third |" + ] =?> + simpleTable' 1 mempty [[plain "first"], [mempty], [plain "third"]] + , "Table with alignment row" =: unlines [ "| Numbers | Text | More |" , "| <c> | <r> | |" @@ -1024,10 +1043,10 @@ tests = , "| 1 | One | foo |" , "| 2" ] =?> - table "" (zip [AlignCenter, AlignRight, AlignDefault] [0, 0, 0]) - [ plain "Numbers", plain "Text" , plain mempty ] - [ [ plain "1" , plain "One" , plain "foo" ] - , [ plain "2" , plain mempty , plain mempty ] + table "" (zip [AlignCenter, AlignRight] [0, 0]) + [ plain "Numbers", plain "Text" ] + [ [ plain "1" , plain "One" , plain "foo" ] + , [ plain "2" ] ] , "Table with caption" =: @@ -1054,6 +1073,33 @@ tests = " where greeting = \"moin\"\n" in codeBlockWith attr' code' + , "Source block with indented code" =: + unlines [ " #+BEGIN_SRC haskell" + , " main = putStrLn greeting" + , " where greeting = \"moin\"" + , " #+END_SRC" ] =?> + let attr' = ("", ["haskell"], []) + code' = "main = putStrLn greeting\n" ++ + " where greeting = \"moin\"\n" + in codeBlockWith attr' code' + + , "Source block with tab-indented code" =: + unlines [ "\t#+BEGIN_SRC haskell" + , "\tmain = putStrLn greeting" + , "\t where greeting = \"moin\"" + , "\t#+END_SRC" ] =?> + let attr' = ("", ["haskell"], []) + code' = "main = putStrLn greeting\n" ++ + " where greeting = \"moin\"\n" + in codeBlockWith attr' code' + + , "Empty source block" =: + unlines [ " #+BEGIN_SRC haskell" + , " #+END_SRC" ] =?> + let attr' = ("", ["haskell"], []) + code' = "" + in codeBlockWith attr' code' + , "Source block between paragraphs" =: unlines [ "Low German greeting" , " #+BEGIN_SRC haskell" diff --git a/tests/docx/enumerated_headings.docx b/tests/docx/enumerated_headings.docx Binary files differnew file mode 100644 index 000000000..afa84748a --- /dev/null +++ b/tests/docx/enumerated_headings.docx diff --git a/tests/docx/enumerated_headings.native b/tests/docx/enumerated_headings.native new file mode 100644 index 000000000..67c0df5e0 --- /dev/null +++ b/tests/docx/enumerated_headings.native @@ -0,0 +1,4 @@ +[Header 1 ("h1",[],[]) [Str "H1"] +,Header 2 ("h2",[],[]) [Str "H2"] +,Header 3 ("h3",[],[]) [Str "H3"] +,Para [Str "And",Space,Str "some",Space,Str "text"]] diff --git a/tests/docx/track_changes_move.docx b/tests/docx/track_changes_move.docx Binary files differnew file mode 100644 index 000000000..b70779fd4 --- /dev/null +++ b/tests/docx/track_changes_move.docx diff --git a/tests/docx/track_changes_move_accept.native b/tests/docx/track_changes_move_accept.native new file mode 100644 index 000000000..0cf276768 --- /dev/null +++ b/tests/docx/track_changes_move_accept.native @@ -0,0 +1,3 @@ +[Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "text."] +,Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "text",Space,Str "to",Space,Str "be",Space,Str "moved."] +,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "more",Space,Str "text."]] diff --git a/tests/docx/track_changes_move_all.native b/tests/docx/track_changes_move_all.native new file mode 100644 index 000000000..3afae83a5 --- /dev/null +++ b/tests/docx/track_changes_move_all.native @@ -0,0 +1,4 @@ +[Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "text."] +,Para [Span ("",["insertion"],[("author","Jesse Rosenthal"),("date","2016-04-16T08:20:00Z")]) [Str "Here",Space,Str "is",Space,Str "the",Space,Str "text",Space,Str "to",Space,Str "be",Space,Str "moved."]] +,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "more",Space,Str "text."] +,Para [Span ("",["deletion"],[("author","Jesse Rosenthal"),("date","2016-04-16T08:20:00Z")]) [Str "Here",Space,Str "is",Space,Str "the",Space,Str "text",Space,Str "to",Space,Str "be",Space,Str "moved."]]] diff --git a/tests/docx/track_changes_move_reject.native b/tests/docx/track_changes_move_reject.native new file mode 100644 index 000000000..9c57871b6 --- /dev/null +++ b/tests/docx/track_changes_move_reject.native @@ -0,0 +1,3 @@ +[Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "text."] +,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "more",Space,Str "text."] +,Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "text",Space,Str "to",Space,Str "be",Space,Str "moved."]] diff --git a/tests/markdown-reader-more.native b/tests/markdown-reader-more.native index 0148e9394..c38ffe038 100644 --- a/tests/markdown-reader-more.native +++ b/tests/markdown-reader-more.native @@ -1,5 +1,5 @@ -[Para [Str "spanning",Space,Str "multiple",Space,Str "lines",SoftBreak,Str "%",Space,Str "Author",Space,Str "One",SoftBreak,Str "Author",Space,Str "Two;",Space,Str "Author",Space,Str "Three;",SoftBreak,Str "Author",Space,Str "Four"] -,Header 1 ("additional-markdown-reader-tests",[],[]) [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"] +Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Author",Space,Str "One"],MetaInlines [Str "Author",Space,Str "Two"],MetaInlines [Str "Author",Space,Str "Three"],MetaInlines [Str "Author",Space,Str "Four"]]),("title",MetaInlines [Str "Title",SoftBreak,Str "spanning",Space,Str "multiple",Space,Str "lines"])]}) +[Header 1 ("additional-markdown-reader-tests",[],[]) [Str "Additional",Space,Str "markdown",Space,Str "reader",Space,Str "tests"] ,Header 2 ("blank-line-before-url-in-link-reference",[],[]) [Str "Blank",Space,Str "line",Space,Str "before",Space,Str "URL",Space,Str "in",Space,Str "link",Space,Str "reference"] ,Para [Link ("",[],[]) [Str "foo"] ("/url",""),Space,Str "and",Space,Link ("",[],[]) [Str "bar"] ("/url","title")] ,Header 2 ("raw-context-environments",[],[]) [Str "Raw",Space,Str "ConTeXt",Space,Str "environments"] diff --git a/tests/mediawiki-reader.native b/tests/mediawiki-reader.native index cf80d0664..6afeb602c 100644 --- a/tests/mediawiki-reader.native +++ b/tests/mediawiki-reader.native @@ -252,6 +252,11 @@ Pandoc (Meta {unMeta = fromList []}) [[]] [[[Para [Str "Orange"]]]] ,Para [Str "Paragraph",Space,Str "after",Space,Str "the",Space,Str "table."] +,Table [] [AlignDefault,AlignDefault] [0.0,0.0] + [[Para [Str "fruit"]] + ,[Para [Str "topping"]]] + [[[Para [Str "apple"]] + ,[Para [Str "ice",Space,Str "cream"]]]] ,Header 2 ("notes",[],[]) [Str "notes"] ,Para [Str "My",Space,Str "note!",Note [Plain [Str "This."]]] ,Para [Str "URL",Space,Str "note.",Note [Plain [Link ("",[],[]) [Str "http://docs.python.org/library/functions.html#range"] ("http://docs.python.org/library/functions.html#range","")]]]] diff --git a/tests/mediawiki-reader.wiki b/tests/mediawiki-reader.wiki index 862bb3b48..11cd52d9c 100644 --- a/tests/mediawiki-reader.wiki +++ b/tests/mediawiki-reader.wiki @@ -381,6 +381,14 @@ and cheese |Orange |}Paragraph after the table. +{| + !fruit + !topping + |- + |apple + |ice cream + |} + == notes == My note!<ref>This.</ref> diff --git a/tests/pipe-tables.native b/tests/pipe-tables.native index 6cd37f6ff..63c2c17bc 100644 --- a/tests/pipe-tables.native +++ b/tests/pipe-tables.native @@ -98,4 +98,18 @@ ,Para [Str "Pipe",Space,Str "table",Space,Str "with",Space,Str "no",Space,Str "body:"] ,Table [] [AlignDefault] [0.0] [[Plain [Str "Header"]]] - []] + [] +,Para [Str "Pipe",Space,Str "table",Space,Str "with",Space,Str "tricky",Space,Str "cell",Space,Str "contents",Space,Str "(see",Space,Str "#2765):"] +,Table [] [AlignLeft,AlignRight,AlignRight] [0.0,0.0,0.0] + [[] + ,[Plain [Str "IP_gene8-_1st"]] + ,[Plain [Str "IP_gene8+_1st"]]] + [[[Plain [Str "IP_gene8-_1st"]] + ,[Plain [Str "1.0000000"]] + ,[Plain [Str "0.4357325"]]] + ,[[Plain [Str "IP_gene8+_1st"]] + ,[Plain [Str "0.4357325"]] + ,[Plain [Str "1.0000000"]]] + ,[[Plain [Str "foo",Code ("",[],[]) "bar|baz"]] + ,[Plain [Str "and|escaped"]] + ,[Plain [Str "3.0000000"]]]]] diff --git a/tests/pipe-tables.txt b/tests/pipe-tables.txt index e93f64af9..c27c71113 100644 --- a/tests/pipe-tables.txt +++ b/tests/pipe-tables.txt @@ -72,3 +72,11 @@ Pipe table with no body: | Header | | ------ | +Pipe table with tricky cell contents (see #2765): + +| | IP_gene8-_1st| IP_gene8+_1st| +|:--------------|-------------:|-------------:| +|IP_gene8-_1st | 1.0000000| 0.4357325| +|IP_gene8+_1st | 0.4357325| 1.0000000| +|foo`bar|baz` | and\|escaped | 3.0000000| + diff --git a/tests/tables.docbook5 b/tests/tables.docbook5 new file mode 100644 index 000000000..6224cf222 --- /dev/null +++ b/tests/tables.docbook5 @@ -0,0 +1,432 @@ +<para> + Simple table with caption: +</para> +<table> + <title> + Demonstration of simple table syntax. + </title> + <tgroup cols="4"> + <colspec align="right" /> + <colspec align="left" /> + <colspec align="center" /> + <colspec align="left" /> + <thead> + <row> + <entry> + Right + </entry> + <entry> + Left + </entry> + <entry> + Center + </entry> + <entry> + Default + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + </row> + <row> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + </row> + <row> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + </row> + </tbody> + </tgroup> +</table> +<para> + Simple table without caption: +</para> +<informaltable> + <tgroup cols="4"> + <colspec align="right" /> + <colspec align="left" /> + <colspec align="center" /> + <colspec align="left" /> + <thead> + <row> + <entry> + Right + </entry> + <entry> + Left + </entry> + <entry> + Center + </entry> + <entry> + Default + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + </row> + <row> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + </row> + <row> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + </row> + </tbody> + </tgroup> +</informaltable> +<para> + Simple table indented two spaces: +</para> +<table> + <title> + Demonstration of simple table syntax. + </title> + <tgroup cols="4"> + <colspec align="right" /> + <colspec align="left" /> + <colspec align="center" /> + <colspec align="left" /> + <thead> + <row> + <entry> + Right + </entry> + <entry> + Left + </entry> + <entry> + Center + </entry> + <entry> + Default + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + </row> + <row> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + </row> + <row> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + </row> + </tbody> + </tgroup> +</table> +<para> + Multiline table with caption: +</para> +<table> + <title> + Here's the caption. It may span multiple lines. + </title> + <tgroup cols="4"> + <colspec colwidth="15*" align="center" /> + <colspec colwidth="13*" align="left" /> + <colspec colwidth="16*" align="right" /> + <colspec colwidth="33*" align="left" /> + <thead> + <row> + <entry> + Centered Header + </entry> + <entry> + Left Aligned + </entry> + <entry> + Right Aligned + </entry> + <entry> + Default aligned + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + First + </entry> + <entry> + row + </entry> + <entry> + 12.0 + </entry> + <entry> + Example of a row that spans multiple lines. + </entry> + </row> + <row> + <entry> + Second + </entry> + <entry> + row + </entry> + <entry> + 5.0 + </entry> + <entry> + Here's another one. Note the blank line between rows. + </entry> + </row> + </tbody> + </tgroup> +</table> +<para> + Multiline table without caption: +</para> +<informaltable> + <tgroup cols="4"> + <colspec colwidth="15*" align="center" /> + <colspec colwidth="13*" align="left" /> + <colspec colwidth="16*" align="right" /> + <colspec colwidth="33*" align="left" /> + <thead> + <row> + <entry> + Centered Header + </entry> + <entry> + Left Aligned + </entry> + <entry> + Right Aligned + </entry> + <entry> + Default aligned + </entry> + </row> + </thead> + <tbody> + <row> + <entry> + First + </entry> + <entry> + row + </entry> + <entry> + 12.0 + </entry> + <entry> + Example of a row that spans multiple lines. + </entry> + </row> + <row> + <entry> + Second + </entry> + <entry> + row + </entry> + <entry> + 5.0 + </entry> + <entry> + Here's another one. Note the blank line between rows. + </entry> + </row> + </tbody> + </tgroup> +</informaltable> +<para> + Table without column headers: +</para> +<informaltable> + <tgroup cols="4"> + <colspec align="right" /> + <colspec align="left" /> + <colspec align="center" /> + <colspec align="right" /> + <tbody> + <row> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + <entry> + 12 + </entry> + </row> + <row> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + <entry> + 123 + </entry> + </row> + <row> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + <entry> + 1 + </entry> + </row> + </tbody> + </tgroup> +</informaltable> +<para> + Multiline table without column headers: +</para> +<informaltable> + <tgroup cols="4"> + <colspec colwidth="15*" align="center" /> + <colspec colwidth="13*" align="left" /> + <colspec colwidth="16*" align="right" /> + <colspec colwidth="33*" align="left" /> + <tbody> + <row> + <entry> + First + </entry> + <entry> + row + </entry> + <entry> + 12.0 + </entry> + <entry> + Example of a row that spans multiple lines. + </entry> + </row> + <row> + <entry> + Second + </entry> + <entry> + row + </entry> + <entry> + 5.0 + </entry> + <entry> + Here's another one. Note the blank line between rows. + </entry> + </row> + </tbody> + </tgroup> +</informaltable> diff --git a/tests/tables.latex b/tests/tables.latex index 96cbc9579..9f3f97e53 100644 --- a/tests/tables.latex +++ b/tests/tables.latex @@ -52,47 +52,47 @@ Multiline table with caption: \begin{longtable}[]{@{}clrl@{}} \caption{Here's the caption. It may span multiple lines.}\tabularnewline \toprule -\begin{minipage}[b]{0.13\columnwidth}\centering\strut +\begin{minipage}[b]{0.13\columnwidth}\centering Centered Header -\strut\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright Left Aligned -\strut\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft Right Aligned -\strut\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright Default aligned -\strut\end{minipage}\tabularnewline +\end{minipage}\tabularnewline \midrule \endfirsthead \toprule -\begin{minipage}[b]{0.13\columnwidth}\centering\strut +\begin{minipage}[b]{0.13\columnwidth}\centering Centered Header -\strut\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright Left Aligned -\strut\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft Right Aligned -\strut\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright Default aligned -\strut\end{minipage}\tabularnewline +\end{minipage}\tabularnewline \midrule \endhead -\begin{minipage}[t]{0.13\columnwidth}\centering\strut +\begin{minipage}[t]{0.13\columnwidth}\centering First -\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright row -\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft 12.0 -\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright Example of a row that spans multiple lines. -\strut\end{minipage}\tabularnewline -\begin{minipage}[t]{0.13\columnwidth}\centering\strut +\end{minipage}\tabularnewline +\begin{minipage}[t]{0.13\columnwidth}\centering Second -\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright row -\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft 5.0 -\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright Here's another one. Note the blank line between rows. -\strut\end{minipage}\tabularnewline +\end{minipage}\tabularnewline \bottomrule \end{longtable} @@ -100,35 +100,35 @@ Multiline table without caption: \begin{longtable}[]{@{}clrl@{}} \toprule -\begin{minipage}[b]{0.13\columnwidth}\centering\strut +\begin{minipage}[b]{0.13\columnwidth}\centering Centered Header -\strut\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright Left Aligned -\strut\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft Right Aligned -\strut\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright Default aligned -\strut\end{minipage}\tabularnewline +\end{minipage}\tabularnewline \midrule \endhead -\begin{minipage}[t]{0.13\columnwidth}\centering\strut +\begin{minipage}[t]{0.13\columnwidth}\centering First -\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright row -\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft 12.0 -\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright Example of a row that spans multiple lines. -\strut\end{minipage}\tabularnewline -\begin{minipage}[t]{0.13\columnwidth}\centering\strut +\end{minipage}\tabularnewline +\begin{minipage}[t]{0.13\columnwidth}\centering Second -\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright row -\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft 5.0 -\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright Here's another one. Note the blank line between rows. -\strut\end{minipage}\tabularnewline +\end{minipage}\tabularnewline \bottomrule \end{longtable} @@ -146,23 +146,23 @@ Multiline table without column headers: \begin{longtable}[]{@{}clrl@{}} \toprule -\begin{minipage}[t]{0.13\columnwidth}\centering\strut +\begin{minipage}[t]{0.13\columnwidth}\centering First -\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright row -\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft 12.0 -\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright Example of a row that spans multiple lines. -\strut\end{minipage}\tabularnewline -\begin{minipage}[t]{0.13\columnwidth}\centering\strut +\end{minipage}\tabularnewline +\begin{minipage}[t]{0.13\columnwidth}\centering Second -\strut\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright row -\strut\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut +\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft 5.0 -\strut\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut +\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright Here's another one. Note the blank line between rows. -\strut\end{minipage}\tabularnewline +\end{minipage}\tabularnewline \bottomrule \end{longtable} diff --git a/tests/writer.docbook5 b/tests/writer.docbook5 new file mode 100644 index 000000000..5261a35be --- /dev/null +++ b/tests/writer.docbook5 @@ -0,0 +1,1395 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE article> +<article xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <title>Pandoc Test Suite</title> + <authorgroup> + <author> + <firstname>John</firstname> + <surname>MacFarlane</surname> + </author> + <author> + <firstname></firstname> + <surname>Anonymous</surname> + </author> + </authorgroup> + <date>July 17, 2006</date> + </info> +<para> + This is a set of tests for pandoc. Most of them are adapted from John + Gruber’s markdown test suite. +</para> +<section id="headers"> + <title>Headers</title> + <section id="level-2-with-an-embedded-link"> + <title>Level 2 with an <link xlink:href="/url">embedded + link</link></title> + <section id="level-3-with-emphasis"> + <title>Level 3 with <emphasis>emphasis</emphasis></title> + <section id="level-4"> + <title>Level 4</title> + <section id="level-5"> + <title>Level 5</title> + <para> + </para> + </section> + </section> + </section> + </section> +</section> +<section id="level-1"> + <title>Level 1</title> + <section id="level-2-with-emphasis"> + <title>Level 2 with <emphasis>emphasis</emphasis></title> + <section id="level-3"> + <title>Level 3</title> + <para> + with no blank line + </para> + </section> + </section> + <section id="level-2"> + <title>Level 2</title> + <para> + with no blank line + </para> + </section> +</section> +<section id="paragraphs"> + <title>Paragraphs</title> + <para> + Here’s a regular paragraph. + </para> + <para> + In Markdown 1.0.0 and earlier. Version 8. This line turns into a list + item. Because a hard-wrapped line in the middle of a paragraph looked like + a list item. + </para> + <para> + Here’s one with a bullet. * criminey. + </para> +<literallayout>There should be a hard line break +here.</literallayout> +</section> +<section id="block-quotes"> + <title>Block Quotes</title> + <para> + E-mail style: + </para> + <blockquote> + <para> + This is a block quote. It is pretty short. + </para> + </blockquote> + <blockquote> + <para> + Code in a block quote: + </para> + <programlisting> +sub status { + print "working"; +} +</programlisting> + <para> + A list: + </para> + <orderedlist numeration="arabic" spacing="compact"> + <listitem> + <para> + item one + </para> + </listitem> + <listitem> + <para> + item two + </para> + </listitem> + </orderedlist> + <para> + Nested block quotes: + </para> + <blockquote> + <para> + nested + </para> + </blockquote> + <blockquote> + <para> + nested + </para> + </blockquote> + </blockquote> + <para> + This should not be a block quote: 2 > 1. + </para> + <para> + And a following paragraph. + </para> +</section> +<section id="code-blocks"> + <title>Code Blocks</title> + <para> + Code: + </para> + <programlisting> +---- (should be four hyphens) + +sub status { + print "working"; +} + +this code block is indented by one tab +</programlisting> + <para> + And: + </para> + <programlisting> + this code block is indented by two tabs + +These should not be escaped: \$ \\ \> \[ \{ +</programlisting> +</section> +<section id="lists"> + <title>Lists</title> + <section id="unordered"> + <title>Unordered</title> + <para> + Asterisks tight: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + asterisk 1 + </para> + </listitem> + <listitem> + <para> + asterisk 2 + </para> + </listitem> + <listitem> + <para> + asterisk 3 + </para> + </listitem> + </itemizedlist> + <para> + Asterisks loose: + </para> + <itemizedlist> + <listitem> + <para> + asterisk 1 + </para> + </listitem> + <listitem> + <para> + asterisk 2 + </para> + </listitem> + <listitem> + <para> + asterisk 3 + </para> + </listitem> + </itemizedlist> + <para> + Pluses tight: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + Plus 1 + </para> + </listitem> + <listitem> + <para> + Plus 2 + </para> + </listitem> + <listitem> + <para> + Plus 3 + </para> + </listitem> + </itemizedlist> + <para> + Pluses loose: + </para> + <itemizedlist> + <listitem> + <para> + Plus 1 + </para> + </listitem> + <listitem> + <para> + Plus 2 + </para> + </listitem> + <listitem> + <para> + Plus 3 + </para> + </listitem> + </itemizedlist> + <para> + Minuses tight: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + Minus 1 + </para> + </listitem> + <listitem> + <para> + Minus 2 + </para> + </listitem> + <listitem> + <para> + Minus 3 + </para> + </listitem> + </itemizedlist> + <para> + Minuses loose: + </para> + <itemizedlist> + <listitem> + <para> + Minus 1 + </para> + </listitem> + <listitem> + <para> + Minus 2 + </para> + </listitem> + <listitem> + <para> + Minus 3 + </para> + </listitem> + </itemizedlist> + </section> + <section id="ordered"> + <title>Ordered</title> + <para> + Tight: + </para> + <orderedlist numeration="arabic" spacing="compact"> + <listitem> + <para> + First + </para> + </listitem> + <listitem> + <para> + Second + </para> + </listitem> + <listitem> + <para> + Third + </para> + </listitem> + </orderedlist> + <para> + and: + </para> + <orderedlist numeration="arabic" spacing="compact"> + <listitem> + <para> + One + </para> + </listitem> + <listitem> + <para> + Two + </para> + </listitem> + <listitem> + <para> + Three + </para> + </listitem> + </orderedlist> + <para> + Loose using tabs: + </para> + <orderedlist numeration="arabic"> + <listitem> + <para> + First + </para> + </listitem> + <listitem> + <para> + Second + </para> + </listitem> + <listitem> + <para> + Third + </para> + </listitem> + </orderedlist> + <para> + and using spaces: + </para> + <orderedlist numeration="arabic"> + <listitem> + <para> + One + </para> + </listitem> + <listitem> + <para> + Two + </para> + </listitem> + <listitem> + <para> + Three + </para> + </listitem> + </orderedlist> + <para> + Multiple paragraphs: + </para> + <orderedlist numeration="arabic"> + <listitem> + <para> + Item 1, graf one. + </para> + <para> + Item 1. graf two. The quick brown fox jumped over the lazy dog’s + back. + </para> + </listitem> + <listitem> + <para> + Item 2. + </para> + </listitem> + <listitem> + <para> + Item 3. + </para> + </listitem> + </orderedlist> + </section> + <section id="nested"> + <title>Nested</title> + <itemizedlist spacing="compact"> + <listitem> + <para> + Tab + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + Tab + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + Tab + </para> + </listitem> + </itemizedlist> + </listitem> + </itemizedlist> + </listitem> + </itemizedlist> + <para> + Here’s another: + </para> + <orderedlist numeration="arabic" spacing="compact"> + <listitem> + <para> + First + </para> + </listitem> + <listitem> + <para> + Second: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + Fee + </para> + </listitem> + <listitem> + <para> + Fie + </para> + </listitem> + <listitem> + <para> + Foe + </para> + </listitem> + </itemizedlist> + </listitem> + <listitem> + <para> + Third + </para> + </listitem> + </orderedlist> + <para> + Same thing but with paragraphs: + </para> + <orderedlist numeration="arabic"> + <listitem> + <para> + First + </para> + </listitem> + <listitem> + <para> + Second: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + Fee + </para> + </listitem> + <listitem> + <para> + Fie + </para> + </listitem> + <listitem> + <para> + Foe + </para> + </listitem> + </itemizedlist> + </listitem> + <listitem> + <para> + Third + </para> + </listitem> + </orderedlist> + </section> + <section id="tabs-and-spaces"> + <title>Tabs and spaces</title> + <itemizedlist> + <listitem> + <para> + this is a list item indented with tabs + </para> + </listitem> + <listitem> + <para> + this is a list item indented with spaces + </para> + <itemizedlist> + <listitem> + <para> + this is an example list item indented with tabs + </para> + </listitem> + <listitem> + <para> + this is an example list item indented with spaces + </para> + </listitem> + </itemizedlist> + </listitem> + </itemizedlist> + </section> + <section id="fancy-list-markers"> + <title>Fancy list markers</title> + <orderedlist numeration="arabic"> + <listitem override="2"> + <para> + begins with 2 + </para> + </listitem> + <listitem> + <para> + and now 3 + </para> + <para> + with a continuation + </para> + <orderedlist numeration="lowerroman" spacing="compact"> + <listitem override="4"> + <para> + sublist with roman numerals, starting with 4 + </para> + </listitem> + <listitem> + <para> + more items + </para> + <orderedlist numeration="upperalpha" spacing="compact"> + <listitem> + <para> + a subsublist + </para> + </listitem> + <listitem> + <para> + a subsublist + </para> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + <para> + Nesting: + </para> + <orderedlist numeration="upperalpha" spacing="compact"> + <listitem> + <para> + Upper Alpha + </para> + <orderedlist numeration="upperroman" spacing="compact"> + <listitem> + <para> + Upper Roman. + </para> + <orderedlist numeration="arabic" spacing="compact"> + <listitem override="6"> + <para> + Decimal start with 6 + </para> + <orderedlist numeration="loweralpha" spacing="compact"> + <listitem override="3"> + <para> + Lower alpha with paren + </para> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + <para> + Autonumbering: + </para> + <orderedlist spacing="compact"> + <listitem> + <para> + Autonumber. + </para> + </listitem> + <listitem> + <para> + More. + </para> + <orderedlist spacing="compact"> + <listitem> + <para> + Nested. + </para> + </listitem> + </orderedlist> + </listitem> + </orderedlist> + <para> + Should not be a list item: + </para> + <para> + M.A. 2007 + </para> + <para> + B. Williams + </para> + </section> +</section> +<section id="definition-lists"> + <title>Definition Lists</title> + <para> + Tight using spaces: + </para> + <variablelist spacing="compact"> + <varlistentry> + <term> + apple + </term> + <listitem> + <para> + red fruit + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + orange + </term> + <listitem> + <para> + orange fruit + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + banana + </term> + <listitem> + <para> + yellow fruit + </para> + </listitem> + </varlistentry> + </variablelist> + <para> + Tight using tabs: + </para> + <variablelist spacing="compact"> + <varlistentry> + <term> + apple + </term> + <listitem> + <para> + red fruit + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + orange + </term> + <listitem> + <para> + orange fruit + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + banana + </term> + <listitem> + <para> + yellow fruit + </para> + </listitem> + </varlistentry> + </variablelist> + <para> + Loose: + </para> + <variablelist> + <varlistentry> + <term> + apple + </term> + <listitem> + <para> + red fruit + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + orange + </term> + <listitem> + <para> + orange fruit + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + banana + </term> + <listitem> + <para> + yellow fruit + </para> + </listitem> + </varlistentry> + </variablelist> + <para> + Multiple blocks with italics: + </para> + <variablelist> + <varlistentry> + <term> + <emphasis>apple</emphasis> + </term> + <listitem> + <para> + red fruit + </para> + <para> + contains seeds, crisp, pleasant to taste + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <emphasis>orange</emphasis> + </term> + <listitem> + <para> + orange fruit + </para> + <programlisting> +{ orange code block } +</programlisting> + <blockquote> + <para> + orange block quote + </para> + </blockquote> + </listitem> + </varlistentry> + </variablelist> + <para> + Multiple definitions, tight: + </para> + <variablelist spacing="compact"> + <varlistentry> + <term> + apple + </term> + <listitem> + <para> + red fruit + </para> + <para> + computer + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + orange + </term> + <listitem> + <para> + orange fruit + </para> + <para> + bank + </para> + </listitem> + </varlistentry> + </variablelist> + <para> + Multiple definitions, loose: + </para> + <variablelist> + <varlistentry> + <term> + apple + </term> + <listitem> + <para> + red fruit + </para> + <para> + computer + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + orange + </term> + <listitem> + <para> + orange fruit + </para> + <para> + bank + </para> + </listitem> + </varlistentry> + </variablelist> + <para> + Blank line after term, indented marker, alternate markers: + </para> + <variablelist> + <varlistentry> + <term> + apple + </term> + <listitem> + <para> + red fruit + </para> + <para> + computer + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + orange + </term> + <listitem> + <para> + orange fruit + </para> + <orderedlist numeration="arabic" spacing="compact"> + <listitem> + <para> + sublist + </para> + </listitem> + <listitem> + <para> + sublist + </para> + </listitem> + </orderedlist> + </listitem> + </varlistentry> + </variablelist> +</section> +<section id="html-blocks"> + <title>HTML Blocks</title> + <para> + Simple block on one line: + </para> + <para> + foo + </para> + <para> + And nested without indentation: + </para> + <para> + foo + </para> + <para> + bar + </para> + <para> + Interpreted markdown in a table: + </para> + This is <emphasis>emphasized</emphasis> + And this is <emphasis role="strong">strong</emphasis> + <para> + Here’s a simple block: + </para> + <para> + foo + </para> + <para> + This should be a code block, though: + </para> + <programlisting> +<div> + foo +</div> +</programlisting> + <para> + As should this: + </para> + <programlisting> +<div>foo</div> +</programlisting> + <para> + Now, nested: + </para> + <para> + foo + </para> + <para> + This should just be an HTML comment: + </para> + <para> + Multiline: + </para> + <para> + Code block: + </para> + <programlisting> +<!-- Comment --> +</programlisting> + <para> + Just plain comment, with trailing spaces on the line: + </para> + <para> + Code: + </para> + <programlisting> +<hr /> +</programlisting> + <para> + Hr’s: + </para> +</section> +<section id="inline-markup"> + <title>Inline Markup</title> + <para> + This is <emphasis>emphasized</emphasis>, and so <emphasis>is + this</emphasis>. + </para> + <para> + This is <emphasis role="strong">strong</emphasis>, and so + <emphasis role="strong">is this</emphasis>. + </para> + <para> + An <emphasis><link xlink:href="/url">emphasized link</link></emphasis>. + </para> + <para> + <emphasis role="strong"><emphasis>This is strong and + em.</emphasis></emphasis> + </para> + <para> + So is <emphasis role="strong"><emphasis>this</emphasis></emphasis> word. + </para> + <para> + <emphasis role="strong"><emphasis>This is strong and + em.</emphasis></emphasis> + </para> + <para> + So is <emphasis role="strong"><emphasis>this</emphasis></emphasis> word. + </para> + <para> + This is code: <literal>></literal>, <literal>$</literal>, + <literal>\</literal>, <literal>\$</literal>, + <literal><html></literal>. + </para> + <para> + <emphasis role="strikethrough">This is + <emphasis>strikeout</emphasis>.</emphasis> + </para> + <para> + Superscripts: a<superscript>bc</superscript>d + a<superscript><emphasis>hello</emphasis></superscript> + a<superscript>hello there</superscript>. + </para> + <para> + Subscripts: H<subscript>2</subscript>O, H<subscript>23</subscript>O, + H<subscript>many of them</subscript>O. + </para> + <para> + These should not be superscripts or subscripts, because of the unescaped + spaces: a^b c^d, a~b c~d. + </para> +</section> +<section id="smart-quotes-ellipses-dashes"> + <title>Smart quotes, ellipses, dashes</title> + <para> + <quote>Hello,</quote> said the spider. <quote><quote>Shelob</quote> is my + name.</quote> + </para> + <para> + <quote>A</quote>, <quote>B</quote>, and <quote>C</quote> are letters. + </para> + <para> + <quote>Oak,</quote> <quote>elm,</quote> and <quote>beech</quote> are names + of trees. So is <quote>pine.</quote> + </para> + <para> + <quote>He said, <quote>I want to go.</quote></quote> Were you alive in the + 70’s? + </para> + <para> + Here is some quoted <quote><literal>code</literal></quote> and a + <quote><link xlink:href="http://example.com/?foo=1&bar=2">quoted + link</link></quote>. + </para> + <para> + Some dashes: one—two — three—four — five. + </para> + <para> + Dashes between numbers: 5–7, 255–66, 1987–1999. + </para> + <para> + Ellipses…and…and…. + </para> +</section> +<section id="latex"> + <title>LaTeX</title> + <itemizedlist spacing="compact"> + <listitem> + <para> + </para> + </listitem> + <listitem> + <para> + 2 + 2 = 4 + </para> + </listitem> + <listitem> + <para> + <emphasis>x</emphasis> ∈ <emphasis>y</emphasis> + </para> + </listitem> + <listitem> + <para> + <emphasis>α</emphasis> ∧ <emphasis>ω</emphasis> + </para> + </listitem> + <listitem> + <para> + 223 + </para> + </listitem> + <listitem> + <para> + <emphasis>p</emphasis>-Tree + </para> + </listitem> + <listitem> + <para> + Here’s some display math: + $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ + </para> + </listitem> + <listitem> + <para> + Here’s one that has a line break in it: + <emphasis>α</emphasis> + <emphasis>ω</emphasis> × <emphasis>x</emphasis><superscript>2</superscript>. + </para> + </listitem> + </itemizedlist> + <para> + These shouldn’t be math: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + To get the famous equation, write <literal>$e = mc^2$</literal>. + </para> + </listitem> + <listitem> + <para> + $22,000 is a <emphasis>lot</emphasis> of money. So is $34,000. (It + worked if <quote>lot</quote> is emphasized.) + </para> + </listitem> + <listitem> + <para> + Shoes ($20) and socks ($5). + </para> + </listitem> + <listitem> + <para> + Escaped <literal>$</literal>: $73 <emphasis>this should be + emphasized</emphasis> 23$. + </para> + </listitem> + </itemizedlist> + <para> + Here’s a LaTeX table: + </para> +</section> +<section id="special-characters"> + <title>Special Characters</title> + <para> + Here is some unicode: + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + I hat: Î + </para> + </listitem> + <listitem> + <para> + o umlaut: ö + </para> + </listitem> + <listitem> + <para> + section: § + </para> + </listitem> + <listitem> + <para> + set membership: ∈ + </para> + </listitem> + <listitem> + <para> + copyright: © + </para> + </listitem> + </itemizedlist> + <para> + AT&T has an ampersand in their name. + </para> + <para> + AT&T is another way to write it. + </para> + <para> + This & that. + </para> + <para> + 4 < 5. + </para> + <para> + 6 > 5. + </para> + <para> + Backslash: \ + </para> + <para> + Backtick: ` + </para> + <para> + Asterisk: * + </para> + <para> + Underscore: _ + </para> + <para> + Left brace: { + </para> + <para> + Right brace: } + </para> + <para> + Left bracket: [ + </para> + <para> + Right bracket: ] + </para> + <para> + Left paren: ( + </para> + <para> + Right paren: ) + </para> + <para> + Greater-than: > + </para> + <para> + Hash: # + </para> + <para> + Period: . + </para> + <para> + Bang: ! + </para> + <para> + Plus: + + </para> + <para> + Minus: - + </para> +</section> +<section id="links"> + <title>Links</title> + <section id="explicit"> + <title>Explicit</title> + <para> + Just a <link xlink:href="/url/">URL</link>. + </para> + <para> + <link xlink:href="/url/">URL and title</link>. + </para> + <para> + <link xlink:href="/url/">URL and title</link>. + </para> + <para> + <link xlink:href="/url/">URL and title</link>. + </para> + <para> + <link xlink:href="/url/">URL and title</link> + </para> + <para> + <link xlink:href="/url/">URL and title</link> + </para> + <para> + <link xlink:href="/url/with_underscore">with_underscore</link> + </para> + <para> + Email link (<email>nobody@nowhere.net</email>) + </para> + <para> + <link xlink:href="">Empty</link>. + </para> + </section> + <section id="reference"> + <title>Reference</title> + <para> + Foo <link xlink:href="/url/">bar</link>. + </para> + <para> + Foo <link xlink:href="/url/">bar</link>. + </para> + <para> + Foo <link xlink:href="/url/">bar</link>. + </para> + <para> + With <link xlink:href="/url/">embedded [brackets]</link>. + </para> + <para> + <link xlink:href="/url/">b</link> by itself should be a link. + </para> + <para> + Indented <link xlink:href="/url">once</link>. + </para> + <para> + Indented <link xlink:href="/url">twice</link>. + </para> + <para> + Indented <link xlink:href="/url">thrice</link>. + </para> + <para> + This should [not][] be a link. + </para> + <programlisting> +[not]: /url +</programlisting> + <para> + Foo <link xlink:href="/url/">bar</link>. + </para> + <para> + Foo <link xlink:href="/url/">biz</link>. + </para> + </section> + <section id="with-ampersands"> + <title>With ampersands</title> + <para> + Here’s a <link xlink:href="http://example.com/?foo=1&bar=2">link + with an ampersand in the URL</link>. + </para> + <para> + Here’s a link with an amersand in the link text: + <link xlink:href="http://att.com/">AT&T</link>. + </para> + <para> + Here’s an <link xlink:href="/script?foo=1&bar=2">inline link</link>. + </para> + <para> + Here’s an <link xlink:href="/script?foo=1&bar=2">inline link in + pointy braces</link>. + </para> + </section> + <section id="autolinks"> + <title>Autolinks</title> + <para> + With an ampersand: + <link xlink:href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</link> + </para> + <itemizedlist spacing="compact"> + <listitem> + <para> + In a list? + </para> + </listitem> + <listitem> + <para> + <link xlink:href="http://example.com/">http://example.com/</link> + </para> + </listitem> + <listitem> + <para> + It should. + </para> + </listitem> + </itemizedlist> + <para> + An e-mail address: <email>nobody@nowhere.net</email> + </para> + <blockquote> + <para> + Blockquoted: + <link xlink:href="http://example.com/">http://example.com/</link> + </para> + </blockquote> + <para> + Auto-links should not occur here: + <literal><http://example.com/></literal> + </para> + <programlisting> +or here: <http://example.com/> +</programlisting> + </section> +</section> +<section id="images"> + <title>Images</title> + <para> + From <quote>Voyage dans la Lune</quote> by Georges Melies (1902): + </para> + <figure> + <title>lalune</title> + <mediaobject> + <imageobject> + <imagedata fileref="lalune.jpg" /> + </imageobject> + <textobject><phrase>lalune</phrase></textobject> + </mediaobject> + </figure> + <para> + Here is a movie <inlinemediaobject> + <imageobject> + <imagedata fileref="movie.jpg" /> + </imageobject> + </inlinemediaobject> icon. + </para> +</section> +<section id="footnotes"> + <title>Footnotes</title> + <para> + Here is a footnote reference,<footnote> + <para> + Here is the footnote. It can go anywhere after the footnote reference. + It need not be placed at the end of the document. + </para> + </footnote> and another.<footnote> + <para> + Here’s the long note. This one contains multiple blocks. + </para> + <para> + Subsequent blocks are indented to show that they belong to the + footnote (as with list items). + </para> + <programlisting> + { <code> } +</programlisting> + <para> + If you want, you can indent every line, but you can also be lazy and + just indent the first line of each block. + </para> + </footnote> This should <emphasis>not</emphasis> be a footnote reference, + because it contains a space.[^my note] Here is an inline note.<footnote> + <para> + This is <emphasis>easier</emphasis> to type. Inline notes may contain + <link xlink:href="http://google.com">links</link> and + <literal>]</literal> verbatim characters, as well as [bracketed text]. + </para> + </footnote> + </para> + <blockquote> + <para> + Notes can go in quotes.<footnote> + <para> + In quote. + </para> + </footnote> + </para> + </blockquote> + <orderedlist numeration="arabic" spacing="compact"> + <listitem> + <para> + And in list items.<footnote> + <para> + In list. + </para> + </footnote> + </para> + </listitem> + </orderedlist> + <para> + This paragraph should not be part of the note, as it is not indented. + </para> +</section> +</article> diff --git a/tests/writer.dokuwiki b/tests/writer.dokuwiki index fe1f8296a..79fcdde8a 100644 --- a/tests/writer.dokuwiki +++ b/tests/writer.dokuwiki @@ -459,7 +459,7 @@ Ellipses…and…and…. * $\alpha \wedge \omega$ * $223$ * $p$-Tree - * Here’s some display math: $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ + * Here’s some display math: $$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$$ * Here’s one that has a line break in it: $\alpha + \omega \times x^2$. These shouldn’t be math: diff --git a/tests/writers-lang-and-dir.latex b/tests/writers-lang-and-dir.latex index 056809a5e..346675353 100644 --- a/tests/writers-lang-and-dir.latex +++ b/tests/writers-lang-and-dir.latex @@ -27,16 +27,16 @@ breaklinks=true} \urlstyle{same} % don't use monospace font for urls \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex - \usepackage[shorthands=off,ngerman,british,ngerman,spanish,french,main=english]{babel} + \usepackage[shorthands=off,ngerman,british,nswissgerman,spanish,french,main=english]{babel} \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}} - \newenvironment{german}[1]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}} + \newenvironment{german}[2][]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}} \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}} - \newenvironment{english}[1]{\begin{otherlanguage}{british}}{\end{otherlanguage}} + \newenvironment{english}[2][]{\begin{otherlanguage}{british}}{\end{otherlanguage}} \let\oritextspanish\textspanish \AddBabelHook{spanish}{beforeextras}{\renewcommand{\textspanish}{\oritextspanish}} \AddBabelHook{spanish}{afterextras}{\renewcommand{\textspanish}[2][]{\foreignlanguage{spanish}{##2}}} \newcommand{\textfrench}[2][]{\foreignlanguage{french}{#2}} - \newenvironment{french}[1]{\begin{otherlanguage}{french}}{\end{otherlanguage}} + \newenvironment{french}[2][]{\begin{otherlanguage}{french}}{\end{otherlanguage}} \else \usepackage{polyglossia} \setmainlanguage[]{english} diff --git a/windows/make-windows-installer.bat b/windows/make-windows-installer.bat index c7befe531..d3d9bb71c 100644 --- a/windows/make-windows-installer.bat +++ b/windows/make-windows-installer.bat @@ -2,8 +2,6 @@ stack install --test
if %errorlevel% neq 0 exit /b %errorlevel%
for /f "delims=" %%a in ('stack path --local-bin-path') do @set BINPATH=%%a
-strip %BINPATH%\pandoc.exe
-strip %BINPATH%\pandoc-citeproc.exe
%BINPATH%\pandoc.exe -s -S ..\README -o README.html
if %errorlevel% neq 0 exit /b %errorlevel%
%BINPATH%\pandoc.exe -s ..\COPYING -t rtf -S -o COPYING.rtf
diff --git a/windows/stack.yaml b/windows/stack.yaml index a01dbfc03..312b39e3b 100644 --- a/windows/stack.yaml +++ b/windows/stack.yaml @@ -15,5 +15,7 @@ packages: - '..' - '../../pandoc-citeproc' extra-deps: -- 'hsb2hs-0.3.1' -resolver: lts-5.2 +- 'aeson-0.11.1.1' +- 'texmath-0.8.5' +- 'highlighting-kate-0.6.2' +resolver: lts-5.8 |