Commit graph

1932 commits

Author SHA1 Message Date
Alexander Krotov
f8877516e0 Muse reader: Require space before and after '=' for code (#3758) 2017-06-25 10:01:43 +02:00
John MacFarlane
a20302d9cf Added comment in source. 2017-06-23 22:36:43 +02:00
John MacFarlane
5812ac0390 Markdown reader: interpret YAML metadata as Inlines when possible.
If the metadata field is all on one line, we try to interpret
it as Inlines, and only try parsing as Blocks if that fails.

If it extends over one line (including possibly the `|` or
`>` character signaling an indented block), then we parse as
Blocks.

This was motivated by some German users finding that

    date: '22. Juin 2017'

got parsed as an ordered list.

Closes #3755.
2017-06-23 22:31:08 +02:00
John MacFarlane
2b34337a9c Text.Pandoc.Extensions: Added Ext_raw_attribute.
Documented in MANUAL.txt.

This is enabled by default in pandoc markdown and multimarkdown.
2017-06-23 00:37:13 +02:00
John MacFarlane
6e6324bade Removed an 'error' bomb. 2017-06-20 22:44:09 +02:00
John MacFarlane
21c4281b13 Odt reader: replaced collectRights with rights from Data.Either. 2017-06-20 22:43:06 +02:00
John MacFarlane
2363e6a15b Move CR filtering from tabFilter to the readers.
The readers previously assumed that CRs had been filtered
from the input.  Now we strip the CRs in the readers themselves,
before parsing.  (The point of this is just to simplify the
parsers.)

Shared now exports a new function `crFilter`. [API change]
And `tabFilter` no longer filters CRs.
2017-06-20 21:52:13 +02:00
Alexander Krotov
2192528424 Muse reader: check that headers start at the first column (#3749) 2017-06-20 14:48:00 +02:00
John MacFarlane
b6a38ed111 Vimwiki reader: adjusted for changes in trace. 2017-06-19 22:29:01 +02:00
John MacFarlane
814ac51d32 Separated tracing from logging.
Formerly tracing was just log messages with a DEBUG log
level.  We now make these things independent.  Tracing
can be turned on or off in PandocMonad using `setTrace`;
it is independent of logging.

* Removed `DEBUG` from `Verbosity`.
* Removed `ParserTrace` from `LogMessage`.
* Added `trace`, `setTrace` to `PandocMonad`.
2017-06-19 22:17:43 +02:00
Alexander Krotov
4929d027dc Muse reader: fix list item continuation parsing (#3747) 2017-06-19 22:16:21 +02:00
Yuchen Pei
564c77964d Added Vimwiki reader (#3705).
* New module Text.Pandoc.Readers.Vimwiki, exporting readVimwiki [API change].
* New input format `vimwiki`.
* New data file, `data/vimwiki.css`, for displaying the HTML produced by this reader and pandoc's HTML writer in the style of vimwiki's own HTML export.
2017-06-19 22:15:12 +02:00
Alexander Krotov
a91b9b2a1d Add Muse reader (#3620) 2017-06-19 10:46:02 +02:00
John MacFarlane
9849ba7fd7 Use Control.Monad.State.Strict throughout.
This gives 20-30% speedup and reduction of memory
usage in most of the writers.
2017-06-17 07:45:28 +02:00
John MacFarlane
b466152d61 Don't allow backslash + newline to affect block structure.
Note that as a result of this change, the following,
which formerly produced a header with two lines separated
by a line break, will now produce a header followed by a
paragraph:

    # Hi\
    there

This may affect some existing documents that relied on
this undocumented and unintended behavior.

This change makes pandoc more consistent with other
Markdown implementations, and with itself (since the two-space
version of a line break doesn't work inside ATX headers, and
neither version works inside Setext headers).

Closes #3730.
2017-06-11 22:24:20 +02:00
John MacFarlane
49b738de4e Rewrote HTML reader to use Text throughout.
- Export new NamedTag class from HTML reader.
- Effect on memory usage is modest (< 10%).
2017-06-11 21:15:58 +02:00
schrieveslaach
f36de77a25 Support for \faCheck and \faClose (#3727) 2017-06-11 07:47:42 +02:00
John MacFarlane
94b3dacb4e Changed all readers to take Text instead of String.
Readers: Renamed StringReader -> TextReader.

Updated tests.

API change.
2017-06-10 18:26:44 +02:00
Albert Krewinkel
55d679e382
Improve code style in lua and org modules 2017-06-03 13:35:19 +02:00
Albert Krewinkel
d55f01c65f
Org reader: apply hlint suggestions 2017-06-03 00:05:20 +02:00
John MacFarlane
e43ea03410 Fixed HTML reader. 2017-06-02 10:10:31 +02:00
John MacFarlane
eb6fb62e55 HTML reader: Use sets instead of lists for block tag lookup. 2017-06-01 19:15:00 +02:00
John MacFarlane
0f07404daf HTML reader: Removed "button" from block tag list.
It is already in the eitherBlockOrInlineTag list, and
should be both places.

Closes #3717.

Note: the result of this change is that there will be
p tags around the whole paragraph.  That is the right
result, because the `button` tags are treated as inline
HTML here, and the whole chunk of text is a Markdown
paragraph.
2017-06-01 18:59:21 +02:00
John MacFarlane
9396f1fb67 LaTeX reader: handle some width specifiers on table columns.
Currently we only handle the form `0.9\linewidth`.
Anything else would have to be converted to a percentage,
using some kind arbitrary assumptions about line widths.

See #3709.
2017-06-01 12:08:28 +02:00
John MacFarlane
af6e8414c7 LaTeX reader: more table refactoring. 2017-06-01 11:56:59 +02:00
John MacFarlane
58cfac84f0 LaTeX reader: Small refactoring of table parsing code.
This makes room for doing something with widths.
2017-06-01 11:35:03 +02:00
John MacFarlane
1e7ba5ccd7 LaTeX reader: Handle block structure inside table cells.
minipage is no longer required.

Closes #3709.
2017-06-01 11:16:28 +02:00
John MacFarlane
a61dce88e8 Merge pull request #3714 from tarleb/odt-reader-cleanup
Odt reader: remove dead code
2017-06-01 10:26:25 +02:00
Albert Krewinkel
e1a0666689
Org reader: respect export option for tags
Tags are appended to headlines by default, but will be omitted when the
`tags` export option is set to nil.

Closes: #3713
2017-05-31 21:26:07 +02:00
Albert Krewinkel
33a1e4ae1a
Org reader: include tags in headlines
The Emacs default is to include tags in the headline when exporting.
Instead of just empty spans, which contain the tag name as attribute,
tags are rendered as small caps and wrapped in those spans.
Non-breaking spaces serve as separators for multiple tags.
2017-05-31 20:43:30 +02:00
Albert Krewinkel
7852cd5603
Org reader: recognize babel result blocks with attributes
Babel result blocks can have block attributes like captions and names.
Result blocks with attributes were not recognized and were parsed as
normal blocks without attributes.

Fixes: #3706
2017-05-31 20:01:04 +02:00
Albert Krewinkel
4b98d0459a
Org reader: fix module names in haddock comments
Copy-pasting had lead to haddock module descriptions containing the
wrong module names.
2017-05-31 20:01:04 +02:00
Albert Krewinkel
f955af58e6
Odt reader: remove dead code
The ODT reader contained a lot of general code useful for working with
arrows. However, many of these utils weren't used and are hence removed.
2017-05-31 19:59:34 +02:00
John MacFarlane
774075c3e2 Added eastAsianLineBreakFilter to Shared.
This used to live in the Markdown reader.
2017-05-30 10:22:48 +02:00
John MacFarlane
5ec384eb60 LaTeX reader: handle escaped & inside table cell.
Closes #3708.
2017-05-29 22:47:04 +02:00
John MacFarlane
230a1b89e8 LaTeX reader: don't crash on empty enumerate environment.
Closes #3707.
2017-05-29 15:09:24 +02:00
John MacFarlane
d461b29d9d Merge pull request #3704 from labdsf/anylinenewline
Markdown reader: use anyLineNewline
2017-05-29 09:25:53 +02:00
Alexander Krotov
efc069de5d Markdown reader: use anyLineNewline 2017-05-28 22:52:35 +03:00
Herwig Stuetz
bfd5c6b172 Org reader: Fix cite parsing behaviour
Until now, org-ref cite keys included special characters also at the
end. This caused problems when citations occur right before colons or
at the end of a sentence.

With this change, all non alphanumeric characters at the end of a cite
key are ignored.

This also adds `,` to the list of special characters that are legal
in cite keys to better mirror the behaviour of org-export.
2017-05-28 18:08:11 +02:00
Herwig Stuetz
5a71632d11 Parsing: many1Till: Check for the end condition before parsing
By not checking for the end condition before the first parse, the
parser was applied too often, consuming too much of the input.

This fixes the behaviour of

  `testStringWith (many1Till (oneOf "ab") (string "aa")) "aaa"`

which before incorrectly returned `Right "a"`. With this change, it
instead correctly fails with `Left (PandocParsecError ...)` because it
is not able to parse at least one occurence of `oneOf "ab"` that is
not `"aa"`.

Note that this only affects `many1Till p end` where `p` matches on a
prefix of `end`.
2017-05-28 18:08:11 +02:00
Alexander Krotov
c38d5966ed RST reader: use anyLineNewline in rawListItem (#3702) 2017-05-28 09:29:37 +02:00
John MacFarlane
8614902234 Markdown writer: changes to --reference-links.
With `--reference-location` of `section` or `block`, pandoc
will now repeat references that have been used in earlier
sections.

The Markdown reader has also been modified, so that *exactly*
repeated references do not generate a warning, only
references with the same label but different targets.

The idea is that, with references after every block,
one  might want to repeat references sometimes.

Closes #3701.
2017-05-27 23:18:45 +02:00
Albert Krewinkel
bf93c07267
Org reader: subject full doc tree to headline transformations
Emacs parses org documents into a tree structure, which is then
post-processed during exporting. The reader is changed to do the same,
turning the document into a single tree of headlines starting at
level 0.

Fixes: #3695
2017-05-27 15:38:08 +02:00
John MacFarlane
708973a33a Added spaced_reference_links extension.
This is now the default for pandoc's Markdown.
It allows whitespace between the two parts of a
reference link:  e.g.

    [a] [b]

    [b]: url

This is now forbidden by default.

Closes #2602.
2017-05-25 12:57:31 +02:00
John MacFarlane
8f2c803f97 Markdown reader: warn for notes defined but not used.
Closes #1718.

Parsing.ParserState: Make stateNotes' a Map, add stateNoteRefs.
2017-05-25 11:34:51 +02:00
John MacFarlane
41db9e826e MediaWiki reader: don't do curly quotes inside <tt> contexts.
Even if `+smart`.

See #3585.
2017-05-25 09:35:25 +02:00
John MacFarlane
e6f4636a2c MediaWiki reader: Make smart double quotes depend on smart extension.
Closes #3585.
2017-05-25 09:19:34 +02:00
John MacFarlane
b9a30ef959 Markdown reader: fixed smart quotes after emphasis.
E.g. in

    *foo*'s 'foo'

Closes #2228.
2017-05-24 23:23:08 +02:00
John MacFarlane
8f718b0883 LaTeX reader: Fixed failures on \ref{}, \label{} with +raw_tex.
Now these commands are parsed as raw if `+raw_tex`;
otherwise, their argument is parsed as a bracketed string.
2017-05-24 23:04:49 +02:00
John MacFarlane
bc6aac7b47 Parsing: Provide parseFromString'.
This is a verison of parseFromString specialied to
ParserState, which resets stateLastStrPos at the end.
This is almost always what we want.

This fixes a bug where `_hi_` wasn't treated as emphasis in
the following, because pandoc got confused about the
position of the last word:

    - [o] _hi_

Closes #3690.
2017-05-24 22:41:47 +02:00