Commit graph

104 commits

Author SHA1 Message Date
Albert Krewinkel
8fdbef841d Update copyright notices for 2014, add missing notices 2014-05-09 00:46:08 +02:00
John MacFarlane
c8f97d3d41 Fix #1267.
We now check the writerName for a lua script in pandoc.hs, so that
lowercasing and format parsing aren't done.  Note this behavior
change: getWriter in Text.Pandoc no longer returns a custom writer on
input "foo.lua".
2014-04-27 20:56:50 -07:00
John MacFarlane
ae86e24ff6 Merge branch 'master' of https://github.com/mb21/pandoc into mb21-master 2014-03-04 10:15:43 -08:00
Albert Krewinkel
24b2ac43b0 Add a simple Emacs Org-mode reader
The basic structure of org-mode documents is recognized; however,
org-mode features like todo markers, tags etc. are not supported yet.
2014-03-04 10:40:40 +01:00
mb21
80511f1b34 InDesign ICML Writer 2014-02-28 13:35:35 +01:00
John MacFarlane
4a14467055 Text.Pandoc: Don't default to pandocExtensions for all writers.
In particular, we don't want to default to math parsing for the
HTML writer.
2013-12-06 17:31:47 -08:00
John MacFarlane
99bb066bb9 Pass writename as argument to filters.
This way filters can figure out what the target format is
and react appropriately.

Example:

    #!/usr/bin/env runghc
    import Text.Pandoc.JSON
    import Data.Char

    main = toJSONFilter cap
      where cap (Just "html") (Str xs) = Str $ map toUpper xs
            cap _ x = x

This capitalizes text only for html output.
2013-08-08 15:15:58 -07:00
John MacFarlane
97b2be599e Text.Pandoc: Don't reexport ToJSONFilter.
It's better just to import this from Text.Pandoc.JSON.
That way, compiled filters will be smaller in size.
2013-08-03 17:02:35 -07:00
John MacFarlane
1567d291a3 Text.Pandoc.JSON: Use To/FromJSON instances from pandoc-types.
* These use GHC generics rather than syb, and are faster.
* toJsonFilter is now a deprecated synonym of toJSONFilter from
  Text.Pandoc.JSON.
* The deprecated jsonFilter function has been removed.
2013-08-03 16:39:43 -07:00
John MacFarlane
5592666ca4 Text.Pandoc: Added readJSON, writeJSON to the API.
Closes #817.
2013-07-23 22:31:50 -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
5f4a32e465 Use aeson for json.
Benchmarked:  about twice as slow as json!
2013-06-24 20:27:37 -07:00
John MacFarlane
80ab208b3d Removed obsolete comment. 2013-05-09 09:50:15 -07:00
John MacFarlane
4fa2a94759 Added Text.Pandoc.Writers.Custom, --print-custom-lua-writer.
pandoc -t data/sample.lua

will load the script sample.lua and use it as a custom writer.
data/sample.lua is provided as an example.

Added `--print-custom-lua-writer` option to print the sample
script.
2013-04-14 00:31:39 -05:00
David Lazar
18459b95ba Add reader for Haddock markup based on Haddock's own lexer/parser. 2013-03-28 14:53:10 -07:00
John MacFarlane
da1e38893a Reveal.js improvements.
Changed name to revealjs (from reveal_js).
Set revealjs-url template variable to 'reveal.js' by default.
2013-03-23 21:48:34 -04:00
Jamie F. Olson
6b53a905c4 Added basic support for reveal.js.
Support unordered and ordered lists with "fragment" elements.

Modified by JGM to remove the --reveal_js-url command-line option.
Instead use -V reveal_js-url=... as with slidy and the other slide
formats.  Also cleaned up the list code in the HTML writer.
2013-03-21 14:54:17 -07:00
John MacFarlane
69acb47a34 Added Text.Pandoc.Writers.OPML.
TODO:

* Document in README
* Add tests
* Add template (and add template to cabal file)
2013-03-19 22:49:44 -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
18d490bd38 Added markdown_github as input format. 2013-02-11 17:27:06 -08:00
John MacFarlane
8eab759a9c RTF writer: Added writeRTFWithEmbeddedImages.
* RTF writer:  Export writeRTFWithEmbeddedImages instead of
  rtfEmbedImage.
