summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-06-13 23:53:14 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-06-13 23:53:14 +0200
commit29552eff3e1c0a7eab8b114ac58ca83422a84fb0 (patch)
tree27e4d08cc4bc998b9f8d07e56a5a9468f51f9dbe /src
parentcf2502de8fb3d208a6b062d38a09cec0f9faba5a (diff)
Org reader: support arbitrary raw inlines
Org mode allows arbitrary raw inlines ("export snippets" in Emacs parlance) to be included as `@@format:raw foreign format text@@`. Support for this features is added to the Org reader.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Org/Inlines.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs
index dc6b739fe..d0e007312 100644
--- a/src/Text/Pandoc/Readers/Org/Inlines.hs
+++ b/src/Text/Pandoc/Readers/Org/Inlines.hs
@@ -118,6 +118,7 @@ inline =
, subscript
, superscript
, inlineLaTeX
+ , exportSnippet
, smart
, symbol
] <* (guard =<< newlinesCountWithinLimits)
@@ -129,7 +130,7 @@ inlines = trimInlinesF . mconcat <$> many1 inline
-- treat these as potentially non-text when parsing inline:
specialChars :: [Char]
-specialChars = "\"$'()*+-,./:;<=>[\\]^_{|}~"
+specialChars = "\"$'()*+-,./:;<=>@[\\]^_{|}~"
whitespace :: OrgParser (F Inlines)
@@ -841,6 +842,13 @@ inlineLaTeXCommand = try $ do
dropWhileEnd :: (a -> Bool) -> [a] -> [a]
dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) []
+exportSnippet :: OrgParser (F Inlines)
+exportSnippet = try $ do
+ string "@@"
+ format <- many1Till (alphaNum <|> char '-') (char ':')
+ snippet <- manyTill anyChar (try $ string "@@")
+ returnF $ B.rawInline format snippet
+
smart :: OrgParser (F Inlines)
smart = do
getOption readerSmart >>= guard