Commit graph

13961 commits

Author SHA1 Message Date
John MacFarlane
5990cbb150 Parsing: Small code improvements. 2020-12-07 21:34:23 -08:00
John MacFarlane
8031ac137f LaTeX template: include csquotes package if csquotes variable set. 2020-12-07 18:57:24 -08:00
John MacFarlane
0fa1023b9e Parsing: More minor performance improvements. 2020-12-07 18:57:09 -08:00
John MacFarlane
ce1791913d Small efficiency improvement in uri parser 2020-12-07 13:24:19 -08:00
John MacFarlane
2f9b684b3a Bibtex parser: avoid noneOf. 2020-12-07 13:01:30 -08:00
John MacFarlane
f2749ba6cd Parsing: in nonspaceChar use satisfy instead of oneOf.
For efficiency.
2020-12-07 12:56:03 -08:00
John MacFarlane
501ea7f0c4 Dokuwiki reader: handle unknown interwiki links better.
DokuWiki lets the user define his own Interwiki links.
Previously pandoc reacted to these by emitting a
google search link, which is not helpful. Instead,
we now just emit the full URL including the
wikilink prefix, e.g. `faquk>FAQ-mathml`.
This at least gives users the ability to
modify the links using filters.

Closes #6932.
2020-12-07 12:15:14 -08:00
John MacFarlane
810df00cf5
Merge pull request #6922 from jtojnar/db-writer-admonitions
Docbook writer: handle admonitions
2020-12-07 08:48:02 -08:00
Jan Tojnar
70c7c5703a
Docbook writer: Handle admonition titles from Markdown reader
Docbook reader produces a `Div` with `title` class for `<title>` element
within an “admonition” element. Markdown writer then turns this
into a fenced div with `title` class attribute. Since fenced divs
are block elements, their content is recognized as a paragraph
by the Markdown reader. This is an issue for Docbook writer because
it would produce an invalid DocBook document from such AST –
the `<title>` element can only contain “inline” elements.

Let’s handle this invalid special case separately by unwrapping
the paragraph before creating the `<title>` element.
2020-12-07 07:28:39 +01:00
Jan Tojnar
16ef877457
Docbook writer: Use correct id attribute consistently
DocBook5 should always use xml:id instead of id so let’s use it everywhere.
2020-12-07 06:23:25 +01:00
Jan Tojnar
dc6856530c
Docbook writer: handle admonitions
Similarly to d6fdfe6f2b,
we should handle admonitions.
2020-12-07 06:23:25 +01:00
Albert Krewinkel
acf932825b
Org reader: preserve targets of spurious links
Links with (internal) targets that the reader doesn't know about are
converted into emphasized text. Information on the link target is now
preserved by wrapping the text in a Span of class `spurious-link`, with
an attribute `target` set to the link's original target. This allows to
recover and fix broken or unknown links with filters.

