git.iko.soy/typeable/pandoc
on master help sign in
RST reader: use Div for admonitions.

Previously blockquotes were used. Now a Div is used with class `admonition` and (if relevant) one of the following: `attention`, `caution`, `danger`, `error`, `hint`, `important`, `note`, `tip`, `warning`. `sidebar` is also put into a Div. Note: This will change rendering of RST documents! It should provide much more flexibility. Closes #3031.

commit3263ed3c42b0f6d162dba5649ad1c44544fc3683 authorJohn MacFarlane <jgm@Johns-MacBook-Pro.local> dateWed 20 Jul 2016, 10:14 (10 years ago) parente2d5946
1 file changed+6−8
src/Text/Pandoc/Readers/RST.hs+6−8
src/Text/Pandoc/Readers/RST.hs+6−8
@@ -562,13 +562,11 @@ directive' = do
562562 "rubric" -> B.para . B.strong <$> parseInlineFromString top
563563 _ | label `elem` ["attention","caution","danger","error","hint",
564564 "important","note","tip","warning"] ->
565− do let tit = B.para $ B.strong $ B.str label
566− bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
567− return $ B.blockQuote $ tit <> bod
565+ do bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
566+ return $ B.divWith ("",["admonition", label],[]) bod
568567 "admonition" ->
569− do tit <- B.para . B.strong <$> parseInlineFromString top
570− bod <- parseFromString parseBlocks body'
571− return $ B.blockQuote $ tit <> bod
568+ do bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
569+ return $ B.divWith ("",["admonition"],[]) bod
572570 "sidebar" ->
573571 do let subtit = maybe "" trim $ lookup "subtitle" fields
574572 tit <- B.para . B.strong <$> parseInlineFromString
@@ -576,11 +574,11 @@ directive' = do
576574 then ""
577575 else (": " ++ subtit))
578576 bod <- parseFromString parseBlocks body'
579− return $ B.blockQuote $ tit <> bod
577+ return $ B.divWith ("",["sidebar"],[]) $ tit <> bod
580578 "topic" ->
581579 do tit <- B.para . B.strong <$> parseInlineFromString top
582580 bod <- parseFromString parseBlocks body'
583− return $ tit <> bod
581+ return $ B.divWith ("",["topic"],[]) $ tit <> bod
584582 "default-role" -> mempty <$ updateState (\s ->
585583 s { stateRstDefaultRole =
586584 case trim top of