]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blobdiff - src/LWN/XHTML.hs
Source reorganization and cleanup.
[dead/lwn-epub.git] / src / LWN / XHTML.hs
diff --git a/src/LWN/XHTML.hs b/src/LWN/XHTML.hs
new file mode 100644 (file)
index 0000000..caa7403
--- /dev/null
@@ -0,0 +1,33 @@
+module LWN.XHTML (
+  XHTML,
+  parse_lwn,
+  to_xhtml
+  )
+where
+
+import Text.XML.HXT.Core (
+  IOStateArrow,
+  SysConfigList,
+  XmlTree,
+  no,
+  readString,
+  withParseHTML,
+  withValidate,
+  withWarnings,
+  yes
+  )
+
+class XHTML a where
+  to_xhtml :: a -> String
+
+
+
+-- | Options used when parsing HTML.
+my_read_opts :: SysConfigList
+my_read_opts = [ withValidate  no,
+                 withParseHTML yes,
+                 withWarnings no ]
+
+-- | My version of HandsomeSoup's parseHTML.
+parse_lwn :: String -> IOStateArrow s b XmlTree
+parse_lwn = readString my_read_opts