diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2016-05-29 20:00:52 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2016-05-29 21:08:50 +0200 |
commit | c17c62a2c74bbb6e36e12feea5aa6ba8679a023a (patch) | |
tree | 33d18ed315087426f356b8be643337f75bcff67a /src | |
parent | 4f84cf02c78cc20f7e52d9e82149fdfcc8282960 (diff) | |
download | pandoc-c17c62a2c74bbb6e36e12feea5aa6ba8679a023a.tar.gz |
Org reader: support new syntax for export blocks
Org-mode version 9 usees a new syntax for export blocks. Instead of
`#+BEGIN_<FORMAT>`, where `<FORMAT>` is the format of the block's
content, the new format uses `#+BEGIN_export <FORMAT>` instead. Both
types are supported.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Org/Blocks.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs index dba36fa4d..36645a356 100644 --- a/src/Text/Pandoc/Readers/Org/Blocks.hs +++ b/src/Text/Pandoc/Readers/Org/Blocks.hs @@ -168,6 +168,7 @@ orgBlock = try $ do blkType <- blockHeaderStart ($ blkType) $ case blkType of + "export" -> exportBlock "comment" -> rawBlockLines (const mempty) "html" -> rawBlockLines (return . (B.rawBlock blkType)) "latex" -> rawBlockLines (return . (B.rawBlock blkType)) @@ -239,6 +240,14 @@ rawBlockContent blockType = try $ do ignHeaders :: OrgParser () ignHeaders = (() <$ newline) <|> (() <$ anyLine) +-- | Read a block containing code intended for export in specific backends +-- only. +exportBlock :: String -> OrgParser (F Blocks) +exportBlock blockType = try $ do + exportType <- skipSpaces *> orgArgWord <* ignHeaders + contents <- rawBlockContent blockType + returnF (B.rawBlock (map toLower exportType) contents) + verseBlock :: String -> OrgParser (F Blocks) verseBlock blockType = try $ do ignHeaders |