]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blobdiff - src/LWN/ArticlePage.hs
Go through a good bit of nonsense to get it successfully parsing our three test cases.
[dead/lwn-epub.git] / src / LWN / ArticlePage.hs
index 927e241d91eba76b57f586133087db652738df4f..5964013f418303db52ce1ebe7dfdea123cdfe70c 100644 (file)
@@ -29,16 +29,16 @@ instance XHTML ArticlePage where
     "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" ++
     "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"" ++
     "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">" ++
-    "\n<head>\n" ++
+    "<head>" ++
     "  <meta http-equiv=\"Content-Type\"" ++
     " content=\"application/xhtml+xml; charset=utf-8\" />" ++
-    "  <title>" ++ (LWN.Article.title a) ++ "</title>\n" ++
-    "</head>\n" ++
-    "<body>\n" ++
-    "<div>\n\n" ++
+    "  <title>" ++ (show $ LWN.Article.title a) ++ "</title>" ++
+    "</head>" ++
+    "<body>" ++
+    "<div>" ++
     (to_xhtml a) ++
-    "\n\n</div>\n" ++
-    "\n</body>\n" ++
+    "</div>" ++
+    "</body>" ++
     "</html>"
 
 
@@ -49,7 +49,7 @@ instance Epublishable ArticlePage where
       Just [x] -> return $ Just $ ArticlePage x
       _   -> return Nothing
 
-  title (ArticlePage x) = LWN.Article.title x
+  title (ArticlePage x) = show $ LWN.Article.title x
 
 
 -- | Takes data from an LWN page and determines whether or not it's a
@@ -95,7 +95,7 @@ parse_articles xml = do
   parsed_headline <- parse_headline xml
   parsed_byline   <- parse_byline xml
   parsed_body     <- parse_body xml
-  let title'   = fromJust parsed_headline
-  let byline' = fromJust parsed_byline
-  let body'   = fromJust parsed_body
+  let title'   = Title (fromJust parsed_headline)
+  let byline' = Byline  parsed_byline
+  let body'   = BodyHtml (fromJust parsed_body)
   return $ Just $ [Article title' byline' body']