aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
AgeCommit message (Collapse)AuthorFilesLines
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.
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-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 Krewinkel1-12/+21
* 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-08Update copyright notices for 2021 (#7012)Albert Krewinkel38-39/+39
2021-01-07gfm/commonmark writer: implement start number on ordered lists.John MacFarlane1-1/+4
Previously they always started at 1, but according to the spec the start number is respected. Closes #7009.
2021-01-05HTML writer: fix implicit_figure at end of footnotes.John MacFarlane1-3/+7
Closes #7006.
2021-01-04EPUB writer: adjust internal links to identifiers...John MacFarlane1-0/+20
defined in raw HTML sections after splitting into chapters. Closes #7000.
2021-01-03EPUB writer: recognize `Format "html4"`, `Format "html5"` as raw HTML.John MacFarlane1-2/+8
2021-01-03EPUB writer: adjust internal links to images, links, and tables...John MacFarlane1-0/+6
after splitting into chapters. Previously we only did this for Div and Span and Header elements. See #7000.
2021-01-02LaTeX writer: revert table line height increase in 2.11.3.John MacFarlane1-1/+1
In 2.11.3 we started adding `\addlinespace`, which produced less dense tables. This wasn't an intentional change; I misunderstood a comment in the discussion leading up to the change. This commit restores the earlier default table appearance. Note that if you want a less dense table, you can use something like `\def\arraystretch{1.5}` in your header. Closes #6996.
2020-12-30Undo the "Use fromRight" hlint hint.John MacFarlane1-2/+1
2020-12-30Hlint fixesJohn MacFarlane1-1/+2
2020-12-30Ms writer: don't justify inside table cells.John MacFarlane1-1/+3
2020-12-29Improve fix to #6983.John MacFarlane1-1/+3
If we have a paragraph then a bookmarkEnd, we don't need to insert the empty paragraph (and in fact it alters the spacing). Closes #6983.
2020-12-28Docx writer: fix nested tables with captions.John MacFarlane1-4/+6
Previously we got unreadable content, because docx seems to want a `<w:p>` element (even an empty one) at the end of every table cell. Closes #6983.
2020-12-27Use meta-description instead of description in templates.John MacFarlane1-0/+3
Since this is an attribute value, we need to prepare it in the writer.
2020-12-27Add support for writing nested tables to asciidoc (#6972)timo-a1-7/+32
Added field to WriterState that denotes the current nesting level for traversing tables. Depending on the value of that field nested tables are recognized and written. Asciidoc supports one level of nesting. If deeper tables are to be written, they are omitted and a warning is issued.