aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-23 00:05:35 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-23 00:05:35 -0800
commit50d08ec2c3892076bde53b66f1b728e4bf23ab97 (patch)
tree2f8b8632ea64909e3092e1f8a8f7fb3a155fa4d9 /src/Text/Pandoc
parent9f99c39cafabf1438c195c61e2bea785b529f0c0 (diff)
downloadpandoc-50d08ec2c3892076bde53b66f1b728e4bf23ab97.tar.gz
Textile reader: Added code blocks with bc.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index c3b2e69a2..05bcd6108 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -135,9 +135,18 @@ blockParsers = [ codeBlock
block :: GenParser Char ParserState Block
block = choice blockParsers <?> "block"
--- | Code Blocks in Textile are between <pre> and </pre>
codeBlock :: GenParser Char ParserState Block
-codeBlock = try $ do
+codeBlock = codeBlockBc <|> codeBlockPre
+
+codeBlockBc :: GenParser Char ParserState Block
+codeBlockBc = try $ do
+ string "bc. "
+ contents <- manyTill anyLine blanklines
+ return $ CodeBlock ("",[],[]) $ unlines contents
+
+-- | Code Blocks in Textile are between <pre> and </pre>
+codeBlockPre :: GenParser Char ParserState Block
+codeBlockPre = try $ do
htmlTag (tagOpen (=="pre") null)
result' <- manyTill anyChar (try $ htmlTag (tagClose (=="pre")) >> blockBreak)
-- drop leading newline if any