aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
AgeCommit message (Collapse)AuthorFilesLines
2021-02-13HTML reader: fix bad handling of empty src attribute in iframe.John MacFarlane1-6/+12
- If src is empty, we simply skip the iframe. - If src is invalid or cannot be fetched, we issue a warning and skip instead of failing with an error. - Closes #7099.
2021-02-13T.P.Error: export `renderError`.John MacFarlane1-33/+72
Refactor `handleError` to use `renderError`. This allows us render error messages without exiting.
2021-02-13Org: support task_lists extensionAlbert Krewinkel3-5/+54
The tasks lists extension is now supported by the org reader and writer; the extension is turned on by default. Closes: #6336
2021-02-13T.P.Shared: export `handleTaskListItem`. [API change]Albert Krewinkel1-0/+1
2021-02-13LaTeX reader: remove unnecessary lineJohn MacFarlane1-1/+0
2021-02-13Remove Ext_fenced_code_attributes from allowed commonmark attributes.John MacFarlane1-2/+0
This attribute was listed as allowed, but it didn't actually do anything. Use `attributes` for code attributes and more. Closes #7097.
2021-02-12Avoid an unnecessary withRaw.John MacFarlane1-1/+4
2021-02-12LaTeX reader improvements.John MacFarlane2-22/+68
* Rewrote `withRaw` so it doesn't rely on fragile assumptions about token positions (which break when macros are expanded). This requires the addition of `sEnableWithRaw` and `sRawTokens` in `LaTeXState`, and a new combinator `disablingWithRaw` to disable collecting of raw tokens in certain contexts. * Add `parseFromToks` to T.P.Readers.LaTeX.Parsing. * Fix parsing of single character tokens so it doesn't mess up the new raw token collecting. * These changes slightly increase allocations and have a small performance impact, but it's minor. Closes #7092.
2021-02-11Use getTimestamp instead of getCurrentTime in writers.John MacFarlane5-7/+7
Setting SOURCE_DATE_EPOCH will allow reproducible builds. Partially addresses #7093. This does not suffice to fully enable reproducible in EPUB, since a unique id is being generated for each build.
2021-02-11T.P.Class: Add getTimestamp [API change].John MacFarlane1-2/+19
This attempts to read the SOURCE_DATE_EPOCH environment variable and parse a UTC time from it (treating it as a unix date stamp, see https://reproducible-builds.org/specs/source-date-epoch/). If the variable is not set or can't be parsed as a unix date stamp, then the function returns the current date.
2021-02-11Correctly parse "raw" date value in markdown references metadata.John MacFarlane1-3/+5
See jgm/citeproc#53.
2021-02-10Add new unexported module T.P.XMLParser.John MacFarlane16-87/+224
This exports functions that uses xml-conduit's parser to produce an xml-light Element or [Content]. This allows existing pandoc code to use a better parser without much modification. The new parser is used in all places where xml-light's parser was previously used. Benchmarks show a significant performance improvement in parsing XML-based formats (especially ODT and FB2). Note that the xml-light types use String, so the conversion from xml-conduit types involves a lot of extra allocation. It would be desirable to avoid that in the future by gradually switching to using xml-conduit directly. This can be done module by module. The new parser also reports errors, which we report when possible. A new constructor PandocXMLError has been added to PandocError in T.P.Error [API change]. Closes #7091, which was the main stimulus. These changes revealed the need for some changes in the tests. The docbook-reader.docbook test lacked definitions for the entities it used; these have been added. And the docx golden tests have been updated, because the new parser does not preserve the order of attributes. Add entity defs to docbook-reader.docbook. Update golden tests for docx.
2021-02-08ODT reader: finer-grained errors on parse failure.John MacFarlane1-21/+18
See #7091.
2021-02-08ODT reader: give more information if zip can't be unpacked.John MacFarlane1-1/+4
2021-02-08DocBook reader: Support informalfigure (#7079)Nils Carlson1-1/+3
Add support for informalfigure.
2021-02-07Avoid unnecessary use of NoImplicitPrelude pragma (#7089)Albert Krewinkel1-1/+0
2021-02-06Markdown reader: improved handling of mmd link attributes in references.John MacFarlane1-0/+2
Previously they only worked for links that had titles. Closes #7080.
2021-02-04Lua filters: use same function names in Haskell and LuaAlbert Krewinkel2-28/+30
2021-02-03ePub writer: `belongs-to-collection` metadata (#7063)Nick Berendsen1-41/+58
2021-02-02Lua: add module "pandoc.path"Albert Krewinkel1-0/+2
The module allows to work with file paths in a convenient and platform-independent manner. Closes: #6001 Closes: #6565
2021-02-02Add parseOptionsFromArgs [API change, addition].John MacFarlane2-2/+9
Exported by Text.Pandoc.App.
2021-02-01BibTeX writer: use doclayout and doctemplate.John MacFarlane3-23/+39
This change allows bibtex/biblatex output to wrap as other formats do, depending on the settings of `--wrap` and `--columns`. It also introduces default templates for bibtex and biblatex, which allow for using the variables `header-include`, `include-before` or `include-after` (or alternatively the command line options `--include-in-header`, `--include-before-body`, `--include-after-body`) to insert content into the generated bibtex/biblatex. This change requires a change in the return type of the unexported `T.P.Citeproc.writeBibTeXString` from `Text` to `Doc Text`. Closes #7068.
2021-02-01BibTeX writer fixes. Closes #7067.John MacFarlane1-6/+15
+ Require citeproc 0.3.0.7, which correctly titlecases when titles contain non-ASCII characters. + Correctly handle 'pages' (= 'page' in CSL). + Correctly handle BibLaTeX 'langid' (= 'language' in CSL). + In BibTeX output, protect foreign titles since there's no language field.
2021-01-31RST reader: fix handling of header in CSV tables.John MacFarlane1-4/+5
The interpretation of this line is not affected by the delim option. Closes #7064.
2021-01-31CslJson writer: fix compiler warningAlbert Krewinkel1-1/+1
2021-01-30CslJson writer: output `[]` if no references in input,John MacFarlane1-5/+5
instead of raising a PandocAppError as before.
2021-01-29Markdown writer: handle math right before digit.John MacFarlane1-1/+5
We insert an HTML comment to avoid a `$` right before a digit, which pandoc will not recognize as a math delimiter.
2021-01-29JATS writer: escape special chars in reference elements.Albert Krewinkel1-3/+6
Prevents the generation of invalid markup if a citation element contains an ampersand or another character with a special meaning in XML.
2021-01-26Clean up BibTeX parsing.John MacFarlane2-32/+19
Previously there was a messy code path that gave strange results in some cases, not passing through raw tex but trying to extract a string content. This was an artefact of trying to handle some special bibtex-specific commands in the BibTeX reader. Now we just handle these in the LaTeX reader and simplify parsing in the BibTeX reader. This does mean that more raw tex will be passed through (and currently this is not sensitive to the `raw_tex` extension; this should be fixed). Closes #7049.
2021-01-26LaTeX writer: change BCP47 lang tag from jp to jaMauro Bieg1-1/+1
fixes #7047
2021-01-26Lua: always load built-in Lua scripts from default data-dirAlbert Krewinkel4-46/+44
The Lua modules `pandoc` and `pandoc.List` are now always loaded from the system's default data directory. Loading from a different directory by overriding the default path, e.g. via `--data-dir`, is no longer supported to avoid unexpected behavior and to address security concerns.
2021-01-22ImageSize: use viewBox for svg if no length, width.John MacFarlane1-2/+6
This change allows pandoc to extract size information from more SVGs. Closes #7045.
2021-01-22Merge pull request #7042 from tarleb/jats-element-citationsJohn MacFarlane5-25/+213
JATS writer: use element citations
2021-01-22JATS writer: allow to use element-citationAlbert Krewinkel4-7/+192
2021-01-22Add biblatex, bibtex as output formats (closes #7040).John MacFarlane4-3/+306
* `biblatex` and `bibtex` are now supported as output as well as input formats. * New module Text.Pandoc.Writers.BibTeX, exporting writeBibTeX and writeBibLaTeX. [API change] * New unexported function `writeBibtexString` in Text.Pandoc.Citeproc.BibTeX.
2021-01-21Text.Pandoc.Citeproc: use finer grained importsAlbert Krewinkel1-18/+21
This allows to import the module in writers without causing a circular dependency.
2021-01-19JATS writer: Ensure that disp-quote is always wrapped in p.John MacFarlane1-1/+3
Closes #7041.
2021-01-18RST writer: fix #7039.John MacFarlane1-2/+2
We were losing content from inside spans with a class, due to logic that is meant to avoid nested inline structures that can't be represented in RST. The logic was a bit stricter than necessary. This commit fixes the issue.
2021-01-16Revert "Markdown reader: support GitHub wiki's internal links (#2923) (#6458)"John MacFarlane2-28/+0
This reverts commit 6efd3460a776620fdb93812daa4f6831e6c332ce. Since this extension is designed to be used with GitHub markdown (gfm), we need to implement the parser as a commonmark extension (commonmark-extensions), rather than in pandoc's markdown reader. When that is done, we can add it here.
2021-01-16Markdown reader: support GitHub wiki's internal links (#2923) (#6458)Gautier DI FOLCO2-0/+28
Canges overview: * Add a `Ext_markdown_github_wikilink` constructor to `Extension` [API change]. * Add the parser `githubWikiLink` in `Text.Pandoc.Readers.Markdown` * Add tests.
2021-01-16Recognize more extensions as markdown by default.John MacFarlane1-0/+5
`mkdn`, `mkd`, `mdwn`, `mdown`, `Rmd`. Closes #7034.
2021-01-12Markdown writer: cleaned up raw formats.John MacFarlane1-34/+35
We now react appropriately to gfm, commonmark, and commonmark_x as raw formats.
2021-01-12Docx writer: handle table header using styles.John MacFarlane1-17/+20
Instead of hard-coding the border and header cell vertical alignment, we now let this be determined by the Table style, making use of Word's "conditional formatting" for the table's first row. For headerless tables, we use the tblLook element to tell Word not to apply conditional first-row formatting. Closes #7008.
2021-01-10JATS writer: fix citations (#7018)Albert Krewinkel2-26/+23
* JATS writer: keep code lines at 80 chars or below * JATS writer: fix citations
2021-01-10Fix infinite HTTP requests when writing epubs from URL source.John MacFarlane1-5/+9
Due to a bug in code added to avoid overwriting the cover image if it had the form `fileX.YYY`, pandoc made an endless sequence of HTTP requests when writing epub with input from a URL. Closes #7013.
2021-01-10T.P.Citeproc: factor out and export `getStyle`.John MacFarlane1-45/+55
2021-01-10T.P.Citeproc: factor out getLang.John MacFarlane1-8/+15
2021-01-10T.P.Citeproc: refactor and export `getReferences`.John MacFarlane1-28/+51
See #7016.
2021-01-09Org reader: allow multiple pipe chars in todo sequencesAlbert Krewinkel1-4/+10
Additional pipe chars, used to separate "action" state from "no further action" states, are ignored. E.g., for the following sequence, both `DONE` and `FINISHED` are states with no further action required. #+TODO: UNFINISHED | DONE | FINISHED Previously, parsing of the todo sequence failed if multiple pipe chars were included. Closes: #7014
2021-01-08Update copyright notices for 2021 (#7012)Albert Krewinkel135-148/+148