aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 89c30ff5d..9e38b1872 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -122,6 +122,7 @@ block = choice [ codeBlock
, fieldList
, blockQuote
, imageBlock
+ , customCodeBlock
, unknownDirective
, header
, hrule
@@ -331,6 +332,16 @@ codeBlock = try $ do
result <- indentedBlock
return $ CodeBlock ("",[],[]) $ stripTrailingNewlines result
+-- | The 'code-block' directive (from Sphinx) that allows a language to be
+-- specified.
+customCodeBlock :: GenParser Char st Block
+customCodeBlock = try $ do
+ string ".. code-block:: "
+ language <- manyTill anyChar newline
+ blanklines
+ result <- indentedBlock
+ return $ CodeBlock ("", ["sourceCode", language], []) $ stripTrailingNewlines result
+
lhsCodeBlock :: GenParser Char ParserState Block
lhsCodeBlock = try $ do
failUnlessLHS