aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@Johns-MacBook-Pro.local>2016-07-20 10:14:24 -0700
committerJohn MacFarlane <jgm@Johns-MacBook-Pro.local>2016-07-20 10:14:24 -0700
commit3263ed3c42b0f6d162dba5649ad1c44544fc3683 (patch)
tree4e586449026a70611e3d4f8f2c8fcab5f30673c0 /src/Text/Pandoc
parente2d59461bbaa5ff41d41b2f0e430e03c12d8d0fd (diff)
downloadpandoc-3263ed3c42b0f6d162dba5649ad1c44544fc3683.tar.gz
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 60d69638b..46f082ccd 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -562,13 +562,11 @@ directive' = do
"rubric" -> B.para . B.strong <$> parseInlineFromString top
_ | label `elem` ["attention","caution","danger","error","hint",
"important","note","tip","warning"] ->
- do let tit = B.para $ B.strong $ B.str label
- bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
- return $ B.blockQuote $ tit <> bod
+ do bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
+ return $ B.divWith ("",["admonition", label],[]) bod
"admonition" ->
- do tit <- B.para . B.strong <$> parseInlineFromString top
- bod <- parseFromString parseBlocks body'
- return $ B.blockQuote $ tit <> bod
+ do bod <- parseFromString parseBlocks $ top ++ "\n\n" ++ body'
+ return $ B.divWith ("",["admonition"],[]) bod
"sidebar" ->
do let subtit = maybe "" trim $ lookup "subtitle" fields
tit <- B.para . B.strong <$> parseInlineFromString
@@ -576,11 +574,11 @@ directive' = do
then ""
else (": " ++ subtit))
bod <- parseFromString parseBlocks body'
- return $ B.blockQuote $ tit <> bod
+ return $ B.divWith ("",["sidebar"],[]) $ tit <> bod
"topic" ->
do tit <- B.para . B.strong <$> parseInlineFromString top
bod <- parseFromString parseBlocks body'
- return $ tit <> bod
+ return $ B.divWith ("",["topic"],[]) $ tit <> bod
"default-role" -> mempty <$ updateState (\s ->
s { stateRstDefaultRole =
case trim top of