aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-02-11 09:16:25 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2021-02-11 09:16:25 -0800
commitacc9afaf6f6afa14cbe7cd06798275728e78a529 (patch)
treea29dbab8854a9d6c9772f076d8e0725d8eb63d2a /src/Text/Pandoc
parent8ca191604dcd13af27c11d2da225da646ebce6fc (diff)
downloadpandoc-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.hs8
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