]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blobdiff - src/LWN/XHTML.hs
Remove full story paragraphs if we aren't going to use them.
[dead/lwn-epub.git] / src / LWN / XHTML.hs
index a2f103fa0d83b7ae433f239036e02456eb6e08f3..c54bada32538c97e5e0f6d9c5fe579a37e2a4f77 100644 (file)
@@ -9,6 +9,7 @@ module LWN.XHTML (
   parse_lwn,
   preprocess,
   remove_byline,
+  remove_full_story_paragraphs,
   remove_title,
   to_xhtml,
   to_xml,
@@ -16,7 +17,6 @@ module LWN.XHTML (
 where
 
 import Text.HandsomeSoup (css)
-import Text.Regex.Posix ((=~))
 import Text.XML.HXT.Core (
   (>>>),
   (/>),
@@ -91,6 +91,11 @@ is_link =
   isElem >>> hasName "a"
 
 
+remove_full_story_paragraphs  :: (ArrowXml a) => a XmlTree XmlTree
+remove_full_story_paragraphs =
+  processTopDown $ none `when` full_story_paragraph
+
+
 remove_comment_links  :: (ArrowXml a) => a XmlTree XmlTree
 remove_comment_links =
   processTopDown $ kill_comments `when` is_link
@@ -163,7 +168,7 @@ full_story_link =
   hasName "a"
   >>>
   ifA
-    (this /> hasText (=~ "Full Story"))
+    (this /> hasText (== "Full Story"))
     this
     none