@@ -209,7 +209,7 @@ rawFieldListItem minIndent = try $ do
209fieldListItem :: Int -> RSTParser (Inlines, [Blocks])
209fieldListItem :: Int -> RSTParser (Inlines, [Blocks])
210fieldListItem minIndent = try $ do
210fieldListItem minIndent = try $ do
211 (name, raw) <- rawFieldListItem minIndent
211 (name, raw) <- rawFieldListItem minIndent
212− term <- parseFromString (trimInlines . mconcat <$> many inline) name
212+ term <- parseInlineFromString name
213 contents <- parseFromString parseBlocks raw
213 contents <- parseFromString parseBlocks raw
214 optional blanklines
214 optional blanklines
215 return (term, [contents])
215 return (term, [contents])
@@ -229,8 +229,7 @@ fieldList = try $ do
229lineBlock :: RSTParser Blocks
229lineBlock :: RSTParser Blocks
230lineBlock = try $ do
230lineBlock = try $ do
231 lines' <- lineBlockLines
231 lines' <- lineBlockLines
232− lines'' <- mapM (parseFromString
232+ lines'' <- mapM parseInlineFromString lines'
233− (trimInlines . mconcat <$> many inline)) lines'
234 return $ B.para (mconcat $ intersperse B.linebreak lines'')
233 return $ B.para (mconcat $ intersperse B.linebreak lines'')
@@ -549,39 +548,33 @@ directive' = do
549 "role" -> addNewRole top $ map (\(k,v) -> (k, trim v)) fields
548 "role" -> addNewRole top $ map (\(k,v) -> (k, trim v)) fields
550 "container" -> parseFromString parseBlocks body'
549 "container" -> parseFromString parseBlocks body'
551 "replace" -> B.para <$> -- consumed by substKey
550 "replace" -> B.para <$> -- consumed by substKey
552− parseFromString (trimInlines . mconcat <$> many inline)
553− (trim top)
551+ parseInlineFromString (trim top)
554 "unicode" -> B.para <$> -- consumed by substKey
552 "unicode" -> B.para <$> -- consumed by substKey
555− parseFromString (trimInlines . mconcat <$> many inline)
556− (trim $ unicodeTransform top)
553+ parseInlineFromString (trim $ unicodeTransform top)
557 "compound" -> parseFromString parseBlocks body'
554 "compound" -> parseFromString parseBlocks body'
558 "pull-quote" -> B.blockQuote <$> parseFromString parseBlocks body'
555 "pull-quote" -> B.blockQuote <$> parseFromString parseBlocks body'
559 "epigraph" -> B.blockQuote <$> parseFromString parseBlocks body'
556 "epigraph" -> B.blockQuote <$> parseFromString parseBlocks body'
560 "highlights" -> B.blockQuote <$> parseFromString parseBlocks body'
557 "highlights" -> B.blockQuote <$> parseFromString parseBlocks body'
561− "rubric" -> B.para . B.strong <$> parseFromString
558+ "rubric" -> B.para . B.strong <$> parseInlineFromString top
562− (trimInlines . mconcat <$> many inline) top
563 _ | label `elem` ["attention","caution","danger","error","hint",
559 _ | label `elem` ["attention","caution","danger","error","hint",
564 "important","note","tip","warning"] ->
560 "important","note","tip","warning"] ->
565 do let tit = B.para $ B.strong $ B.str label
561 do let tit = B.para $ B.strong $ B.str label
566 bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
562 bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
567 return $ B.blockQuote $ tit <> bod
563 return $ B.blockQuote $ tit <> bod
568 "admonition" ->
564 "admonition" ->
569− do tit <- B.para . B.strong <$> parseFromString
565+ do tit <- B.para . B.strong <$> parseInlineFromString top
570− (trimInlines . mconcat <$> many inline) top
571 bod <- parseFromString parseBlocks body'
566 bod <- parseFromString parseBlocks body'
572 return $ B.blockQuote $ tit <> bod
567 return $ B.blockQuote $ tit <> bod
573 "sidebar" ->
568 "sidebar" ->
574 do let subtit = maybe "" trim $ lookup "subtitle" fields
569 do let subtit = maybe "" trim $ lookup "subtitle" fields
575− tit <- B.para . B.strong <$> parseFromString
570+ tit <- B.para . B.strong <$> parseInlineFromString
576− (trimInlines . mconcat <$> many inline)
577 (trim top ++ if null subtit
571 (trim top ++ if null subtit
579 else (": " ++ subtit))
573 else (": " ++ subtit))
580 bod <- parseFromString parseBlocks body'
574 bod <- parseFromString parseBlocks body'
581 return $ B.blockQuote $ tit <> bod
575 return $ B.blockQuote $ tit <> bod
582 "topic" ->
576 "topic" ->
583− do tit <- B.para . B.strong <$> parseFromString
577+ do tit <- B.para . B.strong <$> parseInlineFromString top
584− (trimInlines . mconcat <$> many inline) top
585 bod <- parseFromString parseBlocks body'
578 bod <- parseFromString parseBlocks body'
586 return $ tit <> bod
579 return $ tit <> bod
587 "default-role" -> mempty <$ updateState (\s ->
580 "default-role" -> mempty <$ updateState (\s ->
@@ -962,6 +955,9 @@ inline = choice [ whitespace
962 , escapedChar
955 , escapedChar
963 , symbol ] <?> "inline"
956 , symbol ] <?> "inline"
958+parseInlineFromString :: String -> RSTParser Inlines
959+parseInlineFromString = parseFromString (trimInlines . mconcat <$> many inline)
965hyphens :: RSTParser Inlines
961hyphens :: RSTParser Inlines
966hyphens = do
962hyphens = do
967 result <- many1 (char '-')
963 result <- many1 (char '-')