2017-03-04 13:03:41 +01:00
|
|
|
{-# LANGUAGE FlexibleInstances #-}
|
|
|
|
{-# LANGUAGE GADTs #-}
|
|
|
|
{-# LANGUAGE ScopedTypeVariables #-}
|
2007-11-04 00:27:58 +01:00
|
|
|
{-
|
2017-05-13 23:30:13 +02:00
|
|
|
Copyright (C) 2006-2017 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
|
2017-05-13 23:30:13 +02:00
|
|
|
Copyright : Copyright (C) 2006-2017 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
|
2017-06-20 21:25:39 +02:00
|
|
|
> import Data.Text (Text)
|
|
|
|
> import qualified Data.Text.IO as T
|
2008-08-01 01:16:31 +02:00
|
|
|
>
|
2017-06-20 21:25:39 +02:00
|
|
|
> mdToRST :: Text -> IO Text
|
|
|
|
> mdToRST txt = runIOorExplode $
|
|
|
|
> readMarkdown def txt
|
|
|
|
> >>= writeRST def{ writerReferenceLinks = True }
|
|
|
|
|
2011-02-15 19:40:50 +01:00
|
|
|
>
|
2017-06-20 21:25:39 +02:00
|
|
|
> main :: IO ()
|
|
|
|
> main = do
|
|
|
|
> T.getContents >>= mdToRST >>= T.putStrLn
|
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
|
2017-10-29 23:00:49 +01:00
|
|
|
, module Text.Pandoc.Class
|
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
|