764 Commits
Author SHA1 Message Date
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
John MacFarlane 1393037f4e LaTeX writer: use \includesvg for SVGs...
...and include the `svg` package.
Closes #8334.
2022-09-29 09:31:39 -07:00
Albert Krewinkel 16d134218b HTML writer: revert to using width property for column widths
The default `flex` and `overflow-x` properties of a column are set to
`auto`. In combination, these changes allow to get good results when
using columns with or without explicit widths.
2022-08-22 15:32:39 +02:00
luz paz aff726b460 Fix typos
Found via `codespell -q 3 -S changelog.md -L bu,fo,ist,mke,multline,noes,ot,pard,pres,tabl,te,tothe`
2022-08-21 20:23:00 -07:00
Albert Krewinkel 90d8205e17 Org template: add abstract from metadata as block of type "abstract"
See #8204.
2022-08-17 16:40:54 +02:00
Albert Krewinkel eb18267407 LaTeX template: fix behavior of colorlinks variable
Fixes a regression that required the `boxlinks` variable to be set in
addition to the usual link coloring variables. Otherwise links were
never colored in LaTeX PDF output.

Fixes: #8226
2022-08-12 00:11:10 +02:00
John MacFarlane 473c3f22ec Improve default CSS for task lists.
This ensures that there is a space between the checkbox
and the following content and that subsequent content lines up.

Closes #8151.

Supersedes and closes #8163.
2022-08-03 09:51:21 -07:00
Albert Krewinkel 0e8f424d9e HTML: use CSS flex boxes for columns.
This allows to render an arbitrary number of columns, while the previous
approach assumed exactly two columns.
2022-08-01 10:12:13 -07:00
John MacFarlane d2bd9abc4d Html template styles: remove span.underline.
Now we use `<u>` elements for underlined text, so this is
superfluous. (@mb21 correct me if I'm wrong.)
2022-07-31 09:51:54 -07:00
John MacFarlane c97c4761a8 Add boxlinks variable for LaTeX/PDF output.
If `boxlinks` is set but `colorlinks` is not, then boxes will
be printed around links (`hidelinks` will not be set in `hypersetup`).

Addresses #8198.
2022-07-26 09:48:17 -07:00
John MacFarlane c950a28191 ms template: redefine rather than removing .CH macro.
This responds to feedback in #8175.
2022-07-12 00:03:51 +02:00
John MacFarlane 05ab2060d6 ms writer: add comment in preamble stating generator. 2022-07-11 23:40:45 +02:00
Albert Krewinkel 41af476a3d JATS template: mark authors with cor-id as corresponding authors
Corresponding authors are marked by setting the attribute
`corresp="yes"` in their respective `<contrib>` element.
2022-06-24 15:44:38 +02:00
Castedo Ellerman e7269beeb6 Follow JATS4R recommendation and PudMed Central (#8041)
Using the default jats template of pandoc 2.18, the https://jats4r.org/jats4r-validator/ warns: "The license URI is given in `@xlink:href`. For JATS 1.1d3 and later, if the license is defined by a canonical URI, then it should be specified in the `<ali:license_ref>` child element."

I can confirm that what JATS4R recommends here is consistent with the JATS article packages found on the FTP site for the
PubMed Central Open Access Subset <https://www.ncbi.nlm.nih.gov/pmc/tools/openftlist/> (at least with the eLife article I looked at).

This proposed change follows the JATS4R recommendation and an example eLife article on the PubMed Central FTP site.
2022-06-22 10:17:24 -07:00
Albert Krewinkel f49bee5c31 ConTeXt writer: support complex table structures. (#8116)
The following table feature are now supported in ConTeXt:

- colspans,
- rowspans,
- multiple bodies,
- row headers, and
- multi-row table head and foot.

The wrapping `placetable` environment is also given a `reference` option
with the table identifier, enabling referencing of the table from within
the document.
2022-06-21 10:22:34 -07:00
John MacFarlane 786a2d4757 Update default.csl from the latest chicago-author-date.csl. 2022-06-14 20:42:49 -06:00
Albert Krewinkel e5c41f11de ConTeXt writer: use "sectionlevel" environment for headings (#8106)
The document hierarchy is now conveyed using the
`\startsectionlevel`/`\stopsectionlevel` by default. This makes it easy
to include pandoc-generated snippets in documents at arbitrary levels.
The more semantic environments "chapter", "section", "subsection", etc.
are used if the `--top-level-division` command line parameter is set to
a non-default value.

Closes: #5539
2022-06-06 09:24:28 -07:00
Albert Krewinkel 9c29d840ff LaTeX template: fix links-as-notes
The redefinition of `\href` when using `links-as-notes` must happen
after the hyperref package has been loaded.

Fixes: #8077
2022-05-17 16:12:53 +02:00
Albert Krewinkel 843eeae13d JATS template: include particles, prefix, suffix in names 2022-05-01 13:02:53 +02:00
Albert Krewinkel 3f354ce4b8 JATS template: unconditionally include permissions element
Fixes a bug that caused license information to be omitted when no copyright
information was provided.

Fixes: #8040
2022-04-26 17:48:27 +02:00
Hos Es b1990b0657 LaTeX template: Fix <200c> character rendering (#8036)
Renamed `\textormath` to `\TextOrMath`.
2022-04-23 11:38:47 +02:00
Albert Krewinkel dbc80c1a6b JATS template: allow multiple licenses to be given.
The `license` metadata field can now be used to set the license of an
article; a list can be used to add multiple license statements.
2022-04-04 10:05:32 +02:00
Albert Krewinkel c694a6e4f5 JATS template: allow multiple copyright statements, years, holders 2022-04-02 15:29:37 +02:00
John MacFarlane 9053214fba LaTeX template: Move urlstyle and xurl commands to after hyperref.
Closes #7978.
2022-03-21 10:42:18 -07:00
John MacFarlane c9cf8568bf LaTeX template: Fix regression with code in footnotes...
...due to moving hyperref later in the template.

Closes #7964.
2022-03-14 12:28:56 -07:00
John MacFarlane 8d3959ea29 Remove special redefinition of \sout.
This used to be necessary to avoid problems with hyperref,
when headings contain strikeout text, but it does not seem to be
necessary any more (tested).
2022-03-13 17:18:31 -07:00