aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-08-29 14:10:56 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-08-29 14:10:56 +0200
commit153970bef5068f5a82943cc7a2bec79f04d31ae9 (patch)
treed1d9bb674d844f4d59013b32712552352c5fea27 /src/Text
parentbed5f700ceb91365018a4de6afea8a7c331688ae (diff)
downloadpandoc-153970bef5068f5a82943cc7a2bec79f04d31ae9.tar.gz
Org reader: read markup only for special meta keys
Most meta-keys should be read as normal string values, only a few are interpreted as marked-up text.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Org/Meta.hs25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Meta.hs b/src/Text/Pandoc/Readers/Org/Meta.hs
index e61947d43..8f0b9f6b5 100644
--- a/src/Text/Pandoc/Readers/Org/Meta.hs
+++ b/src/Text/Pandoc/Readers/Org/Meta.hs
@@ -55,20 +55,35 @@ metaLine = mempty <$ metaLineStart <* (optionLine <|> declarationLine)
declarationLine :: OrgParser ()
declarationLine = try $ do
- key <- metaKey
- value <- metaInlines
+ key <- map toLower <$> metaKey
+ value <- metaValue key
updateState $ \st ->
let meta' = B.setMeta key <$> value <*> pure nullMeta
in st { orgStateMeta = orgStateMeta st <> meta' }
-metaInlines :: OrgParser (F MetaValue)
-metaInlines = fmap (MetaInlines . B.toList) <$> inlinesTillNewline
-
metaKey :: OrgParser String
metaKey = map toLower <$> many1 (noneOf ": \n\r")
<* char ':'
<* skipSpaces
+metaValue :: String -> OrgParser (F MetaValue)
+metaValue key = do
+ case key of
+ "author" -> metaInlines
+ "title" -> metaInlines
+ "date" -> metaInlines
+ _ -> metaString
+
+metaInlines :: OrgParser (F MetaValue)
+metaInlines = fmap (MetaInlines . B.toList) <$> inlinesTillNewline
+
+metaString :: OrgParser (F MetaValue)
+metaString = return . MetaString <$> anyLine
+
+
+--
+-- export options
+--
optionLine :: OrgParser ()
optionLine = try $ do
key <- metaKey