Commit graph

8735 commits

Author SHA1 Message Date
John MacFarlane
ddc2b9024f LaTeX reader: support all \textXX commands.
where XX = rm, tt, up, md, sf, bf.

Spans with a class are used when there is nothing better.

Closes #3488.
2017-03-05 20:21:29 +01:00
John MacFarlane
e20f55618f Markdown reader: fixed internal header links.
Closes #2397.

This patch also adds `shortcut_reference_links` to the list
of mmd extensions.
2017-03-05 16:34:47 +01:00
John MacFarlane
aeb11cea4e Markdown writer: escape initial % in a paragraph...
...if the `pandoc_title_blocks` extension is enabled.
Otherwise in a document starting with a literal percent sign
the first line is wrongly interpreted as a title.

Closes #3454.
2017-03-05 15:28:57 +01:00
John MacFarlane
6530bc4471 LaTeX reader: small improvements in parsing arguments. 2017-03-05 11:17:03 +01:00
John MacFarlane
3ff41fe7f4 LaTeX reader: Handle spaces before \cite arguments. 2017-03-05 11:10:11 +01:00
John MacFarlane
2fee07795c Added a markdown abbrevation test case. 2017-03-05 10:44:25 +01:00
John MacFarlane
95f2726ee7 Added readerAbbreviations to ParserState.
Markdown reader now consults this to determine what is an
abbreviation.

