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