2017-03-04 13:03:41 +01:00
|
|
|
{-# LANGUAGE FlexibleInstances #-}
|
|
|
|
{-# LANGUAGE GADTs #-}
|
|
|
|
{-# LANGUAGE ScopedTypeVariables #-}
|
2007-11-04 00:27:58 +01:00
|
|
|
{-
|
2016-03-23 01:20:39 +01:00
|
|
|
Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
|
2007-11-04 00:27:58 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
-}
|
|
|
|
|
|
|
|
{- |
|
|
|
|
Module : Text.Pandoc
|
2016-03-23 01:20:39 +01:00
|
|
|
Copyright : Copyright (C) 2006-2016 John MacFarlane
|
2011-02-15 19:40:50 +01:00
|
|
|
License : GNU GPL, version 2 or above
|
2007-11-04 00:27:58 +01:00
|
|
|
|
|
|
|
Maintainer : John MacFarlane <jgm@berkeley.edu>
|
2011-02-15 19:40:50 +01:00
|
|
|
Stability : alpha
|
2007-11-04 00:27:58 +01:00
|
|
|
Portability : portable
|
|
|
|
|
|
|
|
This helper module exports the main writers, readers, and data
|
|
|
|
structure definitions from the Pandoc libraries.
|
|
|
|
|
|
|
|
A typical application will chain together a reader and a writer
|
|
|
|
to convert strings from one format to another. For example, the
|
|
|
|
following simple program will act as a filter converting markdown
|
|
|
|
fragments to reStructuredText, using reference-style links instead of
|
|
|
|
inline links:
|
|
|
|
|
|
|
|
> module Main where
|
|
|
|
> import Text.Pandoc
|
2008-08-01 01:16:31 +02:00
|
|
|
>
|
2016-12-03 22:35:58 +01:00
|
|
|
> markdownToRST :: String -> Either PandocError String
|
2016-10-23 21:48:22 +02:00
|
|
|
> markdownToRST =
|
2016-12-03 22:35:58 +01:00
|
|
|
> writeRST def {writerReferenceLinks = True} . readMarkdown def
|
2011-02-15 19:40:50 +01:00
|
|
|
>
|
2016-12-03 22:35:58 +01:00
|
|
|
> main = getContents >>= either error return markdownToRST >>= putStrLn
|
2007-11-04 00:27:58 +01:00
|
|
|
|
2009-10-05 00:09:23 +02:00
|
|
|
Note: all of the readers assume that the input text has @'\n'@
|
|
|
|
line endings. So if you get your input text from a web form,
|
|
|
|
you should remove @'\r'@ characters using @filter (/='\r')@.
|
|
|
|
|
2007-11-04 00:27:58 +01:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Text.Pandoc
|
2011-02-15 19:40:50 +01:00
|
|
|
(
|
2007-11-04 00:27:58 +01:00
|
|
|
-- * Definitions
|
|
|
|
module Text.Pandoc.Definition
|
2010-12-24 22:39:27 +01:00
|
|
|
-- * Generics
|
|
|
|
, module Text.Pandoc.Generic
|
2012-07-25 19:45:45 +02:00
|
|
|
-- * Options
|
|
|
|
, module Text.Pandoc.Options
|
2017-02-10 20:59:54 +01:00
|
|
|
-- * Logging
|
|
|
|
, module Text.Pandoc.Logging
|
2016-11-27 11:51:40 +01:00
|
|
|
-- * Typeclass
|
2016-12-10 23:14:43 +01:00
|
|
|
, PandocMonad
|
|
|
|
, runIO
|
|
|
|
, runPure
|
|
|
|
, runIOorExplode
|
2017-02-04 21:06:36 +01:00
|
|
|
, setVerbosity
|
2016-10-24 22:31:36 +02:00
|
|
|
-- * Error handling
|
|
|
|
, module Text.Pandoc.Error
|
2007-11-04 00:27:58 +01:00
|
|
|
-- * Readers: converting /to/ Pandoc format
|
2017-04-17 10:51:37 +02:00
|
|
|
, module Text.Pandoc.Readers
|
2007-11-04 00:27:58 +01:00
|
|
|
-- * Writers: converting /from/ Pandoc format
|
2017-04-17 11:02:38 +02:00
|
|
|
, module Text.Pandoc.Writers
|
2009-12-31 02:10:57 +01:00
|
|
|
-- * Rendering templates and default templates
|
|
|
|
, module Text.Pandoc.Templates
|
2011-01-28 17:42:04 +01:00
|
|
|
-- * Miscellaneous
|
2015-10-10 22:42:02 +02:00
|
|
|
, pandocVersion
|
2007-11-04 00:27:58 +01:00
|
|
|
) where
|
|
|
|
|
2017-03-04 13:03:41 +01:00
|
|
|
import Text.Pandoc.Class
|
2007-11-04 00:27:58 +01:00
|
|
|
import Text.Pandoc.Definition
|
2017-03-04 13:03:41 +01:00
|
|
|
import Text.Pandoc.Error
|
2010-12-24 22:39:27 +01:00
|
|
|
import Text.Pandoc.Generic
|
2017-03-04 13:03:41 +01:00
|
|
|
import Text.Pandoc.Logging
|
|
|
|
import Text.Pandoc.Options
|
2017-04-17 10:51:37 +02:00
|
|
|
import Text.Pandoc.Readers
|
|
|
|
import Text.Pandoc.Shared (pandocVersion)
|
2017-03-04 13:03:41 +01:00
|
|
|
import Text.Pandoc.Templates
|
2017-04-17 11:02:38 +02:00
|
|
|
import Text.Pandoc.Writers
|