X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FPage.hs;h=bdfe8ca40ad18c38e549dd8dbf65718eedb1c366;hp=0307214176a82c469f1f555a056b553c05bd3b06;hb=8202cb1437ece6be41677c0bbdae4713041199ac;hpb=abd072d7a4b825cdfc7aaa49ef3c7897ffad3bf2 diff --git a/src/LWN/Page.hs b/src/LWN/Page.hs index 0307214..bdfe8ca 100644 --- a/src/LWN/Page.hs +++ b/src/LWN/Page.hs @@ -5,9 +5,8 @@ where import qualified Data.Map as Map import Data.Time (getCurrentTime) -import System.IO (Handle) +import System.IO (Handle, hClose, hFlush) import qualified Data.ByteString.Lazy as B (ByteString, hPut) -import Data.List (isInfixOf) import Data.String.Utils (split, strip) import Data.Maybe (catMaybes, fromJust, isNothing) import Data.Tree.NTree.TypeDefs (NTree) @@ -44,6 +43,7 @@ import Text.HandsomeSoup (css, parseHtml) import LWN.Article import LWN.HTTP (save_image) import LWN.URI (URL, try_make_absolute_url) +import Misc (contains) import XHTML -- Map absolute image URLs to local system file paths where the image @@ -121,8 +121,6 @@ remove_comment_links :: (ArrowXml a) => a XmlTree XmlTree remove_comment_links = processTopDown $ kill_comments `when` is_link where - contains = isInfixOf - is_comment_link = hasAttrValue "href" (contains "#Comments") @@ -395,7 +393,8 @@ epublish obj handle = do epmd <- metadata obj epub <- xhtml_to_epub epmd xhtml B.hPut handle epub - + hFlush handle + hClose handle xhtml_to_epub :: String -> String -> IO B.ByteString xhtml_to_epub epmd =