aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 2c748dc5f..657c95b71 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -56,6 +56,7 @@ module Text.Pandoc.Shared (
inlineListToIdentifier,
textToIdentifier,
isHeaderBlock,
+ hasLineBreaks,
onlySimpleTableCells,
isTightList,
taskListItemFromAscii,
@@ -607,6 +608,18 @@ uniqueIdent exts title' usedIdents =
x -> x
numIdent n = baseIdent <> "-" <> tshow n
+-- | True if inlines include a LineBreak (possibly embedded), with the exception
+-- of line breaks in Notes.
+hasLineBreaks :: [Inline] -> Bool
+hasLineBreaks = getAny . query isLineBreak . walk removeNote
+ where
+ removeNote :: Inline -> Inline
+ removeNote (Note _) = Str ""
+ removeNote x = x
+ isLineBreak :: Inline -> Any
+ isLineBreak LineBreak = Any True
+ isLineBreak _ = Any False
+
-- | True if block is a Header block.
isHeaderBlock :: Block -> Bool
isHeaderBlock Header{} = True