Commit graph

492 commits

Author SHA1 Message Date
Albert Krewinkel
e5c8b65004
Org reader: support minlevel option for includes
The level of headers in included files can be shifted to a higher level
by specifying a minimum header level via the `:minlevel` parameter. E.g.
`#+include: "tour.org" :minlevel 1` will shift the headers in tour.org
such that the topmost headers become level 1 headers.

Fixes: #4154
2017-12-28 14:16:04 +01:00
Albert Krewinkel
2d443ecb07
Break-up org reader test file
The org reader test file had grown large, to the point that editor
performance was negatively affected in some cases. The tests are spread
over multiple submodules, and re-combined into a tasty TestTree in the
main org reader test file.
2017-12-28 14:15:58 +01:00
John MacFarlane
acfa846aab
Merge pull request #4184 from mb21/html-reader-figcaption
HTML Reader: be more forgiving about figcaption
2017-12-27 13:33:00 -07:00
John MacFarlane
a888083ee1 HTML reader: parse div with class line-block as LineBlock.
See #4162.
2017-12-27 12:26:15 -08:00
John MacFarlane
e23e1f3c22 Added tests for custom writer. 2017-12-27 09:15:45 -08:00
Jesse Rosenthal
d71165c8e2 Docx reader: add tests for structured document tags unwrapping. 2017-12-27 10:03:00 -05:00
John MacFarlane
9e1d86638c LaTeX reader: support \foreignlanguage from babel. 2017-12-26 10:57:57 -08:00
John MacFarlane
718b2c5837 HTML writer: Use br elements in line blocks...
instead of relying on CSS.  Closes #4162.  HTML-based templates have had
the custom CSS for div.line-block removed.  Those maintaining custom
templates will want to remove this too.

We still enclose line blocks in a div with class line-block.
2017-12-26 08:40:33 -08:00
John MacFarlane
ee5fe9bf2c RST reader: allow empty list items (as docutils does).
Closes #4193.
2017-12-24 13:02:18 -08:00
Albert Krewinkel
59a4745457
Lua modules: add function pandoc.utils.hierarchicalize
Convert list of Pandoc blocks into (hierarchical) list of Elements.
2017-12-23 23:29:24 +01:00
John MacFarlane
6b63b63f30 JATS reader: process author metadata. 2017-12-23 10:03:13 -08:00
Albert Krewinkel
2c66a42ab8
Lua modules: add function pandoc.utils.normalize_date
The function parses a date and converts it (if possible) to "YYYY-MM-DD"
format.
2017-12-23 13:43:22 +01:00
Albert Krewinkel
35f0567a8f
Lua modules: add function pandoc.utils.to_roman_numeral
The function allows conversion of numbers below 4000 into roman
numerals.
2017-12-23 13:42:35 +01:00
mb21
9b54b94612 HTML Reader: be more forgiving about figcaption
fixes #4183
2017-12-23 09:42:04 +01:00
John MacFarlane
28b736bf95 latex_macros extension changes.
Don't pass through macro definitions themselves when `latex_macros`
is set.  The macros have already been applied.

If `latex_macros` is enabled, then `rawLaTeXBlock` in
Text.Pandoc.Readers.LaTeX will succeed in parsing a macro definition,
and will update pandoc's internal macro map accordingly, but the
empty string will be returned.

