packages feed

scalpel 0.2.1 → 0.2.1.1

raw patch · 4 files changed

+57/−55 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -2,6 +2,11 @@  ## HEAD +## 0.2.1.1++- Cleanup stale instance references in documentation of TagName and+  AttributeName.+ ## 0.2.1  - Made Scraper an instance of MonadPlus.
README.md view
@@ -56,52 +56,56 @@ `"http://example.com/article.html"` and you would like to extract a list of all of the comments. -    <html>-      <body>-        <div class='comments'>-          <div class='comment container'>-            <span class='comment author'>Sally</span>-            <div class='comment text'>Woo hoo!</div>-          </div>-          <div class='comment container'>-            <span class='comment author'>Bill</span>-            <img class='comment image' src='http://example.com/cat.gif' />-          </div>-          <div class='comment container'>-            <span class='comment author'>Susan</span>-            <div class='comment text'>WTF!?!</div>-          </div>-        </div>-      </body>-    </html>+```html+<html>+  <body>+    <div class='comments'>+      <div class='comment container'>+        <span class='comment author'>Sally</span>+        <div class='comment text'>Woo hoo!</div>+      </div>+      <div class='comment container'>+        <span class='comment author'>Bill</span>+        <img class='comment image' src='http://example.com/cat.gif' />+      </div>+      <div class='comment container'>+        <span class='comment author'>Susan</span>+        <div class='comment text'>WTF!?!</div>+      </div>+    </div>+  </body>+</html>+```  The following snippet defines a function, `allComments`, that will download the web page, and extract all of the comments into a list: -    type Author = String+```haskell+type Author = String -    data Comment-        = TextComment Author String-        | ImageComment Author URL-        deriving (Show, Eq)+data Comment+    = TextComment Author String+    | ImageComment Author URL+    deriving (Show, Eq) -    allComments :: IO (Maybe [Comment])-    allComments = scrapeURL "http://example.com/article.html" comments-       where-           comments :: Scraper String [Comment]-           comments = chroots ("div" @: [hasClass "container"]) comment+allComments :: IO (Maybe [Comment])+allComments = scrapeURL "http://example.com/article.html" comments+   where+       comments :: Scraper String [Comment]+       comments = chroots ("div" @: [hasClass "container"]) comment -           comment :: Scraper String Comment-           comment = textComment <|> imageComment+       comment :: Scraper String Comment+       comment = textComment <|> imageComment -           textComment :: Scraper String Comment-           textComment = do-               author      <- text $ "span" @: [hasClass "author"]-               commentText <- text $ "div"  @: [hasClass "text"]-               return $ TextComment author commentText+       textComment :: Scraper String Comment+       textComment = do+           author      <- text $ "span" @: [hasClass "author"]+           commentText <- text $ "div"  @: [hasClass "text"]+           return $ TextComment author commentText -           imageComment :: Scraper String Comment-           imageComment = do-               author   <- text       $ "span" @: [hasClass "author"]-               imageURL <- attr "src" $ "img"  @: [hasClass "image"]-               return $ ImageComment author imageURL+       imageComment :: Scraper String Comment+       imageComment = do+           author   <- text       $ "span" @: [hasClass "author"]+           imageURL <- attr "src" $ "img"  @: [hasClass "image"]+           return $ ImageComment author imageURL+```
scalpel.cabal view
@@ -1,5 +1,5 @@ name:                scalpel-version:             0.2.1+version:             0.2.1.1 synopsis:            A high level web scraping library for Haskell. description:     Scalpel is a web scraping library inspired by libraries like Parsec and@@ -24,7 +24,7 @@ source-repository this   type:     git   location: https://github.com/fimad/scalpel.git-  tag:      v0.2.1+  tag:      v0.2.1.1  library   other-extensions:
src/Text/HTML/Scalpel/Internal/Select/Types.hs view
@@ -25,23 +25,16 @@     toSelector :: s -> Selector  -- | The 'AttributeName' class defines a class of types that can be used when--- creating 'Selector's to specify the name of an attribute of a tag.------ The most basic types of 'AttributeName' are the string like types (e.g.--- 'String', 'T.Text', etc). Values of these types refer to attributes with--- names of that value.------ In addition there is also the 'Any' type which will match any attribute name.+-- creating 'Selector's to specify the name of an attribute of a tag.  Currently+-- the only types of this class are 'String' for matching attributes exactly,+-- and 'Any' for matching attributes with any name. class AttributeName k where     matchKey :: TagSoup.StringLike str => k -> str -> Bool  -- | The 'TagName' class defines a class of types that can be used when creating--- 'Selector's to specify the name of a tag.------ The most basic types of 'TagName' are the string like types (e.g.  'String',--- 'T.Text', etc). Values of these types refer to tags of the given value.------ In addition there is also the 'Any' type which will match any tag.+-- 'Selector's to specify the name of a tag. Currently the only types of this+-- class are 'String' for matching tags exactly, and 'Any' for matching tags+-- with any name. class TagName t where     toSelectNode :: t -> [AttributePredicate] -> SelectNode