Commit graph

245 commits

Author SHA1 Message Date
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