aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-14 21:20:30 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-11-14 21:20:30 -0800
commit22d69c8916f5cf53c4329c7757d063093cf39928 (patch)
tree4409f934437e9631d65e63bd67537dc119b2357c
parentc2a68ad7632cfa0ee00cd7bac9c7ee58f9947abd (diff)
downloadpandoc-22d69c8916f5cf53c4329c7757d063093cf39928.tar.gz
RST reader: better support for 'container' directive.
Create a div, incorporate name attribute and classes. Closes #4066.
-rw-r--r--src/Text/Pandoc/Readers/RST.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index de488adfe..41b3c8b82 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -658,6 +658,7 @@ directive' = do
body <- option "" $ try $ blanklines >> indentedBlock
optional blanklines
let body' = body ++ "\n\n"
+ name = trim $ fromMaybe "" (lookup "name" fields)
imgAttr cl = ("", classes, widthAttr ++ heightAttr)
where
classes = words $ maybe "" trim (lookup cl fields) ++
@@ -691,7 +692,8 @@ directive' = do
"line-block" -> lineBlockDirective body'
"raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
"role" -> addNewRole top $ map (second trim) fields
- "container" -> parseFromString' parseBlocks body'
+ "container" -> B.divWith (name, "container" : words top, []) <$>
+ parseFromString' parseBlocks body'
"replace" -> B.para <$> -- consumed by substKey
parseInlineFromString (trim top)
"unicode" -> B.para <$> -- consumed by substKey