Commit graph

207 commits

Author SHA1 Message Date
John MacFarlane
fddd6ffdd0 Add blank lines to #3531 command test. 2017-03-26 20:48:54 +02:00
John MacFarlane
358dfba8f4 MediaWiki writer: don't softbreak lines inside list items.
Closes #3531.
2017-03-26 20:41:09 +02:00
John MacFarlane
0eb62f03fe Ms writer: Hyperlink table of contents and other improvements. 2017-03-26 20:03:37 +02:00
John MacFarlane
bd99d9f6af Ms writer: Add PDF outline bookmarks. 2017-03-26 18:06:15 +02:00
John MacFarlane
0cb0aa7308 Fixed a test not updated on last commit. 2017-03-26 17:15:53 +02:00
John MacFarlane
e30d2c700a Ms writer: Use @ instead of | for inline math delimiter.
The `|` delimiter had a bad interaction with tbl.
See discussion in #1839.
2017-03-26 16:59:38 +02:00
John MacFarlane
267e1a13ea Ms writer: Support external links.
Also add config options for link color.
2017-03-26 11:05:23 +02:00
John MacFarlane
d9e8e84be0 Ms writer: better placement of header anchors. 2017-03-26 10:44:34 +02:00
John MacFarlane
1d659bec01 Ms writer: Implement header identifiers and internal links. 2017-03-25 22:16:44 +01:00
John MacFarlane
ed6249bd0b Ms writer: use light gray for strikeout.
Pending groff definitions for striking out an arbitrary
section of text (not just a few words).
2017-03-25 20:53:32 +01:00
John MacFarlane
c941a00cac Ms writer: improved pdf metadata. 2017-03-25 19:30:24 +01:00
John MacFarlane
7d3d5387ac Updated test suite for ms template change. 2017-03-25 11:45:05 +01:00
John MacFarlane
2e20129903 Ms. writer: links: use footnote only for absolute URIs. 2017-03-25 10:35:05 +01:00
John MacFarlane
14ebd289ea Updated tests. 2017-03-25 09:27:04 +01:00
John MacFarlane
c13cfe8f5d Ms writer: Use indented paragraphs after first in section.
Note that the current indentation setting is 0; see the
settings in the template.
2017-03-24 23:32:28 +01:00
John MacFarlane
af57de0b27 default.ms: Add settings for document variables like width. 2017-03-24 22:15:46 +01:00
John MacFarlane
a7ae4b1ee2 Ms writer: support --toc, date, abstract. 2017-03-24 17:25:09 +01:00
John MacFarlane
438e8686cf Markdown writer: don't emit a simple table if simple_tables disabled.
Closes #3529.
2017-03-24 16:11:56 +01:00
John MacFarlane
2251d9cb73 Ms writer: Use custom .HRULE macro for horizontal rule. 2017-03-24 09:23:19 +01:00
John MacFarlane
ffd699385a Ms writer: improved definition lists.
Use standard .IP macro.
Also properly escape ".
2017-03-23 17:29:26 +01:00
John MacFarlane
a939cfe769 Pipe tables: impose minimum cell size.
This might help with #3526.
At any rate, it fixes another bug (see test/command/3526.md).
2017-03-23 16:54:47 +01:00
John MacFarlane
e92941a9ca Grid tables: remove unnecessary extra space in cells. 2017-03-23 14:59:51 +01:00
John MacFarlane
e180a2efa6 Ms writer: fixed hard line breaks. 2017-03-23 14:48:09 +01:00
John MacFarlane
86142ab7c0 Updated ms tests. 2017-03-23 14:33:29 +01:00
John MacFarlane
8cf5c55e5e Ms. writer: don't render links in footnotes as footnotes. 2017-03-23 12:05:41 +01:00
John MacFarlane
1809f64a4c Ms writer: Improved footnotes. 2017-03-23 11:56:13 +01:00
John MacFarlane
da0aae9c8f Ms writer: fixed strong/emph combination.
Perhaps something similar is needed in the man writer.
2017-03-23 11:48:01 +01:00
John MacFarlane
6c204ea2bd Initial addition of groff ms writer.
* New module: Text.Pandoc.Writers.Ms.
* New template: default.ms.
* The writer uses texmath's new eqn writer to convert math
  to eqn format, so a ms file produced with this writer
  should be processed with `groff -ms -e` if it contains
  math.
