diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-02-11 09:16:25 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-02-11 09:16:25 -0800 |
commit | acc9afaf6f6afa14cbe7cd06798275728e78a529 (patch) | |
tree | a29dbab8854a9d6c9772f076d8e0725d8eb63d2a /src/Text/Pandoc | |
parent | 8ca191604dcd13af27c11d2da225da646ebce6fc (diff) | |
download | pandoc-acc9afaf6f6afa14cbe7cd06798275728e78a529.tar.gz |
Correctly parse "raw" date value in markdown references metadata.
See jgm/citeproc#53.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Citeproc/MetaValue.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Citeproc/MetaValue.hs b/src/Text/Pandoc/Citeproc/MetaValue.hs index f5a49f49e..b43ca7314 100644 --- a/src/Text/Pandoc/Citeproc/MetaValue.hs +++ b/src/Text/Pandoc/Citeproc/MetaValue.hs @@ -135,12 +135,13 @@ metaValueToVal k v MetaMap _ -> TextVal mempty metaValueToDate :: MetaValue -> Date -metaValueToDate (MetaMap m) = - Date +metaValueToDate (MetaMap m) = fromMaybe + (Date { dateParts = dateparts , dateCirca = circa , dateSeason = season - , dateLiteral = literal } + , dateLiteral = literal }) + rawdate where dateparts = case M.lookup "date-parts" m of Just (MetaList xs) -> @@ -152,6 +153,7 @@ metaValueToDate (MetaMap m) = M.lookup "circa" m >>= metaValueToBool season = M.lookup "season" m >>= metaValueToInt literal = M.lookup "literal" m >>= metaValueToText + rawdate = M.lookup "raw" m >>= metaValueToText >>= rawDateEDTF metaValueToDate (MetaList xs) = Date{ dateParts = mapMaybe metaValueToDateParts xs , dateCirca = False |