Commit graph

705 commits

Author SHA1 Message Date
Amogh Rathore
d50f46d26d Add Reader support for HTML <samp> element (#5843)
The `<samp>` element is parsed as a Span with class `sample`.
Closes #5792.
2019-10-23 08:44:24 -07:00
Alexander Krotov
a1977dd2d6 Muse reader: do not allow closing asterisks to be followed by "*" 2019-10-15 16:36:05 +03:00
Alexander Krotov
d5c13dd438 Muse reader: do not split series of asterisks into symbols and emphasis
Fixes #5821
2019-10-15 01:55:32 +03:00
Alexander Krotov
13e0ac1104 Muse reader: do not terminate emphasis on "*" not followed by space 2019-10-15 01:02:54 +03:00
John MacFarlane
aceee9ca48 Options.WriterOptions: Change type of writerVariables to Context Text.
This will allow structured values.

[API change]
2019-10-09 11:01:33 -07:00
Alexander Krotov
6a9cafc67a hlint Muse reader tests 2019-10-04 18:28:53 +03:00
John MacFarlane
7caaa3d5d6 Minor ghc 8.8 fixups. 2019-10-03 22:41:24 -07:00
John MacFarlane
e99050283e ConTeXt unit tests - tweak code property.
Inline code will never have two consecutive newlines.
We get a counterexample in this case

https://pipelines.actions.githubusercontent.com/bMXCpShstkkHbFPgw9hBRMWw2w9plyzdVM8r7CRPFBHFvidaAG/5cf52d2d-3804-412d-ae65-4f8c059b0fb7/_apis/pipelines/1/runs/116/signedlogcontent/39?urlExpires=2019-09-23T17%3A38%3A05.8358735Z&urlSigningMethod=HMACV1&urlSignature=Qtd6vnzqgSwXpAkIyp9DJY4Kn7GJzYMR8UDkLR%2FsMQY%3D

so for simplicity we just weed out code with newlines.
2019-09-23 15:03:26 -07:00
John MacFarlane
d247e9f72e Make plain output plainer.
Previously we used the following Project Gutenberg conventions
for plain output:

- extra space before and after level 1 and 2 headings
- all-caps for strong emphasis `LIKE THIS`
- underscores surrounding regular emphasis `_like this_`

This commit makes `plain` output plainer. Strong and Emph
inlines are rendered without special formatting.  Headings
are also rendered without special formatting, and with only
one blank line following.

To restore the former behavior, use `-t plain+gutenberg`.

API change: Add `Ext_gutenberg` constructor to `Extension`.

See #5741.
2019-09-22 11:33:09 -07:00
Nikolay Yakimov
c113ca6717 [Docx Reader] Use style names, not ids, for assigning semantic meaning
Motivating issues: #5523, #5052, #5074

Style name comparisons are case-insensitive, since those are
case-insensitive in Word.

w:styleId will be used as style name if w:name is missing (this should
only happen for malformed docx and is kept as a fallback to avoid
failing altogether on malformed documents)

Block quote detection code moved from Docx.Parser to Readers.Docx

Code styles, i.e. "Source Code" and "Verbatim Char" now honor style
inheritance

Docx Reader now honours "Compact" style (used in Pandoc-generated docx).
The side-effect is that "Compact" style no longer shows up in
docx+styles output. Styles inherited from "Compact" will still
show up.

Removed obsolete list-item style from divsToKeep. That didn't
really do anything for a while now.

Add newtypes to differentiate between style names, ids, and
different style types (that is, paragraph and character styles)

Since docx style names can have spaces in them, and pandoc-markdown
classes can't, anywhere when style name is used as a class name,
spaces are replaced with ASCII dashes `-`.

Get rid of extraneous intermediate types, carrying styleId information.
Instead, styleId is saved with other style data.

Use RunStyle for inline style definitions only (lacking styleId and styleName);
for Character Styles use CharStyle type (which is basicaly RunStyle with styleId
and StyleName bolted onto it).
2019-09-21 11:18:15 -07:00
Ben Steinberg
7389919bb4 Preserve built-in styles in DOCX with custom style (#5670)
This commit prevents custom styles on divs and spans from overriding
styles on certain elements inside them, like headings, blockquotes,
and links. On those elements, the "native" style is required for the
element to display correctly. This change also allows nesting of
custom styles; in order to do so, it removes the default "Compact"
style applied to Plain blocks, except when inside a table.
2019-09-20 22:13:29 -07:00
John MacFarlane
45b7636307 Revert "FB2 reader test: better diagnostics on failure."
This reverts commit c65af7d1a2.
2019-09-15 10:27:19 -07:00
John MacFarlane
c65af7d1a2 FB2 reader test: better diagnostics on failure. 2019-09-15 09:06:38 -07:00
John MacFarlane
88a0327579 FB2 reader test: Another attempt to fix test failure on GitHub CI. 2019-09-14 10:37:19 -07:00
John MacFarlane
7ecae69e27 Revert "FB2 reader test: filter CRs."
This reverts commit e35147d715.
2019-09-13 22:08:42 -07:00
John MacFarlane
e35147d715 FB2 reader test: filter CRs.
This may help with the test failure on GitHub CI.

b59e6d0376/checks
2019-09-13 16:50:00 -07:00
John MacFarlane
e4cca4cf67 Roff readers: better parsing of groups.
We now allow groups where the closing `\\}` isn't at the
beginning of a line.

Closes #5410.
2019-09-04 09:24:42 -07:00
Jesse Rosenthal
4a7dad18b1 PowerPoint writer: Start numbering at appopriate numbers.
Starting numbers for ordered lists were previously ignored. Now we
specify the number if it is something other than 1.

Closes: #5709
2019-08-27 01:24:41 -04:00
John MacFarlane
b35fae6511 Use doctemplates 0.3, change type of writerTemplate.
* Require recent doctemplates.  It is more flexible and
  supports partials.
* Changed type of writerTemplate to Maybe Template instead
  of Maybe String.
* Remove code from the LaTeX, Docbook, and JATS writers that looked in
  the template for strings to determine whether it is a book or an
  article, or whether csquotes is used. This was always kludgy and
  unreliable.  To use csquotes for LaTeX, set `csquotes` in your
  variables or metadata. It is no longer sufficient to put
  `\usepackage{csquotes}` in your template or header includes.
  To specify a book style, use the `documentclass` variable or
  `--top-level-division`.
* Change template code to use new API for doctemplates.
2019-07-28 19:25:45 -07:00
Albert Krewinkel
63c65c89da
Org reader: accept ATTR_LATEX in block attributes
Attributes for LaTeX output are accepted as valid block attributes;
however, their values are ignored.

Fixes: #5648
2019-07-22 08:12:22 +02:00
John MacFarlane
28cad16517 Markdown writer: prefer using raw_attribute when enabled.
The `raw_attribute` will be used to mark raw bits, even HTML
and LaTeX, and even when `raw_html` and `raw_tex` are enabled,
as they are by default.

To get the old behavior, disable `raw_attribute` in the writer.

Closes #4311.
2019-07-18 22:31:03 -07:00
Alexander Krotov
0713cb65bc Muse: add RTL support
Closes #5551
2019-07-14 18:22:52 +03:00
John MacFarlane
7bc9eab846
Merge pull request #5589 from blmage/fix-3992
Add support for EPUB2 covers (fix #3992)
2019-07-13 16:48:09 -07:00
John MacFarlane
a16311c225
Merge pull request #5606 from blmage/odt-frames
Improve the parsing of frames in ODT documents
2019-07-13 15:53:58 -07:00
Pete Ryland
24c781039f Fix redundant constraint warnings. (#5625) 2019-07-02 10:29:34 +02:00
martinfrancois
4b73544087 add tests for EPUB2 and EPUB3 cover reader 2019-06-22 22:07:26 +02:00
blmage
449c133406 Add a test for MathML formulas in ODT documents 2019-06-20 21:55:31 +02:00
Jeroen de Haas
e67f4c58f2 Powerpoint code formatting is now context dependent (#5573)
This commit alters the way in which the Powerpoint writer treats
inline code and code blocks.

- Inline code is now formatted at the same size as the surrounding
  text.
- Code blocks are now given a margin and font size according to their
  level.
- Furthermore this commit allows changing the font with which code is
  formatted via the `monofont` option.

Tested in
- PowerPoint 365 for Windows - 1808 (Build 10730.20344 Click-to-Run)
- PowerPoint 365 for Mac - 16.26 (19060901)
2019-06-14 08:42:06 -07:00
John MacFarlane
3febd81cbc LaTeX writer: Use mbox to get proper behavior inside \sout.
Closes #5529.
2019-06-10 15:02:48 -07:00
Alexander Krotov
814c3af4df Muse reader: test that links inside image descriptions work 2019-06-09 14:08:37 +03:00
Albert Krewinkel
1c36857465 Add jira writer (#5548)
This adds support for Atlassian's jira markup.

Closes #2497
2019-06-05 17:52:23 -04:00
Albert Krewinkel
f7222370af
Lua modules: test pandoc.mediabag 2019-05-30 08:44:40 +02:00
Albert Krewinkel
505f5bf5d9
Lua: add Version type to simplify comparisons
Version specifiers like `PANDOC_VERSION` and `PANDOC_API_VERSION` are
turned into `Version` objects. The objects simplify version-appropriate
comparisons while maintaining backward-compatibility.

A function `pandoc.types.Version` is added as part of the newly
introduced module `pandoc.types`, allowing users to create version
objects in scripts.
2019-05-29 10:07:43 +02:00
Alexander Krotov
f807f5b383 Muse reader: allow images inside link descriptions 2019-05-25 19:17:16 +03:00
Alexander Krotov
19f9eed0bb Muse writer: do not escape empty line after <br> 2019-05-25 17:54:31 +03:00
Albert Krewinkel
6208d4e7fc Improve output of Lua tests (#5499)
This makes use of tasty-lua, a package to write tests in Lua
and integrate the results into Tasty output. Test output becomes
more informative: individual tests and test groups become visible
in test output. Failures are reported with helpful error messages.
2019-05-20 12:52:28 -04:00
John MacFarlane
e87b54dcad JATS writer: properly handle footnotes.
"Best Practice: When footnotes are grouped at the end of an article,
wrap them in a `<fn-group>` and use an `<xref>` element in the text, as
usual, to tie each footnote in the list to a particular location in the
text."

Closes #5511.
2019-05-16 21:39:03 -07:00
Albert Krewinkel
8b00bc6029
Org reader: fix planning elements in headers level 3 and higher
Planning info is now always placed before the subtree contents.
Previously, the planning info was placed after the content if the
header's subtree was converted to a list, which happens with headers of
level 3 and higher per default.

Fixes: #5494
2019-05-13 22:55:13 +02:00
Albert Krewinkel
00ef03827e
Org reader: omit, but warn about unknown export options
Unknown export options are properly ignored and omitted from the output.
2019-05-13 22:25:04 +02:00
Alexander Krotov
5c7ad59ffe FB2 reader: add notes parsing test 2019-05-11 12:10:20 +00:00
Albert Krewinkel
33e2d46dbe
Org reader: prefer plain symbols over math symbols
Symbols like `\alpha` are output plain and unemphasized, not as math.

Fixes: #5483
2019-05-05 14:48:37 +02:00
Albert Krewinkel
7e7bc3493e
Org reader: recognize emphasis after TODO/DONE keyword
Fixes: #5484
2019-05-05 13:53:11 +02:00
Albert Krewinkel
786594b23b Lua: add pandoc.system module (#5468)
The `system` Lua module provides utility functions to interact with the
operating- and file system. E.g.

    print(pandoc.system.get_current_directory())

or

    pandoc.system.with_temporary_directory('tikz', function (dir)
      -- write and compile a TikZ file with pdflatex
    end)
2019-05-04 01:06:30 -04:00
Alexander Krotov
2b2d9baaa8 Muse writer tests: compare Text without converting to [Char] 2019-04-28 03:21:14 +03:00
John MacFarlane
40b60a911c Actually run the xwiki writer tests. 2019-04-02 17:11:35 -07:00
Jesse Rosenthal
0d1fc7dfff PowerPoint writer: add test for speaker notes after metadata. 2019-03-31 17:09:00 -04:00
Jesse Rosenthal
efa6304eee Pptx writer: test for speaker notes after breaking header. 2019-03-30 22:52:31 -04:00
John MacFarlane
052684712b HTML reader: read data-foo attribute into foo.
The HTML writer adds the `data-` prefix for HTML5
for nonstandard attributes.  But the attributes are
represented in the AST without the `data-` prefix,
so we should strip this when reading HTML.

Closes #5392.
2019-03-25 08:43:59 -07:00
John MacFarlane
5b385d2e66 Tests.Old: specify --data-dir=../data.
Remove old pandoc_datadir environment variable, which
doesn't do anything.
2019-03-13 17:44:07 -07:00
John MacFarlane
e405d7b532 Include execution output in ipynb test. 2019-03-09 16:53:53 -08:00
Jesse Rosenthal
9a1a3fe482 Docx reader: add tests for trimming last inline. 2019-02-18 15:49:00 -05:00
Alexander Krotov
c4814ea965 Muse reader: add secondary note support 2019-02-18 15:21:32 +03:00
Alexander Krotov
2c7c8a6f40 Muse writer: escape secondary notes 2019-02-18 15:21:32 +03:00
Jesse Rosenthal
332e2ba5b6 Docx reader: Add test for reading sdts in footnotes. 2019-02-12 17:26:37 -05:00
John MacFarlane
b6cf490efd Use latest skylighting. 2019-02-10 08:06:53 -08:00
John MacFarlane
1cdbb896f6 Added simple ipynb reader/writer tests.
Closes #5274.
2019-02-09 14:53:30 -08:00
TG
568b25d33a Adds Asciidoctor sprcific writer and tests 2019-02-09 08:21:53 -08:00
Jesse Rosenthal
1847bdbb83 Docx reader: Tests for alternate document.xml 2019-02-06 21:14:46 -05:00
Alexander Krotov
59fa4eb17e Muse reader: test that block level markup does not break <verbatim> 2019-02-06 02:25:24 +03:00
Albert Krewinkel
37a82b0b11 Add missing copyright notices and remove license boilerplate (#5112)
Quite a few modules were missing copyright notices.

This commit adds copyright notices everywhere via haddock module
headers.  The old license boilerplate comment is redundant with this and has
been removed.

Update copyright years to 2019.

Closes #4592.
2019-02-04 13:52:31 -08:00
John MacFarlane
7c424b315c Tests: avoid calling findPandoc multiple times. 2019-01-31 20:56:20 -08:00
John MacFarlane
fdf7f07f62 Old tests: remove need for temp files by using pipeProcess. 2019-01-31 17:25:36 -08:00
leungbk
ac83b9c37c Org reader: add support for #+SELECT_TAGS. 2019-01-30 18:27:38 +01:00
Agustín Martín Barbero
9894d05fe3 Improve writing metadata for docx, pptx and odt (#5252)
* docx writer: support custom properties.  Solves the writer part of #3024.
  Also supports additional core properties:  `subject`, `lang`, `category`,
  `description`.

* odt writer: improve standard properties, including the following core properties:
  `generator` (Pandoc/VERSION), `description`, `subject`, `keywords`,
  `initial-creator` (from authors), `creation-date` (actual creation date).
  Also fix date.

* pptx writer: support custom properties.  Also supports additional core
  properties: `subject`, `category`, `description`.

* Includes golden tests.

* MANUAL: document metadata support for docx, odt, pptx writers
2019-01-26 16:14:35 -08:00
Albert Krewinkel
42a7b80c04
data/pandoc.lua: auto-fix nested constructor arguments
Incorrect types to pandoc element constructors are automatically
converted to the correct types when possible. This was already done for
most constructors, but conversions are now also done for nested
types (like lists of lists).
2019-01-13 17:14:10 +01:00
Brian Leung
35971495ab RST reader: change treatment of number-lines directives. (#5207)
Directives of this type without numeric inputs should not have a
`startFrom` attribute; with a blank value, the writers can produce
extra whitespace.
2019-01-09 22:19:26 -08:00
John MacFarlane
8673eb079b Removed superfluous sourceCode class on code blocks.
* These were added by the RST reader and, for literate Haskell,
  by the Markdown and LaTeX readers.  There is no point to
  this class, and it is not applied consistently by all readers.
  See #5047.

* Reverse order of `literate` and `haskell` classes on code blocks
  when parsing literate Haskell. Better if `haskell` comes first.
2019-01-08 11:36:33 -08:00
John MacFarlane
599327bee1 Asciidoc writer: shorter delimiters for tables, blockquotes.
This matches asciidoctor reference docs.

Closes #4364.
2019-01-07 22:10:34 -08:00
Brian Leung
9dbcf16161 Org reader: handle minlevel option differently. (#5190)
When `minlevel` exceeds the original minimum level observed in the
file to be included, every heading should be shifted rightward.
2019-01-07 20:28:47 -08:00
Alexander
40c30a9d88 Add DokuWiki reader (#5108)
Closes #1792
2019-01-06 15:06:32 -08:00
John MacFarlane
4ac036fe13 Cleaned up findPandoc. 2019-01-04 20:14:24 -08:00
John MacFarlane
fc87925b77 Tests: Fix findPandoc to work with Windows. 2019-01-04 18:36:15 -08:00
John MacFarlane
ae4a5f4858 Fix findPandoc so it works with cabalv2. 2019-01-04 17:44:26 -08:00
Albert Krewinkel
2f92261d87
Org reader: fix self-link parsing regression
Fixes a regression introduced by the previous commit.
2019-01-01 22:06:44 +01:00
Albert Krewinkel
c0caaaeabb
Org reader: fix treatment of links to images
Links with descriptions which are pointing to images are no longer read
as inline images, but as proper links.

Fixes: #5191
2019-01-01 21:03:38 +01:00
Alexander Krotov
5101f4324b Muse reader tests: test #cover directive 2018-12-25 15:23:02 +03:00
Jesse Rosenthal
0f736d778f Docx: add test for lists with level overrides. 2018-12-10 19:24:56 -05:00
Alexander Krotov
367e8cac18 Muse reader: trim whitespace before parsing grid table cells 2018-11-14 19:17:05 +03:00
Alexander Krotov
c61b67410a Muse reader: add grid tables support 2018-11-14 17:58:44 +03:00
Alexander Krotov
195b3af8b6 Muse writer: indent simple tables only on the top level 2018-11-14 15:10:38 +03:00
Alexander Krotov
4079697281 Muse writer: output tables with one column as grid tables 2018-11-13 18:44:56 +03:00
Alexander Krotov
928ec21732 Use OverloadedStrings extension to simplify Muse writer tests 2018-11-06 00:04:33 +03:00
Alexander Krotov
0c84630549 Muse writer: add support for --reference-location=
Address #107
2018-11-05 08:42:52 +03:00
Yan Pashkovsky
43a0734f62 table tests 2018-11-02 22:42:51 -07:00
John MacFarlane
3305a018bc Roff reader: properly handle unknown backslash escapes.
They are treated as regular characters, according to groff 7.

Cloess #5034.
2018-10-30 15:54:29 -07:00
John MacFarlane
8d55dc10cd Roff tokenizer: better handling of escapes. 2018-10-28 21:37:57 -07:00
John MacFarlane
22755a35b7 Roff tokenizer: revamped font parsing using escapeArg.
Add support for \C'...' escapes.
2018-10-28 18:06:34 -07:00
Albert Krewinkel
6f29e1c9c1 T.P.Lua: rename runPandocLua to runLua (API change) 2018-10-28 12:08:52 -07:00
Albert Krewinkel
7f54f76e8b T.P.Lua: merge runLuaFilter into T.P.Filter.Lua (API change)
The function `runLuaFilter` was only used in Text.Pandoc.Filter.Lua, use
apply from the that module instead.
2018-10-28 12:08:52 -07:00
Alexander Krotov
f8ca36525d Muse: Make tables round-trip 2018-10-28 03:52:35 +03:00
Alexander Krotov
e34a0703f5 Muse reader: try to parse lists before trying to parse table
This ensures that tables inside lists are parsed correctly.
2018-10-28 03:52:25 +03:00
Alexander Krotov
d8135b2e67 Remove misleading comment from Muse reader tests
pandoc follows Text::Amuse rules instead of being bug compatible with Emacs Muse
2018-10-27 23:43:23 +03:00
Alexander Krotov
d28dca57db Muse reader: forbid whitespace after opening and before closing markup elements
See https://github.com/melmothx/text-amuse/issues/44 for discussion on these rules
2018-10-27 23:35:11 +03:00
Alexander Krotov
1ca320e249 Muse reader: parse page breaks 2018-10-26 16:30:15 +03:00
Alexander Krotov
4275d58a9f Muse writer: do not insert newline before lists 2018-10-23 03:38:59 +03:00
John MacFarlane
0327226d4c Man reader: don't parse \[ul] as unicode escape. 2018-10-22 12:05:34 -07:00
Alexander Krotov
875e33ecf6 Muse reader: allow footnotes to start with empty line
A space character was required after footnote marker, now newline is allowed.
2018-10-22 03:05:17 +03:00
Alexander Krotov
a98e2b7c42 Muse writer: use lightweight markup after </em> tag 2018-10-21 20:23:10 +03:00
John MacFarlane
2b7a541dd0 Man reader: Fixed handling of nested fonts.
Closes #4978.
2018-10-20 22:41:39 -07:00
Alexander Krotov
8df59952bf Muse reader: allow empty headers
Previously empty headers caused parser to terminate without parsing the rest of the document.
2018-10-21 06:42:00 +03:00
John MacFarlane
f202279902 Man reader: Fix .B, .I, .BR, etc. 2018-10-20 16:40:44 -07:00
John MacFarlane
a9fc71118f Man reader: major restructuring, support macros.
- Improved support for custom macro definitions.
- LinePart type has been added. RoffStr is now one
  constructor of LinePart (the other being MacroArg).
- MComment has lost its argument.
- MEndMacro has been removed.
- MStr has been removed (we now simply use LinePart).
- Macros now store a list of tokens.
- Each macro argument is a [LinePart], instead of a LinePart.
- .BR now behaves as documented in man (and doesn't create a link).
2018-10-20 15:57:34 -07:00
John MacFarlane
62566c8182 Man reader: handle shift in list style.
Closes #4987.
2018-10-20 09:30:37 -07:00
Jesse Rosenthal
11e681edac Powerpoint tests: test raw openxml
Output files confirmed not to be corrupt, and with content as
expected, on PowerPoint 2013 on Windows 10 (virtualbox on linux).
2018-10-20 09:00:23 -04:00
John MacFarlane
7dd06e96d7 Man reader: Improved header parsing.
- .SH should be level 1, .SS level 2.
- The header title can come on the next line.
2018-10-19 23:27:04 -07:00
John MacFarlane
f5704fac97 Man reader: properly handle multi-block list items.
Closes #4985.
2018-10-19 22:54:05 -07:00
John MacFarlane
790ada8946 Man reader: Added more tests for escapes.
Closes #4983.
2018-10-19 15:36:43 -07:00
John MacFarlane
56c4a11f97 Man reader: minor improvements.
use `trimInlines` for Para content to avoid leading and
trailing spaces.

Fix handling of \" in middle of line.

Add more tests for escapes.
2018-10-19 15:17:53 -07:00
John MacFarlane
e6772360f6 More man reader test updates. 2018-10-19 14:59:11 -07:00
John MacFarlane
400e87df1d Update man reader tests. 2018-10-18 23:54:13 -07:00
John MacFarlane
94c73e84d5 Merge branch 'Yanpas-groff_reader' 2018-10-18 20:58:46 -07:00
Alexander Krotov
6fc812485e Muse reader: allow examples to be indented with tabs 2018-10-17 18:17:30 +03:00
Alexander Krotov
1071732719 Muse reader: remove indentation from examples indicated by {{{ and }}} 2018-10-17 13:57:05 +03:00
John MacFarlane
5c42101ee9 Merge branch 'groff_reader' of https://github.com/Yanpas/pandoc into Yanpas-groff_reader 2018-10-16 18:39:20 -07:00
Yan Pas
7741cdbf04 added old-style test 2018-10-17 00:21:52 +03:00
John MacFarlane
885cbfd420 Only override --quickcheck-tests=N if N is not default value (100).
Some of the round-trip tests are set to do a maximum of 25
trials when the default value is given.

Closes #4956.
2018-10-15 22:15:43 -07:00
Yan Pas
ce27bf9a02 builders 2018-10-16 03:12:06 +03:00
Yan Pas
3fed62611e tests, commented debug functions 2018-10-14 00:57:15 +03:00
Alexander Krotov
6b8fd99dbd Test that Muse reader can parse code with = sign inside
(fixed by previous commit)
2018-10-10 03:27:36 +03:00
Alexander Krotov
d3b2161bd1 Muse reader: fix parsing of empty cells 2018-10-10 01:48:58 +03:00
Yan Pas
27467189ab Merge branch 'master' into groff_reader 2018-10-07 18:10:01 +03:00
Alexander Krotov
5f7799ac8f Muse reader: allow table caption to contain "+" 2018-10-05 11:58:41 +03:00
leungbk
4f9ab7e032 Parse empty argument array in inline src blocks.
`enclosedByPair` alone does not the handle the empty array properly since it uses `many1Till`.
2018-09-28 14:05:14 +02:00
John MacFarlane
13f8f3c1a8 HTML, Muse reader tests: reduce time taken by round-trip test. 2018-09-27 09:47:09 -07:00
Albert Krewinkel
56fe5b559e
Use hslua v1.0.0 2018-09-24 20:11:27 +02:00
Alexander Krotov
389ffa3045 Muse reader tests: more tests
Check that indented blocks that end in self-terminating blocks (such as block tags and verse) can be terminated by paragraphs.
2018-09-22 20:28:11 +03:00
Alexander Krotov
dd5d234c6a Muse reader: do not allow code markup to be followed by digit 2018-09-21 13:07:56 +03:00
John MacFarlane
136bf901aa Markdown reader: distinguish autolinks in the AST.
With this change, autolinks are parsed as Links with
the `uri` class. (The same is true for bare links, if
the `autolink_bare_uris` extension is enabled.)  Email
autolinks are parsed as Links with the `email` class.
This allows the distinction to be represented in the
URI.

Formerly the `uri` class was added to autolinks by
the HTML writer, but it had to guess what was an autolink
and could not distinguish `[http://example.com](http://example.com)`
from `<http://example.com>`.  It also incorrectly recognized
`[pandoc](pandoc)` as an autolink.  Now the HTML writer
simply passes through the `uri` attribute if it is present,
but does not add anything.

The Textile writer has been modified so that the `uri`
class is not explicitly added for autolinks, even if it
is present.

Closes #4913.
2018-09-19 14:53:29 -07:00
Albert Krewinkel
dba5c8d4e3
Lua filter tests: produce better error on test failure 2018-09-19 21:36:19 +02:00
danse
db2a68d089 parse rST inlines containing newlines closing #4912
this eliminates a regression error introduced after pandoc 2.1.1,
affecting rST inline parsing. see the issue for details
2018-09-18 13:31:09 +02:00
Alexander Krotov
71776661cd Muse writer: replace newlines in strings with spaces 2018-09-16 21:05:57 +03:00
Alexander Krotov
3f8891b26f Enable tables in HTML round trip test 2018-09-11 19:24:00 +03:00
Alexander Krotov
ca420983aa HTML reader tests: accept Blocks in round trip test 2018-09-11 19:23:46 +03:00
Alexander Krotov
0ac3512cfe Muse reader tests: accept Blocks instead of Block in round trip test
This way testcase can be shrinked better up to removing all blocks completely.
2018-09-11 14:22:09 +03:00
Alexander Krotov
1aac754359 Muse writer: set envInsideBlock = True when rendering notes 2018-09-11 14:10:20 +03:00
Alexander Krotov
e6ba0cc893 HTML writer: always output <dt> element, even if it is empty
Fixes #4883
2018-09-11 13:20:11 +03:00
Alexander Krotov
165a61095c Muse writer: check for whitespace in the beginning and end of Str's 2018-09-11 11:49:11 +03:00
Alexander Krotov
cb28cab489 Muse writer: escape -, ; and > in the beginning of strings 2018-09-11 11:35:25 +03:00
Alexander Krotov
c899b4e89d Muse writer: escape list markers in the beginning of notes 2018-09-11 04:15:32 +03:00
Alexander Krotov
00b2b0feb6 Muse writer: normalize inline list before testing if tags should be used 2018-09-11 01:36:11 +03:00
Alexander Krotov
c2b97c4b80 Muse writer: use tags instead of lightweight markup for empty strings 2018-09-11 00:39:37 +03:00
Alexander Krotov
1b9dd3e06b Remove RawBlock from HTML round trip tests 2018-09-10 14:28:28 +03:00
Alexander Krotov
4467fe6d38 HTML reader: test round trip property 2018-09-10 12:15:27 +03:00
Albert Krewinkel
275afec38a Org reader: respect export option p for planning info
Inclusion of planning info (*DEADLINE*, *SCHEDULED*, and *CLOSED*) can
be controlled via the `p` export option: setting the option to `t` will
add all planning information in a *Plain* block below the respective
headline.
2018-09-06 20:57:21 +02:00
Alexander Krotov
0b7001c318 Muse reader: close the </quote> in indented tag test
There is already a separate test for unclosed </quote>.
2018-09-06 19:57:24 +03:00
Albert Krewinkel
ceec26f647 Org reader: strip planning info from output
Planning info is parsed, but not included in the output (as is the
default with Emacs Org-mode).

Fixes: #4867
2018-09-05 17:12:54 +02:00
Alexander Krotov
bec2023265 hlint Muse writer tests 2018-09-04 11:00:44 +03:00
Alexander Krotov
66f3b00206 Remove redundant $ 2018-09-04 10:53:37 +03:00
Alexander Krotov
02e68859eb Muse reader: autonumber sections in the correct order
Parsing now stops at each section header to ensure the
header is registered before parsing of the next section starts.
2018-09-02 17:37:19 +03:00
Alexander Krotov
6ea6011ca6 Muse writer: use lightweight markup when possible 2018-09-02 03:29:27 +03:00
Alexander Krotov
23ed97f081 Muse reader: allow newline after opening "*" or "**"
Emacs Muse allows this.
2018-09-02 01:03:43 +03:00
Alexander Krotov
56685e8735 Muse reader: parse <verse> tag in one pass
instead of using parseFromString.

This change makes it possible to have verbatim </verse> tag
inside verse.
2018-08-31 16:43:07 +03:00
Alexander Krotov
d74c63d6d3 Fix a typo: s/afeter/after/ 2018-08-30 16:02:46 +03:00
Alexander Krotov
81131ef5d1 Muse reader: don't allow digits after closing marker in lightweight markup
This change makes reader more compatible with Emacs Muse
2018-08-12 21:20:07 +03:00
John MacFarlane
581a3514ca RST reader: improve parsing of inline interpreted text roles.
* Use a Span with class "title-reference" for the default
  title-reference role.
* Use B.text to split up contents into Spaces, SoftBreaks, and Strs
  for title-reference.
* Use Code with class "interpreted-text" instead of Span and Str for
  unknown roles.  (The RST writer has also been modified to round-trip
  this properly.)
* Disallow blank lines in interpreted text.
* Backslash-escape now works in interpreted text.
* Backticks followed by alphanumerics no longer end interpreted text.

Closes #4811.
2018-08-05 09:56:43 -07:00
Francesco Occhipinti
2661658a69 RST writer: use titleblock instead of title variable for title block
Closes #4803

After this commit use `$titleblock$` in order to get what was contained
in `$title$` before, that is a title and subtitle rendered according to
the official rST method:
http://docutils.sourceforge.net/docs/user/rst/quickstart.html#document-title-subtitle. from

With this commit, the `$title$` and `$subtitle$` metadata are available and they
simply carry the metadata values.  This opens up more possibilities in templates.
2018-08-01 12:32:16 -07:00
Albert Krewinkel
fb94c0f6a1 Lua Utils module: add function blocks_to_inlines (#4799)
Exposes a function converting which flattenes a list of blocks into a
list of inlines. An example use case would be the conversion of Note
elements into other inlines.
2018-07-30 10:55:25 -07:00
danse
be2d7921cb RST reader: remove support for nested inlines.
RST does not allow nested emphasis, links, or other inline
constructs.

Closes #4581, double parsing of links with URLs as
link text.  This supersedes the earlier fix for #4581
in 6419819b46.

Fixes #4561, a bug parsing with URLs inside emphasis.

Closes #4792.
2018-07-24 15:35:50 -07:00
Albert Krewinkel
4e899eb9c8
Org reader: fix parsers relying on parseFromString
Emphasis was not parsed when it followed directly after some block types
(e.g., lists).

The org reader uses a wrapper for the `parseFromString` function to
handle org-specific state. The last position of a character allowed
before emphasis was reset incorrectly in this wrapper. Emphasized text
was not recognized when placed directly behind a block which the reader
parses using `parseFromString`.

Fixes: #4784
2018-07-23 22:05:41 +02:00
Anders Waldenborg
ec30fb37c1 Wrap emojis in span nodes (#4759)
Text.Pandoc.Emoji now exports `emojiToInline`, which returns a Span inline containing the emoji character and some attributes with metadata (class `emoji`, attribute `data-emoji` with emoji name).  Previously, emojis (as supported in Markdown and CommonMark readers, e.g "😄")
were simply translated into the corresponding unicode code point.  By wrapping them in Span
nodes, we make it possible to do special handling such as giving them a special font
in HTML output.  We also open up the possibility of treating them differently when the
`--ascii` option is selected (though that is not part of this commit).

Closes #4743.
2018-07-15 15:14:40 -07:00
Alexander Krotov
41cf6d540f More spellcheck 2018-07-02 19:07:28 +03:00
Alexander Krotov
5fbc981fc2 Muse reader: add support for floating images 2018-05-31 23:31:27 +03:00
Alexander Krotov
1f78efff3b Muse reader: add support for images with specified width 2018-05-31 01:07:51 +03:00
Alexander Krotov
1100bfc0e6 Muse reader: parse image URLs without "guard" and "takeExtension" 2018-05-30 02:29:43 +03:00
Alexander Krotov
6907985e82 Muse reader: test image with space in filename 2018-05-27 22:22:04 +03:00
Yan Pas
1ce067fc2a tests, parsing fixes 2018-05-23 00:20:30 +03:00
Yan Pas
b0b41cbbe6 Merge branch 'master' into groff_reader 2018-05-12 11:42:39 +03:00
John MacFarlane
a00ca6f0d8 Removed inadvertently added .orig files from repository.
These were added by
96d10c72cc

Closes #4648.
2018-05-11 17:10:32 -07:00
Yan Pas
ad19166bc3 fix build and tests 2018-05-09 20:40:37 +03:00
Yan Pashkovsky
a337685fe0
Merge branch 'master' into groff_reader 2018-05-09 19:48:34 +03:00
Yan Pas
c1617565fc basic manfile parsing 2018-05-09 03:24:45 +03:00
Alexander Krotov
5879923422 Muse writer: add support for left-align and right-align classes
Address issue #4542
2018-05-07 14:54:20 +03:00
Alexander Krotov
4139e3e92b Test Lua filter converting display math to inline math 2018-04-29 16:20:38 +03:00
Francesco Occhipinti
8b01f03eaa RST writer: preserve empty inline parents in flatten (#4603) 2018-04-27 09:01:20 -07:00
Alexander
1927bc9aac Add FB2 reader (#4539) 2018-04-26 12:33:18 -07:00
John MacFarlane
619aaf29aa Merge branch 'fb2-hrblankline' of https://github.com/labdsf/pandoc into labdsf-fb2-hrblankline 2018-04-26 12:29:06 -07:00
Francesco Occhipinti
eef1c211f5 RST reader: flatten nested inlines, closes #4368 (#4554)
nested inlines are not valid RST syntax, so we flatten them following
some readability criteria discussed in #4368.
2018-04-26 12:17:51 -07:00
Alexander Krotov
4d89a1db7f Muse reader: allow nested footnotes 2018-04-26 12:38:17 +03:00
John MacFarlane
16f36eee43 Removed deprecated ancient HTML math methods.
Removed `--latexmathml`, `--gladtex`, `--mimetex`, `--jsmath`, `-m`,
`--asciimathml` options.

Removed `JsMath`, `LaTeXMathML`, and `GladTeX` constructors from
`Text.Pandoc.Options.HTMLMathMethod` [API change].

Removed unneeded data file LaTeXMathML.js and updated tests.

Bumped version to 2.2.
2018-04-25 17:18:56 -07:00
John MacFarlane
276894a2f2 RST writer: use more consistent indentation.
Previously we used an odd mix of 3- and 4-space indentation.
Now we use 3-space indentation, except for ordered lists,
where indentation must depend on the width of the list marker.

Closes #4563.
2018-04-19 13:47:16 -07:00
Alexander Krotov
caeb963447 FB2 writer: convert metadata value "abstract" to book annotation 2018-04-19 17:03:21 +03:00
Alexander Krotov
ce4326a4f1 Muse reader: allow "-" in anchors 2018-04-19 14:17:59 +03:00
Jesse Rosenthal
c5d8fab058 Docx reader tests: Test for combining adjacent code blocks. 2018-04-17 09:29:54 -04:00
Alexander Krotov
3443df6068 Markdown reader: add regression test for previous commit 2018-04-17 11:55:37 +03:00
Alexander Krotov
a8122987fc Muse reader: allow verse to be indented
Muse writer indents verse blocks in definition list more than necessary, so Muse reader should parse them.
2018-04-16 15:08:34 +03:00
Alexander Krotov
ce7301de02 Fix a typo in Muse reader testsuite comment 2018-04-16 12:12:25 +03:00
Alexander Krotov
f39931fd6c Muse writer: escape definition list terms starting with list markers 2018-04-16 11:40:18 +03:00
Alexander Krotov
01f5ed14e6 Muse reader: don't allow footnote references inside links 2018-04-15 17:53:53 +03:00
Alexander Krotov
17767bd29d Muse writer: escape strings starting with space 2018-04-15 16:28:45 +03:00
Alexander Krotov
9cc2bf0295 Muse reader: allow URL to be empty
Muse writer can write links with empty URLs, so Muse reader should read them.
2018-04-15 14:50:46 +03:00
Alexander Krotov
6be0139145 Muse reader: require that comment semicolons are in the first column
Fixes #4551
2018-04-15 12:17:33 +03:00
John MacFarlane
d5b98c8c6e Man writer: Don't escape U+2019 as '.
Closes #4550.
2018-04-14 10:42:05 -07:00
Alexander Krotov
782ab73aa3 Muse writer: escape > less often
> should be escaped only when it can start verse, i.e., at the beginning of the line.
2018-04-10 23:38:30 +03:00
Alexander Krotov
52803e2960 Muse writer: don't break headers, line blocks and tables with line breaks 2018-04-09 04:24:08 +03:00
Alexander Krotov
44093930a8 Muse writer: correctly output empty headings 2018-04-09 04:10:05 +03:00
Alexander Krotov
17b0499516 Muse reader: add support for Text:Amuse multiline headings 2018-04-09 02:05:57 +03:00
Alexander Krotov
ebbd441d06 Muse reader: add support for <biblio> and <play> tags 2018-04-07 18:31:06 +03:00
John MacFarlane
7e99178a09 Changes to tests to accommodate changes in pandoc-types.
In https://github.com/jgm/pandoc-types/pull/36 we changed
the table builder to pad cells.  This commit changes tests
(and two readers) to accord with this behavior.
2018-04-05 10:14:06 -07:00
Alexander Krotov
f224567d52 FB2 writer: represent HorizontalRule as empty line
HorizontalRule corresponds to <hr> element in the default output
format, HTML. Current HTML standard defines <hr> element as
"paragraph-level thematic break". In typography it is often
represented by extra space or centered asterism ("⁂"), but since
FB2 does not support text centering, empty line (similar to extra space)
is the only solution.

Line breaks, on the other hand, don't generate <empty-line />
anymore. Previously line breaks generated <empty-line /> element
inside paragraph, which is not allowed. So, this commit addresses
issue #2424 ("FB2 produced by pandoc doesn't validate").

FB2 does not have a way to represent line breaks inside paragraphs.
They are replaced with LF character, which is not rendered by
FB2 readers, but at least preserves some information.
2018-04-05 19:53:36 +03:00
Alexander Krotov
87dda2109d Muse writer: escape horizontal rule only if at the beginning of the line 2018-04-05 19:49:09 +03:00
Alexander Krotov
2380845206 Muse reader: add <math> tag support 2018-04-02 17:19:26 +03:00
Alexander Krotov
ca78d93b40 Muse writer: place header IDs before header
See https://github.com/melmothx/text-amuse/issues/39
2018-04-02 15:58:37 +03:00
Alexander Krotov
aca4137c40 Muse writer: only escape brackets when necessary
It includes cases when they can be mistaken for footnotes
and links, as well as inside link description.
2018-04-01 19:39:18 +03:00
Alexander Krotov
bdb8424697 Muse writer: do not escape list markers unless preceded by space 2018-03-31 23:40:31 +03:00
Alexander Krotov
b379a2903a Muse writer: escape semicolons and markers after line break 2018-03-28 13:19:39 +03:00
Alexander Krotov
aa929e462d Muse reader: enable round-trip test
Close #4468
2018-03-25 23:04:54 +03:00
Alexander Krotov
79592db66c Muse reader: allow links to have empty descriptions 2018-03-25 22:16:45 +03:00
Alexander Krotov
a3f659d2c0 Muse writer: escape ordered list markers
Also reduced amount of <verbatim> tags in output to avoid escaping every "-" and word that ends in a full stop.
2018-03-25 19:28:23 +03:00
Alexander Krotov
c24c9efd98 Muse writer: enable --wrap=preserve for all tests by default 2018-03-25 18:31:28 +03:00
Alexander Krotov
c6232d0f7d Muse reader: require block <literal> tags to be on separate lines 2018-03-25 18:31:28 +03:00
Alexander Krotov
4a8993f9b0 Muse writer: improve span writing
Test more cases when span has or hasn't anchor, class and contents in different combinations.
2018-03-25 01:18:33 +03:00
Alexander Krotov
d58b961a6d Muse writer: do not join Span's doing normalization
Separate spans may have different semantics, for example if spans indicate syllables in a word.
2018-03-25 00:30:05 +03:00
Alexander Krotov
6f50733691 Muse writer: don't align ordered list items
It leads to problems with round-trip test,
because aligned line blocks can't be read back.
2018-03-21 17:33:27 +03:00
Jesse Rosenthal
f12348cab5 Powerpoint writer: add tests for improved speaker notes.
Tests speaker notes appearing after (and inside of) separating blocks.

Output checked on Windows10 (archlinux virtualbox), PowerPoint
2013. Not corrupted, and output as expected.
2018-03-21 10:07:07 -04:00
Alexander Krotov
81afcdfaf8 Muse writer: escape "]" in image title 2018-03-20 15:01:53 +03:00
Alexander Krotov
268c73c873 Muse writer: escape ";" to avoid accidental comments 2018-03-20 12:16:34 +03:00
Alexander Krotov
d63bba3066 Muse writer: escape "]" brackets in URLs as "%5D" 2018-03-20 12:16:34 +03:00
John MacFarlane
0ef56657ed Comment out Muse reader round-trip test.
It fails too often.  Perhaps a separate test program should
be used to hunt for round-trip bugs.
2018-03-18 12:43:36 -07:00
John MacFarlane
7e389cb3db Use NoImplicitPrelude and explicitly import Prelude.
This seems to be necessary if we are to use our custom Prelude
with ghci.

Closes #4464.
2018-03-18 10:46:28 -07:00
John MacFarlane
dfa1dc164a hlint fixes. 2018-03-17 22:00:55 -07:00
Francesco Occhipinti
ba965d1736 RST writer: filter out empty inline containers (#4434).
There is nothing in RST that corresponds to e.g. `Emph []`, so we just filter out elements like this.
2018-03-17 20:39:26 -07:00
Francesco Occhipinti
65cc909fde RST writer: strip whitespace within inlines, closes #4327 (#4329)
+ Whitespace is ignored at the beginning and end of emphasis, as per
  <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup>.
+ Export `stripLeadingTrailingSpace` from `Text.Pandoc.Writers.Shared`.
2018-03-17 19:21:27 -07:00
John MacFarlane
049dacf85f Removed redundant import of <> 2018-03-17 17:17:47 -07:00
Jesse Rosenthal
85a65c6a51 Docx reader: add tests for nested smart tags. 2018-03-13 22:16:54 -04:00
Alexander Krotov
3ee45a7357 Muse reader: compare first rewrite to the second in round-trip test 2018-03-12 15:09:27 +03:00
Alexander Krotov
c3fbc492c8 Muse reader: require closing tag to have the same indentation as opening 2018-03-12 14:24:50 +03:00
Alexander Krotov
f0a029ac51 Muse reader: do not reparse blocks inside unclosed block tag
Fixes #4425
2018-03-12 13:44:27 +03:00
Alexander Krotov
19fd98e452 Muse writer: support spans with anchors 2018-03-12 01:47:20 +03:00
Alexander Krotov
9bcd090848 Muse reader: parse <class> tag
<class> tag is supported by Emacs Muse
2018-03-10 07:27:41 +03:00
Alexander Krotov
1884ee6083 Muse writer: replace smallcaps with emphasis before normalization 2018-03-07 20:10:19 +03:00
Alexander Krotov
ff8e59a174 Muse writer: output smallcaps as emphasis 2018-03-07 19:11:27 +03:00
Alexander Krotov
f8e255053d Muse writer: write empty inline lists as <verbatim></verbatim> 2018-03-07 18:35:04 +03:00
Alexander Krotov
1b1b6f02d5 Muse writer: escape "-" to avoid creating bullet lists 2018-03-07 15:19:36 +03:00
Alexander Krotov
4d2bf177fc Muse reader: do not produce empty Str element for unindented verse lines 2018-03-07 14:24:16 +03:00
Alexander Krotov
31b4387a6b Muse writer: fix math expansion for more than one expression per paragraph 2018-03-06 12:58:20 +03:00
Nokome Bentley
7d193b2aad Remove extraneous, significant whitespace in JATS writer output (#4335)
This patch fixes some cases where the JATS writer was introducing
semantically significant whitespace by indenting and wrapping tags.
Note that the JATS spec has a content model for `<p>` tags of `(#PCDATA | ...`.
Any tag where `#PCDATA` children are possible should not have any
indentation. The same is true for `<th>`, `<td>`, `<term>`, `<label>`.
2018-03-05 09:44:34 -08:00
Alexander Krotov
7da6e4390c Muse writer: expand math before inline list normalization 2018-03-05 19:50:19 +03:00
Alexander Krotov
a71a1fec69 Muse reader: fix indentation requirements for footnote continuations 2018-03-03 03:33:02 +03:00
Alexander Krotov
a01573692a Muse reader: enable <literal> tags even if amuse extension is enabled
Amusewiki disables <literal> tags for security reasons.
If user wants similar behavior in pandoc, RawBlocks and RawInlines
can be removed or replaced with filters.
2018-03-02 12:52:39 +03:00
Alexander Krotov
9dbd59a7c1 Muse writer: join strings during inline normalization 2018-03-02 01:45:01 +03:00
Alexander Krotov
177c5120a5 Muse reader: do not consume whitespace while looking for closing end tag
Fix for a bug caught by round-trip test.
2018-03-02 01:01:50 +03:00
Alexander Krotov
55c4b9982c Muse reader: convert alphabetical list markers to decimal in round-trip test
Alphabetical lists are an addition of Text::Amuse.
They are not present in Emacs Muse and can be ambiguous
when list starts with "i.", "c." etc.
2018-03-02 00:33:16 +03:00
Jesse Rosenthal
7d3e7a5a6d Docx reader: Handle nested sdt tags.
Previously we had only unwrapped one level of sdt tags. Now we recurse
if we find them.

Closes: #4415
2018-02-28 16:32:20 -05:00
Alexander Krotov
cc34771928 Muse reader: add test for verse tag with one empty line 2018-02-28 14:43:36 +03:00
Alexander Krotov
8b1630aae0 Muse writer: change verse markup
Use "> " instead of <verse> tag
2018-02-28 14:42:43 +03:00
Alexander Krotov
1d57f7a641 Muse writer: remove empty strings during inline normalization 2018-02-28 14:26:11 +03:00
Alexander Krotov
a7ac590b08 Muse reader: allow <quote> and other tags to be indented 2018-02-28 12:11:56 +03:00
Jesse Rosenthal
0287530a67 Powerpoint writer: use trim from Shared
Instead of writing my own.
2018-02-27 11:28:15 -05:00
Jesse Rosenthal
cdaa80e718 Powerpoint writer: add test for table and list syntax
These were never added when the tests were first created.

Output files checked in MS PowerPoint 2013 (Windows 10, VBox). No
corruption, and output as expected.
2018-02-27 09:34:24 -05:00
Jesse Rosenthal
cdbe45e8ee Powerpoint writer: Remove empty slides
Make sure there are no empty slides in the pptx output. Because of the
way that slides were split, these could be accidentally produced by
comments after images.

When animations are added, there will be a way to add an empty slide
with either incremental lists or pauses.

Test outputs checked with MS PowerPoint (Office 2013, Windows 10,
VBox). Both files have expected output and are not corrupted.
2018-02-27 09:12:17 -05:00