From dc835632383cad7ad94446dda18c4fb94ef7ce94 Mon Sep 17 00:00:00 2001 From: Szymon Date: Sat, 7 May 2022 18:28:49 +0200 Subject: [PATCH] fix for title --- app/czasopisma.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/czasopisma.hs b/app/czasopisma.hs index d8ba9d7..a663914 100644 --- a/app/czasopisma.hs +++ b/app/czasopisma.hs @@ -25,15 +25,23 @@ toShadowItem ((url, articleTitle), yearlyTitle) = format = Just "pdf", 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 + getDate url = case url =~~ "_(19[0-9][0-9]|20[0-9][0-9])" :: Maybe [[String]] of Just [[_, year]] -> year 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 let start = "https://www.czasopisma.centralnabibliotekapttk.pl" let shadowLibrary = ShadowLibrary {logoUrl=Nothing,