2017-03-23 10:14:16 +01:00
John MacFarlane
286b320fb0 Added to issue 3516 command test to debug test failure on appveyor. 2017-03-22 14:36:12 +01:00
John MacFarlane
cf306f34e5 Plain writer: use _(..) or ^(..) for super/subscript...
...unless unicode super/subscripted characters are available.
2017-03-21 15:41:58 +01:00
John MacFarlane
430e2db9ba Improve rendering of superscript in plain output.
We now handle a few non digit characters (+, -, =, parentheses)
for which there are superscripted unicode characters.

Closes #3518.
2017-03-21 14:43:14 +01:00
John MacFarlane
daf8d1db18 RST writer: improve grid table output, fix bug with empty rows.
Uses the new gridTable in Writers.Shared, which is here
improved to better handle 0-width cells.

Closes #3516.
2017-03-21 14:16:46 +01:00
John MacFarlane
48c88d566d Add space_in_atx_header extension.
This is enabled by default in pandoc and GitHub markdown but not the
other flavors.

This requirse a space between the opening #'s and the header
text in ATX headers (as CommonMark does but many other implementations
do not).  This is desirable to avoid falsely capturing things ilke

    #hashtag

or

    #5

Closes #3512.
2017-03-20 21:55:30 +01:00
Albert Krewinkel
f2f6851713 Lua filters (#3514)
* Add `--lua-filter` option.  This works like `--filter` but takes pathnames of special lua filters and uses the lua interpreter baked into pandoc, so that no external interpreter is needed.  Note that lua filters are all applied after regular filters, regardless of their position on the command line.
* Add Text.Pandoc.Lua, exporting `runLuaFilter`.  Add `pandoc.lua` to data files.
* Add private module Text.Pandoc.Lua.PandocModule to supply the default lua module.
* Add Tests.Lua to tests.
* Add data/pandoc.lua, the lua module pandoc imports when processing its lua filters.
* Document in MANUAL.txt.
2017-03-20 15:17:03 +01:00
John MacFarlane
fff3489bf3 Removed failing part of 3348 test.
This was failing because of a small discrepancy in markdown
table header line lengths on appveyor.

It's a minor issue, I can't see what is causing it, and
it's irrelevant to the issue this is testing, so we'll
just write native for this test.
2017-03-19 20:37:39 +01:00
John MacFarlane
87f99f3fdf HTML reader: Better sanity checks on raw HTML.
This also affects the Markdown reader.

Closes #3257.
2017-03-18 22:43:57 +01:00
John MacFarlane
435221a9f3 Added test case to 3348 to try to figure out why appveyor build fails. 2017-03-17 17:10:43 +01:00
John MacFarlane
8f90b83fee Adjust command test 3348.md to specify column width.
This is meant to address a test failure on appveyor.
2017-03-17 16:19:51 +01:00
John MacFarlane
090165d714 Added test for #256. 2017-03-16 22:31:36 +01:00
John MacFarlane
482e5b78a0 OpenDocument writer: use more widely available bullet characters.
The old characters weren't available in some font sets.
These seem to work well on Windows and Linux versions of LibreOffice.

Closes #1400.
2017-03-15 17:19:28 +01:00
John MacFarlane
2235c2a8f7 Use tasty-golden for golden tests in Old. 2017-03-15 00:27:39 +01:00
John MacFarlane
93c49a2865 Command tests: just findPandoc once. 2017-03-14 23:39:28 +01:00
John MacFarlane
14edbd2967 Removed unneeded import. 2017-03-14 21:30:15 +01:00
John MacFarlane
6cb54c3def Got rid of distracting warning in test output. 2017-03-14 21:06:14 +01:00
John MacFarlane
ebbaf2e965 Small test plumbing improvement. 2017-03-14 17:27:30 +01:00
John MacFarlane
6ecc5b96a9 Use tasty for tests rather than test-framework. 2017-03-14 17:07:23 +01:00
John MacFarlane
6bf3f89d69 Better handling of \part in LaTeX.
Closes #1905.

Removed stateChapters from ParserState.

Now we parse chapters as level 0 headers, and parts as level -1 headers.
After parsing, we check for the lowest header level, and if it's
less than 1 we bump everything up so that 1 is the lowest header level.
So `\part` will always produce a header; no command-line options
are needed.
2017-03-13 22:11:10 +01:00
John MacFarlane
efcb51bcb0 Put TEI writer inside PandocMonad. Added warnings for omitted raw elements.
Also added identifiers on `<div>` elements.  These were commented
out before, not sure why?
2017-03-13 11:08:17 +01:00
John MacFarlane
c8b906256d Improved behavior of auto_identifiers when there are explicit ids.
Previously only autogenerated ids were added to the list
of header identifiers in state, so explicit ids weren't taken
into account when generating unique identifiers.  Duplicated
identifiers could result.

This simple fix ensures that explicitly given identifiers are
also taken into account.

Fixes #1745.

Note some limitations, however.  An autogenerated identifier
may still coincide with an explicit identifier that is given
for a header later in the document, or with an identifier on
a div, span, link, or image.  Fixing this would be much more
difficult, because we need to run `registerHeader` before
we have the complete parse tree (so we can't get a complete
list of identifiers from the document by walking the tree).

However, it might be worth issuing warnings for duplicate
header identifiers; I think we can do that.  It is not
common for headers to have the same text, and the issue
can always be worked around by adding explicit identifiers,
if the user is aware of it.
2017-03-12 21:30:04 +01:00
John MacFarlane
62becc1536 Changed test case labeled 3384.md to 3348.md.
The last commit referred to #3384, but should have
closed #3348.
2017-03-11 23:29:57 +01:00
John MacFarlane
d66b046c8a Markdown writer: fixed bugs in simple/multiline list output.
* Previously we got overlong lists with `--wrap=none`.  This is fixed.
* Previously a multiline list could become a simple list (and would
  always become one with `--wrap=none`).

Closes #3384.
2017-03-11 23:24:14 +01:00
Alexander Krotov
d037c5019d Add Muse writer (#3489)
* Add Muse writer

* Advertise new Muse writer

* Muse writer: add regressions tests
2017-03-10 10:16:27 +01:00
John MacFarlane
c46febaaee Expand \newenvironment macros.
Closes #987.

Depends on still unreleased texmath 0.9.3.
2017-03-10 09:46:32 +01:00
John MacFarlane
239a17a986 HTML writer: fallback to basename rather than Untitled. 2017-03-09 09:41:22 +01:00
Albert Krewinkel
c91f168fc9 Org reader: disallow tables on list marker lines
Fixes: #3499
2017-03-08 15:45:00 +01:00
John MacFarlane
bcfb77e2ab Markdown writer: Avoid spurious blanklines at end of document...
after tables and list, for example.
2017-03-08 12:47:39 +01:00
John MacFarlane
b6e7bfaf1d Markdown writer: ensure space before list at top level.
Closes #3487.
2017-03-08 12:42:01 +01:00
John MacFarlane
410991ec6e Org reader: don't allow tables inside list items.
Closes #3499.
2017-03-08 12:28:13 +01:00
John MacFarlane
2c67101c7d Added test case for #3497. 2017-03-08 12:23:01 +01:00
John MacFarlane
93a9c09b6b Speed up Native writer quickcheck tests. 2017-03-07 15:14:36 +01:00
John MacFarlane
69c4602f46 Small change to unbalanced bracket test to speed up test suite. 2017-03-07 15:03:26 +01:00
John MacFarlane
8c55b7b564 Markdown reader: Treat certain environments as inline
when they occur without space surrounding them.

E.g. equation, math.

This avoids incorrect vertical space around equations.

Closes #3309.
Closes #2171.
See also rstudio/bookdown#358.
2017-03-07 15:00:32 +01:00
John MacFarlane
74afd2974a Markdown writer: better handling of tables with empty columns.
E.g. an HTML table with two cells in the first row and one
in the second (but no row/colspan).

We now calculate the number of columns based on the longest
row (or the length of aligns or widths).

Closes #3337.
2017-03-06 22:51:28 +01:00
John MacFarlane
9e87114234 LaTeX reader: allow newpage, clearpage, pagebreak in inline contexts
as well as block contexts.

Closes #3494.
2017-03-06 21:49:06 +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
2fee07795c Added a markdown abbrevation test case. 2017-03-05 10:44:25 +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
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