diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-03-12 23:29:39 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-03-12 23:29:39 +0100 |
commit | 0196ca893d5cbdf3d31ee5f5e9bcf76240f6698b (patch) | |
tree | e413dbeba72aaddf1b20cf4b8901f1ce615f722f /src/Text/Pandoc/Readers/Org | |
parent | 1012e668cfd57c919e930a7919a9bd69a7c3a486 (diff) | |
download | pandoc-0196ca893d5cbdf3d31ee5f5e9bcf76240f6698b.tar.gz |
Org reader: interpret more meta value as inlines
The values of the following meta variables are now interpreted using
org-markup instead of treating them as pure strings:
- *keywords*: comma-separated list of inlines
- *subtitle*: inline values
- *nocite*: inline values; using it multiple times accumulates the
values.
Diffstat (limited to 'src/Text/Pandoc/Readers/Org')
-rw-r--r-- | src/Text/Pandoc/Readers/Org/Meta.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Meta.hs b/src/Text/Pandoc/Readers/Org/Meta.hs index c22f441d4..69ca00b23 100644 --- a/src/Text/Pandoc/Readers/Org/Meta.hs +++ b/src/Text/Pandoc/Readers/Org/Meta.hs @@ -90,8 +90,11 @@ metaValue key = let inclKey = "header-includes" in case key of "author" -> (key,) <$> metaInlinesCommaSeparated + "keywords" -> (key,) <$> metaInlinesCommaSeparated "title" -> (key,) <$> metaInlines + "subtitle" -> (key,) <$> metaInlines "date" -> (key,) <$> metaInlines + "nocite" -> (key,) <$> accumulatingList key metaInlines "header-includes" -> (key,) <$> accumulatingList key metaInlines "latex_header" -> (inclKey,) <$> accumulatingList inclKey (metaExportSnippet "latex") @@ -109,11 +112,11 @@ metaInlines = fmap (MetaInlines . B.toList) <$> inlinesTillNewline metaInlinesCommaSeparated :: PandocMonad m => OrgParser m (F MetaValue) metaInlinesCommaSeparated = do - authStrs <- (many1 (noneOf ",\n")) `sepBy1` (char ',') + itemStrs <- (many1 (noneOf ",\n")) `sepBy1` (char ',') newline - authors <- mapM (parseFromString inlinesTillNewline . (++ "\n")) authStrs + items <- mapM (parseFromString inlinesTillNewline . (++ "\n")) itemStrs let toMetaInlines = MetaInlines . B.toList - return $ MetaList . map toMetaInlines <$> sequence authors + return $ MetaList . map toMetaInlines <$> sequence items metaString :: Monad m => OrgParser m (F MetaValue) metaString = metaModifiedString id @@ -183,7 +186,9 @@ parseFormat = try $ do tillSpecifier c = manyTill (noneOf "\n\r") (try $ string ('%':c:"")) inlinesTillNewline :: PandocMonad m => OrgParser m (F Inlines) -inlinesTillNewline = trimInlinesF . mconcat <$> manyTill inline newline +inlinesTillNewline = do + updateLastPreCharPos + trimInlinesF . mconcat <$> manyTill inline newline -- -- ToDo Sequences and Keywords |