summaryrefslogtreecommitdiff
path: root/lib/Text/Pandoc/Extended.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Text/Pandoc/Extended.hs')
-rw-r--r--lib/Text/Pandoc/Extended.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Text/Pandoc/Extended.hs b/lib/Text/Pandoc/Extended.hs
new file mode 100644
index 0000000..941d716
--- /dev/null
+++ b/lib/Text/Pandoc/Extended.hs
@@ -0,0 +1,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