X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FPage.hs;h=3dccf466fea98f49a8ee42dcf44a2cdebe66a42c;hp=49faa0bb4d6d1b0c77c0b4c6eb8d00e1a9261c50;hb=d7eb43dabd083ff2e12e9cfbf9bc2b6fcaa55e0b;hpb=5ac7dd7f301ba633b38d7bf2361044d25204bb6e diff --git a/src/LWN/Page.hs b/src/LWN/Page.hs index 49faa0b..3dccf46 100644 --- a/src/LWN/Page.hs +++ b/src/LWN/Page.hs @@ -42,7 +42,7 @@ import Text.XML.HXT.Core ( when) import Text.HandsomeSoup (css, parseHtml) -import Configuration (Cfg) +import Configuration (Cfg, full_stories) import LWN.Article import LWN.HTTP ( ImageMap, @@ -134,7 +134,7 @@ insert_full_stories story_map = article_xml :: (ArrowXml a) => a XmlTree XmlTree article_xml = lookup_func - $< + $< -- From HXT's Control.Arrow.ArrowList (this /> full_story_link >>> getAttrValue "href") replace_remote_img_srcs :: (ArrowXml a) => ImageMap -> a XmlTree XmlTree @@ -192,8 +192,11 @@ download_full_stories cfg xml = do parse :: Cfg -> IOSArrow XmlTree XmlTree -> IO (Maybe Page) parse cfg xml = do - story_map <- download_full_stories cfg xml - let fs_xml = xml >>> insert_full_stories story_map + fs_xml <- if (full_stories cfg) then do + story_map <- download_full_stories cfg xml + return $ xml >>> insert_full_stories story_map + else do + return xml let clean_xml = fs_xml >>> preprocess image_map <- download_images clean_xml