From cf26bc5f681a4d98f8962fd74e047dc30bd91d40 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 11 Feb 2017 22:47:05 +0100 Subject: RST reader: Support `.. line-block` directive. This is deprecated but may still be in older documents. --- src/Text/Pandoc/Readers/RST.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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' -- cgit v1.2.3