summaryrefslogtreecommitdiff
path: root/lib/Text/Pandoc/Extended.hs
blob: 941d71627a9d363765c8849f32dea46efca3669e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--------------------------------------------------------------------------------
{-# 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 = map $ \case
    Plain inlines -> Para inlines
    block         -> block


--------------------------------------------------------------------------------
newlineToSpace :: [Inline] -> [Inline]
newlineToSpace = grecT $ \case
    SoftBreak -> Space
    LineBreak -> Space
    inline    -> inline