* Text.Pandoc: Use writeRTFWithEmbeddedImages for RTF.
* Moved code for embedding images in RTF out of pandoc.hs.
2013-01-18 10:33:37 -08:00
John MacFarlane
923204d553 Options: Added multimarkdownExtensions.
Also added 'markdown_mmd' as input/output option.
2013-01-16 08:52:54 -08:00
John MacFarlane
97a3cb2e86 Options: Added githubMarkdownExtensions.
Added github_markdown as input/output option.
2013-01-11 10:11:53 -08:00
John MacFarlane
791763d09f Added markdown_phpextra as writer option. 2013-01-10 22:43:02 -08:00
John MacFarlane
f8db21fa16 Options: Added phpMarkdownExtraExtensions.
And added markdown_phpextra input/output format.
2013-01-10 22:39:47 -08:00
John MacFarlane
0cc9504796 EPUB changes.
* Epub writer now exports writeEPUB, not writeEPUB2 and writeEPUB3.
* Options now exports EPUBVersion
* WriterOptions now includes writerEpubVersion.
2013-01-05 13:00:12 -08:00
John MacFarlane
4e381e787a Use readMarkdownWithWarnings in Text.Pandoc. 2013-01-04 11:42:22 -08:00
John MacFarlane
3bea3635d6 Changed type of 'readers' in Text.Pandoc, so all readers are in IO.
Users who want pure readers can still get them; this just affects
the function getReader that looks up a reader based on the format
name.

The point of this change is to make it possible to print warnings
from the parser.
2013-01-03 22:55:55 -08:00
John MacFarlane
43448d7d53 Preliminary changes for epub3 format.
* EPUB writer now exports writeEPUB2 and writeEPUB3.
* 'epub' output format is epub v2, while 'epub3'
  is v3.
2012-11-02 17:46:22 -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
8d65651309 Changed strict to markdown_strict. 2012-08-09 22:32:22 -07:00
John MacFarlane
05216d2919 Fixed handling of default extensions, so they don't override +options. 2012-08-09 20:41:50 -07:00
John MacFarlane
0cb7362f62 Removed --strict, added extensions to writer/reader names.
* The `--strict` option has been removed.
* Instead of using `--strict`, one can now use `strict` instead of
  `markdown` as an input or output format name.
* The `--enable` and `--disable` optinos have been removed.
* It is now possible to enable or disable specific extensions
  by appending them (with '+' or '-') to the writer or reader
  name.  For example `pandoc -f markdown-footnotes+hard_line_breaks`.
* The lhs extensions are now implemented this way, too; you can
  use either `+lhs` or `+literate_haskell`.
2012-08-09 20:24:05 -07:00
John MacFarlane
71e0c206c1 Added getReader, getWriter to Text.Pandoc. 2012-08-09 19:11:19 -07:00
John MacFarlane
a740de0508 Use safeRead instead of using reads directly (various modules). 2012-08-09 08:11:28 -07:00
John MacFarlane
244dae8da8 Added parseFormatSpec to Text.Pandoc. 2012-08-09 07:42:40 -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
acde1e82d2 Changed reader parameters from ParserState to ReaderOptions. 2012-07-25 22:35:41 -07:00
John MacFarlane
856aa8c244 Moved stateLiterateHaskell to readerLiterateHaskell in Options. 2012-07-25 22:05:06 -07:00
John MacFarlane
da3702357d Put smart, strict in separate options field in state.
This is the beginning of a larger transition that will make
Options, not ParserState, the parameter of the read functions.
(Options will also be used in writers, in place of WriterOptions.)

Next step is to remove strict, replacing it with granular
tests for different extensions.
2012-07-25 10:45:45 -07:00
John MacFarlane
e6c76525b2 Text.Pandoc: writers now an assoc list of String, Writer.
A Writer can be a PureStringWriter, an IOStringWriter, or
an IOByteStringWriter.  ALL writers are now in the 'writers'
list, including the binary writers and fb2 writer.  Code simplified
at end of pandoc.hs.
2012-07-24 19:05:38 -07:00
John MacFarlane
fb6e798917 Set writerTableOfContents for s5 in Text.Pandoc, not pandoc.hs. 2012-07-23 22:58:16 -07:00
John MacFarlane
1bd0c47968 Set writerSlideVariant in Text.Pandoc rather than pandoc.hs. 2012-07-23 22:53:35 -07:00
Sergey Astanin
b39597a910 Added a new FictionBook2 (FB2) writer. 2012-07-22 11:13:14 -07:00
John MacFarlane
2351f7a112 Provide Data.Default instances for ParserState and WriterOptions.
Now you can use def (which is re-exported by Text.Pandoc) instead of
defaultParserState or defaultWriterOptions.  For now, these
are still defined too, so existing code need not change.

Closes #546.
2012-07-19 12:38:54 -07:00
Jonas Smedegaard
61f8dd4da8 Add support for Slideous output. 2012-05-24 10:31:18 +02:00
John MacFarlane
d0d101d840 Export readDocBook in Text.Pandoc. 2012-05-12 19:29:39 -07:00
John MacFarlane
d339b29967 Added skeleton of basic docbook reader. 2012-04-14 16:44:21 -07:00
John MacFarlane
9766b532f3 Added beamer+lhs as output format. 2012-03-09 10:32:32 -08:00