RST reader: Support .. line-block directive.

This is deprecated but may still be in older documents.
This commit is contained in:
John MacFarlane
2017-02-11 22:47:05 +01:00
parent 2759960204
commit cf26bc5f68
+7 -2
View File
@@ -53,9 +53,8 @@ import Control.Monad.Except (throwError)
import Text.Pandoc.Class (PandocMonad, report, readFileFromDirs)
-- TODO:
-- [ ] .. line-block
-- [ ] .. parsed-literal
-- [ ] .. table
-- [ ] :widths: attribute in .. table
-- [ ] .. csv-table
-- [ ] .. list-table
@@ -241,6 +240,11 @@ lineBlock = try $ do
lines'' <- mapM parseInlineFromString lines'
return $ B.lineBlock lines''
lineBlockDirective :: PandocMonad m => String -> RSTParser m Blocks
lineBlockDirective body = do
lines' <- mapM parseInlineFromString $ lines $ stripTrailingNewlines body
return $ B.lineBlock lines'
--
-- paragraph block
--
@@ -627,6 +631,7 @@ directive' = do
Nothing -> []
case label of
"table" -> tableDirective top fields body'
"line-block" -> lineBlockDirective body'
"raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
"role" -> addNewRole top $ map (\(k,v) -> (k, trim v)) fields
"container" -> parseFromString parseBlocks body'