def gen_url(url, text)
            if url =~ /([A-Za-z]+):(.*)/
                type = $1
                path = $2
            else
                type = "http"
                path = url
                url  = "http://#{url}"
            end

            if type == "link"
                url = path
            end

            if (type == "http" || type == "link") && url =~ /\.(gif|png|jpg|jpeg|bmp)$/
                "<img src=\"#{url}\">"
            elsif (type == "http" || type == "link")
                "<a href=\"#{url}\" target=\"_blank\">#{text}</a>"
            else
                "<a href=\"#\" onclick=\"jsHref('#{url}');\">#{text.sub(%r{^#{type}:/*}, '')}</a>"

            end
        end
def gen_url(url, text)
            if url =~ /([A-Za-z]+):(.*)/
                type = $1
                path = $2
            else
                type = "http"
                path = url
                url  = "http://#{url}"
            end

            if type == "link"
                url = path
            end

            if (type == "http" || type == "link") && url =~ /\.(gif|png|jpg|jpeg|bmp)$/
                "<img src=\"#{url}\">"
            elsif (type == "http" || type == "link")
                "<a href=\"#{url}\" target=\"_blank\">#{text}</a>"
            else
                "<a href=\"#\" onclick=\"jsHref('#{url}');\">#{text.sub(%r{^#{type}:/*}, '')}</a>"

            end
        end
Generate a hyperlink for url, labeled with text. Handle the
 special cases for img: and link: described under handle_special_HYPEDLINK