Add comments

This commit is contained in:
Filip Gralinski 2021-03-13 18:31:04 +01:00
parent 8662447b6f
commit 8883a924b4
1 changed files with 7 additions and 4 deletions

View File

@ -11,11 +11,14 @@ import Data.List.Utils (replace)
import Text.Regex.Posix
import Text.Printf
extractRecords = extractLinksWithText "//a[@class='roczniki']"
>>> second (arr $ replace "\r\n " "")
>>> first (arr ((++"tr") . init))
>>> first (extractLinksWithText "//li/a[contains(@href,'.pdf')]")
extractRecords = extractLinksWithText "//a[@class='roczniki']" -- pary adres-tytuł
>>> second (arr $ replace "\r\n " " ") -- czyścimy drugi element pary, czyli tytuł z niepotrzebnych białych znaków
>>> first (arr ((++"tr") . init)) -- modyfikujemy pierwszy element pary, czyli adres URL
>>> first (extractLinksWithText "//li/a[contains(@href,'.pdf')]") -- pobieramy stronę z adresu URL i wyciągamy linki z tej strony pasujące do wyrażenia XPathowego
-- ostatecznie wyjdą trójki ((adres URL, tytuł artykułu), tytuł rocznika)
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
toShadowItem :: ((String, String), String) -> ShadowItem
toShadowItem ((url, articleTitle), yearlyTitle) =
(defaultShadowItem url title) {