[Delete the Web.Text module, move all the HTML/URL bits to General.Web
Neil Mitchell**20101119070138] {
hunk ./hoogle.cabal 157
- Web.Text
hunk ./src/Data/TagStr.hs 13
-import Numeric
+import General.Web
hunk ./src/Data/TagStr.hs 95
- url = if "http:" `isPrefixOf` str then str else "?hoogle=" +% str
- g (TagHyperlink url x) = "" ++ showTagHTML x ++ ""
+ url = if "http:" `isPrefixOf` str then str else "?hoogle=" ++% str
+ g (TagHyperlink url x) = "" ++ showTagHTML x ++ ""
hunk ./src/Data/TagStr.hs 99
-
--- FIXME: Should not be here!
-a +& b = a ++ escapeHTML b
-a +% b = a ++ escapeCGI b
-escapeHTML = concatMap f
- where
- f '\"' = """
- f '<' = "<"
- f '>' = ">"
- f '&' = "&"
- f '\n' = "
"
- f x = [x]
-escapeCGI = concatMap f
- where
- f x | isAlphaNum x || x `elem` "-" = [x]
- | x == ' ' = "+"
- | otherwise = '%' : ['0'|length s == 1] ++ s
- where s = showHex (ord x) ""
-
hunk ./src/General/Util.hs 19
+
+-- | Only append strings if neither one is empty
+(++?) :: String -> String -> String
+a ++? b = if null a || null b then [] else a ++ b
hunk ./src/General/Web.hs 8
- combineURL, escapeURL, unescapeURL,
- escapeHTML,
+ combineURL, escapeURL, (++%), unescapeURL,
+ escapeHTML, (++&),
hunk ./src/General/Web.hs 35
+-- | Escape the second argument as HTML before appending
+(++&) :: String -> String -> String
+a ++& b = a ++ escapeHTML b
+
+
hunk ./src/General/Web.hs 58
-escapeURL (x:xs) | isAlphaNum x = x : escapeURL xs
- | otherwise = '%' : f (showHex (ord x) "") ++ escapeURL xs
- where f x = ['0' | length x == 1] ++ x
-escapeURL [] = []
+escapeURL = concatMap f
+ where
+ f x | isAlphaNum x || x `elem` "-" = [x]
+ | x == ' ' = "+"
+ | otherwise = '%' : ['0'|length s == 1] ++ s
+ where s = showHex (ord x) ""
+
hunk ./src/General/Web.hs 66
+-- | Escape the second argument as a CGI query string before appending
+(++%) :: String -> String -> String
+a ++% b = a ++ escapeURL b
hunk ./src/Web/Page.hs 4
-import Web.Text
+import General.Web
+import General.Util
+
hunk ./src/Web/Page.hs 13
- ,"