aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
AgeCommit message (Collapse)AuthorFilesLines
2021-04-20Docx writer: add missing fileAlbert Krewinkel1-0/+181
2021-04-20Docx writer: extract Table handling into separate moduleAlbert Krewinkel2-221/+119
2021-04-17Update to released unicode-collation, latest citeproc dev version.John MacFarlane7-7/+7
Update citeproc test.
2021-04-17Remove Text.Pandoc.BCP47 module.John MacFarlane9-42/+44
[API change] Use Lang from UnicodeCollation.Lang instead. This is a richer implementation of BCP 47.
2021-04-17Move getLang from BCP47 -> T.P.Writers.Shared.John MacFarlane2-58/+73
[API change]
2021-04-16JATS writer: reduce unnecessary use of <p> elements for wrappingAlbert Krewinkel3-16/+47
The `<p>` element is used for wrapping in cases were the contents would otherwise not be allowed in a certain context. Unnecessary wrapping is avoided, especially around quotes (`<disp-quote>` elements). Closes: #7227
2021-04-10JATS writer: convert spans to <named-content> elementsAlbert Krewinkel1-6/+7
Spans with attributes are converted to `<named-content>` elements instead of being wrapped with `<milestone-start/>` and `<milestone-end>` elements. Milestone elements are not allowed in documents using the articleauthoring tag set, so this change ensures the creation of valid documents. Closes: #7211
2021-04-10JATS writer: add footnote number as label in backmatterAlbert Krewinkel1-0/+1
Footnotes in the backmatter are given the footnote's number as a label. The articleauthoring output is unaffected from this change, as footnotes are placed inline there. Closes: #7210
2021-04-05Commonmark writer: Use backslash escapes for `<` and `|`...John MacFarlane1-1/+11
instead of entities. Closes #7208.
2021-04-05JATS writer: escape disallows chars in identifiersAlbert Krewinkel3-17/+19
XML identifiers must start with an underscore or letter, and can contain only a limited set of punctuation characters. Any IDs not adhering to these rules are rewritten by writing the offending characters as Uxxxx, where `xxxx` is the character's hex code.
2021-04-01Org writer: Use LaTeX style maths deliminators (#7196)tecosaur1-2/+2
Org works better with LaTeX-style delimiters.
2021-03-29Powerpoint writer: allow monofont to be specified in metadata...John MacFarlane2-6/+19
...not just using `--variable` on the command line (as in other writers). Closes #7187.
2021-03-20RST writer: use NonEmpty for init, last.John MacFarlane1-8/+12
2021-03-20Include Header.Attr.attributes as XML attributes on sectionErik Rask1-2/+45
Add key-value pairs found in the attributes list of Header.Attr as XML attributes on the corresponding section element. Any key name not allowed as an XML attribute name is dropped, as are keys with invalid values where they are defined as enums in DocBook, and xml:id (for DocBook 5)/id (for DocBook 4) to not intervene with computed identifiers.
2021-03-20T.P.Shared: remove `backslashEscapes`, `escapeStringUsing`.John MacFarlane7-34/+77
[API change] These are inefficient association list lookups. Replace with more efficient functions in the writers that used them (with 10-25% performance improvements in haddock, org, rtf, texinfo writers).
2021-03-19Protect partial uses of maximum with NonEmpty.John MacFarlane15-69/+84
2021-03-19Use NonEmpty instead of minimumDef.John MacFarlane1-2/+3
2021-03-18Use minimumDef instead of minimum (partial function).John MacFarlane1-5/+2
2021-03-17Docx writer: make nsid in abstractNum deterministic.John MacFarlane1-6/+4
Previously we assigned a random number (though in a deterministic way). But changes in the random package mean we get different results now on different architectures, even with the same random seed. We don't need random values; so now we just assign a value based on the list number id, which is guaranteed to be unique to the list marker.
2021-03-16Removed unused LANGUAGE pragmas.John MacFarlane1-1/+0
2021-03-15Use foldl' instead of foldl everywhere.John MacFarlane3-8/+8
2021-03-14Handle 'nocite' better with --biblatex and --natbib.John MacFarlane1-2/+10
Previously the nocite metadata field was ignored with these formats. Now it populates a `nocite-ids` template variable and causes a `\nocite` command to be issued. Closes #4585.
2021-03-13Use integral values for w:tblW in docx.John MacFarlane1-1/+1
Cloess #7141.
2021-03-13Jira writer: improve div/panel handlingAlbert Krewinkel1-11/+28
Include div attributes in panels, always render divs with class `panel` as panels, and avoid nesting of panels.
2021-03-10HTML writer: Add warnings on duplicate attribute values.John MacFarlane1-18/+23
This prevents emitting invalid HTML. Ultimately it would be good to prevent this in the types themselves, but this is better for now. T.P.Logging: Add DuplicateAttribute constructor to LogMessage. [API change]
2021-03-09Org writer: fix operator precedence mistake in previous commitAlbert Krewinkel1-1/+2
2021-03-09Org writer: prevent unintended creation of ordered list itemsAlbert Krewinkel1-4/+7
Adjust line wrapping if default wrapping would cause a line to be read as an ordered list item. Fixes #7132
2021-03-08Jira writer: use noformat instead of code for unknown languages.Albert Krewinkel1-5/+5
Code blocks that are not marked as a language supported by Jira are rendered as preformatted text with `{noformat}` blocks. Fixes: tarleb/jira-wiki-markup#4
2021-03-02Split out T.P.Writers.LaTeX.Util.John MacFarlane2-243/+285
2021-03-02Split out T.P.Writers.LaTeX.Citation.John MacFarlane2-142/+187
2021-03-02Split out T.P.Writers.LaTeX.Lang.John MacFarlane2-180/+203
2021-03-02Split up T.P.Writers.Markdown...John MacFarlane3-591/+688
with T.P.Writers.Markdown.Types and T.P.Writers.Markdown.Inline. The module was difficult to compile on low-memory system.s
2021-03-01Jira writer: use Span identifiers as anchorsAlbert Krewinkel1-1/+3
Closes: tarleb/jira-wiki-markup#3.
2021-02-28LaTeX writer: use function instead of map for accent lookup.John MacFarlane1-27/+25
2021-02-26Fix/update URLs and use HTTP**S** where possible (#7122)Salim B1-1/+1
2021-02-18LaTeX writer: adjust hypertargets to beginnings of paragraphs.John MacFarlane1-2/+3
Use `\vadjust pre` so that the hypertarget takes you to the beginning of the paragraph rather than one line down. Closes #7078. This makes a particular difference for links to citations using `--citeproc` and `link-citations: true`.
2021-02-16Rename Text.Pandoc.XMLParser -> Text.Pandoc.XML.Light...John MacFarlane6-513/+485
..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-13Org: support task_lists extensionAlbert Krewinkel1-3/+13
The tasks lists extension is now supported by the org reader and writer; the extension is turned on by default. Closes: #6336
2021-02-11Use getTimestamp instead of getCurrentTime in writers.John MacFarlane4-5/+5
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-10Add new unexported module T.P.XMLParser.John MacFarlane5-24/+42
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-03ePub writer: `belongs-to-collection` metadata (#7063)Nick Berendsen1-41/+58
2021-02-01BibTeX writer: use doclayout and doctemplate.John MacFarlane1-3/+16
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-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-26LaTeX writer: change BCP47 lang tag from jp to jaMauro Bieg1-1/+1
fixes #7047
2021-01-22Merge pull request #7042 from tarleb/jats-element-citationsJohn MacFarlane3-7/+178
JATS writer: use element citations
2021-01-22JATS writer: allow to use element-citationAlbert Krewinkel3-7/+178
2021-01-22Add biblatex, bibtex as output formats (closes #7040).John MacFarlane1-0/+48
* `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.