From: Michael Orlitzky Date: Sat, 30 Jun 2012 16:39:07 +0000 (-0400) Subject: Whitespace cleanup. X-Git-Tag: v0.0.1~23 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=4220827f62d772d7edcbdcc1c2f13d6c2eb5f534;p=dead%2Flwn-epub.git Whitespace cleanup. --- diff --git a/src/Configuration.hs b/src/Configuration.hs index b791507..4898c08 100644 --- a/src/Configuration.hs +++ b/src/Configuration.hs @@ -107,7 +107,7 @@ parse_config = do Right cp -> let cp_username = get cp "DEFAULT" "username" cp_password = get cp "DEFAULT" "password" - + cfg_username = either_to_maybe cp_username cfg_password = either_to_maybe cp_password in diff --git a/src/LWN/HTTP.hs b/src/LWN/HTTP.hs index a8a1980..4cfcb04 100644 --- a/src/LWN/HTTP.hs +++ b/src/LWN/HTTP.hs @@ -39,7 +39,7 @@ default_curl_opts :: [CurlOption] default_curl_opts = [ -- The Global cache is not thread-friendly. CurlDNSUseGlobalCache False, - + -- And we don't want to use a DNS cache anyway. CurlDNSCacheTimeout 0, @@ -130,7 +130,7 @@ log_in cookie_jar username password = CurlCookieJar cookie_jar, CurlPost True, CurlPostFields post_data ] - + curl_opts :: [CurlOption] curl_opts = default_curl_opts ++ post_opts 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" diff --git a/src/LWN/URI.hs b/src/LWN/URI.hs index d9076c4..1601c37 100644 --- a/src/LWN/URI.hs +++ b/src/LWN/URI.hs @@ -63,7 +63,7 @@ add_trailing_slash url = if (isSuffixOf "/" old_path) || (isSuffixOf "bigpage" old_path) then -- It already had a trailing slash, or it's a 'bigpage' URL. -- Trailing slashes after 'bigpage' don't work. - url + url else show $ uri { uriPath = old_path ++ "/" } where @@ -163,7 +163,7 @@ make_absolute_uri relative_uri = make_absolute_url :: URL -> Maybe URL -make_absolute_url relative_url = +make_absolute_url relative_url = case parse_result of Nothing -> Nothing Just relative_uri -> diff --git a/src/Main.hs b/src/Main.hs index 5ce4026..981a705 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -29,7 +29,7 @@ import LWN.XHTML (parse_lwn) -- | Try to parse the given article using HXT. We try a few different -- methods; if none of them work, we return 'Nothing'. get_xml_from_article :: Cfg -> IO (Maybe (IOStateArrow s b XmlTree)) -get_xml_from_article cfg = do +get_xml_from_article cfg = do my_article <- real_article_path (article cfg) is_file <- doesFileExist my_article case is_file of