pandoc 1.19 → 1.19.1
raw patch · 25 files changed
+472/−345 lines, 25 filesdep ~aesondep ~directorydep ~vectorbinary-addedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, directory, vector
API changes (from Hackage documentation)
+ Text.Pandoc.Pretty: afterBreak :: String -> Doc
Files
- MANUAL.txt +48/−32
- changelog +237/−173
- data/MathMLinHTML.js +0/−70
- data/bash_completion.tpl +21/−5
- data/templates/default.latex +1/−1
- man/pandoc.1 +42/−29
- pandoc.cabal +1/−2
- pandoc.hs +7/−7
- src/Text/Pandoc/Pretty.hs +15/−0
- src/Text/Pandoc/Readers/Docx.hs +2/−1
- src/Text/Pandoc/Readers/HTML.hs +8/−4
- src/Text/Pandoc/Readers/RST.hs +34/−6
- src/Text/Pandoc/Writers/LaTeX.hs +1/−1
- src/Text/Pandoc/Writers/Man.hs +2/−4
- src/Text/Pandoc/Writers/Markdown.hs +1/−1
- tests/Tests/Old.hs +12/−3
- tests/Tests/Readers/Docx.hs +4/−0
- tests/Tests/Writers/LaTeX.hs +22/−0
- tests/docx/table_one_row.docx binary
- tests/docx/table_one_row.native +5/−0
- tests/rst-reader.native +1/−0
- tests/rst-reader.rst +2/−0
- tests/writer.markdown +2/−2
- tests/writer.opml +2/−2
- tests/writer.plain +2/−2
MANUAL.txt view
@@ -1,6 +1,6 @@ % Pandoc User's Guide % John MacFarlane-% November 30, 2016+% December 10, 2016 Synopsis ========@@ -284,11 +284,11 @@ (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+ 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`@@ -609,7 +609,7 @@ : Include contents of *FILE*, verbatim, at the end of the header. This can be used, for example, to include special- CSS or javascript in HTML documents. This option can be used+ CSS or JavaScript in HTML documents. This option can be used repeatedly to include multiple files in the header. They will be included in the order specified. Implies `--standalone`. @@ -657,7 +657,7 @@ `--ascii` -: Use only ascii characters in output. Currently supported only+: Use only ASCII characters in output. Currently supported only for HTML output (which uses numerical entities instead of UTF-8 when this option is selected). @@ -677,7 +677,7 @@ `--atx-headers` -: Use ATX-style headers in Markdown and asciidoc output. The default is+: Use ATX-style headers in Markdown and AsciiDoc output. The default is to use setext-style headers for levels 1-2, and then ATX headers. `--chapters`@@ -761,7 +761,7 @@ : Specify a method for obfuscating `mailto:` links in HTML documents. `none` leaves `mailto:` links as they are. `javascript` obfuscates- them using javascript. `references` obfuscates them by printing their+ them using JavaScript. `references` obfuscates them by printing their letters as decimal or hexadecimal character references. The default is `none`. @@ -795,6 +795,13 @@ `--data-dir`). If this is not found either, sensible defaults will be used. + To produce a custom `reference.odt`, first get a copy of+ the default `reference.odt`: `pandoc+ --print-default-data-file reference.odt >+ custom-reference.odt`. Then open `custom-reference.docx` in+ LibreOffice, modify the styles as you wish, and save the+ file.+ `--reference-docx=`*FILE* : Use the specified file as a style reference in producing a docx file.@@ -805,15 +812,24 @@ reference docx is specified on the command line, pandoc will look for a file `reference.docx` in the user data directory (see `--data-dir`). If this is not found either, sensible defaults will be- used. The following styles are used by pandoc: [paragraph]- Normal, Body Text, First Paragraph, Compact, Title, Subtitle, Author, Date,- Abstract, Bibliography, Heading 1, Heading 2, Heading 3, Heading 4,- Heading 5, Heading 6, Block Text, Footnote Text, Definition Term,- Definition, Caption, Table Caption, Image Caption, Figure,- Figure With Caption, TOC Heading;- [character] Default Paragraph Font, Body Text Char, Verbatim Char,- Footnote Reference, Hyperlink; [table] Normal Table.+ used. + To produce a custom `reference.docx`, first get a copy of+ the default `reference.docx`: `pandoc+ --print-default-data-file reference.docx >+ custom-reference.docx`. Then open `custom-reference.docx`+ in Word, modify the styles as you wish, and save the file.+ For best results, do not make changes to this file other+ than modifying the styles used by pandoc: [paragraph] Normal,+ Body Text, First Paragraph, Compact, Title, Subtitle,+ Author, Date, Abstract, Bibliography, Heading 1, Heading 2,+ Heading 3, Heading 4, Heading 5, Heading 6, Block Text,+ Footnote Text, Definition Term, Definition, Caption, Table+ Caption, Image Caption, Figure, Figure With Caption, TOC+ Heading; [character] Default Paragraph Font, Body Text Char,+ Verbatim Char, Footnote Reference, Hyperlink; [table] Normal+ Table.+ `--epub-stylesheet=`*FILE* : Use the specified CSS file to style the EPUB. If no stylesheet@@ -966,7 +982,7 @@ `--mathml`[`=`*URL*] : Convert TeX math to [MathML] (in `docbook`, `docbook5`, `html` and `html5`).- In standalone `html` output, a small javascript (or a link to such a+ 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. @@ -1665,7 +1681,7 @@ be wrapped in a `div` (or a `section`, if `--html5` was specified), and the identifier will be attached to the enclosing `<div>` (or `<section>`) tag rather than the header itself. This allows entire-sections to be manipulated using javascript or treated differently in+sections to be manipulated using JavaScript or treated differently in CSS. #### Extension: `implicit_header_references` ####@@ -1851,7 +1867,7 @@ ``` If the `fenced_code_attributes` extension is disabled, but-input contains class attribute(s) for the codeblock, the first+input contains class attribute(s) for the code block, the first class attribute will be printed after the opening fence as a bare word. @@ -2009,7 +2025,7 @@ Unlike standard Markdown, pandoc allows ordered list items to be marked with uppercase and lowercase letters and roman numerals, in addition to-arabic numerals. List markers may be enclosed in parentheses or followed by a+Arabic numerals. List markers may be enclosed in parentheses or followed by a single right-parentheses or period. They must be separated from the text that follows by at least one space, and, if the list marker is a capital letter with a period, by at least two spaces.[^2]@@ -2774,13 +2790,13 @@ ~ It will be rendered inside `<span class="math">` tags. RTF, OpenDocument, ODT- ~ It will be rendered, if possible, using unicode characters,+ ~ It will be rendered, if possible, using Unicode characters, and will otherwise appear verbatim. DocBook ~ If the `--mathml` flag is used, it will be rendered using MathML in an `inlineequation` or `informalequation` tag. Otherwise it- will be rendered, if possible, using unicode characters.+ will be rendered, if possible, using Unicode characters. Docx ~ It will be rendered using OMML math markup.@@ -2794,7 +2810,7 @@ ~ The way math is rendered in HTML will depend on the command-line options selected: - 1. The default is to render TeX math as far as possible using unicode+ 1. The default is to render TeX math as far as possible using Unicode characters, as with RTF, DocBook, and OpenDocument output. Formulas are put inside a `span` with `class="math"`, so that they may be styled differently from the surrounding text if needed.@@ -3471,7 +3487,7 @@ #### Extension: `ascii_identifiers` #### Causes the identifiers produced by `auto_identifiers` to be pure ASCII.-Accents are stripped off of accented latin letters, and non-latin+Accents are stripped off of accented Latin letters, and non-Latin letters are omitted. #### Extension: `mmd_link_attributes` ####@@ -3563,7 +3579,7 @@ Producing slide shows with pandoc ================================= -You can use pandoc to produce an HTML + javascript slide presentation+You can use pandoc to produce an HTML + JavaScript slide presentation that can be viewed via a web browser. There are five ways to do this, using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js]. You can also produce a PDF slide show using LaTeX [`beamer`].@@ -3602,19 +3618,19 @@ - Get in bed - Count sheep -To produce an HTML/javascript slide show, simply type+To produce an HTML/JavaScript slide show, simply type pandoc -t FORMAT -s habits.txt -o habits.html where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`. For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the-`-s/--standalone` option embeds a link to javascripts and CSS files, which are+`-s/--standalone` option embeds a link to JavaScript and CSS files, which are assumed to be available at the relative path `s5/default` (for S5), `slideous` (for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at `w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`, `slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],-above.) For DZSlides, the (relatively short) javascript and css are included in+above.) For DZSlides, the (relatively short) JavaScript and CSS are included in the file by default. With all HTML slide formats, the `--self-contained` option can be used to@@ -3934,7 +3950,7 @@ The default color scheme is `pygments`, which imitates the default color scheme used by the Python library pygments (though pygments is not actually used to do the highlighting). To see a list of highlight styles,-type `pandoc --list-hightlight-styles`.+type `pandoc --list-highlight-styles`. To disable highlighting, use the `--no-highlight` option. @@ -3949,7 +3965,7 @@ purposes, especially alongside a `reference.docx` file. However, if you need to apply your own styles to blocks, or match a preexisting set of styles, pandoc allows you to define custom styles for blocks and text-using `div`s and `span`s, respecitively.+using `div`s and `span`s, respectively. If you define a `div` or `span` with the attribute `custom-style`, pandoc will apply your specified style to the contained elements. So,
changelog view
@@ -1,242 +1,307 @@+pandoc (1.19.1)++ * Set `PANDOC_VERSION` environment variable for filters (#2640).+ This allows filters to check the pandoc version that produced+ the JSON they are receiving.++ * Docx reader: Ensure one-row tables don't have header (#3285,+ Jesse Rosenthal). Tables in MS Word are set by default to have+ special first-row formatting, which pandoc uses to determine whether+ or not they have a header. This means that one-row tables will, by+ default, have only a header -- which we imagine is not what people+ want. This change ensures that a one-row table is not understood to+ be a header only. Note that this means that it is impossible to+ produce a header-only table from docx, even though it is legal+ pandoc. But we believe that in nearly all cases, it will be an+ accidental (and unwelcome) result++ * HTML reader:++ + Fixed some bad regressions in HTML table parser (#3280).+ This regression leads to the introduction of empty rows+ in some circumstances.+ + Understand `style=width:` as well as `width` in `col` (#3286).++ * RST reader:++ + Print warnings when keys, substitition, notes not found.+ Previously the parsers failed and we got raw text. Now we get a+ link with an empty URL, or empty inlines in the case of a note or+ substitution.++ + Fix hyperlink aliases (#3283).++ * Man writer: Ensure that periods are escaped at beginning of line+ (#3270).++ * LaTeX writer: Fix unnumbered headers when used with `--top-level`+ (#3272, Albert Krewinkel). Fix interaction of top-level divisions+ `part` or `chapter` with unnumbered headers when emitting LaTeX. Headers+ are ensured to be written using stared commands (like `\subsection*{}`).++ * LaTeX template: use comma not semicolon to separate keywords for+ `pdfkeywords`. Thanks to Wandmalfarbe.++ * Markdown writer: Fixed incorrect word wrapping (#3277). Previously pandoc+ would sometimes wrap lines too early due to this bug.++ * Text.Pandoc.Pretty: Added `afterBreak` [API change]. This makes it+ possible to insert escape codes for content that needs escaping at the+ beginning of a line.++ * Removed old MathMLInHTML.js from 2004, which should no longer+ be needed for MathML with modern browsers.++ * Fixed tests with dynamic linking (#2709).++ * Makefile: Use stack instead of cabal for targets. This is just+ a convenience for developers.++ * Fixed bash completion of filenames with space (#2749).++ * MANUAL: improved documentation on how to create a custom `reference.docx`.++ * Fix minor spelling typos in the manual (#3273, Anthony Geoghegan)+ pandoc (1.19) * Changed resolution of filter paths. + We now first treat the argument of `--filter` as a full (absolute- or relative) path, looking for a program there. If it's found,- we run it.- + If not, and if it is a simple program name or a relative path,- we try resolving it relative to `$DATADIR/filters`.- + If this fails, then we treat it as a program name and look in- the user's PATH.- + Removed a hardcoded '/' that may have caused problems with Windows- paths.+ or relative) path, looking for a program there. If it's found, we+ run it.+ + If not, and if it is a simple program name or a relative path, we+ try resolving it relative to `$DATADIR/filters`.+ + If this fails, then we treat it as a program name and look in the+ user's PATH.+ + Removed a hardcoded '/' that may have caused problems with+ Windows paths. - Previously if you did `--filter foo` and you had `foo` in your- path and also an executable `foo` in your working directory,- the one in the path would be used. Now the one in the working- directory is used.+ Previously if you did `--filter foo` and you had `foo` in your path and+ also an executable `foo` in your working directory, the one in the path+ would be used. Now the one in the working directory is used. - In addition, when you do `--filter foo/bar.hs`, pandoc will now- find a filter `$DATADIR/filters/foo/bar.hs` -- assuming there- isn't a `foo/bar.hs` relative to the working directory.+ In addition, when you do `--filter foo/bar.hs`, pandoc will now find a+ filter `$DATADIR/filters/foo/bar.hs` -- assuming there isn't a+ `foo/bar.hs` relative to the working directory. - * Allow `file://` URIs as arguments (#3196). Also improved default reader- format detection. Previously with a URI ending in .md or .markdown,- pandoc would assume HTML input. Now it treats these as markdown.+ * Allow `file://` URIs as arguments (#3196). Also improved default reader+ format detection. Previously with a URI ending in .md or .markdown,+ pandoc would assume HTML input. Now it treats these as markdown. * Allow to overwrite top-level division type heuristics (#3258,- Albert Krewinkel). Pandoc uses heuristics to determine the most- reasonable top-level division type when emitting LaTeX or Docbook markup.- It is now possible to overwrite this implicitly set top-level division- via the `top-level-division` command line parameter.+ Albert Krewinkel). Pandoc uses heuristics to determine the most+ reasonable top-level division type when emitting LaTeX or+ Docbook markup. It is now possible to overwrite this implicitly set+ top-level division via the `top-level-division` command line parameter. - * Text.Pandoc.Options [API changes]:+ * Text.Pandoc.Options \[API changes\]: - + Removed `writerStandalone` field in `WriterOptions`,- made `writerTemplate` a `Maybe` value. Previously setting- `writerStandalone = True` did nothing unless a template was- provided in writerTemplate. Now a fragment will be generated- if `writerTemplate` is `Nothing`; otherwise, the specified- template will be used and standalone output generated.- + `Division` has been renamed `TopLevelDivision` (#3197).- The `Section`, `Chapter`, and `Part` constructors were- renamed to `TopLevelSection`, `TopLevelChapter`, and+ + Removed `writerStandalone` field in `WriterOptions`, made+ `writerTemplate` a `Maybe` value. Previously setting+ `writerStandalone = True` did nothing unless a template was provided+ in writerTemplate. Now a fragment will be generated if+ `writerTemplate` is `Nothing`; otherwise, the specified template+ will be used and standalone output generated.+ + `Division` has been renamed `TopLevelDivision` (#3197). The+ `Section`, `Chapter`, and `Part` constructors were renamed to+ `TopLevelSection`, `TopLevelChapter`, and `TopLevelPart`, respectively. An additional `TopLevelDefault`- constructor was added, which is now also the new default value of the- `writerTopLevelDivision` field in `WriterOptions`.+ constructor was added, which is now also the new default value of+ the `writerTopLevelDivision` field in `WriterOptions`. * Improved error if they give wrong arg to `--top-level-division`. - * Use new module from texmath to lookup MS font codepoints in Docx- reader. Removed unexported module Text.Pandoc.Readers.Docx.Fonts.- Its code now lives in texmath (0.9).+ * Use new module from texmath to lookup MS font codepoints in Docx reader.+ Removed unexported module Text.Pandoc.Readers.Docx.Fonts. Its code now+ lives in texmath (0.9). - * DocBook reader: Fixed xref lookup (#3243).- It previously only worked when the qnames lacked the docbook- namespace URI.+ * DocBook reader: Fixed xref lookup (#3243). It previously only worked+ when the qnames lacked the docbook namespace URI. * HTML reader: - + Improved table parsing (#3027). We now check explicitly for non-1+ + Improved table parsing (#3027). We now check explicitly for non-1 rowspan or colspan attributes, and fail when we encounter them. Previously we checked that each row had the same number of cells,- but that could be true even with rowspans/colspans.- And there are cases where it isn't true in tables that- we can handle fine -- e.g. when a tr element is empty.- So now we just pad rows with empty cells when needed.- + Treat `<math>` as MathML by default unless something else- is explicitly specified in xmlns. Provided it parses as MathML,- of course. Also fixed default which should be to inline math if no+ but that could be true even with rowspans/colspans. And there are+ cases where it isn't true in tables that we can handle fine -- e.g.+ when a tr element is empty. So now we just pad rows with empty cells+ when needed.+ + Treat `<math>` as MathML by default unless something else is+ explicitly specified in xmlns. Provided it parses as MathML,+ of course. Also fixed default which should be to inline math if no display attribute is used.- + Only treat "a" element as link if it has href (#3226). Otherwise+ + Only treat "a" element as link if it has href (#3226). Otherwise treat as span. * Docx reader (Jesse Rosenthal): - + Add a placeholder value for CHART. We wrap `[CHART]` in a- `<span class="chart">`. Note that it maps to inlines because, in docx,- anything in a drawing tag can be part of a larger paragraph.+ + Add a placeholder value for CHART. We wrap `[CHART]` in a+ `<span class="chart">`. Note that it maps to inlines because, in+ docx, anything in a drawing tag can be part of a larger paragraph. + Be more specific in parsing images We not only want `w:drawing`, because that could also include charts. Now we specify `w:drawing/pic:pic`. This shouldn't change behavior at all, but it's a first step toward allowing other sorts of drawing data as well. + Abstract out function to avoid code repetition. + Update tests for img title and alt (#3204).- + Handle Alt text and titles in images. We use the "description" field+ + Handle Alt text and titles in images. We use the "description" field as alt text and the "title" field as title. These can be accessed through the "Format Picture" dialog in Word.- + Docx reader utils: handle empty namespace in `elemName`.- Previously, if given an empty namespace `(elemName ns "" "foo")`- `elemName` would output a QName with a `Just ""` namespace. This is- never what we want. Now we output a `Nothing`. If someone *does* want a- `Just ""` in the namespace, they can enter the QName value explicitly.+ + Docx reader utils: handle empty namespace in `elemName`. Previously,+ if given an empty namespace `(elemName ns "" "foo")` `elemName`+ would output a QName with a `Just ""` namespace. This is never what+ we want. Now we output a `Nothing`. If someone *does* want a+ `Just ""` in the namespace, they can enter the QName+ value explicitly. * ODT reader/writer: - + Inline code when text has a special style (Hubert Plociniczak). When- a piece of text has a text `Source_Text` then we assume that this is a- piece of the document that represents a code that needs to be inlined.- Adapted the writer to also reflect that change. Previously it was just- writing a 'preformatted' text using a non-distinguishable font style.- Code blocks are still not recognized by the ODT reader. That's a- separate issue.- + Infer table's caption from the paragraph (#3224, Hubert Plociniczak).- ODT's reader always put empty captions for the parsed tables. This commit+ + Inline code when text has a special style (Hubert Plociniczak). When+ a piece of text has a text `Source_Text` then we assume that this is+ a piece of the document that represents a code that needs to+ be inlined. Adapted the writer to also reflect that change.+ Previously it was just writing a 'preformatted' text using a+ non-distinguishable font style. Code blocks are still not recognized+ by the ODT reader. That's a separate issue.+ + Infer table's caption from the paragraph (#3224,+ Hubert Plociniczak). ODT's reader always put empty captions for the+ parsed tables. This commit - 1. checks paragraphs that follow the table definition- 2. treats specially a paragraph with a style named 'Table'- 3. does some postprocessing of the paragraphs that combines- tables followed immediately by captions+ 1. checks paragraphs that follow the table definition+ 2. treats specially a paragraph with a style named 'Table'+ 3. does some postprocessing of the paragraphs that combines tables+ followed immediately by captions - The ODT writer used the `TableCaption` style for the caption- paragraph. This commit follows the OpenOffice approach which- allows for appending captions to table but uses a built-in style- named `Table` instead of `TableCaption`. Users of a custom- `reference.odt` should change the style's name from `TableCaption`- to `Table`.+ The ODT writer used the `TableCaption` style for the caption+ paragraph. This commit follows the OpenOffice approach which allows+ for appending captions to table but uses a built-in style named+ `Table` instead of `TableCaption`. Users of a custom `reference.odt`+ should change the style's name from `TableCaption` to `Table`. - * ODT reader: Infer tables' header props from rows (#3199, Hubert- Plociniczak). ODT reader simply provided an empty header list- which meant that the contents of the whole table, even if not empty,- was simply ignored. While we still do not infer headers we at least- have to provide default properties of columns.+ * ODT reader: Infer tables' header props from rows (#3199,+ Hubert Plociniczak). ODT reader simply provided an empty header list+ which meant that the contents of the whole table, even if not empty, was+ simply ignored. While we still do not infer headers we at least have to+ provide default properties of columns. * Markdown reader: - + Allow reference link labels starting with `@...` if `citations`- extension disabled (#3209). Example: in-- [link text][@a]+ + Allow reference link labels starting with `@...` if `citations`+ extension disabled (#3209). Example: in - [@a]: url+ \[link text\]\[@a\] - `link text` isn't hyperlinked because `[@a]` is parsed as a citation.- Previously this happened whether or not the `citations` extension was- enabled. Now it happens only if the `citations` extension is enabled.- + Allow alignments to be specified in Markdown grid tables. For example,+ `link text` isn't hyperlinked because `[@a]` is parsed as+ a citation. Previously this happened whether or not the `citations`+ extension was enabled. Now it happens only if the `citations`+ extension is enabled.+ + Allow alignments to be specified in Markdown grid tables. For+ example, - +---------------+---------------+--------------------+- | Right | Left | Centered |- +==============:+:==============+:==================:+- | Bananas | $1.34 | built-in wrapper |- +---------------+---------------+--------------------++ +-------+---------------+--------------------++ | Right | Left | Centered |+ +=========:+:=================+:=============:++ | Bananas | $1.34 | built-in wrapper |+ +-------+---------------+--------------------+ - + Allow Small Caps elements to be created using bracketed spans- (as they already can be using HTML-syntax spans) (#3191, Kolen Cheung).+ + Allow Small Caps elements to be created using bracketed spans (as+ they already can be using HTML-syntax spans) (#3191, Kolen Cheung). * LaTeX reader: + Don't treat `\vspace` and `\hspace` as block commands (#3256).- Fixed an error which came up, for example, with `\vspace`- inside a caption. (Captions expect inlines.)- + Improved table handling. We can now parse all of the tables emitted- by pandoc in our tests. The only thing we don't get yet are- alignments and column widths in more complex tables. See #2669.+ Fixed an error which came up, for example, with `\vspace` inside+ a caption. (Captions expect inlines.)+ + Improved table handling. We can now parse all of the tables emitted+ by pandoc in our tests. The only thing we don't get yet are+ alignments and column widths in more complex tables. See #2669. + Limited support for minipage.- + Allow for `[]`s inside LaTeX optional args. Fixes cases like:-- \begin{center}- \begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt]- \Tree [.{S} [.NP John\index{i} ] [.VP [.V likes ] [.NP himself\index{i,*j} ]]]- \end{tikzpicture}- \end{center}+ + Allow for `[]`s inside LaTeX optional args. Fixes cases like: + Handle BVerbatim from fancyvrb (#3203). + Handle hungarumlaut (#3201). + Allow beamer-style `<...>` options in raw LaTeX (also in Markdown)- (#3184). This allows use of things like `\only<2,3>{my content}` in+ (#3184). This allows use of things like `\only<2,3>{my content}` in Markdown that is going to be converted to beamer. - * Use pre-wrap for code in dzslides template (Nicolas Porcel).- Otherwise overly long code will appear on every slide.+ * Use pre-wrap for code in dzslides template (Nicolas Porcel). Otherwise+ overly long code will appear on every slide. * Org reader (Albert Krewinkel): - + Respect column width settings (#3246). Table column properties can- optionally specify a column's width with which it is displayed in- the buffer. Some exporters, notably the ODT exporter in org-mode v9.0,- use these values to calculate relative column widths. The org reader now- implements the same behavior. Note that the org-mode LaTeX and HTML- exporters in Emacs don't support this feature yet, which should be kept- in mind by users who use the column widths parameters.- + Allow HTML attribs on non-figure images (#3222). Images which are the- only element in a paragraph can still be given HTML attributes, even if- the image does not have a caption and is hence not a figure.- The following will add set the `width` attribute of the image to `50%`:+ + Respect column width settings (#3246). Table column properties can+ optionally specify a column's width with which it is displayed in+ the buffer. Some exporters, notably the ODT exporter in org-mode+ v9.0, use these values to calculate relative column widths. The org+ reader now implements the same behavior. Note that the org-mode+ LaTeX and HTML exporters in Emacs don't support this feature yet,+ which should be kept in mind by users who use the column+ widths parameters.+ + Allow HTML attribs on non-figure images (#3222). Images which are+ the only element in a paragraph can still be given HTML attributes,+ even if the image does not have a caption and is hence not a figure.+ The following will add set the `width` attribute of the image to+ `50%`: - #+ATTR_HTML: :width 50%- [[file:image.jpg]]+ +ATTR\_HTML: :width 50%+ ======================= - + Support `ATTR_HTML` for special blocks (#3182).- Special blocks (i.e. blocks with unrecognized names) can be prefixed- with an `ATTR_HTML` block attribute. The attributes defined in that- meta-directive are added to the `Div` which is used to represent the- special block.- + Support the `todo` export option. The `todo` export option allows to- toggle the inclusion of TODO keywords in the output. Setting this to- `nil` causes TODO keywords to be dropped from headlines. The default- is to include the keywords.- + Add support for todo-markers. Headlines can have optional todo-markers- which can be controlled via the `#+TODO`, `#+SEQ_TODO`, or `#+TYP_TODO`- meta directive. Multiple such directives can be given, each adding a- new set of recognized todo-markers. If no custom todo-markers are- defined, the default `TODO` and `DONE` markers are used. Todo-markers- are conceptually separate from headline text and are hence excluded- when autogenerating headline IDs. The markers are rendered as spans- and labelled with two classes: One class is the markers name, the other- signals the todo-state of the marker (either `todo` or `done`).+ \[\[file:image.jpg\]\] + + Support `ATTR_HTML` for special blocks (#3182). Special+ blocks (i.e. blocks with unrecognized names) can be prefixed with an+ `ATTR_HTML` block attribute. The attributes defined in that+ meta-directive are added to the `Div` which is used to represent the+ special block.+ + Support the `todo` export option. The `todo` export option allows to+ toggle the inclusion of TODO keywords in the output. Setting this to+ `nil` causes TODO keywords to be dropped from headlines. The default+ is to include the keywords.+ + Add support for todo-markers. Headlines can have optional+ todo-markers which can be controlled via the `#+TODO`, `#+SEQ_TODO`,+ or `#+TYP_TODO` meta directive. Multiple such directives can be+ given, each adding a new set of recognized todo-markers. If no+ custom todo-markers are defined, the default `TODO` and `DONE`+ markers are used. Todo-markers are conceptually separate from+ headline text and are hence excluded when autogenerating+ headline IDs. The markers are rendered as spans and labelled with+ two classes: One class is the markers name, the other signals the+ todo-state of the marker (either `todo` or `done`).+ * LaTeX writer: + Use `\autocites*` when "suppress-author" citation used.- + Ensure that simple tables have simple cells (#2666). If cells contain- more than a single Plain or Para, then we need to set nonzero widths- and put contents into minipages.+ + Ensure that simple tables have simple cells (#2666). If cells+ contain more than a single Plain or Para, then we need to set+ nonzero widths and put contents into minipages. + Remove invalid inlines in sections (#3218, Hubert Plociniczak). * Markdown writer: + Fix calculation of column widths for aligned multiline tables- (#1911, Björn Peemöller). This also fixes excessive CPU and memory+ (#1911, Björn Peemöller). This also fixes excessive CPU and memory usage for tables when `--columns` is set in such a way that cells- must be very tiny. Now cells are guaranteed to be big enough so that- single words don't need to line break, even if this pushes the- line length above the column width.+ must be very tiny. Now cells are guaranteed to be big enough so that+ single words don't need to line break, even if this pushes the line+ length above the column width. + Use bracketed form for native spans when `bracketed_spans` enabled (#3229).- + Fixed inconsistent spacing issue (#3232). Previously a tight bullet+ + Fixed inconsistent spacing issue (#3232). Previously a tight bullet sublist got rendered with a blank line after, while a tight ordered- sublist did not. Now we don't get the blank line in either case.- + Fix escaping of spaces in super/subscript (#3225). Previously two+ sublist did not. Now we don't get the blank line in either case.+ + Fix escaping of spaces in super/subscript (#3225). Previously two backslashes were inserted, which gave a literal backslash.- + Adjust widths in Markdown grid tables so that they match on round-trip.+ + Adjust widths in Markdown grid tables so that they match+ on round-trip. * Docx writer: + Give full detail when there are errors converting tex math.- + Handle title text in images (Jesse Rosenthal). We already handled alt- text. This just puts the image "title" into the docx "title" attr.- + Fixed XML markup for empty cells (#3238). Previously the Compact+ + Handle title text in images (Jesse Rosenthal). We already handled+ alt text. This just puts the image "title" into the docx+ "title" attr.+ + Fixed XML markup for empty cells (#3238). Previously the Compact style wasn't being applied properly to empty cells. * HTML writer:@@ -245,34 +310,33 @@ * Text.Pandoc.Pretty: - + Fixed some bugs that caused blank lines in tables (#3251).- The bugs caused spurious blank lines in grid tables when we- had things like ``blankline $$ blankline``.- + Add exported function `minOffet` [API change] (Björn Peemöller).+ + Fixed some bugs that caused blank lines in tables (#3251). The bugs+ caused spurious blank lines in grid tables when we had things like+ `blankline $$ blankline`.+ + Add exported function `minOffet` \[API change\] (Björn Peemöller). + Added error message for illegal call to `block` (Björn Peemöller). * Text.Pandoc.Shared: + Put `warn` in MonadIO.- + `fetchItem`: Better handling of protocol-relative URL (#2635).- If URL starts with `//` and there is no "base URL" (as there- would be if a URL were used on the command line), then default- to http:.+ + `fetchItem`: Better handling of protocol-relative URL (#2635). If+ URL starts with `//` and there is no "base URL" (as there would be+ if a URL were used on the command line), then default to http:. - * Export Text.Pandoc.getDefaultExtensions [API change] (#3178).+ * Export Text.Pandoc.getDefaultExtensions \[API change\] (#3178). - * In --version, trap error in `getAppUserDataDirectory` (#3241).- This fixes a crash with `pandoc --version` on unusual systems with- no real user (e.g. SQL Server 2016).+ * In --version, trap error in `getAppUserDataDirectory` (#3241). This+ fixes a crash with `pandoc --version` on unusual systems with no real+ user (e.g. SQL Server 2016). * Added weigh-pandoc for memory usage diagnostics (#3169). * Use correct mime types for woff and woff2 (#3228). - * Remove make_travis_yml.hs (#3235, Kolen Cheung).+ * Remove make\_travis\_yml.hs (#3235, Kolen Cheung). - * changelog: Moved an item that was misplaced in the 1.17.2 section to- the 1.18 section where it belongs.+ * changelog: Moved an item that was misplaced in the 1.17.2 section to the+ 1.18 section where it belongs. * CONTRIBUTING.md: minor change in wording and punctuation (#3252, Kolen Cheung).
− data/MathMLinHTML.js
@@ -1,70 +0,0 @@-/*-March 19, 2004 MathHTML (c) Peter Jipsen http://www.chapman.edu/~jipsen-Released under the GNU General Public License version 2 or later.-See the GNU General Public License (at http://www.gnu.org/copyleft/gpl.html)-for more details.-*/--function convertMath(node) {// for Gecko- if (node.nodeType==1) {- var newnode =- document.createElementNS("http://www.w3.org/1998/Math/MathML",- node.nodeName.toLowerCase());- for(var i=0; i < node.attributes.length; i++)- newnode.setAttribute(node.attributes[i].nodeName,- node.attributes[i].value);- for (var i=0; i<node.childNodes.length; i++) {- var st = node.childNodes[i].nodeValue;- if (st==null || st.slice(0,1)!=" " && st.slice(0,1)!="\n")- newnode.appendChild(convertMath(node.childNodes[i]));- }- return newnode;- }- else return node;-}--function convert() {- var mmlnode = document.getElementsByTagName("math");- var st,str,node,newnode;- for (var i=0; i<mmlnode.length; i++)- if (document.createElementNS!=null)- mmlnode[i].parentNode.replaceChild(convertMath(mmlnode[i]),mmlnode[i]);- else { // convert for IE- str = "";- node = mmlnode[i];- while (node.nodeName!="/MATH") {- st = node.nodeName.toLowerCase();- if (st=="#text") str += node.nodeValue;- else {- str += (st.slice(0,1)=="/" ? "</m:"+st.slice(1) : "<m:"+st);- if (st.slice(0,1)!="/")- for(var j=0; j < node.attributes.length; j++)- if (node.attributes[j].value!="italic" &&- node.attributes[j].value!="" &&- node.attributes[j].value!="inherit" &&- node.attributes[j].value!=undefined)- str += " "+node.attributes[j].nodeName+"="+- "\""+node.attributes[j].value+"\"";- str += ">";- }- node = node.nextSibling;- node.parentNode.removeChild(node.previousSibling);- }- str += "</m:math>";- newnode = document.createElement("span");- node.parentNode.replaceChild(newnode,node);- newnode.innerHTML = str;- }-}--if (document.createElementNS==null) {- document.write("<object id=\"mathplayer\"\- classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");- document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");-}-if(typeof window.addEventListener != 'undefined'){- window.addEventListener('load', convert, false);-}-if(typeof window.attachEvent != 'undefined') {- window.attachEvent('onload', convert);-}
data/bash_completion.tpl view
@@ -1,5 +1,3 @@-#!/bin/bash- # This script enables bash autocompletion for pandoc. To enable # bash completion, add this to your .bashrc: # eval "$(pandoc --bash-completion)"@@ -15,6 +13,7 @@ opts="%s" informats="%s" outformats="%s"+ highlight_styles="%s" datadir="%s" case "${prev}" in@@ -38,8 +37,24 @@ COMPREPLY=( $(compgen -W "reference.odt reference.docx $(find ${datadir} | sed -e 's/.*\/data\///')" -- ${cur}) ) return 0 ;;+ --wrap)+ COMPREPLY=( $(compgen -W "auto none preserve" -- ${cur}) )+ return 0+ ;;+ --track-changes)+ COMPREPLY=( $(compgen -W "accept reject all" -- ${cur}) )+ return 0+ ;;+ --reference-location)+ COMPREPLY=( $(compgen -W "block section document" -- ${cur}) )+ return 0+ ;;+ --top-level-division)+ COMPREPLY=( $(compgen -W "section chapter part" -- ${cur}) )+ return 0+ ;; --highlight-style)- COMPREPLY=( $(compgen -W "pygments tango espresso zenburn kate monochrome haddock" -- ${cur}) )+ COMPREPLY=( $(compgen -W "${highlight_styles}" -- ${cur}) ) return 0 ;; *)@@ -52,11 +67,12 @@ return 0 ;; *)- COMPREPLY=( $(compgen -f ${cur}) )+ local IFS=$'\n'+ COMPREPLY=( $(compgen -X '' -f "${cur}") ) return 0 ;; esac } -complete -F _pandoc pandoc+complete -o filenames -o bashdefault -F _pandoc pandoc
data/templates/default.latex view
@@ -72,7 +72,7 @@ pdfauthor={$author-meta$}, $endif$ $if(keywords)$- pdfkeywords={$for(keywords)$$keywords$$sep$; $endfor$},+ pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, $endif$ $if(colorlinks)$ colorlinks=true,
man/pandoc.1 view
@@ -1,5 +1,5 @@ .\"t-.TH PANDOC 1 "November 30, 2016" "pandoc 1.19"+.TH PANDOC 1 "December 10, 2016" "pandoc 1.19.1" .SH NAME pandoc - general markup converter .SH SYNOPSIS@@ -257,11 +257,11 @@ (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]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+\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@@ -669,7 +669,7 @@ .TP .B \f[C]\-H\f[] \f[I]FILE\f[], \f[C]\-\-include\-in\-header=\f[]\f[I]FILE\f[] Include contents of \f[I]FILE\f[], verbatim, at the end of the header.-This can be used, for example, to include special CSS or javascript in+This can be used, for example, to include special CSS or JavaScript in HTML documents. This option can be used repeatedly to include multiple files in the header.@@ -731,7 +731,7 @@ .RE .TP .B \f[C]\-\-ascii\f[]-Use only ascii characters in output.+Use only ASCII characters in output. Currently supported only for HTML output (which uses numerical entities instead of UTF\-8 when this option is selected). .RS@@ -756,7 +756,7 @@ .RE .TP .B \f[C]\-\-atx\-headers\f[]-Use ATX\-style headers in Markdown and asciidoc output.+Use ATX\-style headers in Markdown and AsciiDoc output. The default is to use setext\-style headers for levels 1\-2, and then ATX headers. .RS@@ -792,7 +792,7 @@ .RS .RE .TP-.B \f[C]\-\-number\-offset=\f[]\f[I]NUMBER\f[][\f[C],\f[]\f[I]NUMBER\f[]\f[C],\f[]\f[I]\&...\f[]]+.B \f[C]\-\-number\-offset=\f[]\f[I]NUMBER\f[][\f[C],\f[]\f[I]NUMBER\f[]\f[C],\f[]\f[I]...\f[]] Offset for section headings in HTML output (ignored in other output formats). The first number is added to the section number for top\-level headers,@@ -860,7 +860,7 @@ Specify a method for obfuscating \f[C]mailto:\f[] links in HTML documents. \f[C]none\f[] leaves \f[C]mailto:\f[] links as they are.-\f[C]javascript\f[] obfuscates them using javascript.+\f[C]javascript\f[] obfuscates them using JavaScript. \f[C]references\f[] obfuscates them by printing their letters as decimal or hexadecimal character references. The default is \f[C]none\f[].@@ -901,6 +901,12 @@ \f[C]\-\-data\-dir\f[]). If this is not found either, sensible defaults will be used. .RS+.PP+To produce a custom \f[C]reference.odt\f[], first get a copy of the+default \f[C]reference.odt\f[]:+\f[C]pandoc\ \-\-print\-default\-data\-file\ reference.odt\ >\ custom\-reference.odt\f[].+Then open \f[C]custom\-reference.docx\f[] in LibreOffice, modify the+styles as you wish, and save the file. .RE .TP .B \f[C]\-\-reference\-docx=\f[]\f[I]FILE\f[]@@ -914,14 +920,21 @@ for a file \f[C]reference.docx\f[] in the user data directory (see \f[C]\-\-data\-dir\f[]). If this is not found either, sensible defaults will be used.-The following styles are used by pandoc: [paragraph] Normal, Body Text,-First Paragraph, Compact, Title, Subtitle, Author, Date, Abstract,+.RS+.PP+To produce a custom \f[C]reference.docx\f[], first get a copy of the+default \f[C]reference.docx\f[]:+\f[C]pandoc\ \-\-print\-default\-data\-file\ reference.docx\ >\ custom\-reference.docx\f[].+Then open \f[C]custom\-reference.docx\f[] in Word, modify the styles as+you wish, and save the file.+For best results, do not make changes to this file other than modifying+the styles used by pandoc: [paragraph] Normal, Body Text, First+Paragraph, Compact, Title, Subtitle, Author, Date, Abstract, Bibliography, Heading 1, Heading 2, Heading 3, Heading 4, Heading 5, Heading 6, Block Text, Footnote Text, Definition Term, Definition, Caption, Table Caption, Image Caption, Figure, Figure With Caption, TOC Heading; [character] Default Paragraph Font, Body Text Char, Verbatim Char, Footnote Reference, Hyperlink; [table] Normal Table.-.RS .RE .TP .B \f[C]\-\-epub\-stylesheet=\f[]\f[I]FILE\f[]@@ -1106,7 +1119,7 @@ .B \f[C]\-\-mathml\f[][\f[C]=\f[]\f[I]URL\f[]] Convert TeX math to MathML (in \f[C]docbook\f[], \f[C]docbook5\f[], \f[C]html\f[] and \f[C]html5\f[]).-In standalone \f[C]html\f[] output, a small javascript (or a link to+In standalone \f[C]html\f[] output, a small JavaScript (or a link to such a script if a \f[I]URL\f[] is supplied) will be inserted that allows the MathML to be viewed on some browsers. .RS@@ -2051,7 +2064,7 @@ \f[C]\-\-html5\f[] was specified), and the identifier will be attached to the enclosing \f[C]<div>\f[] (or \f[C]<section>\f[]) tag rather than the header itself.-This allows entire sections to be manipulated using javascript or+This allows entire sections to be manipulated using JavaScript or treated differently in CSS. .SS Extension: \f[C]implicit_header_references\f[] .PP@@ -2308,8 +2321,8 @@ .fi .PP If the \f[C]fenced_code_attributes\f[] extension is disabled, but input-contains class attribute(s) for the codeblock, the first class attribute-will be printed after the opening fence as a bare word.+contains class attribute(s) for the code block, the first class+attribute will be printed after the opening fence as a bare word. .PP To prevent all highlighting, use the \f[C]\-\-no\-highlight\f[] flag. To set the highlighting style, use \f[C]\-\-highlight\-style\f[].@@ -2503,7 +2516,7 @@ .PP Unlike standard Markdown, pandoc allows ordered list items to be marked with uppercase and lowercase letters and roman numerals, in addition to-arabic numerals.+Arabic numerals. List markers may be enclosed in parentheses or followed by a single right\-parentheses or period. They must be separated from the text that follows by at least one space,@@ -3466,7 +3479,7 @@ .RE .TP .B RTF, OpenDocument, ODT-It will be rendered, if possible, using unicode characters, and will+It will be rendered, if possible, using Unicode characters, and will otherwise appear verbatim. .RS .RE@@ -3474,7 +3487,7 @@ .B DocBook If the \f[C]\-\-mathml\f[] flag is used, it will be rendered using MathML in an \f[C]inlineequation\f[] or \f[C]informalequation\f[] tag.-Otherwise it will be rendered, if possible, using unicode characters.+Otherwise it will be rendered, if possible, using Unicode characters. .RS .RE .TP@@ -3496,7 +3509,7 @@ options selected: .RS .IP "1." 3-The default is to render TeX math as far as possible using unicode+The default is to render TeX math as far as possible using Unicode characters, as with RTF, DocBook, and OpenDocument output. Formulas are put inside a \f[C]span\f[] with \f[C]class="math"\f[], so that they may be styled differently from the surrounding text if needed.@@ -4367,7 +4380,7 @@ .PP Causes the identifiers produced by \f[C]auto_identifiers\f[] to be pure ASCII.-Accents are stripped off of accented latin letters, and non\-latin+Accents are stripped off of accented Latin letters, and non\-Latin letters are omitted. .SS Extension: \f[C]mmd_link_attributes\f[] .PP@@ -4456,7 +4469,7 @@ example.) .SH PRODUCING SLIDE SHOWS WITH PANDOC .PP-You can use pandoc to produce an HTML + javascript slide presentation+You can use pandoc to produce an HTML + JavaScript slide presentation that can be viewed via a web browser. There are five ways to do this, using S5, DZSlides, Slidy, Slideous, or reveal.js.@@ -4501,7 +4514,7 @@ \f[] .fi .PP-To produce an HTML/javascript slide show, simply type+To produce an HTML/JavaScript slide show, simply type .IP .nf \f[C]@@ -4513,7 +4526,7 @@ \f[C]slideous\f[], \f[C]dzslides\f[], or \f[C]revealjs\f[]. .PP For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with-the \f[C]\-s/\-\-standalone\f[] option embeds a link to javascripts and+the \f[C]\-s/\-\-standalone\f[] option embeds a link to JavaScript and CSS files, which are assumed to be available at the relative path \f[C]s5/default\f[] (for S5), \f[C]slideous\f[] (for Slideous), \f[C]reveal.js\f[] (for reveal.js), or at the Slidy website at@@ -4521,7 +4534,7 @@ (These paths can be changed by setting the \f[C]slidy\-url\f[], \f[C]slideous\-url\f[], \f[C]revealjs\-url\f[], or \f[C]s5\-url\f[] variables; see Variables for slides, above.) For DZSlides, the-(relatively short) javascript and css are included in the file by+(relatively short) JavaScript and CSS are included in the file by default. .PP With all HTML slide formats, the \f[C]\-\-self\-contained\f[] option can@@ -4925,7 +4938,7 @@ default color scheme used by the Python library pygments (though pygments is not actually used to do the highlighting). To see a list of highlight styles, type-\f[C]pandoc\ \-\-list\-hightlight\-styles\f[].+\f[C]pandoc\ \-\-list\-highlight\-styles\f[]. .PP To disable highlighting, use the \f[C]\-\-no\-highlight\f[] option. .SH CUSTOM STYLES IN DOCX OUTPUT@@ -4937,7 +4950,7 @@ \f[C]reference.docx\f[] file. However, if you need to apply your own styles to blocks, or match a preexisting set of styles, pandoc allows you to define custom styles for-blocks and text using \f[C]div\f[]s and \f[C]span\f[]s, respecitively.+blocks and text using \f[C]div\f[]s and \f[C]span\f[]s, respectively. .PP If you define a \f[C]div\f[] or \f[C]span\f[] with the attribute \f[C]custom\-style\f[], pandoc will apply your specified style to the
pandoc.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-Version: 1.19+Version: 1.19.1 Cabal-Version: >= 1.10 Build-Type: Custom License: GPL@@ -97,7 +97,6 @@ data/epub.css -- data for LaTeXMathML writer data/LaTeXMathML.js- data/MathMLinHTML.js -- data for dzslides writer data/dzslides/template.html -- sample lua custom writer
pandoc.hs view
@@ -44,7 +44,7 @@ import Text.Pandoc.Process (pipeProcess) import Text.Highlighting.Kate ( languages, Style, tango, pygments, espresso, zenburn, kate, haddock, monochrome )-import System.Environment ( getArgs, getProgName )+import System.Environment ( getArgs, getProgName, getEnvironment ) import System.Exit ( ExitCode (..), exitSuccess ) import System.FilePath import System.Console.GetOpt@@ -135,8 +135,10 @@ when (isNothing mbExe) $ err 83 $ "Error running filter " ++ f ++ ":\n" ++ "Could not find executable '" ++ f' ++ "'."+ env <- getEnvironment+ let env' = Just $ ("PANDOC_VERSION", pandocVersion) : env (exitcode, outbs, errbs) <- E.handle filterException $- pipeProcess Nothing f' args'' $ encode d+ pipeProcess env' f' args'' $ encode d unless (B.null errbs) $ B.hPutStr stderr errbs case exitcode of ExitSuccess -> return $ either error id $ eitherDecode' outbs@@ -478,7 +480,7 @@ case safeRead ("Wrap" ++ uppercaseFirstLetter arg) of Just o -> return opt { optWrapText = o } Nothing -> err 77 "--wrap must be auto, none, or preserve")- "[auto|none|preserve]")+ "auto|none|preserve") "" -- "Option for wrapping text in output" , Option "" ["columns"]@@ -609,7 +611,7 @@ Just tlDiv -> return opt { optTopLevelDivision = tlDiv } _ -> err 76 ("Top-level division must be " ++ "section, chapter, part, or default"))- "[section|chapter|part]")+ "section|chapter|part") "" -- "Use top-level division type in LaTeX, ConTeXt, DocBook" , Option "N" ["number-sections"]@@ -912,6 +914,7 @@ UTF8.hPutStrLn stdout $ printf tpl allopts (unwords (map fst readers)) (unwords (map fst writers))+ (unwords $ map fst highlightingStyles) ddir exitSuccess )) "" -- "Print bash completion script"@@ -1315,9 +1318,6 @@ variables' <- case mathMethod of LaTeXMathML Nothing -> do s <- readDataFileUTF8 datadir "LaTeXMathML.js"- return $ ("mathml-script", s) : variables- MathML Nothing -> do- s <- readDataFileUTF8 datadir "MathMLinHTML.js" return $ ("mathml-script", s) : variables _ -> return variables
src/Text/Pandoc/Pretty.hs view
@@ -45,6 +45,7 @@ , hang , beforeNonBlank , nowrap+ , afterBreak , offset , minOffset , height@@ -101,6 +102,7 @@ | BeforeNonBlank Doc | Flush Doc | BreakingSpace+ | AfterBreak String | CarriageReturn | NewLine | BlankLines Int -- number of blank lines@@ -306,6 +308,7 @@ renderList (BreakingSpace : xs) = do let isText (Text _ _) = True isText (Block _ _) = True+ isText (AfterBreak _) = True isText _ = False let isBreakingSpace BreakingSpace = True isBreakingSpace _ = False@@ -321,6 +324,13 @@ outp 1 " " renderList xs' +renderList (AfterBreak s : xs) = do+ st <- get+ if newlines st > 0+ then outp (realLength s) s+ else return ()+ renderList xs+ renderList (Block i1 s1 : Block i2 s2 : xs) = renderList (mergeBlocks False (IsBlock i1 s1) (IsBlock i2 s2) : xs) @@ -421,6 +431,11 @@ nowrap doc = Doc $ mapWithIndex replaceSpace $ unDoc doc where replaceSpace _ BreakingSpace = Text 1 " " replaceSpace _ x = x++-- | Content to print only if it comes at the beginning of a line,+-- to be used e.g. for escaping line-initial `.` in groff man.+afterBreak :: String -> Doc+afterBreak s = Doc $ singleton (AfterBreak s) -- | Returns the width of a 'Doc'. offset :: Doc -> Int
src/Text/Pandoc/Readers/Docx.hs view
@@ -568,7 +568,8 @@ bodyPartToBlocks (Tbl cap _ look (r:rs)) = do let caption = text cap (hdr, rows) = case firstRowFormatting look of- True -> (Just r, rs)+ True | null rs -> (Nothing, [r])+ | otherwise -> (Just r, rs) False -> (Nothing, r:rs) hdrCells <- case hdr of Just r' -> rowToBlocksList r'
src/Text/Pandoc/Readers/HTML.hs view
@@ -422,7 +422,6 @@ TagOpen _ _ <- pSatisfy (~== TagOpen "table" []) skipMany pBlank caption <- option mempty $ pInTags "caption" inline <* skipMany pBlank- -- TODO actually read these and take width information from them widths' <- (mconcat <$> many1 pColgroup) <|> many pCol let pTh = option [] $ pInTags "tr" (pCell "th") pTr = try $ skipMany pBlank >> pInTags "tr" (pCell "td" <|> pCell "th")@@ -445,10 +444,10 @@ let isSimple = all isSinglePlain $ concat (head':rows'') let cols = length $ if null head' then head rows'' else head' -- add empty cells to short rows- let addEmpties r = case length r - cols of- n | n > 1 -> r ++ replicate n []+ let addEmpties r = case cols - length r of+ n | n > 0 -> r ++ replicate n mempty | otherwise -> r- let rows = addEmpties rows''+ let rows = map addEmpties rows'' let aligns = replicate cols AlignDefault let widths = if null widths' then if isSimple@@ -464,6 +463,11 @@ optional $ pSatisfy (~== TagClose "col") skipMany pBlank return $ case lookup "width" attribs of+ Nothing -> case lookup "style" attribs of+ Just ('w':'i':'d':'t':'h':':':xs) | '%' `elem` xs ->+ fromMaybe 0.0 $ safeRead ('0':'.':filter+ (`notElem` " \t\r\n%'\";") xs)+ _ -> 0.0 Just x | not (null x) && last x == '%' -> fromMaybe 0.0 $ safeRead ('0':'.':init x) _ -> 0.0
src/Text/Pandoc/Readers/RST.hs view
@@ -1120,14 +1120,28 @@ notFollowedBy (char '`') -- `` marks start of inline code label' <- trimInlines . mconcat <$> manyTill (notFollowedBy (char '`') >> inline) (char '<')- src <- manyTill (noneOf ">\n") (char '>')+ src <- trim <$> manyTill (noneOf ">\n") (char '>') skipSpaces string "`_" optional $ char '_' -- anonymous form let label'' = if label' == mempty then B.str src else label'- return $ B.link (escapeURI $ trim src) "" label''+ -- `link <google_>` is a reference link to _google!+ (src',tit,attr) <- case reverse src of+ '_':xs -> do+ keyTable <- stateKeys <$> getState+ let key = toKey $ reverse xs+ case M.lookup key keyTable of+ Nothing -> do+ pos <- getPosition+ addWarning (Just pos) $+ "Could not find reference for " +++ show key+ return ("","",nullAttr)+ Just ((s,t),a) -> return (s,t,a)+ _ -> return (src, "", nullAttr)+ return $ B.linkWith attr (escapeURI src') tit label'' referenceLink :: RSTParser Inlines referenceLink = try $ do@@ -1144,7 +1158,12 @@ then mzero else return (head anonKeys) ((src,tit), attr) <- case M.lookup key keyTable of- Nothing -> fail "no corresponding key"+ Nothing -> do+ pos <- getPosition+ addWarning (Just pos) $+ "Could not find reference for " +++ show key+ return (("",""),nullAttr) Just val -> return val -- if anonymous link, remove key so it won't be used again when (isAnonKey key) $ updateState $ \s -> s{ stateKeys = M.delete key keyTable }@@ -1168,8 +1187,13 @@ (_,ref) <- withRaw $ enclosed (char '|') (char '|') inline state <- getState let substTable = stateSubstitutions state- case M.lookup (toKey $ stripFirstAndLast ref) substTable of- Nothing -> fail "no corresponding key"+ let key = toKey $ stripFirstAndLast ref+ case M.lookup key substTable of+ Nothing -> do+ pos <- getPosition+ addWarning (Just pos) $+ "Could not find reference for " ++ show key+ return mempty Just target -> return target note :: RSTParser Inlines@@ -1180,7 +1204,11 @@ state <- getState let notes = stateNotes state case lookup ref notes of- Nothing -> fail "note not found"+ Nothing -> do+ pos <- getPosition+ addWarning (Just pos) $+ "Could not find note for " ++ show ref+ return mempty Just raw -> do -- We temporarily empty the note list while parsing the note, -- so that we don't get infinite loops with notes inside notes...
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -791,7 +791,7 @@ -- see http://tex.stackexchange.com/questions/169830/ else empty lab <- labelFor ident- let star = if unnumbered && level < 4 then text "*" else empty+ let star = if unnumbered && level' < 4 then text "*" else empty let stuffing = star <> optional <> contents stuffing' <- hypertarget ident $ text ('\\':sectionType) <> stuffing <> lab return $ if level' > 5
src/Text/Pandoc/Writers/Man.hs view
@@ -300,10 +300,6 @@ -- | Convert list of Pandoc inline elements to man. inlineListToMan :: WriterOptions -> [Inline] -> State WriterState Doc--- if list starts with ., insert a zero-width character \& so it--- won't be interpreted as markup if it falls at the beginning of a line.-inlineListToMan opts lst@(Str ('.':_) : _) = mapM (inlineToMan opts) lst >>=- (return . (text "\\&" <>) . hcat) inlineListToMan opts lst = mapM (inlineToMan opts) lst >>= (return . hcat) -- | Convert Pandoc inline element to man.@@ -335,6 +331,8 @@ inlineListToMan opts lst inlineToMan _ (Code _ str) = return $ text $ "\\f[C]" ++ escapeCode str ++ "\\f[]"+inlineToMan _ (Str str@('.':_)) =+ return $ afterBreak "\\&" <> text (escapeString str) inlineToMan _ (Str str) = return $ text $ escapeString str inlineToMan opts (Math InlineMath str) = inlineListToMan opts $ texMathToInlines InlineMath str
src/Text/Pandoc/Writers/Markdown.hs view
@@ -858,7 +858,7 @@ isOrderedListMarker :: String -> Bool isOrderedListMarker xs = (last xs `elem` ['.',')']) &&- isRight (runParserT (anyOrderedListMarker >> eof)+ isRight (runParser (anyOrderedListMarker >> eof) defaultParserState "" xs) isRight :: Either a b -> Bool
tests/Tests/Old.hs view
@@ -6,7 +6,8 @@ import System.Environment.Executable (getExecutablePath) import System.IO ( openTempFile, stderr ) import System.Process ( runProcess, waitForProcess )-import System.FilePath ( (</>), (<.>), takeDirectory, splitDirectories, joinPath )+import System.FilePath ( (</>), (<.>), takeDirectory, splitDirectories,+ joinPath ) import System.Directory import System.Exit import Data.Algorithm.Diff@@ -260,9 +261,17 @@ let normPath = norm let options = ["--data-dir", ".." </> "data"] ++ [inpPath] ++ opts let cmd = pandocPath ++ " " ++ unwords options+ let findDynlibDir [] = Nothing+ findDynlibDir ("build":xs) = Just $ joinPath (reverse xs) </> "build"+ findDynlibDir (_:xs) = findDynlibDir xs+ let mbDynlibDir = findDynlibDir (reverse $ splitDirectories pandocPath)+ let dynlibEnv = case mbDynlibDir of+ Nothing -> []+ Just d -> [("DYLD_LIBRARY_PATH", d),+ ("LD_LIBRARY_PATH", d)]+ let env = dynlibEnv ++ [("TMP","."),("LANG","en_US.UTF-8"),("HOME", "./")] ph <- runProcess pandocPath options Nothing- (Just [("TMP","."),("LANG","en_US.UTF-8"),("HOME", "./")]) Nothing (Just hOut)- (Just stderr)+ (Just env) Nothing (Just hOut) (Just stderr) ec <- waitForProcess ph result <- if ec == ExitSuccess then do
tests/Tests/Readers/Docx.hs view
@@ -242,6 +242,10 @@ "docx/table_with_list_cell.docx" "docx/table_with_list_cell.native" , testCompare+ "tables with one row"+ "docx/table_one_row.docx"+ "docx/table_one_row.native"+ , testCompare "code block" "docx/codeblock.docx" "docx/codeblock.native"
tests/Tests/Writers/LaTeX.hs view
@@ -146,6 +146,28 @@ , "\\subsection{header2}\n" , "\\subsubsection{header3}" ]+ , test (latexTopLevelDiv TopLevelPart)+ "part top-level, section not in toc" $+ ( headerWith ("", ["unnumbered"], []) 1 (text "header1")+ <> headerWith ("", ["unnumbered"], []) 2 (text "header2")+ <> headerWith ("", ["unnumbered"], []) 3 (text "header3")+ <> headerWith ("", ["unnumbered"], []) 4 (text "header4")+ <> headerWith ("", ["unnumbered"], []) 5 (text "header5")+ <> headerWith ("", ["unnumbered"], []) 6 (text "header6"))+ =?>+ unlines [ "\\part*{header1}"+ , "\\addcontentsline{toc}{part}{header1}\n"+ , "\\chapter*{header2}"+ , "\\addcontentsline{toc}{chapter}{header2}\n"+ , "\\section*{header3}"+ , "\\addcontentsline{toc}{section}{header3}\n"+ , "\\subsection*{header4}"+ , "\\addcontentsline{toc}{subsection}{header4}\n"+ , "\\subsubsection*{header5}"+ , "\\addcontentsline{toc}{subsubsection}{header5}\n"+ , "\\paragraph{header6}"+ , "\\addcontentsline{toc}{paragraph}{header6}"+ ] ] ] ]
+ tests/docx/table_one_row.docx view
binary file changed (absent → 25251 bytes)
+ tests/docx/table_one_row.native view
@@ -0,0 +1,5 @@+[Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]+ []+ [[[Plain [Str "One"]]+ ,[Plain [Str "Row"]]+ ,[Plain [Str "Table"]]]]]
tests/rst-reader.native view
@@ -214,6 +214,7 @@ ,Para [Str "Explicit",Space,Str "with",Space,Str "no",Space,Str "label:",Space,Link ("",[],[]) [Str "foo"] ("foo",""),Str "."] ,Para [Str "Two",Space,Str "anonymous",Space,Str "links:",Space,Link ("",[],[]) [Str "the",Space,Str "first"] ("/url1/",""),Space,Str "and",Space,Link ("",[],[]) [Str "the",Space,Str "second"] ("/url2/","")] ,Para [Str "Reference",Space,Str "links:",Space,Link ("",[],[]) [Str "link1"] ("/url1/",""),Space,Str "and",Space,Link ("",[],[]) [Str "link2"] ("/url2/",""),Space,Str "and",Space,Link ("",[],[]) [Str "link1"] ("/url1/",""),Space,Str "again."]+,Para [Str "Another",Space,Link ("",[],[]) [Str "style",Space,Str "of",Space,Str "reference",Space,Str "link"] ("/url1/",""),Str "."] ,Para [Str "Here\8217s",Space,Str "a",Space,Link ("",[],[]) [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."] ,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link ("",[],[]) [Str "AT&T"] ("/url/",""),Str "."] ,Para [Str "Autolinks:",Space,Link ("",[],[]) [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2",""),Space,Str "and",Space,Link ("",[],[]) [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net",""),Str "."]
tests/rst-reader.rst view
@@ -390,6 +390,8 @@ .. _link1: /url1/ .. _`link2`: /url2/ +Another `style of reference link <link1_>`_.+ Here's a `link with an ampersand in the URL`_. Here's a link with an amersand in the link text: `AT&T </url/>`_.
tests/writer.markdown view
@@ -548,8 +548,8 @@ These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`.-- \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot”- is emphasized.)+- \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is+ emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$.
tests/writer.opml view
@@ -33,7 +33,7 @@ <outline text="Lists"> <outline text="Unordered" _note="Asterisks tight: - asterisk 1 - asterisk 2 - asterisk 3 Asterisks loose: - asterisk 1 - asterisk 2 - asterisk 3 Pluses tight: - Plus 1 - Plus 2 - Plus 3 Pluses loose: - Plus 1 - Plus 2 - Plus 3 Minuses tight: - Minus 1 - Minus 2 - Minus 3 Minuses loose: - Minus 1 - Minus 2 - Minus 3 "> </outline>- <outline text="Ordered" _note="Tight: 1. First 2. Second 3. Third and: 1. One 2. Two 3. Three Loose using tabs: 1. First 2. Second 3. Third and using spaces: 1. One 2. Two 3. Three Multiple paragraphs: 1. Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3. ">+ <outline text="Ordered" _note="Tight: 1. First 2. Second 3. Third and: 1. One 2. Two 3. Three Loose using tabs: 1. First 2. Second 3. Third and using spaces: 1. One 2. Two 3. Three Multiple paragraphs: 1. Item 1, graf one. Item 1. graf two. The quick brown fox jumped over the lazy dog’s back. 2. Item 2. 3. Item 3. "> </outline> <outline text="Nested" _note="- Tab - Tab - Tab Here’s another: 1. First 2. Second: - Fee - Fie - Foe 3. Third Same thing but with paragraphs: 1. First 2. Second: - Fee - Fie - Foe 3. Third "> </outline>@@ -50,7 +50,7 @@ </outline> <outline text="Smart quotes, ellipses, dashes" _note="“Hello,” said the spider. “‘Shelob’ is my name.” ‘A’, ‘B’, and ‘C’ are letters. ‘Oak,’ ‘elm,’ and ‘beech’ are names of trees. So is ‘pine.’ ‘He said, “I want to go.”’ Were you alive in the 70’s? Here is some quoted ‘`code`’ and a “[quoted link](http://example.com/?foo=1&bar=2)”. Some dashes: one—two — three—four — five. Dashes between numbers: 5–7, 255–66, 1987–1999. Ellipses…and…and…. ------------------------------------------------------------------------"> </outline>-<outline text="LaTeX" _note="- \cite[22-23]{smith.1899} - $2+2=4$ - $x \in y$ - $\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 one that has a line break in it: $\alpha + \omega \times x^2$. These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`. - \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$. Here’s a LaTeX table: \begin{tabular}{|l|l|}\hline Animal & Number \\ \hline Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} ------------------------------------------------------------------------">+<outline text="LaTeX" _note="- \cite[22-23]{smith.1899} - $2+2=4$ - $x \in y$ - $\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 one that has a line break in it: $\alpha + \omega \times x^2$. These shouldn’t be math: - To get the famous equation, write `$e = mc^2$`. - \$22,000 is a *lot* of money. So is \$34,000. (It worked if “lot” is emphasized.) - Shoes (\$20) and socks (\$5). - Escaped `$`: \$73 *this should be emphasized* 23\$. Here’s a LaTeX table: \begin{tabular}{|l|l|}\hline Animal & Number \\ \hline Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} ------------------------------------------------------------------------"> </outline> <outline text="Special Characters" _note="Here is some unicode: - I hat: Î - o umlaut: ö - section: § - set membership: ∈ - copyright: © AT&T has an ampersand in their name. AT&T is another way to write it. This & that. 4 &lt; 5. 6 &gt; 5. Backslash: \\ Backtick: \` Asterisk: \* Underscore: \_ Left brace: { Right brace: } Left bracket: \[ Right bracket: \] Left paren: ( Right paren: ) Greater-than: &gt; Hash: \# Period: . Bang: ! Plus: + Minus: - ------------------------------------------------------------------------"> </outline>
tests/writer.plain view
@@ -498,8 +498,8 @@ These shouldn’t be math: - To get the famous equation, write $e = mc^2$.-- $22,000 is a _lot_ of money. So is $34,000. (It worked if “lot”- is emphasized.)+- $22,000 is a _lot_ of money. So is $34,000. (It worked if “lot” is+ emphasized.) - Shoes ($20) and socks ($5). - Escaped $: $73 _this should be emphasized_ 23$.