789 Commits
Author SHA1 Message Date
John MacFarlane 2c8de4c129 Typst writer: use #footnote for notes.
Closes #8893.
2023-06-05 16:07:36 -07:00
Michael Stahl 16be353077 Writers.ODT: don't add settings.xml
The way "ooo:configuration-settings" work is that if LibreOffice Writer
loads a file in which it exists, it assumes that an old version of
itself has produced it and it defaults any config-item that it knows but
that doesn't exist in the file to the "backward-compatible" value, which
usually means to enable some layout or text formatting bugs so that the
document looks the same as in the old LO version that created it.

If there is no "ooo:configuration-settings" then it will use the default
values for a new document, which should give the best formatting
results.

Pandoc's documents are obviously not created by LO, so it doesn't make
sense to produce ooo:configuration-settings.

Regarding the "ooo:view-settings", IIRC these mainly set to the
document view to the position where the document was last edited (by
default only if the user in meta.xml matches the user data in LO's
configuration), which is also irrelevant for Pandoc.

So just leave out the settings.xml; only content.xml/styles.xml are
required (see ODF 1.3, part 3, 2.2.1 OpenDocument Document, A.2).

(The settings.xml that is produced for formulas by the documentSettings
function hopefully isn't problematic because LO Math works a bit
differently and stores important formatting attributes in settings.xml
because MathML doesn't allow it in content.xml.)
2023-04-28 12:17:22 -07:00
Michael Stahl 60e72b2542 Writers.ODT: don't add Configurations2 dir
This empty file is some ancient OOo wart and it's quite pointless here.
2023-04-28 12:17:22 -07:00
Michael Stahl 54c0c494a2 Writers.ODT: don't add thumbnail
Quite pointless to add a hardcoded image that doesn't show the
document content.
2023-04-28 12:17:22 -07:00
Michael Stahl f3e1d33ea0 Writers.ODT: stop validator complaints by producing ODF 1.3
The ODF validator complains about an invalid attribute
style:contextual-spacing in styles.xml, ultimately an implementation
error in whatever old version of LibreOffice that produced the
data/odt/styles.xml (should have put it into an extension namespace).

Fortunately the attribute was added to ODF 1.3, which was released a
couple years ago.

So the easiest fix is to simply produce ODF 1.3 instead of 1.2; it's
supposed to be fully backward compatible.
2023-04-28 12:17:22 -07:00
Gabriel Lewertowski b21dee8198 add lang attribute to html tag in epub tpl 2023-04-27 16:27:08 -07:00
John MacFarlane d79c53ba12 Fix YAML in translation files for cs and pl.
The colon needs quoting.

Closes #8787.
2023-04-17 11:26:54 -07:00
John MacFarlane e89a3edf24 Typst writer: omit bibliography if citations not enabled.
With this change, the typst writer will omit the `#bibliography`
command when `citations` is not enabled.  (If you want to use
pandoc's own `--citeproc`, you should combine it with
`-t typst-citations` to disable native typst citations.

Closes #8763.
2023-04-07 08:24:47 -07:00
Albert Krewinkel 832d66e8a3 styles.html: fix task-list styling in reveal.js
Fixes: #8731
2023-03-29 11:15:47 -07:00
John MacFarlane a5159c2c50 Fix \babelfont in default latex template.
The first invocation should not specify a language, because
it's the default.  If we specify a language, we get an error
in some cases.  Closes #8728.
2023-03-28 16:23:51 -07:00
John MacFarlane fd85560b84 Typst: Use customized term instead of custom macro for def lists. 2023-03-27 10:47:15 -07:00
John MacFarlane 4780b4760d More Typst writer improvements.
+ Update manual with variables for Typst.
+ Split `lang` metadata into separate `lang` and `region` for Typst.
+ Fix label positioning in Divs.
+ Fix text customizations (lang, region, font, size) so they actually
  work.
+ Update tests and man page.
2023-03-26 21:32:31 -07:00
John MacFarlane cd6b3bde62 Typst writer improvements.
+ Fix non-decimal enumerated lists.
+ Fix endnotes ending with code blocks.
+ Improve default template to use a typst template.
+ Factor out definitions and typst template into partials.
+ Properly escape backslash and quote inside double quotes.
+ Update tests.
2023-03-26 19:02:05 -07:00
John MacFarlane 9edf965712 Add typst writer.
See #8713.
2023-03-25 22:05:52 -07:00
John MacFarlane 22996abf69 LaTeX template: set mainfontoptions with \babelfont too.
Closes #8721.
2023-03-25 15:16:54 -07:00
John MacFarlane 5af2d70b0d Fix highlight/underline with lualatex.
We need the lua-ul package instead of soul, which doesn't
work with lualatex.

Updates default latex template.

Closes #8707.
2023-03-20 08:05:28 -07:00
John MacFarlane 80e750aa5e Docx writer: include abstract title.
Closes #8702.

Uses localized term for abstract.
2023-03-17 20:06:17 -07:00
John MacFarlane 369e7b52e8 Fix template for babelfonts so it conforms with documentation.
Closes #8697.
2023-03-15 09:20:39 -07:00
John MacFarlane 9b04036f6b Add babelfonts variable to default LaTeX template.
This allows specifying certain fonts to be used with
certain babel languages.

Thanks to Frederik Elwert.
2023-03-10 14:19:02 -08:00
Martín Pozo 5f82c4fd10 Fix background image in Beamer when there are figure environments (#8671) 2023-03-06 08:42:59 -08:00
Yudong Jin a1b7078bd3 LaTeX template: Add CJKsansfont and CJKmonofont for XeLaTeX (#8656)
`CJKsansfont` and `CJKmonofont` will be set for xelatex only if `CJKmainfont` is also provided.
2023-02-26 13:47:23 -08:00
arcnmx 9c39d1632e asciidoc{,tor} template: fix revision date when author is unset
Revision line syntax is only valid in combination with an author line,
so the date attribute must be set explicitly when the author is missing

fixes #8637
2023-02-21 09:42:57 -07:00
John MacFarlane 5889d70a97 Retain metadata in processing sections for chunked HTML.
Previously we suppressed metadata in all but the top page,
in order to prevent the title block from being printed
on every page. This prevented use of custom variables set
by metadata fields.

This commit moves to a better solution: a conditional
in the default template restricts the title block to the
top page.

Closes #8620.
2023-02-15 15:48:11 -08:00
John MacFarlane 4bcce62c90 Include needed polyfill when MathJaX is used.
Closes #8625.
2023-02-14 14:27:22 -08:00
Thomas Hodgson 351a8e6c7c URL style in ConTeXt (#8612)
Previously, a URL like this would be in monospace text: `\useURL[url1][https://example.com]`.
Now, it will match the main text unless the `linkstyle` variable is set, which controls the styling of all links.
Closes #8602.

Added documentation for `urlstyle` variable in the ConTeXt template, and added detail to its
documentation in the LaTeX template.
2023-02-12 13:32:40 -08:00
Albert Krewinkel c71d476fa6 ConTeXt writer: support tagging extension [API Change]
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-15 10:03:58 -08:00
Albert KrewinkelandAner Lucero 909ced5153 Support complex figures. [API change]
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 <4rgento@gmail.com>
2023-01-13 09:13:27 -08:00
John MacFarlane 8a10300785 HTML style template: put Consolas before Lucida Console for code font.
This is to prevent Lucida Console from being used on Windows, where
there seems to be a spacing issue in some applications, with boldface
glyphs wider than regular ones.

Closes #8543.
2023-01-13 08:47:19 -08:00
John MacFarlane 8a2418cc29 LaTeX template: set \babelfont...
when `mainlang` and a lang are specified and pdflatex is not being used.
This is needed for good results in Arabic and doesn't seem to hurt
for other languages we've tried.

Closes #8538.
2023-01-11 09:40:31 -08:00
John MacFarlane ec23d938e0 Add ChunkedHTML writer.
- 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-11 09:08:16 -08:00
John MacFarlane a682e72c03 Add code { hyphens: manual; } to HTML and EPUB CSS.
Closes #8530.
2023-01-06 10:50:48 -08:00
John MacFarlane 355794549d epub.css: comment out flex rules.
This fixes commit 3666d79ae7
which closed #8379.
2023-01-02 22:35:17 -08:00
Albert Krewinkel 528013b2fe Reveal.js template: prevent line-wrapping of parallax options
Fixes: #8503
2022-12-22 12:07:30 +01:00
John MacFarlane 21baefbbbb Fix class name hanging -> hanging-indent in styles.citations.html. 2022-12-21 15:55:23 -08:00
Albert Krewinkel e83120fd2d ConTeXt writer: support syntax highlighting for code. 2022-12-18 15:47:48 +01:00
John MacFarlane 09af316f36 Update default CSL with latest chicago-author-date.csl.
This removes some weird punctuation overrides for Portuguese.
Closes jgm/citeproc#123.
2022-12-12 07:54:00 -08:00
John MacFarlane 144bf90ab9 LaTeX writer: Use soul instead of ulem for strikeout, underline.
This handles things like hyphenation, line breaks, and nonbreaking
spaces better.

Closes #8411.
2022-11-19 12:28:41 -08:00
Amar Al-Zubaidi 03e478ee2c Add LaTeX variable urlstyle (#8429)
This is set to `same` by default, so users should not experience any change.
2022-11-10 08:39:14 -08:00
John MacFarlane 334903bb9d HTML template: remove default font size, line height...
...and font family in default inline css.  Closes #8423
(see comments there for motivation).  `mainfont`, `fontsize`,
and `linestretch` can still be used as before; the only difference
is that we no longer provide opinionated defaults.

This commit also adds a `maxwidth` variable that sets `max-width`;
if not set, 36em is used as a default.
2022-11-09 17:03:12 -08:00
John MacFarlane 2dfa5e06b7 Remove stray character in epub.css. 2022-11-06 20:46:41 -08:00
Marcin Serwin 347fe49115 Change default background color of PDFs generated via HTML (#8422)
* Change default background color of PDFs generated via HTML

* Update tests
2022-11-04 18:13:02 -07:00
John MacFarlane 56e35cd958 epub.css: left-align h1, as before. 2022-11-02 10:16:44 -07:00
Albert Krewinkel 79d6b45566 Remove sample.lua from data files (#8397)
The file is kept around in the pandoc-lua-engine test-suite.

Closes: #8356
2022-10-24 09:46:42 -07:00
John MacFarlane 1a61eec293 Adjust tests for CSS change; add CSS comments to mark...
highlighting CSS and citations CSS in the source.
2022-10-17 16:59:56 -07:00
John MacFarlane 5ca064b401 Fix typo introduced by recent commit in styles.html. 2022-10-17 16:31:01 -07:00
John MacFarlane 0cc48b560e Use styles.citations.html partial in styles.html. 2022-10-17 15:09:40 -07:00
John MacFarlane 3666d79ae7 EPUB CSS changes.
With this change, we reduce the amount of inline CSS used
for EPUBs.  Almost everything is now in the default EPUB
CSS (`data/epub.css`), which can be overridden either by
putting `epub.css` in the user data directory or by using
`--css` on the command line.  Inline styles are only used
for syntax highlighting (which depends on the style specified,
and is only included on pages with highlighted code) and
for bibliography formatting (which can depend on the CSL
style, and is only used in the page containing the bibliography).

Note that, for compatibility with older readers, we don't
use flexbox to style `column/columns` divs by default, as
we do in HTML.  Instead, we use an older method which only
works when there are two `column` divs inside a `columns`
div.  If you need more than two columns and aren't worried
about support for older EPUB readers, you can modify the
default CSS (there is a comment in the CSS telling you what to do).

Closes #8379.
2022-10-17 13:36:18 -07:00
Jeremie Knuesel 644c984169 latex template: set fonts after Beamer theme
Beamer themes such as metropolis and saintpetersburg change the default
fonts. This change gives precedence to the user font settings by moving
them after the loading of the Beamer theme.
2022-10-06 10:14:38 -07:00
Albert Krewinkel 309163f5bc [API Change] Base custom writers on Writer type.
The `T.P.Lua.writeCustom` function changed to allow either a TextWriter
or ByteStringWriter to be returned. The global variables
`PANDOC_DOCUMENT` and `PANDOC_WRITER_OPTIONS` are no longer set when the
writer script is loaded. Both variables are still set in classic writers
before the conversion is started, so they can be used when they are
wrapped in functions.
2022-10-03 08:47:32 -07:00
Link Swanson 4e29d6d379 Remove unsupported element from pptx reference doc (#8342)
The default template contained text above the header, which can mislead
users into thinking there is a way to put  text there using pandoc

See #6338.
2022-10-01 10:30:07 -07:00