aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert+github@zeitkraut.de>2018-07-30 19:55:25 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2018-07-30 10:55:25 -0700
commitfb94c0f6a1b98d4f7ff34107d3b63c2c1d0afe1f (patch)
treeeb0a736a0ced7d45e9ead922db35fb564f3e431e /src/Text/Pandoc/Shared.hs
parentbf56181204a6e5df919da24006ef8a58b595f76a (diff)
downloadpandoc-fb94c0f6a1b98d4f7ff34107d3b63c2c1d0afe1f.tar.gz
Lua Utils module: add function blocks_to_inlines (#4799)
Exposes a function converting which flattenes a list of blocks into a list of inlines. An example use case would be the conversion of Note elements into other inlines.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 5b011c46a..412de99a0 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -94,6 +94,8 @@ module Text.Pandoc.Shared (
-- * for squashing blocks
blocksToInlines,
blocksToInlines',
+ blocksToInlinesWithSep,
+ defaultBlocksSeparator,
-- * Safe read
safeRead,
-- * Temp directory
@@ -757,12 +759,19 @@ blocksToInlinesWithSep sep =
mconcat . intersperse sep . map blockToInlines
blocksToInlines' :: [Block] -> Inlines
-blocksToInlines' = blocksToInlinesWithSep parSep
- where parSep = B.space <> B.str "¶" <> B.space
+blocksToInlines' = blocksToInlinesWithSep defaultBlocksSeparator
blocksToInlines :: [Block] -> [Inline]
blocksToInlines = B.toList . blocksToInlines'
+-- | Inline elements used to separate blocks when squashing blocks into
+-- inlines.
+defaultBlocksSeparator :: Inlines
+defaultBlocksSeparator =
+ -- This is used in the pandoc.utils.blocks_to_inlines function. Docs
+ -- there should be updated if this is changed.
+ B.space <> B.str "¶" <> B.space
+
--
-- Safe read