From e9d5306f9df690803399f81bcc31d86e28084ab9 Mon Sep 17 00:00:00 2001 From: defanor Date: Thu, 26 Oct 2017 01:27:09 +0300 Subject: Initial commit --- Text/Pandoc/Readers/Plain.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Text/Pandoc/Readers/Plain.hs (limited to 'Text/Pandoc/Readers/Plain.hs') 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 +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" -- cgit v1.2.3