diff options
author | Daniel Bergey <bergey@alum.mit.edu> | 2014-12-01 16:27:51 +0000 |
---|---|---|
committer | Daniel Bergey <bergey@alum.mit.edu> | 2014-12-01 18:22:03 +0000 |
commit | 2cdfa5eb207ca07d96235eb018928812f21da593 (patch) | |
tree | 3350c5d8f552389eb14ab465305500af919e39d8 /src/Text/Pandoc | |
parent | 4d296f70dfcbe75ec155809e115565c0a5fe4fb2 (diff) | |
download | pandoc-2cdfa5eb207ca07d96235eb018928812f21da593.tar.gz |
parse RST quoted literal blocks
closes #65
RST quoted literal blocks are the same as indented literal blocks (which
pandoc already supports) except that the quote character is preserved in
each line.
This includes test cases for the quoted literal block, as well as
additional tests for line blocks and indented literal blocks, to verify
that these are unaffected by the changes.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index e5eccb116..dbbfe5191 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -335,6 +335,13 @@ indentedBlock = try $ do optional blanklines return $ unlines lns +quotedBlock :: Parser [Char] st [Char] +quotedBlock = try $ do + quote <- lookAhead $ oneOf "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" + lns <- many1 $ lookAhead (char quote) >> anyLine + optional blanklines + return $ unlines lns + codeBlockStart :: Parser [Char] st Char codeBlockStart = string "::" >> blankline >> blankline @@ -342,7 +349,8 @@ codeBlock :: Parser [Char] st Blocks codeBlock = try $ codeBlockStart >> codeBlockBody codeBlockBody :: Parser [Char] st Blocks -codeBlockBody = try $ B.codeBlock . stripTrailingNewlines <$> indentedBlock +codeBlockBody = try $ B.codeBlock . stripTrailingNewlines <$> + (indentedBlock <|> quotedBlock) lhsCodeBlock :: RSTParser Blocks lhsCodeBlock = try $ do |