diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-01-29 10:03:31 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-01-29 10:03:31 -0800 |
commit | 387a2b365ea4b3e7181d60a0636d0f593e7f3b19 (patch) | |
tree | 720d4176c50186a1eae0266c33d44977b53b69bc | |
parent | 0833daff4af7ce17aa0a77528731f30ec127bc68 (diff) | |
download | pandoc-387a2b365ea4b3e7181d60a0636d0f593e7f3b19.tar.gz |
Shared: Fixed bug in normalize revealed by tests!
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index cf0eb32c3..b1d5de63f 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -257,10 +257,10 @@ normalizeSpaces = cleanup . dropWhile isSpaceOrEmpty -- | Normalize @Pandoc@ document, consolidating doubled 'Space's, -- combining adjacent 'Str's and 'Emph's, remove 'Null's and -- empty elements, etc. -normalize :: Data a => a -> a -normalize = topDown consolidateInlines . - bottomUp removeEmptyInlines . - topDown removeEmptyBlocks +normalize :: (Eq a, Data a) => a -> a +normalize = topDown removeEmptyBlocks . + topDown consolidateInlines . + bottomUp removeEmptyInlines removeEmptyBlocks :: [Block] -> [Block] removeEmptyBlocks (Null : xs) = removeEmptyBlocks xs @@ -280,6 +280,7 @@ removeEmptyInlines (SmallCaps [] : zs) = removeEmptyInlines zs removeEmptyInlines (Strikeout [] : zs) = removeEmptyInlines zs removeEmptyInlines (RawInline _ [] : zs) = removeEmptyInlines zs removeEmptyInlines (Code _ [] : zs) = removeEmptyInlines zs +removeEmptyInlines (Str "" : zs) = removeEmptyInlines zs removeEmptyInlines (x : xs) = x : removeEmptyInlines xs removeEmptyInlines [] = [] |