]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/commitdiff
Remove full story paragraphs if we aren't going to use them.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 14 Jul 2012 02:43:46 +0000 (22:43 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 14 Jul 2012 02:43:46 +0000 (22:43 -0400)
src/LWN/Page.hs
src/LWN/XHTML.hs

index 3dccf466fea98f49a8ee42dcf44a2cdebe66a42c..ccc2590d64b0dddf94dcf85a62a650168549763d 100644 (file)
@@ -58,6 +58,7 @@ import LWN.XHTML (
   is_image,
   preprocess,
   remove_byline,
+  remove_full_story_paragraphs,
   remove_title,
   to_xhtml,
   to_xml,
@@ -196,7 +197,8 @@ parse cfg xml = do
              story_map <- download_full_stories cfg xml
              return $ xml >>> insert_full_stories story_map
            else do
-             return xml
+             -- Get rid of them if we don't want them.
+             return $ xml >>> remove_full_story_paragraphs
 
   let clean_xml = fs_xml >>> preprocess
   image_map <- download_images clean_xml
index 5d3bbd17327a8eaf20bec29152ed30de9aa9c7df..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,
@@ -90,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