X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FPage.hs;h=620e3ec3d8bf66a9a67bff98cc3ac215a2a64b70;hp=6a097cbf7714d8929a37708ddd92a29c8982bf21;hb=4220827f62d772d7edcbdcc1c2f13d6c2eb5f534;hpb=f3321e2ce7d7645ad562dc8f6620bfd561edc75d diff --git a/src/LWN/Page.hs b/src/LWN/Page.hs index 6a097cb..620e3ec 100644 --- a/src/LWN/Page.hs +++ b/src/LWN/Page.hs @@ -110,7 +110,7 @@ is_link = remove_comment_links :: (ArrowXml a) => a XmlTree XmlTree remove_comment_links = processTopDown $ kill_comments `when` is_link - where + where is_comment_link = hasAttrValue "href" (contains "#Comments") @@ -166,7 +166,7 @@ parse xml = do return $ if (isNothing appr) then fppr - else + else appr @@ -200,12 +200,12 @@ parse_byline xml = do -- ap_parse :: IOSArrow XmlTree XmlTree -> IO (Maybe Page) ap_parse xml = do - arts <- ap_parse_articles xml + arts <- ap_parse_articles xml case arts of [x] -> return $ Just $ ArticlePage x _ -> return Nothing - + ap_parse_body :: IOSArrow XmlTree XmlTree -> IO (Maybe String) ap_parse_body xml = do let element_filter = xml >>> css "div.ArticleText" @@ -227,11 +227,11 @@ ap_parse_articles xml = do if (isNothing parsed_headline) || (isNothing parsed_body) then return [] - else do + else do let title' = Title $ fromJust parsed_headline let byline' = Byline parsed_byline let body' = BodyHtml $ fromJust parsed_body - + return $ [Article title' byline' body'] @@ -323,7 +323,7 @@ parse_html_article html = do let xml = parseHtml $ wrap_in_body_div html fp_parse_article xml - + -- | In the full page, all of the article titles and bodies are -- wrapped in one big div.ArticleText. parse_bodies :: IOSArrow XmlTree XmlTree -> IOSArrow XmlTree XmlTree @@ -415,7 +415,7 @@ make_image_srcs_absolute = changeAttrValue try_make_absolute_url make_srcs_absolute :: (ArrowXml a) => a XmlTree XmlTree - make_srcs_absolute = + make_srcs_absolute = processAttrl $ change_src `when` hasName "src"