@@ -139,20 +139,6 @@ parseHtmlContentWithAttrs tag parser = do
139parseHtmlContent :: PandocMonad m => String -> MuseParser m a -> MuseParser m [a]
139parseHtmlContent :: PandocMonad m => String -> MuseParser m a -> MuseParser m [a]
140parseHtmlContent tag p = fmap snd (parseHtmlContentWithAttrs tag p)
140parseHtmlContent tag p = fmap snd (parseHtmlContentWithAttrs tag p)
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 [] = []
150−normalizeInlines :: Inlines -> Inlines
151−normalizeInlines = B.fromList . normalizeInlineList . B.toList . B.trimInlines
153−normalizeInlinesF :: Future s Inlines -> Future s Inlines
154−normalizeInlinesF = liftM normalizeInlines
157-- directive parsers
143-- directive parsers
@@ -164,7 +150,7 @@ parseDirective = do
166 raw <- manyTill anyChar eol
152 raw <- manyTill anyChar eol
167− value <- parseFromString (normalizeInlinesF . mconcat <$> many inline) raw
153+ value <- parseFromString (trimInlinesF . mconcat <$> many inline) raw
168 return (key, value)
154 return (key, value)
170directive :: PandocMonad m => MuseParser m ()
156directive :: PandocMonad m => MuseParser m ()
@@ -231,7 +217,7 @@ header = try $ do
231 level <- fmap length $ many1 $ char '*'
217 level <- fmap length $ many1 $ char '*'
232 guard $ level <= 5
218 guard $ level <= 5
233 spaceChar
219 spaceChar
234− content <- normalizeInlinesF . mconcat <$> manyTill inline eol
220+ content <- trimInlinesF . mconcat <$> manyTill inline eol
235 attr <- registerHeader ("", [], []) (runF content defaultParserState)
221 attr <- registerHeader ("", [], []) (runF content defaultParserState)
236 return $ B.headerWith attr level <$> content
222 return $ B.headerWith attr level <$> content
@@ -300,7 +286,7 @@ verseLines :: PandocMonad m => MuseParser m (F Blocks)
300verseLines = do
286verseLines = do
301 optionMaybe blankline -- Skip blankline after opening tag on separate line
287 optionMaybe blankline -- Skip blankline after opening tag on separate line
302 lns <- many verseLine
288 lns <- many verseLine
303− lns' <- mapM (parseFromString' (normalizeInlinesF . mconcat <$> many inline)) lns
289+ lns' <- mapM (parseFromString' (trimInlinesF . mconcat <$> many inline)) lns
304 return $ B.lineBlock <$> sequence lns'
290 return $ B.lineBlock <$> sequence lns'
306verseTag :: PandocMonad m => MuseParser m (F Blocks)
292verseTag :: PandocMonad m => MuseParser m (F Blocks)
@@ -317,7 +303,7 @@ para = do
317 indent <- length <$> many spaceChar
303 indent <- length <$> many spaceChar
318 st <- stateParserContext <$> getState
304 st <- stateParserContext <$> getState
319 let f = if st /= ListItemState && indent >= 2 && indent < 6 then B.blockQuote else id
305 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
322 endOfParaElement = lookAhead $ endOfInput <|> endOfPara <|> newBlockElement
308 endOfParaElement = lookAhead $ endOfInput <|> endOfPara <|> newBlockElement
323 endOfInput = try $ skipMany blankline >> skipSpaces >> eof
309 endOfInput = try $ skipMany blankline >> skipSpaces >> eof