git.iko.soy/typeable/pandoc
on master help sign in
RST reader: Support `.. line-block` directive.

This is deprecated but may still be in older documents.

commitcf26bc5f681a4d98f8962fd74e047dc30bd91d40 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 11 Feb 2017, 22:47 (10 years ago) parent2759960
1 file changed+7−2
src/Text/Pandoc/Readers/RST.hs+7−2
src/Text/Pandoc/Readers/RST.hs+7−2
@@ -53,9 +53,8 @@ import Control.Monad.Except (throwError)
5353import Text.Pandoc.Class (PandocMonad, report, readFileFromDirs)
5454
5555-- TODO:
56−-- [ ] .. line-block
5756-- [ ] .. parsed-literal
58−-- [ ] .. table
57+-- [ ] :widths: attribute in .. table
5958-- [ ] .. csv-table
6059-- [ ] .. list-table
6160
@@ -241,6 +240,11 @@ lineBlock = try $ do
241240 lines'' <- mapM parseInlineFromString lines'
242241 return $ B.lineBlock lines''
243242
243+lineBlockDirective :: PandocMonad m => String -> RSTParser m Blocks
244+lineBlockDirective body = do
245+ lines' <- mapM parseInlineFromString $ lines $ stripTrailingNewlines body
246+ return $ B.lineBlock lines'
247+
244248--
245249-- paragraph block
246250--
@@ -627,6 +631,7 @@ directive' = do
627631 Nothing -> []
628632 case label of
629633 "table" -> tableDirective top fields body'
634+ "line-block" -> lineBlockDirective body'
630635 "raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
631636 "role" -> addNewRole top $ map (\(k,v) -> (k, trim v)) fields
632637 "container" -> parseFromString parseBlocks body'