Together with earlier changes, this closes #4179.
2017-12-22 18:03:51 -08:00
John MacFarlane
4a07977715 Markdown reader: improved raw tex parsing.
+ Preserve original whitespace between blocks.
+ Recognize `\placeformula` as context.
2017-12-22 18:03:51 -08:00
Albert Krewinkel
23edb958db
Lua modules: add stringify function to pandoc.utils
The new function `pandoc.utils.stringify` converts any AST element to a
string with formatting removed.
2017-12-22 20:09:37 +01:00
John MacFarlane
9758720a24 RST writer: fix anchors for headers.
We were missing an `_`.
See #4188.
2017-12-22 10:36:37 -08:00
John MacFarlane
af04881655
Merge pull request #4177 from stencila/jats-xml-reader
Add Basic JATS reader based on DocBook reader
2017-12-21 23:16:03 -07:00
Hamish Mackenzie
a5d7be075d JATS writer: Make <p> optional in <td> and <th> (#4178)
If the contents are single `Plain` block then do not wrap them with
a <p> element.
2017-12-21 22:30:22 -07:00
Hamish Mackenzie
d853571397 Improve support for code language in JATS 2017-12-22 15:24:54 +13:00
Alexander Krotov
d035689a06 Org writer: do not wrap "-" to avoid accidental bullet lists
Also add TODO for ordered lists.
2017-12-21 16:36:29 +03:00
Alexander Krotov
0405c5b461 Muse reader: parse anchors immediately after headings as IDs 2017-12-21 15:52:10 +03:00
Albert Krewinkel
299e452463
Test more pandoc Lua module functions
The functions `sha1`, `read`, and `pipe` are now tested.

Change: minor
2017-12-20 21:36:41 +01:00
Alexander Krotov
b5e62a5c09 Muse reader: require that note references does not start with 0 2017-12-20 14:00:30 +03:00
Hamish Mackenzie
5d3c9e5646 Add Basic JATS reader based on DocBook reader 2017-12-20 13:54:02 +13:00
Alexander Krotov
1e21cfb251 Muse writer: don't wrap note references to the next line
Closes #4172.
2017-12-19 13:30:48 +03:00
Alexander Krotov
ef8430e702 Fix for #4171 fix: don't wrap note references after SoftBreak 2017-12-19 13:30:48 +03:00
Alexander Krotov
f6abf15832 Muse reader: parse empty comments correctly 2017-12-19 04:23:32 +03:00
John MacFarlane
c0cc9270cb Org writer: don't allow fn refs to wrap to beginning of line.
Otherwise they can be interpreted as footnote definitions.

Closes #4171.
2017-12-18 16:33:52 -08:00
John MacFarlane
808f6d3fa1 OPML reader: enable raw HTML and other extensions by default for notes.
This fixes a regression in 2.0.

Note that extensions can now be individually disabled, e.g.
`-f opml-smart-raw_html`.

Closes #4164.
2017-12-17 09:52:53 -08:00
John MacFarlane
79c3f57c47 Added tests of latex tokenizer.
This should help prevent regressions like #4159.
2017-12-15 10:13:43 -08:00
John MacFarlane
044d58bb24 Fixed regression in LateX tokenization.
This mainly affects the Markdown reader when parsing
raw LaTeX with escaped spaces.  Closes #4159.
2017-12-15 09:45:29 -08:00
John MacFarlane
b94f1e2045 RST reader: more accurate parsing of references.
Previously we erroneously included the enclosing
backticks in a reference ID (closes #4156).

This change also disables interpretation of
syntax inside references, as in docutils.
So, there is no emphasis in

    `my *link*`_
2017-12-14 12:48:43 -08:00
John MacFarlane
3361f85f8e
Merge pull request #4148 from stencila/jats-figures
fig, table-wrap & caption Divs for JATS writer
2017-12-14 13:45:23 -07:00
Hamish Mackenzie
fa0241592c Deduplicate JATS writer image mime type code 2017-12-14 18:39:45 +13:00
John MacFarlane
52a8116e71
Merge pull request #4153 from tarleb/unify-lua-init
Unify lua initalization
2017-12-13 21:42:06 -07:00
Jesse Rosenthal
440533643e Docx writer: Add tests for list continuation. 2017-12-13 15:16:44 -05:00
Albert Krewinkel
4c64af4407
Custom writer: use init file to setup Lua interpreter
The same init file (`data/init`) that is used to setup the Lua
interpreter for Lua filters is also used to setup the interpreter of
custom writers.lua.
2017-12-13 21:15:41 +01:00
John MacFarlane
7093a3b44c Markdown: Improved computation of relative cell widths in pipe tables. 2017-12-12 15:36:29 -08:00
John MacFarlane
e86c337356 Pipe tables: use full text width for tables with wrapping cells.
Previously we computed the column sizes based on the ratio
between the header lines and the text width (as set by `--columns`).
This meant that tables with very short header lines would be
very narrow. With this change, pipe tables with wrapping cells will
always take up the whole text width. The relative column widths
will still be determined by the ratio of header lines, but they
will be normalized to add up to 1.0.
2017-12-12 15:16:16 -08:00
Hamish Mackenzie
ec1693505c fig, table-wrap & caption Divs for JATS writer
Support writing <fig> and <table-wrap> elements with <title> and
<caption> inside them by using Divs with class set to on of
fig, table-wrap or cation.  The title is included as a Heading
so the constraint on where Heading can occur is also relaxed.

Also leaves out empty alt attributes on links.
2017-12-13 12:06:22 +13:00
John MacFarlane
5e039d913f Changes for skylighting-0.5.
This fixes a bug in 2.0.4, whereby pandoc could not
read the theme files generated with `--print-highlight-style`.

It also fixes some CSS issues involving line numbers.
Highlighted code blocks are now enclosed in a div with class
sourceCode.

Highlighting CSS no longer sets a generic color for pre
and code; we only set these for class `sourceCode`.

This will close #4133 and #4128.
2017-12-10 21:13:05 -08:00
John MacFarlane
67b6abc806 LaTeX reader: fix \ before newline.
This should be a nonbreaking space, as long as it's not
followed by a blank line. This has been fixed at the tokenizer
level.

Closes #4134.
2017-12-08 16:34:15 -08:00
John MacFarlane
f6007e7146 Markdown reader: accept processing instructions as raw HTML.
Closes #4125.
2017-12-06 16:05:50 -08:00
Albert Krewinkel
d5b1c7b767
Lua filters: refactor lua module handling
The integration with Lua's package/module system is improved: A
pandoc-specific package searcher is prepended to the searchers in
`package.searchers`. The modules `pandoc` and `pandoc.mediabag` can now
be loaded via `require`.
2017-12-02 23:07:29 +01:00
Alexander Krotov
e536c4d9c9 hlint Muse reader and tests 2017-12-06 19:38:25 +03:00
Alexander Krotov
6fd3cdac46 Muse reader: add test for #disable-tables directive in Emacs mode 2017-12-06 19:35:01 +03:00
Alexander Krotov
3ae359721d Muse reader: don't allow emphasis to be preceded by letter 2017-12-06 19:04:35 +03:00
John MacFarlane
6a2562efb5 Rewrite empty_paragraphs test so it will run on Windows. 2017-12-04 15:41:09 -08:00