From f9edf473fe3cc6c2dc0bf5d2829c2287baa1a0a6 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 18 Oct 2015 00:13:32 +0200 Subject: Revert "Added massaging to make sure blocks are not followed by extraneous whitespace" This reverts commit 6db9326c348f54cd25f399ad1e472b20cb7771c0. --- bbcode/src/BBCode.hs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/bbcode/src/BBCode.hs b/bbcode/src/BBCode.hs index 118aed7..3071db6 100644 --- a/bbcode/src/BBCode.hs +++ b/bbcode/src/BBCode.hs @@ -55,20 +55,7 @@ make' (Cooked c) = c make' (Raw _) = error "Cannot transform block containing raw data to bbcode" parse :: String -> Either String (Block String) -parse input = (remerge . massage . blockify <$> (tokenize input >>= treeify)) >>= semantics - -massage :: [Decorated String] -> [Decorated String] -massage [] = [] -massage (x@(Decorated _ tags) : x'@(Decorated wSpace []) : xs) - | any $ map isSpace wSpace - , any $ map isBlock tags = (x:Decorated (massage' wSpace) []:xs) - | otherwise = x : massage (x':xs) - where - massage' [] = [] - massage' l@(x:xs) - | isSpace x = massage' xs - | otherwise = l -massage (x:xs) = x : massage xs +parse input = (remerge . blockify <$> (tokenize input >>= treeify)) >>= semantics blockify :: ContentForest -> [Decorated String] blockify = map sortDeco . concat . map (blockify' []) -- cgit v1.2.3