@@ -139,20 +139,6 @@ parseHtmlContentWithAttrs tag parser = do
139139parseHtmlContent :: PandocMonad m => String -> MuseParser m a -> MuseParser m [a]
140140parseHtmlContent tag p = fmap snd (parseHtmlContentWithAttrs tag p)
141141
142−normalizeInlineList :: [Inline] -> [Inline]
143−normalizeInlineList (Code a1 x1 : Code a2 x2 : ils) | a1 == a2
144− = normalizeInlineList $ Code a1 (x1 ++ x2) : ils
145−normalizeInlineList (RawInline f1 x1 : RawInline f2 x2 : ils) | f1 == f2
146− = normalizeInlineList $ RawInline f1 (x1 ++ x2) : ils
147−normalizeInlineList (x:xs) = x : normalizeInlineList xs
148−normalizeInlineList [] = []
149−
150−normalizeInlines :: Inlines -> Inlines
151−normalizeInlines = B.fromList . normalizeInlineList . B.toList . B.trimInlines
152−
153−normalizeInlinesF :: Future s Inlines -> Future s Inlines
154−normalizeInlinesF = liftM normalizeInlines
155−
156142--
157143-- directive parsers
158144--
@@ -164,7 +150,7 @@ parseDirective = do
164150 space
165151 spaces
166152 raw <- manyTill anyChar eol
167− value <- parseFromString (normalizeInlinesF . mconcat <$> many inline) raw
153+ value <- parseFromString (trimInlinesF . mconcat <$> many inline) raw
168154 return (key, value)
169155
170156directive :: PandocMonad m => MuseParser m ()
@@ -231,7 +217,7 @@ header = try $ do
231217 level <- fmap length $ many1 $ char '*'
232218 guard $ level <= 5
233219 spaceChar
234− content <- normalizeInlinesF . mconcat <$> manyTill inline eol
220+ content <- trimInlinesF . mconcat <$> manyTill inline eol
235221 attr <- registerHeader ("", [], []) (runF content defaultParserState)
236222 return $ B.headerWith attr level <$> content
237223
@@ -300,7 +286,7 @@ verseLines :: PandocMonad m => MuseParser m (F Blocks)
300286verseLines = do
301287 optionMaybe blankline -- Skip blankline after opening tag on separate line
302288 lns <- many verseLine
303− lns' <- mapM (parseFromString' (normalizeInlinesF . mconcat <$> many inline)) lns
289+ lns' <- mapM (parseFromString' (trimInlinesF . mconcat <$> many inline)) lns
304290 return $ B.lineBlock <$> sequence lns'
305291
306292verseTag :: PandocMonad m => MuseParser m (F Blocks)
@@ -317,7 +303,7 @@ para = do
317303 indent <- length <$> many spaceChar
318304 st <- stateParserContext <$> getState
319305 let f = if st /= ListItemState && indent >= 2 && indent < 6 then B.blockQuote else id
320− fmap (f . B.para) . normalizeInlinesF . mconcat <$> many1Till inline endOfParaElement
306+ fmap (f . B.para) . trimInlinesF . mconcat <$> many1Till inline endOfParaElement
321307 where
322308 endOfParaElement = lookAhead $ endOfInput <|> endOfPara <|> newBlockElement
323309 endOfInput = try $ skipMany blankline >> skipSpaces >> eof