diff options
author | defanor <defanor@uberspace.net> | 2017-10-26 01:27:09 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-10-26 01:27:09 +0300 |
commit | e9d5306f9df690803399f81bcc31d86e28084ab9 (patch) | |
tree | d1dc013cc00b348d5c71dae9d8eef052f1ad34aa /Text/Pandoc/Readers/Plain.hs |
Initial commit
Diffstat (limited to 'Text/Pandoc/Readers/Plain.hs')
-rw-r--r-- | Text/Pandoc/Readers/Plain.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Text/Pandoc/Readers/Plain.hs b/Text/Pandoc/Readers/Plain.hs new file mode 100644 index 0000000..600e5f8 --- /dev/null +++ b/Text/Pandoc/Readers/Plain.hs @@ -0,0 +1,20 @@ +{- | +Module : Text.Pandoc.Readers.Plain +Maintainer : defanor <defanor@uberspace.net> +Stability : unstable +Portability : portable +-} + +{-# LANGUAGE OverloadedStrings #-} +module Text.Pandoc.Readers.Plain ( readPlain ) where + +import Text.Pandoc.Definition +import Text.Pandoc.Error +import Data.List + +-- | Reads plain text, always succeeding and producing a single +-- 'Plain' block. +readPlain :: String -> Either PandocError Pandoc +readPlain = Right . Pandoc mempty . pure . Plain . + concatMap (\l -> (intersperse Space $ map Str $ words l) ++ [LineBreak]) . lines + -- or Right . Pandoc mempty . pure . RawBlock "plain" |