Commit graph

280 commits

Author SHA1 Message Date
John MacFarlane
6f736dfa75 Added Tests.Walk.
This verifies that walk and query match the generic traversals.
2013-08-10 19:04:15 -07:00
John MacFarlane
cbfa932106 Adjustments for new Format newtype. 2013-08-10 17:24:54 -07:00
John MacFarlane
800c5490ec LaTeX reader: Don't add spurious ", " to citation suffixes.
This is added when needed in Text.Pandoc.Biblio anyway.
2013-07-21 11:44:49 -07:00
Clare Macrae
7eded47bcd Initial work to create dokuwiki writer (#386)
In this first version, all dokuwiki files are straight copies of the
media wiki counterparts.
2013-07-14 13:40:27 +01:00
John MacFarlane
35e2caa058 Updated a test whose output changed due to last commit. 2013-07-13 13:47:09 -07:00
John MacFarlane
79a4ea03e2 Stop escaping | in LaTeX math.
This caused problems with array environments.  Closes #891.
2013-06-26 20:54:31 -07: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
a2b98ba218 Added test for #882. 2013-06-19 09:27:11 -07:00
John MacFarlane
0b85ad7546 Added stubs for haddock reader tests.
Modify tests/haddock-reader.haddock and
tests/haddock-reader.native.
2013-03-28 15:58:09 -07:00
John MacFarlane
5b4d239b85 Added OPML template, tests.
Minor fixes to OPML writer.
Improved OPML reader tests.
2013-03-20 10:17:59 -07:00
John MacFarlane
74d53f4347 Added Text.Pandoc.Readers.OPML, exporting readOPML.
The _note attribute is supported.  This is unofficial, but
used e.g. in OmniOutliner and supported by multimarkdown.
We treat the contents as markdown blocks under a section
header.

Added to documentation and tests.
2013-03-19 20:22:14 -07:00
John MacFarlane
835deee58b Markdown writer: New approach for citations.
* Reverts 1.11 change that caused citations to be rendered as
  markdown citations, even if `--biblio` was specified, unless
  `citation` extension is disabled.  Now, formatted citations
  are always printed if `--biblio` was specified.  If you want to
  reformat markdown keeping pandoc markdown citations intact,
  just don't specify `--biblio`.

* Reverted now unnecessary changes to Text.Pandoc.Biblio adding the raw
  block to mark the bibliography, and to Text.Pandoc.Writers.Markdown
  to remove the bibliography if `citations` not specified.

* If the content of a `Cite` inline is a `RawInline "latex"`, which
  means that a LaTeX citation command was parsed and `--biblio` wasn't
  specified, then render it as a pandoc markdown citation.  This means
  that `pandoc -f latex -t markdown`, without `--biblio`, will convert
  LaTeX citation commands to pandoc markdown citations.
2013-03-17 10:33:54 -07:00
John MacFarlane
cae52ecc31 Revert "LaTeX reader: citation handling changes."
This reverts commit f7229b1473.
2013-03-17 08:48:29 -07:00
John MacFarlane
f7229b1473 LaTeX reader: citation handling changes.
Previously, a LaTeX citation would always be parsed as a Citation
element, with the raw LaTeX in the [Inline] part.

Now, the LaTeX citation is parsed as a Citation element only if
`--biblio` was specified (i.e. only if there is a nonempty set
of references in readerReferences).  Otherwise it is parsed as
raw LaTeX.

This will make it possible to simplify some things in the markdown
writer.  It also makes the LaTeX reader behave more like the Markdown
reader.
2013-03-09 10:33:25 -08:00
John MacFarlane
af7e97b9f5 Markdown writer: Render citations as pandoc-markdown citations.
Previously citations were rendered as citeproc-formatted citations
by default.  Now we render them as pandoc citations, e.g. `[@item1]`,
unless the `citations` extension is disabled.

If you still want formatted citations in your markdown output,
use `pandoc -t markdown-citations`.
2013-03-07 16:38:19 -08:00
John MacFarlane
3b63cb0903 Hide Text.Pandoc.Highlighting.
* Moved code for translating listings language names to
  highlighting-kate names and back from LaTeX reader to Highlighting.
* Text.Pandoc.Highlighting no longer exposed (API change)
* Text.Pandoc.Highlighting exports toListingsLang, fromListingsLang
2013-03-05 22:09:42 -08:00
John MacFarlane
daeb52d4e0 Eliminated use of TH in test suite. 2013-01-23 19:26:39 -08:00
John MacFarlane
2fbe611a96 Get rid of compiler warnings in Tests.Helpers. 2013-01-19 10:41:12 -08:00
John MacFarlane
bf3a911a1c Changed Ext_autolink_urls -> Ext_autolink_bare_uris.
Added tests.
2013-01-15 12:44:50 -08:00
John MacFarlane
e9b3d5aa7a Added lots of tests for bare URIs. 2013-01-15 12:28:31 -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
70e308f2f9 Escape | as \vert in LaTeX math.
This avoids a clash with highlighting-kate's macros, which
redefine | as a short verbatim delimiter.  Thanks to
Björn Peemöller for raising this issue.
2013-01-12 10:21:19 -08:00
John MacFarlane
f2aa5fd661 Fixed/simplified diff output for tests. 2013-01-12 10:21:07 -08:00
John MacFarlane
d599c4cdab Added Attr field to Header.
Previously header ids were autogenerated by the writers.
Now they are generated (unless supplied explicitly) in the
markdown parser, if the `header_identifiers` extension is
selected.

In addition, the textile reader now supports id attributes on
headers.
2013-01-09 09:30:05 -08:00
John MacFarlane
8ff81dc9ca Updated tests for tight/loose lists.
Taking into account new context/latex output, and fixing
some bugs in the test suite Tests.Helpers and Tests.Writers.ConTeXt.
(We had the wrong order of expected/actual in the diff output.)
2013-01-07 20:58:49 -08:00
John MacFarlane
56ff5e1845 Updated test runner for changes in pandoc. 2013-01-03 11:20:10 -08:00
John MacFarlane
0675346e76 Fixed test suite to use Diff 0.2 API. 2013-01-02 11:41:22 -08:00
John MacFarlane
06300e59d5 Removed citationSuppressParens.
Makefile: Use citeproc-0.3.6 release.
2012-10-28 09:36:15 -07:00
John MacFarlane
6f2347635c LaTeX reader: Initialize citationSuppressParens field. 2012-10-22 19:17:00 -07:00
John MacFarlane
cfab8eaecb Revert "LaTeX reader: Use new suppressParens option for footnote citations."
This reverts commit 7499499b68.

Conflicts:

	src/Text/Pandoc/Readers/LaTeX.hs
2012-10-21 23:16:23 -07:00
John MacFarlane
7499499b68 LaTeX reader: Use new suppressParens option for footnote citations.
Also changed Biblio, Markdown reader, and LaTeX reader tests because
of new citationSuppressParens field in Citation.
2012-10-15 19:53:57 -07:00
John MacFarlane
93e92a4716 Renamed removedLeadingTrailingSpace to trim.
Also removeLeadingSpace to triml,
removeTrailingSpace to trimr.
2012-09-29 17:09:34 -04:00
John MacFarlane
6ad7ac1239 Removed need for utf8-string package.
* Depend on text.
* Expose Text.Pandoc.UTF8.
* Text.Pandoc.UTF8 now exports toString, fromString,
  toStringLazy, fromStringLazy.
* These are used instead of the old utf8-string functions.
2012-09-25 19:54:21 -07:00
John MacFarlane
22bd34fa33 Markdown reader: Fixed link parser to avoid exponential slowdowns.
Previously the parser would hang on input like this:

    [[[[[[[[[[[[[[[[[[hi

We fixed this by making the link parser parser characters
between balanced brackets (skipping brackets in inline code spans),
then parsing the result as an inline list.

One change is that

    [hi *there]* bud](/url)

is now no longer parsed as a link.  But in this respect pandoc behaved
differently from most other implementations anyway, so that seems okay.
All current tests pass.  Added test for this case.

Closes #620.
2012-09-22 14:05:09 -07:00
John MacFarlane
1038606036 LaTeX reader: Added a 'try' in rawLaTeXBlock.
This allows the markdown reader to treat '\begin' (not followed
by an argument) as a raw string rather than erroring out when
it doesn't find a '{'.

Closes #622.
2012-09-22 13:00:59 -07:00
John MacFarlane
93c35cbf14 Tests.Old: Set TMP to ".".
Otherwise TMP is unset and, on Windows, C:\Windows is used by default,
leading to permission violations.
2012-09-21 20:34:27 -07:00
John MacFarlane
3d361b2101 Added basic mediawiki reader.
Text.Pandoc.Readers.MediaWiki module,
tests/mediawiki-reader.{txt,native}.
2012-09-12 09:05:10 -07:00
John MacFarlane
dfa4b76630 Changes to literate haskell options.
- Removed writerLiterateHaskell from WriterOptions.
- Removed readerLiterateHaskell from ReaderOptions.
- Added Ext_literate_haskell to Extensions.  Test for this
  instead of the above.
- Removed failUnlessLHS from Shared.

Note:  At this point, +lhs and .lhs extension no longer has any effect.
Need to fix.
2012-08-08 23:18:19 -07:00
John MacFarlane
00dc1e715e Moved WriterOptions and associated types Shared -> Options. 2012-07-26 22:59:56 -07: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
0833daff4a Added Tests.Shared with normalize round-trip tests. 2011-01-29 10:03:24 -08:00
John MacFarlane
18089a44f5 Tests.Arbitrary: don't allow empty list items. 2011-01-29 10:02:12 -08:00
John MacFarlane
e9899b9ab8 Removed intentionally failing test in ConTeXt writer tests. 2011-01-29 09:04:05 -08:00
John MacFarlane
d8c9b0c6f7 Added biblatex citation tests to Tests.Readers.LaTeX.
Removed old biblatex-citations.latex.
2011-01-29 09:01:30 -08:00
John MacFarlane
7961208aaf Added natbib citation tests to Tests.Readers.LaTeX.
Removed old tests/natbib-citations.latex.
2011-01-29 08:47:00 -08:00
John MacFarlane
0acf774011 Added Tests.Readers.Markdown. 2011-01-26 22:09:09 -08:00
John MacFarlane
f8dca6ccbc Add support for attributes in inline Code.
Additional related changes:

* URLs in Code in autolinks now use class "url".
* Require highlighting-kate 0.2.8.2, which omits the final <br/> tag,
  essential for inline code.
2011-01-26 20:44:25 -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
John MacFarlane
c5384a33c0 Updates for compiling with ghc 7.
We now use a CPP trick to have compatible quasiquotes that
work in both GHC 6.12 and 7.
2011-01-26 17:23:56 -08:00
John MacFarlane
bd43c0f4c9 Bumped version to 1.8; depend on pandoc-types 1.8.
The old TeX, HtmlInline and RawHtml elements have been removed
and replaced by generic RawInline and RawBlock elements.

All modules updated to use the new raw elements.
2011-01-26 17:22:53 -08:00
John MacFarlane
b9356fcc7e Removed deliberate error in LaTeX reader tests. 2011-01-22 16:01:14 -08:00
John MacFarlane
87aaa7e719 Use ANSI color to point to diffs in test output.
ConTeXt writer bullet list test set to break as an example.
2011-01-22 14:58:32 -08:00
John MacFarlane
91cc03b131 Tests.Helpers: Added file quasiquoter.
This allows you to take expected test output from a file.
2011-01-22 13:54:12 -08:00
John MacFarlane
1fd5e3bcff Tests.Arbitrary: Let strings include any character. 2011-01-22 13:40:29 -08:00
John MacFarlane
5a1abbe7ac Fixed -Wall error in imports. 2011-01-22 13:40:18 -08:00
John MacFarlane
c801f4f621 Put dashed lines around diff results in Old test. 2011-01-22 13:39:59 -08:00
John MacFarlane
373d05601a Added native writer tests. 2011-01-22 12:37:19 -08:00
John MacFarlane
209b300d6a Added 'property' in Tests.Helpers & some quickcheck tests. 2011-01-22 12:18:59 -08:00
John MacFarlane
d86d9260df Tests.Arbitrary: Added instances for Inlines, Blocks. 2011-01-22 12:18:23 -08:00
John MacFarlane
15250859c3 Improved test framework.
Now there is a uniform interface for reader and writer tests.
Also added a quasiquoter, for multiline strings.
2011-01-22 10:50:15 -08:00
John MacFarlane
d43dbc83f2 More informative output on writer test failure. 2011-01-21 11:02:59 -08:00
John MacFarlane
d0726920db Added Tests.Writers.ConTeXt and helpers for writer tests. 2011-01-21 10:23:41 -08:00
John MacFarlane
e5e2b0f9ab Fixed the two test cases that were intentionally set to fail. 2011-01-20 22:38:16 -08:00
John MacFarlane
52b6e38425 Updated tests for new native format. 2011-01-20 22:36:40 -08:00
John MacFarlane
933cdaf4c8 Show Haskell-readable version of input string in test failure. 2011-01-19 09:44:53 -08:00
John MacFarlane
831889bebc Unit tests: On failure, print the input string. 2011-01-19 09:38:14 -08:00
John MacFarlane
608d5bc753 Added normalize in latex reader tests. 2011-01-18 23:37:54 -08:00
John MacFarlane
0502c0fd28 Revamped tests with new =: and =?> operators + builder.
Left in a couple failing tests for demonstration purposes.
2011-01-18 23:34:34 -08:00
John MacFarlane
0cfafdec64 Replaced --no-citeproc with --natbib in tests. 2011-01-16 11:19:52 -08:00
John MacFarlane
dc93073804 Minor code cleanup. 2011-01-14 18:09:16 -08:00
John MacFarlane
0222f367b1 Keep Tests.Arbitrary but remove quickcheck tests for now.
Remove Tests.Shared.
Remove dependency on QuickCheck.
2011-01-14 18:01:57 -08:00
John MacFarlane
d41c17a2d5 Added quickcheck tests for normalize in Shared. 2011-01-14 00:30:36 -08:00
John MacFarlane
b3fb541d01 Added Tests/Arbitrary.hs, with Arbitrary instances. 2011-01-13 22:31:04 -08:00
John MacFarlane
75e8ab25ef Adjusted source to 80-column limit. 2011-01-13 11:11:55 -08:00
John MacFarlane
4ccd30fe3e Moved Tests.Shared -> Tests.Helpers.
Tests.Shared would be the natural place to put tests for functions
in Text.Pandoc.Shared.
2011-01-13 10:59:44 -08:00
Nathan Gass
2dadb67b25 Generalized latexTestWithState to readerTestWithState. 2011-01-12 19:32:26 +01:00
Nathan Gass
daf5444e24 Merge branch 'tests' of github.com:xabbu42/pandoc into tests 2011-01-12 19:13:15 +01:00
Nathan Gass
e61348dc11 Reordered test files. 2011-01-12 19:12:54 +01:00