From b39597a910514ee22e8bf8c23995e66f2257d487 Mon Sep 17 00:00:00 2001 From: Sergey Astanin Date: Tue, 15 Feb 2011 19:40:50 +0100 Subject: Added a new FictionBook2 (FB2) writer. --- src/Text/Pandoc.hs | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc.hs') diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs index f3436cc7b..0a2c613b1 100644 --- a/src/Text/Pandoc.hs +++ b/src/Text/Pandoc.hs @@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {- | Module : Text.Pandoc Copyright : Copyright (C) 2006-2010 John MacFarlane - License : GNU GPL, version 2 or above + License : GNU GPL, version 2 or above Maintainer : John MacFarlane - Stability : alpha + Stability : alpha Portability : portable This helper module exports the main writers, readers, and data @@ -45,7 +45,7 @@ inline links: > markdownToRST = > (writeRST defaultWriterOptions {writerReferenceLinks = True}) . > readMarkdown defaultParserState -> +> > main = getContents >>= putStrLn . markdownToRST Note: all of the readers assume that the input text has @'\n'@ @@ -55,7 +55,7 @@ you should remove @'\r'@ characters using @filter (/='\r')@. -} module Text.Pandoc - ( + ( -- * Definitions module Text.Pandoc.Definition -- * Generics @@ -63,6 +63,7 @@ module Text.Pandoc -- * Lists of readers and writers , readers , writers + , iowriters -- * Readers: converting /to/ Pandoc format , readMarkdown , readRST @@ -98,9 +99,10 @@ module Text.Pandoc , writeODT , writeDocx , writeEPUB + , writeFB2 , writeOrg , writeAsciiDoc - -- * Writer options used in writers + -- * Writer options used in writers , WriterOptions (..) , HTMLSlideVariant (..) , HTMLMathMethod (..) @@ -129,7 +131,7 @@ import Text.Pandoc.Readers.Textile import Text.Pandoc.Readers.Native import Text.Pandoc.Writers.Native import Text.Pandoc.Writers.Markdown -import Text.Pandoc.Writers.RST +import Text.Pandoc.Writers.RST import Text.Pandoc.Writers.LaTeX import Text.Pandoc.Writers.ConTeXt import Text.Pandoc.Writers.Texinfo @@ -137,10 +139,11 @@ import Text.Pandoc.Writers.HTML import Text.Pandoc.Writers.ODT import Text.Pandoc.Writers.Docx import Text.Pandoc.Writers.EPUB +import Text.Pandoc.Writers.FB2 import Text.Pandoc.Writers.Docbook import Text.Pandoc.Writers.OpenDocument import Text.Pandoc.Writers.Man -import Text.Pandoc.Writers.RTF +import Text.Pandoc.Writers.RTF import Text.Pandoc.Writers.MediaWiki import Text.Pandoc.Writers.Textile import Text.Pandoc.Writers.Org @@ -168,7 +171,7 @@ readers = [("native" , \_ -> readNative) ,("rst+lhs" , \st -> readRST st{ stateLiterateHaskell = True}) ,("docbook" , readDocBook) - ,("textile" , readTextile) -- TODO : textile+lhs + ,("textile" , readTextile) -- TODO : textile+lhs ,("html" , readHtml) ,("latex" , readLaTeX) ,("latex+lhs" , \st -> @@ -218,6 +221,12 @@ writers = [("native" , writeNative) ,("asciidoc" , writeAsciiDoc) ] +-- | Association list of formats and writers which require IO to work. +-- These writers produce text output as well as thoses in 'writers'. +iowriters :: [ (String, WriterOptions -> Pandoc -> IO String) ] +iowriters = [ ("fb2" , writeFB2) + ] + {-# DEPRECATED jsonFilter "Use toJsonFilter instead" #-} -- | Converts a transformation on the Pandoc AST into a function -- that reads and writes a JSON-encoded string. This is useful -- cgit v1.2.3