> module Htmltags
>        (htmlverb
>        ,htmlverbatim
>        ,htmlblock
>        ,htmli
>        ,htmll
>        ,htmlbold
>        ,htmlemph
>        ,htmlurl
>        ,htmlhref
>        ,htmlh1
>        ,htmlh2
>        ,htmlh3
>        ,htmlp
>        ,htmlq
>        ,htmlqq)
>         where

> import Data.String.Utils
> import Data.List.Split

> htmlh1 :: String -> String
> htmlh1 = (replace "</head1>" "</h1>\n") .
>          (replace "<head1>"  "<h1>" )

> htmlh2 :: String -> String
> htmlh2 = (replace "</head2>" "</h2>\n") .
>          (replace "<head2>"  "<h2>" )

> htmlh3 :: String -> String
> htmlh3 = (replace "</head3>" "</h3>\n") .
>          (replace "<head3>"  "<h3>" )

> htmlverb :: String -> String
> htmlverb = (replace "</inline>" "</code>") .
>            (replace "<inline>"  "<code>" )

> htmlverbatim :: String -> String
> htmlverbatim = (replace "</verbatim>" "</pre>\n") .
>                (replace "<verbatim>"  "<pre>"  )

> htmlblock :: String -> String
> htmlblock = (replace "</quote>" "</blockquote>") .
>             (replace "<quote>"  "<blockquote>\n" )

> htmlbold :: String -> String
> htmlbold = (replace "</bold>" "</strong>") .
>            (replace "<bold>"  "<strong>" )

> htmlemph :: String  -> String
> htmlemph = (replace "</emph>" "</em>") .
>            (replace "<emph>"  "<em>" )

> htmloneurl :: String -> String
> htmloneurl s | (isurl s) && length (splitOn "</url>" s) == 2 =
>                     "<a href=\"" ++ geturl s  ++ "\">" ++
>                     geturl s  ++ "</a>" ++ (splitOn "</url>" s)!!1
>              | (isurl s) && length (splitOn "</url>" s) == 1 =
>                     "<a href=\"" ++ geturl s  ++ "\">" ++
>                     geturl s  ++ "</a>"
>              | otherwise = s

> geturl :: [Char] -> [Char]
> geturl = (takeWhile (/= '<')) . (replace "<url>" "")

> htmlurlline :: String -> String
> htmlurlline = unwords . (map htmloneurl) . words

> htmlurl :: String -> String
> htmlurl = unlines . (map htmlurlline) . lines

> gethref :: [Char] -> [Char]
> gethref = (takeWhile (/= '<')   ) .
>           (replace "<href>" "" ) .
>           (replace "</href>" "")

> getdesc :: [Char] -> [[Char]]
> getdesc = (splitOn "</desc>") . (!!1) . (splitOn "<desc>")


> htmlonehref :: [Char] -> [Char]
> htmlonehref s | ishref s = "<a href=\"" ++ gethref s ++ "\">" ++
>                             (getdesc s)!!0  ++ "</a>" ++ (getdesc s)!!1
>               | otherwise = s

> ishref :: [Char] -> Bool
> ishref x = take 6 x == "<href>"

> isurl :: [Char] -> Bool
> isurl x = take 5 x == "<url>"

> htmlhrefline :: String -> String
> htmlhrefline = unwords . (map htmlonehref) . words

> htmlhref :: String -> String
> htmlhref = unlines . (map htmlhrefline) . lines

> htmlp :: String -> String
> htmlp = (replace "</para>" "</p>") . (replace "<para>" "<p>")

> htmlq :: String -> String
> htmlq = (replace "<lq/>" "&lsquo;"  ) . (replace "<rq/>" "&rsquo;" )

> htmlqq :: String -> String
> htmlqq = (replace "<lqq/>" "&ldquo;"  ) . (replace "<rqq/>" "&rdquo;" )

> htmll = (replace "</list>" "</ul>") . (replace "<list>"  "<ul>")

> htmli = (replace "</item>" "</li>") . (replace "<item>" "<li>")


> ff = "<href>http://www.bbc.co.uk</href><desc>BBC SITE</desc>"
