Permalink
Browse files

update feed parser for new-style HaXml API

patch by Iain Lane <laney@debian.org>
taken from twidge 1.0.8.1+nmu1 in Debian
  • Loading branch information...
1 parent a06fe54 commit 1c39c0ea2a2695ed69c557d5b5f06db86736f264 @amoe amoe committed Aug 26, 2012
Showing with 7 additions and 6 deletions.
  1. +6 −5 FeedParser.hs
  2. +1 −1 twidge.cabal
View
@@ -31,6 +31,7 @@ Written by John Goerzen, jgoerzen\@complete.org
module FeedParser where
import Text.XML.HaXml
+import Text.XML.HaXml.Posn
import Data.Char
import Data.List
import Data.String.Utils(strip)
@@ -44,16 +45,16 @@ An implementation without unescaping would simply be:
Because HaXml's unescaping only works on Elements, we must make sure that
whatever Content we have is wrapped in an Element, then use txt to
pull the insides back out. -}
-contentToString :: [Content] -> String
+contentToString :: [Content Posn] -> String
contentToString =
concatMap procContent
where procContent x =
- verbatim $ keep /> txt $ CElem (unesc (fakeElem x))
+ verbatim $ keep /> txt $ CElem (unesc (fakeElem x)) noPos
- fakeElem :: Content -> Element
+ fakeElem :: Content a -> Element a
fakeElem x = Elem "fake" [] [x]
- unesc :: Element -> Element
+ unesc :: Element a -> Element a
unesc = xmlUnEscape stdXmlEscaper
stripUnicodeBOM :: String -> String
@@ -67,4 +68,4 @@ sanitize = strip . map sanitizer
| c `elem` "\n\r\0\t" = ' '
| otherwise = c
-getContent (Document _ _ e _) = CElem e
+getContent (Document _ _ e _) = CElem e noPos
View
@@ -48,7 +48,7 @@ Flag withBitly
Executable twidge
Build-Depends: network, unix, parsec, MissingH>=1.0.0,
- mtl, base >= 4 && < 5, HaXml>=1.13.2, HaXml<1.19, hslogger, hoauth>=0.2.3 && <0.2.4,
+ mtl, base >= 4 && < 5, HaXml>=1.14, hslogger, hoauth>=0.2.3 && <0.2.4,
ConfigFile, directory, HSH, regex-posix, utf8-string, binary,
bytestring, curl, old-locale, time

0 comments on commit 1c39c0e

Please sign in to comment.