From 22d69c8916f5cf53c4329c7757d063093cf39928 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 14 Nov 2017 21:20:30 -0800 Subject: RST reader: better support for 'container' directive. Create a div, incorporate name attribute and classes. Closes #4066. --- src/Text/Pandoc/Readers/RST.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') 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 -- cgit v1.2.3