Commit graph

13984 commits

Author SHA1 Message Date
John MacFarlane
03c897c7ee
Merge pull request #6949 from wikey/patch-1
typo
2020-12-14 10:05:54 -08:00
John MacFarlane
39153ea6e2 ImageSize: use exif width and height when available.
After the move to JuicyPixels, we were getting incorrect
width and heigh information for some images (see #6936, test-3.jpg).

The correct information was encoded in Exif tags that
JuicyPixels seemed to ignore. So we check these first
before looking at the Width and Height identified by
JuicyPixels.

Closes #6936.
2020-12-14 09:39:07 -08:00
Ian Sullivan
c1fb4d3729
typo 2020-12-14 12:37:17 -05:00
John MacFarlane
c43e2dc0f4 RST writer: better image handling.
- An image alone in its paragraph (but not a figure) is now
  rendered as an independent image, with an `alt` attribute
  if a description is supplied.
- An inline image that is not alone in its paragraph will
  be rendered, as before, using a substitution.
  Such an image cannot have a "center", "left", or
  "right" alignment, so the classes `align-center`,
  `align-left`, or `align-right` are ignored.
  However, `align-top`, `align-middle`, `align-bottom`
  will generate a corresponding `align` attribute.

Closes #6948.
2020-12-13 15:25:46 -08:00
John MacFarlane
32902d0fad
Merge pull request #6941 from tarleb/docx-raw
Docx writer: keep raw openxml strings verbatim
2020-12-13 11:08:41 -08:00
John MacFarlane
c3aa90b57a ImageSize: use JuicyPixels to extract size...
...for png, jpeg, gif, instead of doing our own binary parsing.
See #6936.
2020-12-13 10:33:46 -08:00
John MacFarlane
2ce14997ad Require binary >= 0.7.
Needed for runGetOrFail.
2020-12-13 10:33:46 -08:00
John MacFarlane
ef62b70646 ImageSize: use JuicyPixels to determine png size. 2020-12-13 10:33:46 -08:00
Albert Krewinkel
00031fc809
Docx writer: keep raw openxml strings verbatim.
Closes: #6933
2020-12-13 14:09:59 +01:00
Albert Krewinkel
8cf58d96e0
Docx writer: use Content instead of Element. 2020-12-13 14:09:53 +01:00
John MacFarlane
3a7d97f02f
Merge pull request #6946 from mb21/icml-image-fit
ICML writer: fix image bounding box for custom widths/heights
2020-12-12 08:28:14 -08:00
Albert Krewinkel
ccd235e31f
LaTeX writer: extract table handling into separate module. 2020-12-12 16:48:28 +01:00
mb21
208cb96196 ICML writer: fix image bounding box for custom widths/heights
fixes #6936
2020-12-12 14:49:11 +01:00
John MacFarlane
fcd0658189 HTML reader: pay attention to lang attributes on body.
These (as well as lang attributes on html) should update
lang in metadata. See #6938.
2020-12-10 15:51:20 -08:00
John MacFarlane
0a502e5ff5 HTML reader: retain attribute prefixes and avoid duplicates.
Previously we stripped attribute prefixes, reading
`xml:lang` as `lang` for example. This resulted in
two duplicate `lang` attributes when `xml:lang` and
`lang` were both used.  This commit causes the prefixes
to be retained, and also avoids invald duplicate
attributes.

Closes #6938.
2020-12-10 15:44:10 -08:00
John MacFarlane
248a2a1db5 cabal: remove -Werror=missing-home-modules.
It causes problems using cabal repl.
2020-12-10 10:27:31 -08:00
John MacFarlane
9af5664181 RELEASE-CHECKLIST: add suggestion to use policeman. 2020-12-10 10:08:44 -08:00
John MacFarlane
1fd642dd30 Move executable to app directory.
Otherwise we have problems with cabal repl.
2020-12-10 10:08:24 -08:00
John MacFarlane
a3eb87b2ea Add sourcepos extension for commonmarke
* Add `Ext_sourcepos` constructor for `Extension`.
* Add `sourcepos` extension (only for commonmark).
* Bump to 2.11.3

With the `sourcepos` extension set set, `data-pos` attributes are added
to the AST by the commonmark reader. No other readers are affected.  The
`data-pos` attributes are put on elements that accept attributes; for
other elements, an enlosing Div or Span is added to hold the attributes.

Closes #4565.
2020-12-10 08:59:55 -08:00
John MacFarlane
8c9010864c Commonmark reader: refactor specFor, set input name to "". 2020-12-10 08:59:55 -08:00
Albert Krewinkel
b15191aece
cabal.project: disable installation of citeproc from source 2020-12-10 08:11:05 +01:00
John MacFarlane
0dd228593f Use latest citeproc release. 2020-12-09 09:34:15 -08:00
John MacFarlane
d73ef09c84 Document that --number-sections works in ms.
Closes #6935.
2020-12-08 15:14:34 -08:00
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