More cleanup (#6130)

* Use an infix operator normally instead of immediately applying an operator section

* Use M.fromList
This commit is contained in:
Joseph C. Sible 2020-02-08 12:09:33 -05:00 committed by GitHub
parent 4c3db9273f
commit 02ff42b178
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View file

@ -170,7 +170,7 @@ parseMeta content = do
let coverId = findAttr (emptyName "content") =<< filterChild findCover meta
return (coverId, r)
where
findCover e = (== Just "cover") (findAttr (emptyName "name") e)
findCover e = findAttr (emptyName "name") e == Just "cover"
-- http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-metadata-elem
parseMetaItem :: Element -> Meta -> Meta

View file

@ -92,14 +92,13 @@ docToJATS opts (Pandoc meta blocks) = do
Nothing -> NullVal
Just day ->
let (y,m,d) = toGregorian day
in MapVal . Context
. M.insert ("year" :: Text) (SimpleVal $ text $ show y)
. M.insert "month" (SimpleVal $ text $ show m)
. M.insert "day" (SimpleVal $ text $ show d)
. M.insert "iso-8601"
(SimpleVal $ text $
in MapVal . Context $ M.fromList
[("year" :: Text, SimpleVal $ text $ show y)
,("month", SimpleVal $ text $ show m)
,("day", SimpleVal $ text $ show d)
,("iso-8601", SimpleVal $ text $
formatTime defaultTimeLocale "%F" day)
$ mempty
]
Just x -> x
let context = defField "body" main
$ defField "back" back