X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FLWN%2FArticle.hs;h=aa267903a445b790b9d7e481025b15b87fc4fd4d;hp=ac3d456da8aae0ef43339e66c9bd62d5e92cff44;hb=8088bcb0959055f95b8363f83fba808c8dd0094e;hpb=2953924e2016393a1ffb9e2e82b4c90c8c57dfd3 diff --git a/src/LWN/Article.hs b/src/LWN/Article.hs index ac3d456..aa26790 100644 --- a/src/LWN/Article.hs +++ b/src/LWN/Article.hs @@ -15,9 +15,6 @@ import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Text.Regex.Posix ((=~)) import Text.XML.HXT.Core ( - (>>>), - arr, - hread, selem, none, runX, @@ -67,8 +64,9 @@ instance XML Byline where to_xml (Byline Nothing) = none instance XML BodyHtml where - to_xml (BodyHtml bh) = - (arr $ const bh) >>> hread + -- Don't question this. I tried to do it correctly and + -- all hell broke loose. + to_xml (BodyHtml bh) = txt bh data Article = Article { title :: Title, byline :: Byline, @@ -98,12 +96,14 @@ real_article_path path = do where abs_current = try_make_absolute_url ("/" ++ path) abs_article = try_make_absolute_url ("Articles/" ++ path) + abs_full_article = try_make_absolute_url path check_cases :: String check_cases | is_lwn_url path = make_https path | isPrefixOf "current" path = abs_current | path =~ "^[0-9]+$" = abs_article + | path =~ "^/Articles/[0-9]+/?$" = abs_full_article | otherwise = path -- Give up