Commit graph

21 commits

Author SHA1 Message Date
John MacFarlane
d6a4c70ef8 Test fixes. 2015-12-12 12:58:31 -08:00
John MacFarlane
23b693c029 Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."
This reverts commit c423dbb5a3.
2015-11-09 10:08:22 -08:00
John MacFarlane
c423dbb5a3 Use -XNoImplicitPrelude and 'import Prelude' explicitly.
This is needed for ghci to work with pandoc, given that we
now use a custom prelude.

Closes #2503.
2015-11-08 16:56:59 -08:00
John MacFarlane
82b3e0ab97 Use custom Prelude to avoid compiler warnings.
- The (non-exported) prelude is in prelude/Prelude.hs.
- It exports Monoid and Applicative, like base 4.8 prelude,
  but works with older base versions.
- It exports (<>) for mappend.
- It hides 'catch' on older base versions.

This allows us to remove many imports of Data.Monoid
and Control.Applicative, and remove Text.Pandoc.Compat.Monoid.

It should allow us to use -Wall again for ghc 7.10.
2015-10-14 09:09:10 -07:00
John MacFarlane
653a7bbe21 Removed tabs from source. 2015-07-10 10:35:58 -07:00
Lars-Dominik Braun
d9e17cb3f7 Tests.Readers.RST: Test metadata with inline markup too 2015-07-03 16:57:30 +02:00
Lars-Dominik Braun
8577007d9b Tests.Readers.RST: Group field list tests 2015-07-03 16:44:02 +02:00
Lars-Dominik Braun
68b6b9f652 Readers.RST: Parse field list name
“Inline markup is parsed in field names.” [1]

[1] http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#field-lists
2015-07-03 16:41:28 +02:00
Lars-Dominik Braun
3b2c50ed93 Fix RST reference names with special characters 2015-06-29 18:34:45 +02:00
Matthew Pickering
1a7a99161a Update tests 2015-02-18 21:09:07 +00:00
Daniel Bergey
689fb112bf RST Reader: compute Attrs when role is defined
Move recursive role lookup from renderRole to addNewRole.  The Attr value
will be the same for every occurance of this role, so there's no reason
to compute it every time.  This allows simplifying the
stateRstCustomRoles map considerably.

We could go even further, and remove the fmt and attr arguments to
renderRole, which are null except for custom roles.
2014-12-12 14:45:45 +00:00
Daniel Bergey
4e040160e0 WIP: tests for RST roles 2014-12-12 14:45:45 +00:00
Daniel Bergey
74c1b547c2 parse RST class directives
The class directive accepts one or more class names, and creates a Div
value with those classes.  If the directive has an indented body, the
body is parsed as the children of the Div.  If not, the first block
folowing the directive is made a child of the Div.

This differs from the behavior of rst2xml, which does not create a Div
element.  Instead, the specified classes are applied to each child of
the directive.  However, most Pandoc Block constructors to not take an
Attr argument, so we can't duplicate this behavior.
2014-12-01 18:22:03 +00:00
Daniel Bergey
2cdfa5eb20 parse RST quoted literal blocks
closes #65
RST quoted literal blocks are the same as indented literal blocks (which
pandoc already supports) except that the quote character is preserved in
each line.

This includes test cases for the quoted literal block, as well as
additional tests for line blocks and indented literal blocks, to verify
that these are unaffected by the changes.
2014-12-01 18:22:03 +00:00
John MacFarlane
f869f7e08d Use new flexible metadata type.
* Depend on pandoc 1.12.
* Added yaml dependency.
* `Text.Pandoc.XML`: Removed `stripTags`.  (API change.)
* `Text.Pandoc.Shared`:  Added `metaToJSON`.
  This will be used in writers to create a JSON object for use
  in the templates from the pandoc metadata.
* Revised readers and writers to use the new Meta type.
* `Text.Pandoc.Options`: Added `Ext_yaml_title_block`.
* Markdown reader:  Added support for YAML metadata block.
  Note that it must come at the beginning of the document.
* `Text.Pandoc.Parsing.ParserState`:  Replace `stateTitle`,
  `stateAuthors`, `stateDate` with `stateMeta`.
* RST reader:  Improved metadata.
  Treat initial field list as metadata when standalone specified.
  Previously ALL fields "title", "author", "date" in field lists
  were treated as metadata, even if not at the beginning.
  Use `subtitle` metadata field for subtitle.
* `Text.Pandoc.Templates`:  Export `renderTemplate'` that takes a string
  instead of a compiled template..
* OPML template:  Use 'for' loop for authors.
* Org template: '#+TITLE:' is inserted before the title.
  Previously the writer did this.
2013-06-24 20:29:41 -07:00
John MacFarlane
daeb52d4e0 Eliminated use of TH in test suite. 2013-01-23 19:26:39 -08:00
John MacFarlane
5c067bb457 RST reader: Line block improvements.
* Use nonbreaking spaces for initial indent (otherwise lost in HTML and
  LaTeX).
* Allow multiple paragraphs in a single line block.
2013-01-13 11:15:31 -08:00
John MacFarlane
45e4c123a4 Moved tests to tests/, modified cabal file so lib isn't recompiled. 2012-07-26 08:37:36 -07:00
John MacFarlane
570d8ff08c Moved tests to src. 2011-01-29 11:24:16 -08:00
John MacFarlane
703c421c9e RST reader: Improved field lists.
Field lists now work properly with block content.
(Thanks to Lachlan Musicman for pointing out the bug.)

In addition, definition list items are now always Para instead
of Plain -- which matches behavior of rst2xml.py.

Finally, in image blocks, the alt attribute is parsed properly
and used for the alt, not also the title.
2011-01-26 17:23:57 -08:00
John MacFarlane
066cbbad76 Added RST reader tests. 2011-01-26 17:23:56 -08:00