--------------------------------------------------------------------------------
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase   #-}
module Text.Pandoc.Extended
    ( module Text.Pandoc

    , plainToPara
    , newlineToSpace
    ) where


--------------------------------------------------------------------------------
import           Data.Data.Extended (grecT)
import           Text.Pandoc
import           Prelude


--------------------------------------------------------------------------------
plainToPara :: [Block] -> [Block]
plainToPara :: [Block] -> [Block]
plainToPara = forall a b. (a -> b) -> [a] -> [b]
map forall a b. (a -> b) -> a -> b
$ \case
    Plain [Inline]
inlines -> [Inline] -> Block
Para [Inline]
inlines
    Block
block         -> Block
block


--------------------------------------------------------------------------------
newlineToSpace :: [Inline] -> [Inline]
newlineToSpace :: [Inline] -> [Inline]
newlineToSpace = forall a b. (Data a, Data b) => (a -> a) -> b -> b
grecT forall a b. (a -> b) -> a -> b
$ \case
    Inline
SoftBreak -> Inline
Space
    Inline
LineBreak -> Inline
Space
    Inline
inline    -> Inline
inline