Fix fate format

This commit is contained in:
Jakub Kolasiński 2021-04-10 11:05:32 +02:00
parent 8ba5a297b0
commit 0d06e9dc3d

View File

@ -18,14 +18,13 @@ toShadowItem (url, articleTitle) =
(defaultShadowItem url title) {
originalDate = Just date,
itype = "periodical",
format = Just "pdf",
finalUrl = url
format = Just "pdf"
}
where title = "Nasze Popowice " ++ getNr url
date = getDate url
replaceSeparatorWithSpace = map (\c -> if c=='_' then ' '; else if c=='-' then ' '; else c)
replaceSeparatorWithDot = map (\c -> if c=='_' then '.'; else c)
replaceUnderscoreWithDash = map (\c -> if c=='_' then '-'; else c)
getNr url =
case url =~~ "nr[-_][0-9][0-9]" :: Maybe String of
@ -34,7 +33,7 @@ getNr url =
getDate url =
case url =~~ "20[0-9][0-9]_[0-1][0-9]" :: Maybe String of
Just date -> replaceSeparatorWithDot date
Just date -> replaceUnderscoreWithDash date
otherwise -> error $ "unexpected url: " ++ url