aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 084615357..f82597c55 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -457,8 +457,11 @@ transformInlines = insertBS .
-- them either collapsing them in the outer inline container or
-- pulling them out of it
flatten :: Inline -> [Inline]
-flatten outer = combineAll $ dropInlineParent outer
- where combineAll = foldl combine []
+flatten outer
+ | null contents = [outer]
+ | otherwise = combineAll contents
+ where contents = dropInlineParent outer
+ combineAll = foldl combine []
combine :: [Inline] -> Inline -> [Inline]
combine f i =