fix for title

This commit is contained in:
Szymon 2022-05-07 18:28:49 +02:00
parent 0a241f4892
commit dc83563238

View File

@ -25,15 +25,23 @@ toShadowItem ((url, articleTitle), yearlyTitle) =
format = Just "pdf", format = Just "pdf",
finalUrl = url finalUrl = url
} }
where title = replace "\"" "'" (replace "\t\t\t\t\t" "" (replace "\n" "" yearlyTitle)) ++ "articleTitle: " ++ articleTitle where homeTitle = getTitle url
title = replace "_" " " homeTitle ++ "ROK " ++ date ++ " " ++ articleTitle
date = getDate url date = getDate url
getDate url = getDate url =
case url =~~ "_(19[0-9][0-9]|20[0-9][0-9])" :: Maybe [[String]] of case url =~~ "_(19[0-9][0-9]|20[0-9][0-9])" :: Maybe [[String]] of
Just [[_, year]] -> year Just [[_, year]] -> year
otherwise -> error $ "unexpected url: " ++ url otherwise -> error $ "unexpected url: " ++ url
getTitle url =
case url =~~ "/([A-Za-z]+_|[A-Za-z]+_[A-Za-z]+_|[A-Za-z]+_[A-Za-z]+_[A-Za-z]+_|[A-Za-z]+_[A-Za-z]+_[A-Za-z]+_[A-Za-z]+_|[A-Za-z]+_[A-Za-z]+_[A-Za-z]+_[A-Za-z]+_[A-Za-z]+_)" :: Maybe [[String]] of
Just [[_, title]] -> title
otherwise -> error $ "unexpected url2: " ++ url
main = do main = do
let start = "https://www.czasopisma.centralnabibliotekapttk.pl" let start = "https://www.czasopisma.centralnabibliotekapttk.pl"
let shadowLibrary = ShadowLibrary {logoUrl=Nothing, let shadowLibrary = ShadowLibrary {logoUrl=Nothing,