Eventually it will be possible to specify a custom list
(see #256).
2017-03-05 10:24:39 +01:00
John MacFarlane
7fc6919f90 Markdown reader: Fixed regression on left-biased union for metadata.
When multiple YAML metadata blocks are used, and two define
the same field, the value defined first takes precedence,
according to the manual.  This was changed briefly in
ba3ee62323.  This commit
reverts to the original behavior and adds a test case.
2017-03-05 09:28:44 +01:00
John MacFarlane
ba3ee62323 Parse YAML metadata in a context that sees footnotes...
defined in the body of the document.

Closes #1279.
2017-03-05 01:36:40 +01:00
John MacFarlane
14b8aa8c93 Regularized CSS in html/epub/html slide templates.
All templates now include `code{white-space: pre-wrap}`
and CSS for `q` if `--html-q-tags` is used.

Previously some templates had `pre` and others `pre-wrap`;
the `q` styles were only sometimes included.

See #3485.
2017-03-04 23:16:42 +01:00
John MacFarlane
0517cf0bc0 Fixed some loose ends in #1592.
Added test cases.

Fixed HTML reader to parse a span with class "smallcaps" as
SmallCaps.

Fixed Markdown writer to render SmallCaps as a native span
when native spans are enabled.
2017-03-04 23:01:29 +01:00
Mauro Bieg
40d1dc417a templates: CSS for .smallcaps, closes #1592 (#3485) 2017-03-04 22:52:11 +01:00
John MacFarlane
739bf78c37 HTML writer: only issue warning for missing title if --standalone. 2017-03-04 14:50:48 +01:00
John MacFarlane
aa5ae5ff0f HTML writer: Render SmallCaps as span with smallcaps class.
Rather than using a style attribute directly.

This gives the user more flexibility in styling small caps
in CSS.

See #1592.
2017-03-04 14:46:54 +01:00
John MacFarlane
b64211a547 Use smallcaps class for SmallCaps in CommonMark writer.
See #1592.
2017-03-04 14:43:52 +01:00
John MacFarlane
8f20d7d920 Markdown writer: Use span with class 'smallcaps' for SmallCaps.
Instead of a style attribute as before.

See #1592.
2017-03-04 14:41:45 +01:00
John MacFarlane
0795244458 Markdown reader: treat span with class smallcaps as SmallCaps.
This allows users to specify small caps in Markdown this way:

    [my text]{.smallcaps}

See #1592.
2017-03-04 14:38:09 +01:00
John MacFarlane
738880bfcb Makefile - removed 'refactor' target. 2017-03-04 13:40:02 +01:00
John MacFarlane
19d86132a8 Makefile: Separate refactor and reformat targets.
Removed tools/refactor.sh.
2017-03-04 13:13:12 +01:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +01:00
John MacFarlane
0edfbf1478 Added 'make refactor' using hlint, stylish-haskell. 2017-03-04 12:49:14 +01:00
John MacFarlane
17ce813060 hlint refactoring. 2017-03-04 12:02:16 +01:00
John MacFarlane
beb94c53e9 Add hanging indent to log messages.
This makes them easier to read.
2017-03-04 11:26:49 +01:00
John MacFarlane
69b3a369ca HTML writer: issue warning if no title specified and template used.
See #3473.
2017-03-04 11:14:41 +01:00
John MacFarlane
87764b1c46 Logging: Added NoTitleElement constructor for LogMessage. 2017-03-04 11:13:54 +01:00
John MacFarlane
9925739ba9 Require skylighting 0.3.1. 2017-03-04 10:33:52 +01:00
John MacFarlane
37152f9351 Document that html5 output is polyglot compatible. 2017-03-04 10:12:33 +01:00
John MacFarlane
a99d0c6b42 Merge branch 'master' of github.com:jgm/pandoc 2017-03-04 10:08:51 +01:00
John Luke Bentley
07d51d9e30 Make default.html5 polyglot markup conformant. (#3473)
Polyglot markup is HTML5 that is also valid XHTML. See
<https://www.w3.org/TR/html-polyglot>.  With this change, pandoc's
html5 writer creates HTML that is both valid HTML5 and valid XHTML.
See jgm/pandoc-templates#237 for prior discussion.

* Add xml namespace to `<html>` element.
* Make all `<meta>` elements self closing.
  See <https://www.w3.org/TR/html-polyglot/#empty-elements>.
* Add `xml:lang` attribute on `<html>` element, defaulting to blank, and
  always include `lang` attribute, even when blank.  See
  <https://www.w3.org/TR/html-polyglot/#language-attributes>.
* Update test files for template changes.

The key justification for having language values default to blank: it
turns out the HTML5 spec requires it (as I read it).  Under
[the HTML5 spec, section "3.2.5.3. The lang and xml:lang
attributes"](https://www.w3.org/TR/html/dom.html#the-lang-and-xmllang-attributes),
providing attributes with blank contents both:

    * Has meaning, "unknown", and
    * Is a MUST (written as "must") if a language value is not provided ...

> The lang attribute (in no namespace) specifies the primary language
> for the element's contents and for any of the element's attributes that
> contain text. Its value must be a valid BCP 47 language tag, or the
> empty string. Setting the attribute to the empty string indicates that
> the primary language is unknown.

In short, it seems that where a language value is not provided then a
blank value MUST be provided for Polyglot Markup conformance, because
the HTML5 spec stipulates a "must". So although the Polyglot Markup spec
is unclear on this issue it would seem that if it was correctly written,
it would therefore require blank attributes.

Further justifications are found at
https://github.com/jgm/pandoc-templates/issues/237#issuecomment-275584181
(but the HTML5 spec justification given above would seem to be the
clincher).

In addition to having lang-values-default-to-blank I recommend that, when an
author does not provide a lang value, then upon on pandoc command execution
a warning message like the following be provided:

> Polyglot markup stipulates that 'The root element SHOULD always specify
> the language'. It is therefore recommended you specify a language value in
> your source document. See
> <https://www.w3.org/International/articles/language-tags/> for valid
> language values.
2017-03-04 10:08:38 +01:00
John MacFarlane
9616a8a2dd OpenDocument writer: Clarified some code. 2017-03-03 23:16:15 +01:00
John MacFarlane
ce9d49ef04 OpenDocument writer: fixed dropped elements in some ordered lists.
Closes #2434.
2017-03-03 22:48:37 +01:00
John MacFarlane
fb47d1d909 RST reader: support RST-style citations.
The citations appear at the end of the document as a definition
list in a special div with id `citations`.

Citations link to the definitions.

Added stateCitations to ParserState.

Closes #853.
2017-03-03 22:23:01 +01:00
John MacFarlane
d18a1c1c9e Docx writer: Don't include bookmarks on headers unless non-null id.
Closes #3476.
2017-03-03 21:13:08 +01:00
John MacFarlane
dc9788b6dc Pretty: don't error for blocks of size < 1.
Instead, resize to 1.

Note, this (together with earlier changes to the Markdown
writer) seems to fix #1785.

The table renders as garbage, but pandoc now completes the conversion
quickly and doesn't get tied up.
2017-03-03 15:01:23 +01:00
Alexander Krotov
24f027fe8d ConTeXt writer: remove unnecessary $ (#3482) 2017-03-03 10:43:17 +01:00
John MacFarlane
4d25bba5f7 RST reader: Handle multiline cells in simple tables.
Closes #1166.
2017-03-02 16:48:53 +01:00
John MacFarlane
46135ac875 LaTeX writer: add \leavevmode before hypertarget at start of paragraph.
Closes #2704 (formatting problems in beamer citations).

See
http://tex.stackexchange.com/questions/22852/function-and-usage-of-leavevmode
2017-03-02 12:13:20 +01:00
John MacFarlane
8709b7cf80 LaTeX writer: use % after hypertarget before code block 2017-03-02 12:13:02 +01:00
John MacFarlane
9e50319df3 LaTeX writer: minor tweak to hypertarget (semantically irrelevant). 2017-03-02 11:53:31 +01:00
John MacFarlane
a69cfa0178 Removed unnecessary import. 2017-03-02 11:28:29 +01:00
John MacFarlane
81028e2dce Bumped syb upper bound. 2017-03-02 10:42:07 +01:00
John MacFarlane
fa59e2ef28 Markdown reader: when splitting pipe table cells, skip tex math.
You might have a `|` character inside math.
(Or for that matter something that the parser might mistake
for raw HTML.)

See #3481.
2017-03-02 10:25:12 +01:00
John MacFarlane
fe4311d5a1 LaTeX writer: always add hypertarget when there's a non-empty identifier.
Previously the hypertargets were only added when there was actually
a link to that identifier.  Closes #2719.
2017-03-01 21:38:28 +01:00
John MacFarlane
d21c7fee66 LaTeX reader: don't drop contents of \hypertarget. 2017-03-01 21:05:29 +01:00
Alexander Krotov
39a8359b57 Writers: Use gets to access MonadState where possible (#3480) 2017-03-01 20:36:54 +01:00
John MacFarlane
ea619bfcb4 Markdown writer: Fixed grid tables embedded in grid tables.
Closes #2834.
2017-03-01 17:41:14 +01:00
John MacFarlane
8b641f38ca Markdown writer: Refactored gridTable to use widths in chars. 2017-03-01 17:08:14 +01:00
Wandmalfarbe
8af838f98f Fixed typos in CONTRIBUTING.md (#3479) 2017-03-01 15:00:53 +01:00
Mauro Bieg
d0fc2f1573 ODT writer: calculate aspect ratio for percentage-sized images (#3478)
closes #3239
2017-03-01 12:13:45 +01:00
John MacFarlane
d1b50a6c5d RST reader: implemented implicit internal header links.
Cloess #3475.
2017-02-28 10:32:36 +01:00