Commit graph

348 commits

Author SHA1 Message Date
Jesse Rosenthal
ffcecfacb1 Docx reader tests: test custom style extension. 2018-02-22 13:05:44 -05:00
Albert Krewinkel
00d20ccd09
Org reader: allow changing emphasis syntax
The characters allowed before and after emphasis can be configured via
`#+pandoc-emphasis-pre` and `#+pandoc-emphasis-post`, respectively. This
allows to change which strings are recognized as emphasized text on a
per-document or even per-paragraph basis. The allowed characters must be
given as (Haskell) string.

    #+pandoc-emphasis-pre: "-\t ('\"{"
    #+pandoc-emphasis-post: "-\t\n .,:!?;'\")}["

If the argument cannot be read as a string, the default value is
restored.

Closes: #4378
2018-02-21 22:43:18 +01:00
Jesse Rosenthal
f6eac1ad7e Powerpoint writer tests: Test everything with template as well
Modify the PowerPoint tests to run all the tests with
template (--reference-doc) as well. Because there are so many
interlocking pieces, bugs can pop up in weird places when using
templates, since it changes how the writer builds its output
file.

For example, I recently discovered a bug in which speaker notes worked
fine and templating worked fine elsewhere, but templating with speaker
notes produced a file that would crash MS PowerPoint. That particular
bug was fixed, but this will forces us to check for that with each new
change.
2018-02-19 20:04:39 -05:00
Alexander Krotov
5a9d7d20dd Move manyUntil to Text.Pandoc.Parsing and use it in Txt2Tags reader 2018-02-19 19:23:30 +03:00
Jesse Rosenthal
32e6ae4347 Powerpoint writer: Add tests for speaker notes. 2018-02-18 16:31:32 -05:00
Alexander Krotov
0e4b8ae362 Muse reader: prioritize lists with roman numerals over alphabetical lists
This is to make sure "i." starts a roman numbered list,
instead of a list with letter "i" (followed by "j", "k", ...").
2018-02-16 12:53:41 +03:00
danse
e6ff7f7986 Docx reader: Pick table width from the longest row or header
This change is intended to preserve as much of the table content as
possible

Closes #4360
2018-02-15 15:06:01 -05:00
Alexander Krotov
82a0ceaf18 Muse reader: fix directive parsing
This fixes bugs introduced in commit 4bfab8f04c.
2018-02-15 18:17:24 +03:00
Alexander Krotov
9131d62c9b Muse writer: use unicode quotes for quoted text 2018-02-15 14:33:25 +03:00
Alexander Krotov
42e39fbd26 Muse reader: parse definition lists with multiple descriptions 2018-02-13 14:34:45 +03:00
Alexander Krotov
8aed3652c2 Muse reader: refactor to avoid reparsing
Lists are parsed in linear instead of exponential time now.

Contents of block tags, such as <quote>, is parsed directly,
without storing it in a string and parsing with parseFromString.

Fixed a bug: headers did not terminate lists.
2018-02-12 17:30:57 +03:00
Alexander Krotov
3480a8acc2 Muse reader: paragraph indentation does not indicate nested quote
Muse allows indentation to indicate quotation or alignment,
but only on the top level, not within a <quote> or list.

This patch also simplifies the code by removing museInQuote
and museInList fields from the state structure.
Headers and indented paragraphs are attempted to be parsed
only at the topmost level, instead of aborting parsing with guards.
2018-02-12 04:57:56 +03:00
Alexander Krotov
450a200637 Muse reader: test empty quote tag 2018-02-11 19:45:16 +03:00
Alexander Krotov
1dfda7e204 Muse reader: require that block tags are on separate lines
Text::Amuse already explicitly requires it anyway.
Supporting block tags on the same line as contents makes
it hard to combine closing tag parsers with indentation parsers.
Being able to combine parsers is required for no-reparsing refactoring
of Muse reader.
2018-02-11 19:35:58 +03:00
Alexander Krotov
6c45f8c8f6 Muse reader: test that two blank lines after verse can separate list items
Unlike paragraph and <quote> tag parsers, verse parser consumes newline.
For this reason only three or more blank lines can separate list items.
2018-02-05 01:39:38 +03:00
Alexander Krotov
3b667c54ea Muse reader: test that lists can be separated with two blanklines after blockquote
Existing tests only checked this for paragraphs.
2018-02-05 00:25:31 +03:00
Alexander Krotov
d777fe8bbe Muse writer: write image width specified in percent in Text::Amuse mode 2018-02-03 18:36:38 +03:00
Alexander Krotov
9ff8bc64f9 Muse writer: don't wrap displayMath into <verse>
<verse> is a block tag and displayMath is an inline element.
Writing <verse> around displayMath could result in nested
<verse> tags.
2018-01-30 00:33:02 +03:00
Alexander Krotov
b7d8930dc0 Muse writer: escape nonbreaking space ("~~") 2018-01-29 12:54:43 +03:00
Alexander Krotov
248f6076bc Muse reader: fix parsing of trailing whitespace
Newline after whitespace now results in softbreak
instead of space.
2018-01-28 03:18:29 +03:00
Jesse Rosenthal
de6ae29be5 Docx writer tests: correct test name. 2018-01-27 17:47:07 -05:00
Jesse Rosenthal
ebcd04f57a Docx writer tests: Add tests for custom styles 2018-01-27 11:46:41 -05:00
Jesse Rosenthal
b3449a84aa Docx writer tests: Use new golden framework
These are based off the reader tests, with some removed (where the
reader output was identical, based on different docx inputs). There
are still more to be added. In particular, tests for custom-styles
need to be added.

All golden docx files have been checked in MS Word
2013 (windows). There is no corruption.

There is questionable output in the `tables` test: the three tables
seemed to be joined. This will be addressed in a future commit, and
the golden docx file will be changed.
2018-01-27 08:08:25 -05:00
Jesse Rosenthal
61f80e795d Tests: Abstract powerpoint tests out to OOXML tests.
There is very little pptx-specific in these tests, so we abstract out
the basic testing function so it can be used for docx as well. This
should allow us to catch some errors in the docx writer that slipped
by the roundtrip testing.
2018-01-25 15:29:50 -05:00
Henri Menke
751b5ad010 ConTeXt writer: new section syntax and --section-divs (#4295)
Fixes #2609.

This PR introduces the new-style section headings: `\section[my-header]{My Header}` -> `\section[title={My Header},reference={my-header}]`.

On top of this, the ConTeXt writer now supports the `--section-divs` option to write sections in the fenced style, with `\startsection` and `\stopsection`.
2018-01-25 11:56:28 -08:00
Alexander Krotov
6337539e32 Muse reader: fix matching of closing inline tags 2018-01-24 14:16:56 +03:00
Jesse Rosenthal
f0671bf4c7 Powerpoint writer tests: hlint cleanups. 2018-01-23 13:30:23 -05:00
Henri Menke
71bbadb793
ConTeXt writer: xtables: correct wrong usage of caption 2018-01-23 09:15:59 +13:00
Jesse Rosenthal
f8640fdff0 Powerpoint writer tests: add tests for two-column layout and images
Powerpoint output checked in MS PowerPoint 2013 (Windows)
2018-01-22 14:06:47 -05:00
Jesse Rosenthal
145c3f54f9 Powerpoint writer: Add further tests
Tests added for:

 - table of contents
 - endnotes
 - endnotes with table of contents

Powerpoint output checked in MS PowerPoint 2013 (Windows)
2018-01-22 11:52:03 -05:00
Jesse Rosenthal
5cdac2607d Powerpoint writer tests: simplify updating function
We had previously re-read the native file and converted it to
Powerpoint. But we have already done that in constructing the test
archive. So now we just convert the archive back to a bytestring and
write it to disk.
2018-01-22 09:55:41 -05:00
Jesse Rosenthal
0e48c216bc Powerpoint tests: Convert to golden tests
This will allow us to rebuild the pptx files in the test dir more
easily if we make a change in the writer.
2018-01-22 09:14:00 -05:00
Alexander Krotov
e9ed4832ed Muse writer: join code with different attributes during normalization 2018-01-22 16:27:14 +03:00
Alexander Krotov
288065cfd4 Muse writer: indent lists inside Div 2018-01-22 16:24:44 +03:00
Jesse Rosenthal
54526525bf Powerpoint writer tests: New test framework for pptx.
Previously we had tested certain properties of the output PowerPoint
slides. Corruption, though, comes as the result of a numebr of
interrelated issues in the output pptx archive. This is a new
approach, which compares the output of the Powerpoint writer with
files that we know to (a) not be corrupt, and (b) to show the desired
output behavior (details below). This commit introduces three tests
using the new framework. More will follow.

The test procedure: given a native file and a pptx file, we generate a
pptx archive from the native file, and then test:

1. Whether the same files are in the two archives

2. Whether each of the contained xml files is the same. (We skip time
   entries in `docProps/core.xml`, since these are derived from IO. We
   just check to make sure that they're there in the same way in both
   files.)

3. Whether each of the media files is the same.

Note that steps 2 and 3, though they compare multiple files, are one
test each, since the number of files depends on the input file (if
there is a failure, it will only report the first failed file
comparison in the test failure).
2018-01-21 12:15:35 -05:00
Alexander Krotov
98f0e2053e Muse reader: remove multiple descriptions during round-trip tests 2018-01-20 18:34:42 +03:00
Alexander Krotov
e1cc9d9abc Muse reader: enable definition lists in round-trip test 2018-01-20 14:09:44 +03:00
John MacFarlane
b8ffd834cf hlint code improvements. 2018-01-19 21:25:24 -08:00
John MacFarlane
46cd6429d8
Merge pull request #4259 from italia/4248
in RST writer insert comment between lists and quotes, closes #4248
2018-01-19 18:33:07 -07:00
Alexander Krotov
22b69b557e Muse reader: fix parsing of nested definition lists 2018-01-20 02:14:27 +03:00
danse
2165efef7e in RST writer insert comment between lists and quotes, closes #4248 2018-01-19 15:57:54 +01:00
Alexander Krotov
01499b766b Muse writer: support definitions with multiple descriptions
Muse reader does not support this syntax yet, but Emacs Muse parses
it correctly.
2018-01-19 15:00:00 +03:00
Alexander Krotov
7680e9b964 Muse reader: require only one space for nested definition list indentation 2018-01-19 14:16:20 +03:00
Alexander Krotov
19d2576223 Muse reader: parse definition list terms without parseFromString 2018-01-19 01:50:17 +03:00
Alexander Krotov
a516198d47 Muse reader: fix parsing of code at the beginning of paragraph 2018-01-18 15:35:43 +03:00
Alexander Krotov
5f57094a47 Muse reader: refactor definition list parsing
Test with wrong indentation is removed,
because now it is parsed as nested lists.
Emacs Muse and Text::Amuse don't have the same
behavior anyway.
2018-01-18 14:55:07 +03:00
Alexander Krotov
9986ccb333 Muse reader: parse "~~" as non-breaking space in Text::Amuse mode
Latest Text::Amuse supports "~~"
2018-01-18 02:46:02 +03:00
Alexander Krotov
ab85143e8a Muse reader: refactor list parsing
Now list item contents is parsed as blocks,
without resorting to parseFromString.

Only the first line of paragraph has to
be indented now, just like in Emacs Muse
and Text::Amuse.

Definition lists are not refactored yet.

See also: issue #3865.
2018-01-18 02:17:26 +03:00
Jesse Rosenthal
004f60bf26 Docx reader: Add test for hyperlinks in instrText tag
This is difficult to recreate with a modern version of Word, so I'm
using the file submitted with the bug report. It would be preferable
to find a smaller example with Latin characters, though, so as not to
confuse the issue being tested.
2018-01-16 13:22:02 -05:00
Henri Menke
6910267abf ConTeXt writer: Use xtables instead of Tables (#4223)
- Default to xtables for context output.
- Added `ntb` extension (affecting context writer only) to use Natural Tables instead.
- Added `Ext_ntb` constructor to `Extension` (API change).
2018-01-15 18:38:33 -07:00
John MacFarlane
d9584d73f9 Markdown reader: Improved inlinesInBalancedBrackets.
The change both improves performance and fixes a
regression whereby normal citations inside inline notes
were not parsed correctly.

Closes jgm/pandoc-citeproc#315.
2018-01-14 12:24:21 -08:00
John MacFarlane
e5abee82f2 Shorten unbalanced brackets test.
It was taking a lot of time.
2018-01-14 12:24:21 -08:00
Albert Krewinkel
2c71604554
data/pandoc.lua: add attr, listAttributes accessors
Elements with attributes got an additional `attr` accessor. Attributes
were accessible only via the `identifier`, `classes`, and `attributes`,
which was in conflict with the documentation, which indirectly states
that such elements have the an `attr` property.
2018-01-13 23:24:13 +01:00
Albert Krewinkel
e0cb0dab18
data/pandoc.lua: accept single block as singleton list
Every constructor which accepts a list of blocks now also accepts a
single block element for convenience.  Furthermore, strings are accepted as
shorthand for `{pandoc.Str "text"}` in constructors.
2018-01-13 22:32:22 +01:00
Albert Krewinkel
9fdd266677
data/pandoc.lua: accept singleton inline as a list
Every constructor which accepts a list of inlines now also accepts a
single inline element for convenience.
2018-01-13 18:52:17 +01:00
Albert Krewinkel
6528082401
Lua filters: improve error messages
Provide more context about the task which caused an error.
2018-01-12 21:28:27 +01:00
Albert Krewinkel
5b852f8d2a
Lua filters: make PANDOC_READER_OPTIONS available
The options which were used to read the document are made available to
Lua filters via the `PANDOC_READER_OPTIONS` global.
2018-01-12 18:54:19 +01:00
Albert Krewinkel
78b142b880
data/pandoc.lua: cleanup code, remove cruft 2018-01-08 23:26:38 +01:00
Albert Krewinkel
f5dec4bdc1
Lua: make pandoc-types version available as PANDOC_API_VERSION
The current pandoc-types version is made available to Lua programs in
the global PANDOC_API_VERSION. It contains the version as a list of
numbers.
2018-01-07 14:06:34 +01:00
Albert Krewinkel
043740d32b
Lua: make pandoc version available as PANDOC_VERSION
The current pandoc version is made available to Lua programs in the
global PANDOC_VERSION.  It contains the version as a list of numbers.
2018-01-07 13:43:03 +01:00
Jesse Rosenthal
bf15258d3b Powerpoint writer: Set default slidelevel correctly.
We had previously defaulted to slideLevel 2. Now we use the correct
behavior of defaulting to the highest level header followed by
content. We change an expected test result to match this behavior.
2018-01-03 21:58:39 -05:00
Jesse Rosenthal
a5b71a3c7f Docx reader: Add tests for paragraph insertion/deletion. 2018-01-02 11:32:48 -05:00
Jesse Rosenthal
3f30455b49 Docx reader: tests for overlapping targets (anchor spans). 2017-12-31 09:36:42 -05:00
Jesse Rosenthal
475b0dcb66 Docx reader: tests for removing unused anchors. 2017-12-30 22:43:33 -05:00
Alexander Krotov
551aec7b01 Muse reader: enable round trip test
Closes #4107
2017-12-30 20:32:16 +03:00
Jesse Rosenthal
76442a791c Powerpoint Writer tests: Add quickcheck tests for content types.
We want to make sure we always have an override for each xml file in
the content types file.
2017-12-29 10:43:36 -05:00
Jesse Rosenthal
859815e4c7 Powerpoint writer test: more slide number tests
Add test for custom slide-level header, and notes slides.
2017-12-29 06:36:23 -05:00
John MacFarlane
3494b6efd3 Powerpoint writer tests: use IO.
Otherwise we can't find the data files when compiled
with -embed_data_files.
2017-12-28 12:06:38 -08:00
John MacFarlane
fa79e003b3 Use insertInFileTree in powerpoint test. 2017-12-28 10:26:54 -08:00
John MacFarlane
ddd6a89247 Text.Pandoc.Class: add insertInFileTree (API change).
This gives a pure way to insert an ersatz file into a FileTree.

In addition, we normalize paths both on insertion and on
lookup, so that "foo" and "./foo" will be judged equivalent.
2017-12-28 10:23:09 -08:00
John MacFarlane
2dd01b2071 Fixed warning in powerpoint writer test. 2017-12-28 08:54:42 -08:00
Jesse Rosenthal
c1fbf7257b PowerPoint writer: Introduce beginning of tests
This is the beginning of a test suite for the powerpoint
writer. Initial tests are for the number of slides.

Note that at the moment it does not test against corruption in
Microsoft PowerPoint; it just tests that certain outcomes work as
expected. More tests will be added.

This test framework uses the PandocPure monad introduced with Pandoc 2.0.
2017-12-28 10:51:03 -05:00
Albert Krewinkel
c6b5d65161
Org smart test: drop superfluous import
Keeps GHC 7.8 and GHC 7.10 happy.
2017-12-28 14:51:03 +01:00
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
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
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
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
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
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
d853571397 Improve support for code language in JATS 2017-12-22 15:24:54 +13: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
f6abf15832 Muse reader: parse empty comments correctly 2017-12-19 04:23:32 +03: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
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
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
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
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
ae60e0196c Add empty_paragraphs extension.
* Deprecate `--strip-empty-paragraphs` option.  Instead we now
  use an `empty_paragraphs` extension that can be enabled on
  the reader or writer.  By default, disabled.

* Add `Ext_empty_paragraphs` constructor to `Extension`.

* Revert "Docx reader: don't strip out empty paragraphs."
  This reverts commit d6c58eb836.

* Implement `empty_paragraphs` extension in docx reader and writer,
  opendocument writer, html reader and writer.

* Add tests for `empty_paragraphs` extension.
2017-12-04 14:56:57 -08:00
Alexander Krotov
ed261e5832 Muse reader: add underline support in Emacs Muse mode 2017-12-04 15:59:26 +03:00
John MacFarlane
d6c58eb836 Docx reader: don't strip out empty paragraphs.
We now have the `--strip-empty-paragraphs` option for that,
if you want it.  Closes #2252.

Updated docx reader tests.

We use stripEmptyParagraphs to avoid changing too
many tests.  We should add new tests for empty paragraphs.
2017-12-02 16:51:31 -08:00
Alexander Krotov
7751391fce Muse reader: correctly remove indentation from notes
Exactly one space is required and considered to be part of the marker.
2017-11-29 05:12:25 +03:00
John MacFarlane
5a225aa603 Temporarily disable round-trip block test for muse reader.
See #4107.
2017-11-28 16:13:01 -08:00
Alexander Krotov
c2993a6fc6 Muse reader: parse "~~" as non-breaking space in Emacs mode 2017-11-27 12:25:06 +03:00
Alexander Krotov
00004f042c Muse reader: make code blocks round trip 2017-11-27 04:54:23 +03:00
Alexander Krotov
bdad8c1d69 Muse reader: drop common space prefix from list items 2017-11-26 22:14:18 +03:00
Alexander Krotov
a8ac673285 Muse reader: Add partial round trip test 2017-11-26 02:01:39 +03:00
Alexander Krotov
ea2ea455b3 Muse reader: don't interpret XML entities 2017-11-25 22:46:25 +03:00
Alexander Krotov
77af25b4c3 Muse reader: parse markup in definition list terms 2017-11-24 14:02:43 +03:00
Alexander Krotov
137c7c2a65 Muse reader: allow definition to end with EOF 2017-11-24 13:16:09 +03:00
Alexander Krotov
fe74436540 Muse writer: test that inline math conversion result is normalized
Without normalization this test produced
<em>a</em><em>b</em><em>c</em>
2017-11-24 12:35:25 +03:00
Alexander Krotov
0cfd764d27 Muse: move inline list normalization to writer 2017-11-24 12:17:20 +03:00
Albert Krewinkel
cd85c73ded
Org reader: allow empty list items
Fixes: #4090
2017-11-22 22:53:24 +01:00
Alexander Krotov
75e2a1104c Muse reader: allow list items to be empty 2017-11-22 18:49:07 +03:00
Alexander Krotov
0b63ac2db1 Muse reader: add ordered list test 2017-11-22 18:48:45 +03:00
Alexander Krotov
454062eccd Muse writer: escape hash symbol 2017-11-22 16:17:30 +03:00
Alexander Krotov
c8ab4789b6 Muse reader: add more multiline definition tests 2017-11-22 15:23:09 +03:00
Alexander Krotov
7e42857ed8 Muse writer: escape "----" to avoid accidental horizontal rules 2017-11-22 01:39:20 +03:00
Alexander Krotov
351765d4ad Muse reader: concatenate inlines of the same type 2017-11-22 01:22:43 +03:00
Alexander Krotov
df3a80cc97 Muse writer: escape only </code> inside code tag
Additional <verbatim> is not needed as <code> is verbatim already.
2017-11-22 01:22:43 +03:00
Alexander Krotov
6c17117ef2 Muse reader: add inline <literal> support 2017-11-21 19:53:55 +03:00
Alexander Krotov
59f537c31f Muse reader: test <literal> blocks 2017-11-21 19:01:53 +03:00
Albert Krewinkel
849900c516 data/pandoc.lua: enable table-like behavior of attributes (#4080)
Attribute lists are represented as associative lists in Lua. Pure
associative lists are awkward to work with. A metatable is attached to
attribute lists, allowing to access and use the associative list as if
the attributes were stored in as normal key-value pair in table.

Note that this changes the way `pairs` works on attribute lists. Instead
of producing integer keys and two-element tables, the resulting iterator
function now returns the key and value of those pairs.  Use `ipairs` to
get the old behavior.

Warning: the new iteration mechanism only works if pandoc has been
compiled with Lua 5.2 or later (current default: 5.3).

The `pandoc.Attr` function is altered to allow passing attributes as
key-values in a normal table. This is more convenient than having to
construct the associative list which is used internally.

Closes #4071
2017-11-20 09:37:40 -08:00
Alexander Krotov
82bcda80c6 Muse reader: count only one space as part of list item marker 2017-11-19 04:40:00 +03:00
Alexander Krotov
163af3fdee Muse reader: produce SoftBreaks on newlines
Now wrapping can be preserved with --wrap=preserve
2017-11-19 02:37:52 +03:00
Albert Krewinkel
53aafd6643 Lua filters: preload text module (#4077)
The `text` module is preloaded in lua. The module contains some UTF-8
aware string functions, implemented in Haskell.  The module is loaded on
request only, e.g.:

    text = require 'text'
    function Str (s)
      s.text = text.upper(s.text)
      return s
    end
2017-11-18 13:24:06 -08:00
Alexander Krotov
6018a2324d Muse reader: Add Text::Amuse footnote extensions
Footnote end is indicated by indentation,
so footnotes can be placed anywhere in the text,
not just at the end of it.
2017-11-18 23:43:02 +03:00
Alexander Krotov
3a83b3843d Replace "emacs" extension with "amuse" extension
It makes clear that extension is related to Muse markup.
2017-11-13 18:41:49 +03:00
Alexander Krotov
df4cb20f29 Muse reader: accept Emacs Muse definition lists
Emacs Muse does not require indentation.
2017-11-12 18:08:41 +03:00
Alexander Krotov
3cee9c8976 FB2 writer: Add "unrecognised" genre to <title-info>
XML schema requires at least one genre.
2017-11-01 13:31:16 +03:00
Alexander Krotov
8a5541dca8 FB2 writer: remove <annotation> from <body>
<annotation> is not allowed inside <body> according to FictionBook2 XML schema. Besides that, the same information is already placed inside <description>.

Related bug: #2424
2017-11-01 13:08:52 +03:00
John MacFarlane
1f393f1a8b
Merge pull request #4001 from labdsf/fb2-tests
Add new style FB2 tests
2017-11-01 00:37:29 -04:00
Sascha Wilde
03361f0a68 Creole reader: additional test on nowiki-block after para. 2017-10-31 22:26:35 +01:00
Sascha Wilde
fa67d6e86f Creole reader: fixed lists with trailing white space. 2017-10-31 18:55:27 +01:00
John MacFarlane
6a1476e7e2 Export all of Text.Pandoc.Class from Text.Pandoc. 2017-10-29 15:00:49 -07:00
Sascha Wilde
e8be4b0b6d Creole reader (#4002)
* Basic skeleton for creole reader.

No real functionality besides preliminary bold and italics yet.

* Creole: add support for bold/italic with implicit end at paragraph end.

* Creole: add support for headings.

* Creole: add support for tilde escaped chars.

* Basic skeleton for creole reader.

No real functionality besides preliminary bold and italics yet.

* Creole: add support for bold/italic with implicit end at paragraph end.

* Creole: add support for headings.

* Creole: add support for tilde escaped chars.

* Add a test suite for the creole parser

So far this covers only things the parser already supports.

* Added simple parsing of flat unordered lists.

* Added tests for unordered lists in creole.

* First, wrong(!) implementation of sublists.

Fails test, as sublists should not be embedded in a list item!

* Implementation of unordered sublists.

* Added support for ordered lists to creole reader.

* Added utility function to append parsers to Creole reader.

* Creole reader: Fixed list item end detection in sub lists.

* Tests for creole reader: added more tests for lists.

Covering ordered and unordered tests, even mixed.  Tests for
formatting in list items still missing...

* Added "nowiki" blocks.  One exception rule is missing...

* Creole reader: nowiki: implemented exception for curly brackets.

* Creole reader: added inline nowiki.

* Creole reader: added horizontalRule.

* Creole reader: added auto linking of URIs.

* Creole reader: detect horizontalRule as para end.

Used the opportunity for a little refactoring.

* Creole reader: added forced line breaks.

Including test.

* Creole reader: implement wiki links.

* Creole reader: added image support.

* Creole reader: support images as links.

* Creole reader: implemented placeholder -- by simply dropping them.

* Creole reader: added tests for links.

After observing a regression, it was really time...  ;-)

* Creole reader: fixed links with names.

* Creole reader: allow space after first of enclosing tags.

Space after the start of formatting tags are allowed with creole,
e.g. "there is // italic text // in here" is legal.

This problem was discovered using the creole1.0test.txt document from
http://www.wikicreole.org/wiki/Creole1.0TestCases

See l.57:
# // italic item 3 //

* Creole reader: fixed links without names.

* Creole reader: Tests, sorted into groups.

* Creole reader: implemented tables.

* Removed redundant import.

* Creole reader: add correct escaping of links.

* Creole reader: allow handling of e.g. links in parenthesis and quotes.

* Creole reader: Modified disclaimer as most of the code is actually by me.

* Creole reader: Tests: added escaped links.

* Creole reader: preserve leading and trailing space in bold/italic.

* Creole reader: detect tables without a leading blank line.

* Creole Reader: added official creole1.0test.txt as "old" test.

The base document was downloaded from
http://www.wikicreole.org/wiki/Creole1.0TestCases.
The Wiki, and therefore the test document is

Copyright (C) by the contributors.
Some rights reserved, license CC BY-SA.

http://creativecommons.org/licenses/by-sa/1.0/
2017-10-29 13:28:50 -04:00
Alexander Krotov
d99776ea04 Add new style FB2 tests 2017-10-28 21:08:48 +03:00
John MacFarlane
ff16db1aa3 Automatic reformating by stylish-haskell. 2017-10-27 20:28:29 -07:00
John MacFarlane
a2a14f9029 Removed old adjacent_links test for docx reader.
See #2270 for background -- this test blocked the consistent
underline change and was hard to revise, so for now we are
removing it.
2017-10-27 16:09:44 -07:00
hftf
7f8a3c6cb7 Consistent underline for Readers (#2270)
* Added underlineSpan builder function.  This can be easily updated if needed. The purpose is for Readers to transform underlines consistently.

* Docx Reader: Use underlineSpan and update test

* Org Reader: Use underlineSpan and add test

* Textile Reader: Use underlineSpan and add test case

* Txt2Tags Reader: Use underlineSpan and update test

* HTML Reader: Use underlineSpan and add test case
2017-10-27 18:45:00 -04:00
Sascha Wilde
66fd3247ea Creole reader (#3994)
This is feature complete but not very thoroughly tested yet.
2017-10-26 19:19:28 -04:00
Ben Firshman
9046dbadb1
Latex reader: Skip spaces in image options 2017-10-17 16:42:11 +03:00
Ben Firshman
d73fdbf895
Add tests for existing \includegraphics behaviour 2017-10-17 15:09:55 +03:00
Albert Krewinkel
f176ad6f21
Org reader: end footnotes after two blank lines
Footnotes can not only be terminated by the start of a new footnote or a
header, but also by two consecutive blank lines.
2017-10-08 14:17:26 +02:00
bucklereed
c359bdd9b1 LaTeX reader: read polyglossia/babel \text($LANG){...}. 2017-10-06 12:17:50 +01:00
Albert Krewinkel
514662e544
Org reader: support \n export option
The `\n` export option turns all newlines in the text into hard
linebreaks.

Closes #3950
2017-10-02 23:11:58 +02:00
John MacFarlane
f3a80034ff Removed writerSourceURL, add source URL to common state.
Removed `writerSourceURL` from `WriterOptions` (API change).
Added `stSourceURL` to `CommonState`.
It is set automatically by `setInputFiles`.

Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`.

The type of `getInputFiles` has changed; it now returns `[FilePath]`
instead of `Maybe [FilePath]`.

Functions in Class that formerly took the source URL as a parameter
now have one fewer parameter (`fetchItem`, `downloadOrRead`,
`setMediaResource`, `fillMediaBag`).

Removed `WriterOptions` parameter from `makeSelfContained` in
`SelfContained`.
2017-09-30 16:11:20 -05:00
Albert Krewinkel
2f47e04206
Text.Pandoc.Lua: add mediabag submodule 2017-09-30 09:57:03 +02:00
Alexander Krotov
b5d064e8f0 Muse reader: parse anchors 2017-09-28 14:57:24 +03:00
Alexander Krotov
2cdb8fe2e6 Muse reader: test metadata parsing 2017-09-26 19:31:10 +03:00