From 2ca2585b3569bd14923795f3023bd0789fe7911f Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Mon, 29 Aug 2016 14:10:57 +0200 Subject: Org reader: allow multiple, comma-separated authors Multiple authors can be specified in the `#+AUTHOR` meta line if they are given as a comma-separated list. --- src/Text/Pandoc/Readers/Org/Meta.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/Org/Meta.hs b/src/Text/Pandoc/Readers/Org/Meta.hs index 8f0b9f6b5..372b19fb6 100644 --- a/src/Text/Pandoc/Readers/Org/Meta.hs +++ b/src/Text/Pandoc/Readers/Org/Meta.hs @@ -69,7 +69,7 @@ metaKey = map toLower <$> many1 (noneOf ": \n\r") metaValue :: String -> OrgParser (F MetaValue) metaValue key = do case key of - "author" -> metaInlines + "author" -> metaInlinesCommaSeparated "title" -> metaInlines "date" -> metaInlines _ -> metaString @@ -77,6 +77,14 @@ metaValue key = do metaInlines :: OrgParser (F MetaValue) metaInlines = fmap (MetaInlines . B.toList) <$> inlinesTillNewline +metaInlinesCommaSeparated :: OrgParser (F MetaValue) +metaInlinesCommaSeparated = do + authStrs <- (many1 (noneOf ",\n")) `sepBy1` (char ',') + newline + authors <- mapM (parseFromString inlinesTillNewline . (++ "\n")) authStrs + let toMetaInlines = MetaInlines . B.toList + return $ MetaList . map toMetaInlines <$> sequence authors + metaString :: OrgParser (F MetaValue) metaString = return . MetaString <$> anyLine -- cgit v1.2.3