Commit graph

1137 commits

Author SHA1 Message Date
Mauro Bieg
40d1dc417a templates: CSS for .smallcaps, closes #1592 (#3485) 2017-03-04 22:52:11 +01:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +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 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
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
4d25bba5f7 RST reader: Handle multiline cells in simple tables.
Closes #1166.
2017-03-02 16:48:53 +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
ea619bfcb4 Markdown writer: Fixed grid tables embedded in grid tables.
Closes #2834.
2017-03-01 17:41:14 +01:00
John MacFarlane
d1b50a6c5d RST reader: implemented implicit internal header links.
Cloess #3475.
2017-02-28 10:32:36 +01:00
John MacFarlane
99b39ffc17 RST reader: support scale and align attributes of images.
Closes #2662.
2017-02-26 23:40:31 +01:00
John MacFarlane
65c4efeb59 Added test case for variables/metadata in Markdown writer. 2017-02-25 23:54:30 +01:00
John MacFarlane
7d0082aa0b LaTeX reader: allow hspace and vspace to count as raw block or inline.
Previously we would refuse to parse anything as raw inline if
it was in the blockCommands list.  Now we allow exceptions
if they're listed under ignoreInlines in inlineCommands.

This should make it easier e.g. to include an \hspace
between two side-by-side raw LaTeX tables.
2017-02-25 12:43:00 +01:00
John MacFarlane
6beeb49b75 Updated table tests. 2017-02-23 22:34:10 +01:00
John MacFarlane
f4a452f891 When parsing raw LaTeX commands, include trailing space.
Otherwise things like `\noindent foo` break and turn into
`\noindentfoo`.

Affects `-f latex+raw_tex` and `-f markdown` (and other formats
that allow `raw_tex`).

Closes #1773.
2017-02-22 21:15:25 +01:00
John MacFarlane
5d71e37f26 MediaWiki reader: ensure that list starts begin at left margin.
Including when they're in tables or other list items.

Closes #2606.
2017-02-21 23:41:32 +01:00
John MacFarlane
f90b82d3d9 MediaWiki writer: Remove newline before </ref>.
Closes #2652.
2017-02-21 23:03:10 +01:00
John MacFarlane
e462f80d74 MediaWiki writer: add display attribute on <math> tags.
This allows display math to be rendered properly.

Closes #3452.
2017-02-21 22:57:48 +01:00
John MacFarlane
5269724ad3 MediaWiki reader: fixed more table issues.
Closes #2649.
2017-02-21 21:28:24 +01:00
John MacFarlane
3c3138b133 Added warnings for non-rendered blocks to some writers. 2017-02-17 23:11:31 +01:00
John MacFarlane
575014975e Fix indirect hyperlink targets. Closes #512. 2017-02-15 17:36:16 +01:00
Alex Ivkin
93f0a9c2e5 ZimWiki writer: removed internal formatting from note and table cells, because ZimWiki does not support it (#3446) 2017-02-15 11:28:02 +01:00
John MacFarlane
cfdbe85e71 LaTeX reader: properly handle column prefixes/suffixes.
For example, in

     \begin{tabular}{>{$}l<{$}>{$}l<{$} >{$}l<{$}}

each cell will be interpreted as if it has a `$`
before its content and a `$` after (math mode).
2017-02-13 22:39:59 +01:00
Alexander Krotov
48f809384a Add Org writer unit tests 2017-02-12 17:09:07 +03:00
John MacFarlane
2759960204 RST reader/writer: properly handle table captions.
Currently the support for the `.. table` directive is a bit
limited; we don't yet support the `widths` field.  But at least
you can have a proper captioned table.
2017-02-11 22:37:07 +01:00
John MacFarlane
1a23bc65b8 Fixed small bug in RST list parsing.
See #3432.  Previously the parser didn't handle properly this
case:

    * - a
      - b
    * - c
      - d
2017-02-11 20:55:13 +01:00
John MacFarlane
76c55466d3 Use new warnings throughout the code base. 2017-02-11 00:14:44 +01:00
John MacFarlane
47a16065c4 Removed --parse-raw and readerParseRaw.
These were confusing.

Now we rely on the +raw_tex or +raw_html extension with latex
or html input.

Thus, instead of

    --parse-raw -f latex

we use

    -f latex+raw_tex

and instead of

     --parse-raw -f html

we use

    -f html+raw_html
2017-02-06 23:33:23 +01:00
John MacFarlane
fc8208e8bc Use unicode-math by default in default.latex template.
mathspec will be used in xelatex if the `mathspec` variable is
set; otherwise unicode-math will be used.

Thanks to Václav Haisman.
2017-02-06 10:50:36 +01:00
John MacFarlane
c93ecfc3c5 Handle language in inline code with --listings.
Closes #3422.
2017-02-05 22:22:42 +01:00
John MacFarlane
396d304167 More smart escaping tests. 2017-02-04 22:09:19 +01:00
John MacFarlane
a435422d0f Consolidated some common functions in Tests.Helper. 2017-02-04 21:56:32 +01:00
John MacFarlane
ce9ec67970 Added first command test to cabal metadata and repo. 2017-02-04 21:56:32 +01:00
Albert Krewinkel
623d860be6
Org writer: reduce to two spaces after bullets
The org writer was inserting two spaces after list bullets. Emacs
Org-mode defaults to a single space, so behavior is changed to reflect
this.

Closes: #3417
2017-02-04 21:15:05 +01:00
John MacFarlane
49c7cf40fe Added new test framework Tests.Command.
Any files added under test/command will be treated as
shell tests (see smart.md for an example).

This makes it very easy to add regression tests etc.
2017-02-04 21:07:03 +01:00
John MacFarlane
7ea4ad11bb Added skeleton for Tests.Command. 2017-02-04 17:38:03 +01:00
John MacFarlane
18ab864269 Moved tests/ -> test/. 2017-02-04 12:56:30 +01:00