See: #6916
2020-12-05 22:37:48 +01:00
Nils Carlson
c161893f44
OpenDocument writer: Allow references for internal links (#6774)
This commit adds two extensions to the OpenDocument writer,
`xrefs_name` and `xrefs_number`.

Links to headings, figures and tables inside the document are
substituted with cross-references that will use the name or caption
of the referenced item for `xrefs_name` or the number for `xrefs_number`.

For the `xrefs_number` to be useful heading numbers must be enabled
in the generated document and table and figure captions must be enabled using for example the `native_numbering` extension.

In order for numbers and reference text to be updated the generated
document must be refreshed.

Co-authored-by: Nils Carlson <nils.carlson@ludd.ltu.se>
2020-12-05 10:00:04 -08:00
John MacFarlane
ddb76cb356 LaTeX reader: don't apply theorem default styling to a figure inside.
If we put an image in italics, then when rendering to Markdown
we no longer get an implicit figure.

Closes #6925.
2020-12-05 09:53:39 -08:00
Jan Tojnar
6f35600204
Docbook writer: add XML namespaces to top-level elements (#6923)
Previously, we only added xmlns attributes to chapter elements,
even when running with --top-level-division=section.
Let’s add the namespaces to part and section elements too,
when they are the selected top-level divisions.

We do not need to add namespaces to documents produced with
--standalone flag, since those will already have xmlns attribute
on the root element in the template.
2020-12-04 21:00:21 -08:00
John MacFarlane
dc3ef5201f Markdown writer: ensure that a new csl-block begins on a new line.
This just looks better and doesn't affect the semantics.
See #6921.
2020-12-04 10:55:48 -08:00
John MacFarlane
68bcddeb21 LaTeX writer: Fix bug with nested csl- display Spans.
See #6921.
2020-12-04 10:14:19 -08:00
John MacFarlane
171d3db384 HTML writer: Fix handling of nested csl- display spans.
Previously inner Spans used to represent
CSL display attributes were not rendered as div tags.

See #6921.
2020-12-04 09:47:56 -08:00
John MacFarlane
7199d68ba0 EPUB writer: include title page in landmarks.
Closes #6919.

Note that the toc is also included if `--toc` is specified.
2020-12-03 21:39:44 -08:00
John MacFarlane
9c6cc79c11 EPUB writer: add frontmatter type on body element for nav.xhtml.
Closes #6918.
2020-12-03 21:24:27 -08:00
John MacFarlane
5bbd5a9e80 Docx writer: Support bold and italic in "complex script."
Previously bold and italics didn't work properly in LTR
text.  This commit causes the w:bCs and w:iCs attributes
to be used, in addition to w:b and w:i, for bold and
italics respectively.

Closes #6911.
2020-12-03 09:51:23 -08:00
Kolen Cheung
aab54c4325
Add translations zh-Hans.yaml and zh-Hant.yaml
Closes #6904, closes #6909.

Co-authored-by: taotieren <admin@taotieren.com>
2020-12-02 21:00:57 -08:00
Randolf J
f1bd176d81
filters.md: document a new Pandoc filtering framework (#6908) 2020-12-02 12:28:38 -08:00
John MacFarlane
7b11cdee49 Citeproc: ensure that BCP47 lang codes can be used.
We ignore the variants and just use the base lang code
and country code when passing off to citeproc.
2020-12-02 10:46:23 -08:00
John MacFarlane
4ca0d590e2 Use a more recent stack resolver. 2020-11-30 23:02:24 -08:00
John MacFarlane
0240623eda Use doctemplates 0.8.3.
Fixes issues with nested for loops in templates.
2020-11-30 22:45:12 -08:00
John MacFarlane
bff9c129c3 LaTeX reader: don't parse \rule with width 0 as horizontal rule. 2020-11-29 10:35:20 -08:00
Tassos Manganaris
83d63b72e1 Fix a tiny Typo in the CSV reader module
Header comment in the CSV reader module says "RST" instead of "CSV".
2020-11-28 09:40:15 +01:00
Albert Krewinkel
8c38390038
HTML reader tests: improve test coverage of new features 2020-11-27 21:21:25 +01:00
Albert Krewinkel
3a2d993165
CONTRIBUTING: add section "How can I help?" (#6892)
Also adds a paragraph aimed at highlighting the importance of feature
maintenance.
2020-11-27 09:13:02 -08:00
Shin Sang-jae
97b70d20bb
EPUB: use preserveAspectRatio="xMidYMid" for cover image (#6895)
This change affects both the epub2 and the epub3 templates.
It avoids distortion of the cover image by requiring that the aspect ratio be preserved.
2020-11-27 09:11:40 -08:00
Albert Krewinkel
a9c766291f
HTML reader: support body headers, row head columns
Closes: #6312
2020-11-27 10:36:13 +01:00
John MacFarlane
db2db54f80 Added some explicit imports. 2020-11-26 12:44:01 -08:00
John MacFarlane
b0e2d7ded6 Add hie.yaml generated by implicit-cradle. 2020-11-26 12:32:26 -08:00
cholonam
5f4deb5455 Docx writer: Fix bullets/lists indentation
Fix appearance of bullets/numbered lists (the first level is slightly
indented to the right instead of right on the margin).

New golden files have been tested using Word 2010 on Windows 10.
2020-11-26 12:11:26 -08:00
Igor Pashev
630b1bff2b
LaTeX reader: preserve center environment (#6852)
The contents of the `center` environment are put in a `Div`
with class `center`.
2020-11-26 12:04:31 -08:00
Albert Krewinkel
07919e1b22
HTML reader: improve support for table headers, footer, attributes
- `<tfoot>` elements are no longer added to the table body but used as
  table footer.
- Separate `<tbody>` elements are no longer combined into one.
- Attributes on `<thead>`, `<tbody>`, `<th>`/`<td>`, and `<tfoot>`
  elements are preserved.
2020-11-26 07:22:01 +01:00
Albert Krewinkel
3e01ae405f
HTML reader: allow finer grained options for tag omission 2020-11-26 07:22:01 +01:00
John MacFarlane
ce606cb688 Fix pre-commit hook so it doesn't catch .latex+lhs extensions. 2020-11-25 16:09:50 -08:00
John MacFarlane
ea8097e412 latex template: put back amssymb
We need it for checkboxes in todo lists, and maybe for
other things.  In this location it seems compatible
with the cases that propmted #6469 and PR #6762.
2020-11-25 16:08:10 -08:00
John MacFarlane
70a7c2446e Update tests for LaTeX table changes. 2020-11-25 15:49:17 -08:00
John MacFarlane
7c4d7db9c7 LaTeX writer: improve longtable output.
- Don't create minipages for regular paragraphs.
- Put width and alignment information in the longtable column
  descriptors.
- Closes #6883.
2020-11-25 15:42:44 -08:00
John MacFarlane
b50ac3a95b LaTeX tables: Fix calculation of column spacing.
See #6883.
2020-11-25 14:41:28 -08:00
John MacFarlane
815976d537 Fix truncation of [Citation] list in Cite inside footnotes...
This affected author-in-text citations in footnotes.
It didn't cause problems for the printed output, but for
filters that expected the citation id and other information.

Closes #6890.
2020-11-25 09:10:10 -08:00
Albert Krewinkel
c6f2663a23
HTML reader: simplify list attribute handling
This removes the `foldOrElse` function from the internal Text.Pandoc.CSS
module.
2020-11-25 17:55:42 +01:00
John MacFarlane
e26d31d56b latex template: disable language-specific shorthands in babel.
Babel defines "shorthands" for some languages, and these can
produce unexpected results. For example, in Spanish, `1.22`
gets rendered as `122`, and `et~al.` as `etal`.

One would think that babel's `shorthands=off` option (which
we were using) would disable these, but it doesn't.  So we
remove `shorthands=off` and add some code that redefines
the shorthands macro.  Eventually this will be fixed in babel,
I hope, and we can revert to something simpler.

Closes #6817, closes #6887.
2020-11-25 08:25:30 -08:00
Kolen Cheung
bfb2a492c8
test/tables/*.native: normalized (#6888)
The 3 native table test cases are normalized so that it will looks exactly like it is written by some pandoc writers.

Note that apart from white space normalization, it includes other normalization such as `[Str "Nordic countries"] to [Str "Nordic",Space,Str "countries"]`.
2020-11-24 22:33:36 -08:00
John MacFarlane
1489bb8414 Use skylighting 0.10.1. 2020-11-24 21:26:25 -08:00
Albert Krewinkel
0eedbd0a3d
HTML reader tests: disable round-trip testing for tables
Information for cell alignment in a column is not preserved during
round-trips.
2020-11-24 15:46:11 +01:00
Albert Krewinkel
c9f98e2bf5
HTML reader: support row or column-spanning table cells 2020-11-24 14:17:35 +01:00