import Test.HUnit
import Text.Regex (matchRegex, mkRegex)
import Text.XML.HaXml
+import Text.XML.HaXml.Posn (noPos)
import StringUtils (listify)
import Twitter.User
-- |Given some XML content, create a 'Status' from it.
-status_from_content :: Content -> (Maybe Status)
+status_from_content :: Content i -> (Maybe Status)
status_from_content content =
if (length status_ids) == 0
catMaybes maybe_status
where
(Document _ _ root _) = xmlParse xml_file_name xml_data
- root_elem = CElem root
+ root_elem = CElem root noPos
status_element = (single_status root_elem)
maybe_status = map status_from_content status_element
catMaybes maybe_statuses
where
(Document _ _ root _) = xmlParse xml_file_name xml_data
- root_elem = CElem root
+ root_elem = CElem root noPos
status_elements = (all_statuses root_elem)
maybe_statuses = map status_from_content status_elements
matches = matchRegex username_regex word
--- |Parse all usernames of the form @username from a status.
+-- |Parse all usernames of the form \@username from a status.
parse_usernames_from_status :: Status -> [String]
parse_usernames_from_status status =
catMaybes (map parse_username status_words)