X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FPage.hs;h=f0ada7cd13cfff0707904272f93fa2b4b354f9e3;hp=6a097cbf7714d8929a37708ddd92a29c8982bf21;hb=fc0052e451aa03675ebd9a128dfa46573b9357d7;hpb=f3321e2ce7d7645ad562dc8f6620bfd561edc75d diff --git a/src/LWN/Page.hs b/src/LWN/Page.hs index 6a097cb..f0ada7c 100644 --- a/src/LWN/Page.hs +++ b/src/LWN/Page.hs @@ -5,10 +5,12 @@ where import qualified Data.Map as Map (lookup) import Data.Time (getCurrentTime) -import System.IO (Handle, hClose, hFlush) import qualified Data.ByteString.Lazy as B (ByteString, hPut) import Data.String.Utils (split, strip) +import qualified Data.Map as Map (Map, empty, insert) import Data.Maybe (catMaybes, fromJust, isNothing) +import Prelude hiding (readFile) +import System.IO (Handle, hClose, hFlush) import Test.HUnit (Assertion, assertEqual) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) @@ -22,6 +24,7 @@ import Text.XML.HXT.Core ( ArrowXml, IOSArrow, XmlTree, + ($<), (>>>), (/>), (//>), @@ -29,30 +32,37 @@ import Text.XML.HXT.Core ( getAttrValue, getChildren, getText, - hasAttrValue, hasName, - isElem, - mkName, - none, processAttrl, processTopDown, + this, runX, - setElemName, xshow, when) import Text.HandsomeSoup (css, parseHtml) +import Configuration (Cfg) import LWN.Article -import LWN.HTTP (ImageMap, download_image_urls) -import LWN.URI (URL, try_make_absolute_url) -import LWN.XHTML (XHTML, to_xhtml) -import Misc (contains) +import LWN.HTTP ( + ImageMap, + download_image_urls, + get_article_contents) +import LWN.URI (URL) +import LWN.XHTML ( + XHTML, + full_story_urls, + image_srcs, + full_story_link, + full_story_paragraph, + is_image, + preprocess, + remove_byline, + remove_title, + to_xhtml, + to_xml, + xml_from_contents) + --- Should be called *after* preprocessing. -download_images :: IOSArrow XmlTree XmlTree -> IO ImageMap -download_images xml = do - image_urls <- runX $ xml >>> image_srcs - download_image_urls image_urls data Page = @@ -77,9 +87,7 @@ instance XHTML Page where "