aboutsummaryrefslogtreecommitdiff
path: root/src/Text
AgeCommit message (Collapse)Author
2023-02-09Citeproc: Fix bug in metaValueToReference.John MacFarlane
This bug caused us to get some repeated content when converting MetaBlock to Inlines. Closes #8611.
2023-02-09PPTX writer: fix handling of simple figuresAlbert Krewinkel
This ensures that simple figures are displayed in the same way as before the introduction of a dedicated `Figure` constructor in the AST. Closes: #8565
2023-02-09Lua: add field `chunk_template` to WriterOptions objects [API change]Albert Krewinkel
The PathTemplate type exported from Text.Pandoc.Chunks is now an instance of the ToJSON and FromJSON classes. Closes: #8607
2023-02-05LaTeX writer: include short figure/table caption if one is given.Albert Krewinkel
Short captions are used by LaTeX when generating a the list of figures or list of tables. Adding a short caption will now overwrite the full caption in these lists.
2023-02-04Improve handling of `%` in bib(la)tex parsing.John MacFarlane
bibtex/biblatex seem to pass through an unescaped `%` inside braces or quotes; it won't escape the closing brace. So we'll do the same. This prevents the need for our previous special treatment of url and doi fields. Closes #8597.
2023-02-01Handle % in biblatex doi field.John MacFarlane
Closes #8595.
2023-01-30Add new `--chunk-template` option (closes #8581).John MacFarlane
* Add `--chunk-template` CLI option, allowing more control over the chunk filenames in chunked HTML output. * Text.Pandoc.App: Add `optChunkTemplate` constructor to Opt [API change]. * Text.Pandoc.Options: add `writerChunkTemplate` contsructor to WriterOptions [API change]. * Text.Pandoc.Chunks: add Data, Typeable, Generic instances for PathTemplate.
2023-01-29Add support for Textile footnote backlinks (#8585)Stephen Altamirano
Backlinking from footnotes is already the behavior of `Note` values when writing HTML. This adds parsing support for the explicit backlinking syntax in Textile as described here: https://textile-lang.com/doc/footnotes Previously, these lines would be interpreted as a new paragraph beginning with "fn3^." in text.
2023-01-29ODT reader: fix blockquote indent detectionDaniel Kessler
The ODT reader is supposed to detect blockquotes by checking a paragraph style's indentation level. But it's broken for two reasons: * The parser fails on non-integers. So "1in" will get read as 25mm, but "1.0in" fails. By default, the Quotations style is "0.3937in". * The reader doesn't check indentation levels of parent styles. In my test documents, LibreOffice often creates child styles for individual paragraphs, so it's important to check parents (ODT files created by the Pandoc ODT writer don't have this issue though). I added a new test "blockquote2" whose ODT file is generated directly from the corresponding Markdown file with pandoc. Fixes #3437.
2023-01-29Fix 3.0 regression with `--print-highlight-style` option.John MacFarlane
Closes #8586.
2023-01-28Textile reader: don't allow brackets in URLs.John MacFarlane
Closes #8582.
2023-01-25Ensure that automatically set variables ...John MacFarlane
`pandoc-version`, `outputfile`, `title-prefix`, `epub-cover-image`, `curdir`, `dzslides-core` can be overridden by `--variable` on the command line. Previously they would create lists in the template Context, which is not desirable.
2023-01-23LaTeX reader: Fix bug in macro resolution for environments.John MacFarlane
This is a regression in pandoc 3.0 that affects environments with arguments. Closes #8573.
2023-01-23LaTeX reader: Fix small logic error in macro parsing code.John MacFarlane
2023-01-21Fix use of extensions with custom readers.John MacFarlane
Closes #8571.
2023-01-21T.P.Writers.Shared: export setupTranslations [API change].John MacFarlane
Use this in HTML and OpenDocument writers.
2023-01-20Chunked HTML writer: Fix handling of images with absolute URLs.John MacFarlane
Cloess #8567.
2023-01-20HTML writer: don't omit newlines in task lists.John MacFarlane
2023-01-20HTML writer: don't disable checkboxes in task lists.John MacFarlane
Closes #8562.
2023-01-18Add param to tocToList for numberSections.John MacFarlane
Otherwise sections are always numbered in the TOC, even if `--number-sections` is not used.
2023-01-18Fix line lengths in Markdown reader, DocBook writerAlbert Krewinkel
Trying to limit lines to 80 chars.
2023-01-17Fix spacing errors.John MacFarlane
2023-01-16T.P.Class.IO: export function `writeMedia` [API change]Albert Krewinkel
This is useful for the `pandoc.mediabag` module.
2023-01-15T.P.Chunks changes.John MacFarlane
+ Re-use `toTocTree` in constructing `chunkedTOC`. Previously we used an entirely different function toTOCTree'. + Improve `tocToList` so that it avoids empty lists of items that are omitted because they are below the toc depth. pandoc-lua-engine: + Fix structure tests in light of last change. T.P.Writers.ChunkedHTML: + Reuse `tocToList` in `buildTOC`. T.P.Writers.EPUB: + Adjust EPUB writer for Chunks changes.
2023-01-15Chunks: export `tocToList`Albert Krewinkel
2023-01-15Markdown, CommonMark: add support for wiki links. [API change]Albert Krewinkel
Adds the Markdown/CommonMark extensions `wikilinks_title_after_pipe` and `wikilinks_title_before_pipe`. The former enables links of style `[[Name of page|Title]]` and the latter `[[Title|Name of page]]`. Titles are optional in both variants, so this works for both: `[[https://example.org]]`, `[[Name of page]]`. The writer is modified to render links with title `wikilink` as a wikilink if a respective extension is enabled. Pandoc will use `wikilinks_title_after_pipe` if both extensions are enabled. Closes: #2923
2023-01-15ConTeXt writer: support `tagging` extension [API Change]Albert Krewinkel
Paragraphs are enclosed by `\bpar` and `\epar` commands, and `highlight` commands are used for emphasis. This results in much better tagging in PDF output.
2023-01-14Remove Null constructor from docsAlbert Krewinkel
2023-01-13Remove block constructor Null from the code base.John MacFarlane
It has been removed from pandoc-types.
2023-01-13Org writer: use span attributes `tag-name` in headers as tags.Albert Krewinkel
This enables round-tripping of tags in Org headings. Closes: #8513
2023-01-13ChunkedHTML writer: use fetchItem to get resources.John MacFarlane
This ensures that they can be gotten from e.g. docx input.
2023-01-13Support complex figures. [API change]Albert Krewinkel
Thanks and credit go to Aner Lucero, who laid the groundwork for this feature in the 2021 GSoC project. He contributed many changes, including modifications to the readers for HTML, JATS, and LaTeX, and to the HTML and JATS writers. Shared (Albert Krewinkel): - The new function `figureDiv`, exported from `Text.Pandoc.Shared`, offers a standardized way to convert a figure into a Div element. Readers (Aner Lucero): - HTML reader: `<figure>` elements are parsed as figures, with the caption taken from the respective `<figcaption>` elements. - JATS reader: The `<fig>` and `<caption>` elements are parsed into figure elements, even if the contents is more complex. - LaTeX reader: support for figures with non-image contents and for subfigures. - Markdown reader: paragraphs containing just an image are treated as figures if the `implicit_figures` extension is enabled. The identifier is used as the figure's identifier and the image description is also used as figure caption; all other attributes are treated as belonging to the image. Writers (Aner Lucero, Albert Krewinkel): - DokuWiki, Haddock, Jira, Man, MediaWiki, Ms, Muse, PPTX, RTF, TEI, ZimWiki writers: Figures are rendered like Div elements. - Asciidoc writer: The figure contents is unwrapped; each image in the the figure becomes a separate figure. - Classic custom writers: Figures are passed to the global function `Figure(caption, contents, attr)`, where `caption` and `contents` are strings and `attr` is a table of key-value pairs. - ConTeXt writer: Figures are wrapped in a "placefigure" environment with `\startplacefigure`/`\endplacefigure`, adding the features caption and listing title as properties. Subfigures are place in a single row with the `\startfloatcombination` environment. - DocBook writer: Uses `mediaobject` elements, unless the figure contains subfigures or tables, in which case the figure content is unwrapped. - Docx writer: figures with multiple content blocks are rendered as tables with style `FigureTable`; like before, single-image figures are still output as paragraphs with style `Figure` or `Captioned Figure`, depending on whether a caption is attached. - DokuWiki writer: Caption and "alt-text" are no longer combined. The alt text of a figure will now be lost in the conversion. - FB2 writer: The figure caption is added as alt text to the images in the figure; pre-existing alt texts are kept. - ICML writer: Only single-image figures are supported. The contents of figures with additional elements gets unwrapped. - HTML writer: the alt text is no longer constructed from the caption, as was the case with implicit figures. This reduces duplication, but comes at the risk of images that are missing alt texts. Authors should take care to provide alt texts for all images. Some readers, most notably the Markdown reader with the `implicit_figures` extension, add a caption that's identical to the image description. The writer checks for this and adds an `aria-hidden` attribute to the `<figcaption>` element in that case. - JATS writer: The `<fig>` and `<caption>` elements are used write figures. - LaTeX writer: complex figures, e.g. with non-image contents and subfigures, are supported. The `subfigure` template variable is set if the document contains subfigures, triggering the conditional loading of the *subcaption* package. Contants of figures that contain tables are become unwrapped, as longtable environments are not allowed within figures. - Markdown writer: figures are output as implicit figures if possible, via HTML if the `raw_html` extension is enabled, and as Div elements otherwise. - OpenDocument writer: A separate paragraph is generated for each block element in a figure, each with style `FigureWithCaption`. Behavior for single-image figures therefore remains unchanged. - Org writer: Only the first element in a figure is given a caption; additional block elements in the figure are appended without any caption being added. - RST writer: Single-image figures are supported as before; the contents of more complex images become nested in a container of type `float`. - Texinfo writer: Figures are rendered as float with type `figure`. - Textile writer: Figures are rendered with the help of HTML elements. - XWiki: Figures are placed in a group. Co-authored-by: Aner Lucero <[email protected]>
2023-01-12Refine "blending" rules for MediaWiki linksRuqi
The rules for "blending" characters outside a link into the link are described here: https://en.wikipedia.org/wiki/Help:Wikitext#Blend_link These pose a problem for CJK languages, which generally don't have spaces after links. However, it turns out that the blending behavior, as implemented on Wikipedia, is (contrary to the documentation) only for ASCII letters. This commit implements that restriction, which fixes the problem for CJK. (#8525)
2023-01-12Store "unnumbered" class in DocBook role attribute (#8481)lifeunleaded
Markdown allows marking a heading as unnumbered, which is stored as a class token internally. This change will recognize this particular class token and append it to the role attribute, or create a role attribute with it if needed. This does not imply any processing in DocBook but is intended to let customized stylesheets identify these sections and act accordingly. Closes #1402
2023-01-12Replace `--epub-chapter-level` with `--split-level`.John MacFarlane
Rationale: we need this splitting level now not just in EPUB but in chunked HTML. `--epub-chapter-level` will still function as a deprecated synonynm. `epub-chapter-level` will also continue to work in defaults files, ande `epub_chapter_level` will still work for Lua marshalling. [API changes] Text.Pandoc.App.Opt: remove `optEpubChapterLevel`, add `optSplitLevel`. Text.Pandoc.Options: remove `writerEpubChapterLevel`, add `writerSplitLevel`.
2023-01-11Remove unnecessary import.John MacFarlane
2023-01-11Allow `--reference-doc` to take URL argument.John MacFarlane
Closes #8535.
2023-01-11Add ChunkedHTML writer.John MacFarlane
- Add module Text.Pandoc.Writers.ChunkedHTML, exporting writeChunkedHtml [API change]. - Revised API for Text.Pandoc.Chunks. `chunkNext`, `chunkPrev`, `chunkUp` are now just `Maybe Chunk`. - Fix assignment of navigation elements of Chunks. - Strip off anchor portion of next and prev links. - Remove Ord instances for SecInfo, Chunk. - Derive Show, Eq, Generic for ChunkDoc. - Add `chunkSectionNumber`, `chunkUnlisted`. - Automatically unwrap the zip to a directory if an extensionless output file specified. - Incorporate images with relative paths below working dir.
2023-01-11Textile reader: support linked images.John MacFarlane
Closes #8541.
2023-01-11Textile reader: fix strong emph ending with link.John MacFarlane
Closes #8540.
2023-01-11Use jira-wiki-markup 1.5.0Albert Krewinkel
Fixed issues with icon-like sequences at the beginning of words. Fixes: #8511
2023-01-10Update copyright years, it's 2023!Albert Krewinkel
2023-01-05isURI: don't require non-ASCII characters to be escaped.John MacFarlane
Closes #8508.
2023-01-04Use `\toprule\noalign{}` instead of `\toprule()` in LaTeX tables.John MacFarlane
And similar for `\midrule` and `\bottomrule`. This facilitates redefining `\toprule`, `\midrule`, and `\bottomrule` without needing to gobble the ()s. Closes #8223.
2022-12-28Man writer: use UTF-8 by default for non-ascii characters.John MacFarlane
Only use groff escapes if `--ascii` has been specified on the command line (`writerPreferAscii`). Closes #8507.
2022-12-22Support "software" type in biblatex <-> CSL conversions.John MacFarlane
Closes #8504.
2022-12-22Make sure "version" field comes through in biblatex.John MacFarlane
See #8504.
2022-12-20T.P.Scripting: Refactor the scripting engine.John MacFarlane
The new type CustomComponents is exported from T.P.Scripting, and the ScriptEngine fields are changed. Instead of separate fields for custom readers and writers, we now have a single function that loads any number of "components" from a script: these may be custom readers, custom writers, templates for writers, or extension configs. (Note: it's possible to have a custom reader and a custom writer for a format together in the same file.) Pandoc now checks the folder `custom` in the user's data directory for a matching script if it can't find one in the local directory. Previously, the `readers` and `writers` data directories were search for custom readers and writers, respectively. Scripts in those directories must be moved to the `custom` folder. Custom readers used to implement a fallback behavior that allowed to consume just a string value as input to the `Reader` function. This has been removed, the first argument is now always a list of sources. Use `tostring` on that argument to get a string. Closes #8417. Signed-off-by: Albert Krewinkel <[email protected]>
2022-12-20T.P.Format: Monoid, Semigroup instance for ExtensionsConfig.John MacFarlane
2022-12-20Shared: use LineBreak as default block sep in blocksToInlinesAlbert Krewinkel
This change also affects the `pandoc.utils.blocks_to_inlines` Lua function. Closes: #8499