summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-02-11 22:47:05 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-11 22:47:05 +0100
commitcf26bc5f681a4d98f8962fd74e047dc30bd91d40 (patch)
tree1168a5f76289337248d2a2ff3ee39ea6263e69b7 /src/Text/Pandoc/Readers
parent27599602042a43bfe1506c008dab862352bba0b1 (diff)
RST reader: Support `.. line-block` directive.
This is deprecated but may still be in older documents.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 024c56685..f981dd9ad 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -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'