Commit graph

5622 commits

Author SHA1 Message Date
John MacFarlane
fe312b0a7a LaTeX writer/template: be sensitive to filecolor variable.
`linkcolor` only affects internal links, and `urlcolor` only
affects linked URLs.  For external links, the option to use is
`filecolor`.

Closes #4822.
2018-08-16 20:48:51 -07:00
John MacFarlane
13dea94a91 Markdown reader: Use "tex" instead of "latex" for raw tex-ish content.
We can't always tell if it's LaTeX, ConTeXt, or plain TeX.
Better just to use "tex" always.

Also changed:

ConTeXt writer: now outputs raw "tex" blocks as well as "context".
(Closes #969).

RST writer: uses ".. raw:: latex" for "tex" content.
(RST doesn't support raw context anyway.)

Note that if "context" or "latex" specifically is desired,
you can still force that in a markdown document by using
the raw attribute (see MANUAL.txt):

    ```{=latex}
    \foo
    ```

Note that this change may affect some filters, if they assume that raw
tex parsed by the Markdown reader will be RawBlock (Format "latex").
In most cases it should be trivial to modify the filters to accept
"tex" as well.
2018-08-15 10:25:12 -07:00
John MacFarlane
dae3a09433 ODT reader: deal gracefully with missing <office:font-face-decls/>.
This allows pandoc to parse ODT document produced by KDE's Calligra.
Closes #4336.
2018-08-14 11:52:14 -07:00
John MacFarlane
c27ce1e70e LaTeX reader: handle parameter patterns for \def.
For example:  `\def\foo#1[#2]{#1 and #2}`.

Closes #4768.  Also fixes #4771.

API change:  in Text.Pandoc.Readers.LaTeX.Types,
new type ArgSpec added.  Second parameter of Macro
constructor is now `[ArgSpec]` instead of `Int`.
2018-08-14 00:03:55 -07:00
John MacFarlane
919c50162c RST writer: render Divs with admonition classes as admonitions.
Also omit Div with class "admonition-title". These are generated
by the RST reader and should be omitted on round-trip.

Closes #4833.
2018-08-13 11:17:26 -07:00
John MacFarlane
c3f17cb0d7 RST writer: use .. container for generic Divs, instead of raw HTML. 2018-08-13 11:00:28 -07:00
John MacFarlane
6d14f53bd9 LaTeX reader: Allow % characters in URLs.
This affects `\href` and `\url`.  Closes #4832.
2018-08-12 16:46:48 -07:00
Alexander Krotov
81131ef5d1 Muse reader: don't allow digits after closing marker in lightweight markup
This change makes reader more compatible with Emacs Muse
2018-08-12 21:20:07 +03:00
Albert Krewinkel
acf6df1aef
Lua: cleanup Lua utils, remove unused functions. 2018-08-12 12:28:06 +02:00
John MacFarlane
b3c9d94fe0 Avoid non-exhaustive pattern match. 2018-08-10 22:31:49 -07:00
John MacFarlane
1e0439710b Avoid incomplete pattern patch. 2018-08-10 22:10:07 -07:00
John MacFarlane
65aea82a04 Avoid non-exhaustive pattern match. 2018-08-10 15:56:43 -07:00
John MacFarlane
6003c596d7 Avoid non-exhaustive pattern match. 2018-08-10 15:44:20 -07:00
John MacFarlane
84e0b90519 Avoid non-exhaustive pattern match. 2018-08-10 15:34:10 -07:00
John MacFarlane
7a1ec21faa Avoid non-exhaustive pattern matches. 2018-08-10 15:22:10 -07:00
John MacFarlane
0ae79275a9 Avoid non-exhaustive pattern match. 2018-08-10 15:17:49 -07:00
John MacFarlane
7bc879268c Avoid non-exhaustive pattern match. 2018-08-10 15:13:19 -07:00
John MacFarlane
e055f1b21e Avoid non-exhaustive pattern match. 2018-08-10 15:05:25 -07:00
John MacFarlane
ec89628984 Avoid a non-exhaustive pattern match. 2018-08-10 14:59:59 -07:00
John MacFarlane
9752dcd61a HTML writer: Don't prefix epub: attributes with data-. 2018-08-08 09:53:13 -07:00
John MacFarlane
b76203ccf1 Markdown reader: Properly handle boolean values in YAML metadata.
This fixes a regression in 2.2.3, which cause boolean values to
be parsed as MetaInlines instead of MetaBool.

Note also an undocumented (but desirable) change in 2.2.3:
numbers are now parsed as MetaInlines rather than MetaString.

Closes #4819.
2018-08-07 09:26:58 -07:00
John MacFarlane
94c3753c08 Fix parsing of embedded mappings in YAML metadata.
This fixes a regression in 2.2.3 which caused embedded mappings
(e.g. mappings in sequences) not to work in YAML metadata.

Closes #4817.
2018-08-06 12:32:04 -07:00
John MacFarlane
581a3514ca RST reader: improve parsing of inline interpreted text roles.
* Use a Span with class "title-reference" for the default
  title-reference role.
* Use B.text to split up contents into Spaces, SoftBreaks, and Strs
  for title-reference.
* Use Code with class "interpreted-text" instead of Span and Str for
  unknown roles.  (The RST writer has also been modified to round-trip
  this properly.)
* Disallow blank lines in interpreted text.
* Backslash-escape now works in interpreted text.
* Backticks followed by alphanumerics no longer end interpreted text.

Closes #4811.
2018-08-05 09:56:43 -07:00
Francesco Occhipinti
74a35b123c RST writer: allow images to be directly nested within links, closes #4810 (#4814) 2018-08-03 12:13:18 -07:00
Mauro Bieg
f83bdb1ac5 Better error message on -t pdf -o out.pdf (#4815)
closes #1155 (again)
2018-08-03 12:04:38 -07:00
Francesco Occhipinti
2661658a69 RST writer: use titleblock instead of title variable for title block
Closes #4803

After this commit use `$titleblock$` in order to get what was contained
in `$title$` before, that is a title and subtitle rendered according to
the official rST method:
http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle. from

With this commit, the `$title$` and `$subtitle$` metadata are available and they
simply carry the metadata values.  This opens up more possibilities in templates.
2018-08-01 12:32:16 -07:00
John MacFarlane
d3d932f42c Markdown reader: allow unquoted numbers, booleans as YAML mapping keys.
Previously in 2.2.2 you could not do

    ---
    0: bar
    ...

but only

    ---
    '0': bar
    ...

With this change, both forms work.
2018-07-30 23:04:53 -07:00
John MacFarlane
cbb662ca07 Use YAML.decode rather than YAML.decodeStrict.
(Minor)
2018-07-30 22:02:59 -07:00
John MacFarlane
78dca68a0a DocBook reader: metadata handling improvements.
Now we properly parse title and subtitle elements that are
direct children of book and article (as well as children of
bookinfo, articleinfo, or info).

We also now use the "subtitle" metadata field for subtitles,
rather than tacking the subtitle on to the title.
2018-07-30 14:38:38 -07:00
Albert Krewinkel
fb94c0f6a1 Lua Utils module: add function blocks_to_inlines (#4799)
Exposes a function converting which flattenes a list of blocks into a
list of inlines. An example use case would be the conversion of Note
elements into other inlines.
2018-07-30 10:55:25 -07:00
danse
be2d7921cb RST reader: remove support for nested inlines.
RST does not allow nested emphasis, links, or other inline
constructs.

Closes #4581, double parsing of links with URLs as
link text.  This supersedes the earlier fix for #4581
in 6419819b46.

Fixes #4561, a bug parsing with URLs inside emphasis.

Closes #4792.
2018-07-24 15:35:50 -07:00
John MacFarlane
50e8c3b107 MediaWiki writer: Avoid extra blank line in tables with empty cells.
Note that the old output is semantically identical, but the
new output looks better.

Closes #4794.
2018-07-24 11:38:24 -07:00
Albert Krewinkel
4e899eb9c8
Org reader: fix parsers relying on parseFromString
Emphasis was not parsed when it followed directly after some block types
(e.g., lists).

The org reader uses a wrapper for the `parseFromString` function to
handle org-specific state. The last position of a character allowed
before emphasis was reset incorrectly in this wrapper. Emphasized text
was not recognized when placed directly behind a block which the reader
parses using `parseFromString`.

Fixes: #4784
2018-07-23 22:05:41 +02:00
John MacFarlane
6419819b46 RST reader: fix double-link bug.
Link labels containing raw URLs were parsed as autolinks,
but links within links are not allowed.

Closes #4581.
2018-07-21 22:53:04 -07:00
John MacFarlane
34b229dd5a Fix for bug in parsing \include in markdown.
Starting in 2.2.2, everything after an `\input` (or `\include`)
in a markdown file would be parsed as raw LaTeX.
This commit fixes the issue and adds a regression test.

Closes #4781.
2018-07-19 17:44:16 -07:00
John MacFarlane
ac1a46b0cb rawLaTeXBlock: never retokenize macroDef. 2018-07-19 13:52:54 -07:00
John MacFarlane
d7edfbdf4d Fix regression finding templates in user data directory.
Under version 2.2.1 and prior pandoc found latex templates in the
templates directory under the data directory, but this no longer
works in 2.2.2.

MANUAL says: "If the template is not found, pandoc will search for it in
the templates subdirectory of the user data directory (see `--data-dir`)."

This commit fixes the regression, which stems from 07bce91.

Closes #4777.
2018-07-18 18:55:12 -07:00
John MacFarlane
af445b34d8 Make markdown and github writers respect the emoji extension. 2018-07-15 16:02:46 -07:00
Anders Waldenborg
ec30fb37c1 Wrap emojis in span nodes (#4759)
Text.Pandoc.Emoji now exports `emojiToInline`, which returns a Span inline containing the emoji character and some attributes with metadata (class `emoji`, attribute `data-emoji` with emoji name).  Previously, emojis (as supported in Markdown and CommonMark readers, e.g "😄")
were simply translated into the corresponding unicode code point.  By wrapping them in Span
nodes, we make it possible to do special handling such as giving them a special font
in HTML output.  We also open up the possibility of treating them differently when the
`--ascii` option is selected (though that is not part of this commit).

Closes #4743.
2018-07-15 15:14:40 -07:00
John MacFarlane
1579e57833 Support abbreviated units for siunitx (#4773). 2018-07-15 13:35:37 -07:00
John MacFarlane
339a9e1b8b LaTeX reader: be more forgiving in key/value option parsing.
We now allow arbitrary LaTeX values.

This helps with #4761. The `\maxwidth` is still not
propagated to the latex destination, but at least we don't
choke on parsing.
2018-07-15 12:53:42 -07:00
Mauro Bieg
5809d5bef2 AsciiDoc Writer: escape square brackets at start of line (#4708)
closes #4545
2018-07-12 19:37:37 +02:00
John MacFarlane
146555e636 PDF: revert fix for #4484 (only compress images on last run).
Closes #4755.

This will mean some increase in the time it takes to
produce an image-heavy PDF with xelatex, but it will
make tables of contents correct, which is more important.

Note that the production time should also be decreased
by the previous commit, which fixed a logic error
affecting the number of runs.  That change might mitigate
the effect of this one.
2018-07-06 23:51:20 +02:00
John MacFarlane
55e8cb07d0 PDF: Fix logic error in runTeXProgram.
We were running the tex program one more time than requested.
This should speed up pdf production.
2018-07-06 23:43:43 +02:00
Alexander Krotov
5479ea300a JATS reader: fix typo ("lable" instead of "label") 2018-07-02 18:31:46 +03:00
Alexander Krotov
f6dfb632ff Spellcheck comments 2018-07-02 18:30:37 +03:00
John MacFarlane
016e0a09e2 RST writer: don't treat 'example' as a syntax name.
This fixes conversions from org with example blocks.
Closes #4748.
2018-06-30 11:45:49 +02:00
John MacFarlane
5d78ad12b2 Fix compiler warnings. 2018-06-29 23:47:07 +02:00
John MacFarlane
e49b8304e4 Use HsYAML instead of yaml for translations, YAML metadata.
yaml wraps a C library; HsYAML is pure Haskell.
Closes #4747.  Advances #4535.
2018-06-29 23:21:25 +02:00
John MacFarlane
6ed114cb5d Use decodeEither' not decodeEither (deprecated). 2018-06-29 11:47:58 +02:00