aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-16Rename Text.Pandoc.XMLParser -> Text.Pandoc.XML.Light...John MacFarlane102-930/+1388
..and add new definitions isomorphic to xml-light's, but with Text instead of String. This allows us to keep most of the code in existing readers that use xml-light, but avoid lots of unnecessary allocation. We also add versions of the functions from xml-light's Text.XML.Light.Output and Text.XML.Light.Proc that operate on our modified XML types, and functions that convert xml-light types to our types (since some of our dependencies, like texmath, use xml-light). Update golden tests for docx and pptx. OOXML test: Use `showContent` instead of `ppContent` in `displayDiff`. Docx: Do a manual traversal to unwrap sdt and smartTag. This is faster, and needed to pass the tests. Benchmarks: A = prior to 8ca191604dcd13af27c11d2da225da646ebce6fc (Feb 8) B = as of 8ca191604dcd13af27c11d2da225da646ebce6fc (Feb 8) C = this commit | Reader | A | B | C | | ------- | ----- | ------ | ----- | | docbook | 18 ms | 12 ms | 10 ms | | opml | 65 ms | 62 ms | 35 ms | | jats | 15 ms | 11 ms | 9 ms | | docx | 72 ms | 69 ms | 44 ms | | odt | 78 ms | 41 ms | 28 ms | | epub | 64 ms | 61 ms | 56 ms | | fb2 | 14 ms | 5 ms | 4 ms |
2021-02-15JATS writer: add date-type to pub-date elementsAlbert Krewinkel4-6/+13
2021-02-15JATS writer: replace attribute "pub-type" with "publication-format".Albert Krewinkel4-9/+12
The former attribute is deprecated.
2021-02-14T.P.Error: remove unused variablesAlbert Krewinkel1-2/+2
2021-02-14Allow tasty 1.4.*Albert Krewinkel1-1/+1
2021-02-13HTML reader: fix bad handling of empty src attribute in iframe.John MacFarlane2-8/+24
- 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 MacFarlane2-33/+80
Refactor `handleError` to use `renderError`. This allows us render error messages without exiting.
2021-02-13Org: support task_lists extensionAlbert Krewinkel5-16/+113
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-13Clean up benchmark code.John MacFarlane2-75/+41
Now we can do patterns using `-p blah'.
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-12Fix command test 5686John MacFarlane1-1/+1
2021-02-12Add command test for #7092John MacFarlane1-0/+8
2021-02-12Jira: require jira-wiki-markup 1.3.3Albert Krewinkel3-2/+9
* Modified the Doc parser to skip leading blank lines. This fixes parsing of documents which start with multiple blank lines. (#7095) * Prevent URLs within link aliases to be treated as autolinks. (#6944) Fixes: #7095 Fixes: #6944
2021-02-11Add MANUAL section on reproducible builds.John MacFarlane1-0/+15
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 MacFarlane98-91/+238
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-08Use lts-17.2 resolver (with ghc 8.10.3).John MacFarlane1-10/+1
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 Krewinkel59-112/+1
2021-02-07pandoc.cabal: use common stanza to reduce duplication (#7086)Albert Krewinkel1-124/+45
2021-02-07 Document no template fallback for absolute path (#7088)Nixon Enraght-Moony1-1/+2
See jgm/pandoc#7077
2021-02-06Markdown reader: improved handling of mmd link attributes in references.John MacFarlane2-0/+10
Previously they only worked for links that had titles. Closes #7080.
2021-02-06stack.yaml - use commonmark-0.1.1.4 for GHC 9John MacFarlane1-1/+1
2021-02-06CI: use haskell/actions/setup.John MacFarlane1-3/+3
actions/haskell-setup is no longer maintained.
2021-02-06CI: use cabal 2.2 when building with GHC 8.0.2. (#7085)Albert Krewinkel1-5/+8
2021-02-04Lua filters: use same function names in Haskell and LuaAlbert Krewinkel3-28/+31
2021-02-04doc/lua-filters.md: improve docs for `pandoc.mediabag.insert`Albert Krewinkel1-2/+3
2021-02-04doc/lua-filters.md: fix, improve docs for `pandoc.mediabag.fetch`Albert Krewinkel1-2/+12
2021-02-03ePub writer: `belongs-to-collection` metadata (#7063)Nick Berendsen2-41/+67
2021-02-03LaTeX template: Update to iftex package (#7073)Andrew Dunning6-29/+28
Load the iftex package directly rather than via the ifxetex and ifluatex compatibility wrappers, which have been merged into a single package that is part of the LaTeX core. The capitalization of the commands has been changed for compatibility with older versions of TeX Live that have the version of iftex by the Persian TeX Group. This had been removed in <https://github.com/jgm/pandoc/commit/2845794c0c31b2ef1f3e6a73bb5b109da4c74f37> for compatibility with BasicTeX, but that is no longer an issue.
2021-02-02Fixed some compiler warnings in tests.John MacFarlane3-14/+3
2021-02-02Add tests for search_path_separatorAlbert Krewinkel1-0/+8
2021-02-02Check that all documented functions are present.Albert Krewinkel1-0/+19
Rely on tests in the module package to check the correctness of each function.
2021-02-02Fix stack configAlbert Krewinkel1-1/+1
2021-02-02Use hslua-module-path 0.1.0Albert Krewinkel1-1/+1
2021-02-02Improve docs for directory, normalizeAlbert Krewinkel1-3/+6
2021-02-02Lua: add module "pandoc.path"Albert Krewinkel6-1/+197
The module allows to work with file paths in a convenient and platform-independent manner. Closes: #6001 Closes: #6565
2021-02-02Test suite: a more robust way of testing the executable.John MacFarlane4-72/+64
Mmny of our tests require running the pandoc executable. This is problematic for a few different reasons. First, cabal-install will sometimes run the test suite after building the library but before building the executable, which means the executable isn't in place for the tests. One can work around that by first building, then building and running the tests, but that's fragile. Second, we have to find the executable. So far, we've done that using a function findPandoc that attempts to locate it relative to the test executable (which can be located using findExecutablePath). But the logic here is delicate and work with every combination of options. To solve both problems, we add an `--emulate` option to the `test-pandoc` executable. When `--emulate` occurs as the first argument passed to `test-pandoc`, the program simply emulates the regular pandoc executable, using the rest of the arguments (after `--emulate`). Thus, test-pandoc --emulate -f markdown -t latex is just like pandoc -f markdown -t latex Since all the work is done by library functions, implementing this emulation just takes a couple lines of code and should be entirely reliable. With this change, we can test the pandoc executable by running the test program itself (locatable using findExecutablePath) with the `--emulate` option. This removes the need for the fragile `findPandoc` step, and it means we can run our integration tests even when we're just building the library, not the executable. Part of this change involved simplifying some complex handling to set environment variables for dynamic library paths. I have tested a build with `--enable-dynamic-executable`, and it works, but further testing may be needed.
2021-02-02Add parseOptionsFromArgs [API change, addition].John MacFarlane2-2/+9
Exported by Text.Pandoc.App.
2021-02-02cabal.project - more heap spaceJohn MacFarlane1-1/+1
2021-02-02shell.nix - install zlibJohn MacFarlane1-0/+1
2021-02-02Remove superfluous importJohn MacFarlane1-1/+0