X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FFullPage.hs;h=1ba7910cf329d414a6b8e6d6ab10dbceee239050;hp=cc89737d18e933227847181fedf31b98b514fa6a;hb=6103dbc5f8d3689e32001c3fd7627f3153e40bb0;hpb=d5bab2c486d30e54d3e94cc3bdbb230f2cd1f3f3 diff --git a/src/LWN/FullPage.hs b/src/LWN/FullPage.hs index cc89737..1ba7910 100644 --- a/src/LWN/FullPage.hs +++ b/src/LWN/FullPage.hs @@ -1,20 +1,28 @@ module LWN.FullPage where -import Data.String.Utils (strip) -import Data.Maybe (fromJust) +import Data.String.Utils (split, strip) +import Data.Maybe (catMaybes, fromJust) import Data.Tree.NTree.TypeDefs (NTree) import Text.XML.HXT.Core ( + ArrowXml, IOSArrow, XmlTree, XNode, (>>>), (/>), + (//>), + getChildren, getText, + hasAttrValue, + hasName, + none, + processTopDown, runX, - xshow + xshow, + when ) -import Text.HandsomeSoup (css) +import Text.HandsomeSoup (css, parseHtml) import Epublishable import LWN.Article @@ -23,77 +31,180 @@ import XHTML -- | An LWN page with more than one article on it. These require -- different parsing and display functions than the single-article -- pages. -data FullPage = FullPage { articles :: [Article] } +data FullPage = FullPage { headline :: String, + articles :: [Article] } articles_xhtml :: FullPage -> String -articles_xhtml fp = concatMap show (articles x) +articles_xhtml fp = concatMap to_xhtml (articles fp) instance XHTML FullPage where to_xhtml fp = "" ++ "" ++ - "\n
\n" ++ + "" ++ " " ++ - "