From 0196ca893d5cbdf3d31ee5f5e9bcf76240f6698b Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sun, 12 Mar 2017 23:29:39 +0100 Subject: 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. --- src/Text/Pandoc/Readers/Org/Meta.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3