diff options
author | Joris Guyonvarch | 2015-04-18 21:59:22 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-04-18 21:59:22 +0200 |
commit | 389d979eb3eaa18beb8a6da9f4a03bdb6acc1722 (patch) | |
tree | 9d475b868ad13162c0ecba42b2138058c2e2e68b /src/Parser/Utils.hs | |
parent | 86f9991deeb44a6cc81044e61a9ad3ee001c5ced (diff) |
Parsing utag_list from a detail page and showing the keys that are given in the configuration file
Diffstat (limited to 'src/Parser/Utils.hs')
-rw-r--r-- | src/Parser/Utils.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Parser/Utils.hs b/src/Parser/Utils.hs index c03ab03..d72a1ce 100644 --- a/src/Parser/Utils.hs +++ b/src/Parser/Utils.hs @@ -1,5 +1,7 @@ module Parser.Utils - ( getTagsBetween + ( getTagsBefore + , getTagsAfter + , getTagsBetween , getTagAttributes , getTagAttribute , getTagTextAfter @@ -12,11 +14,14 @@ import qualified Data.Text as T import Text.HTML.TagSoup +getTagsBefore :: String -> [Tag Text] -> [Tag Text] +getTagsBefore selector = takeWhile (~/= selector) + +getTagsAfter :: String -> [Tag Text] -> [Tag Text] +getTagsAfter selector = drop 1 . dropWhile (~/= selector) + getTagsBetween :: String -> String -> [Tag Text] -> [Tag Text] -getTagsBetween beginSelector endSelector = - takeWhile (~/= endSelector) - . drop 1 - . dropWhile (~/= beginSelector) +getTagsBetween begin end = getTagsBefore end . getTagsAfter begin getTagAttributes :: String -> Text -> [Tag Text] -> [Text] getTagAttributes selector attribute = |