Revert "add inline images and preformatted alt text" This reverts commit 2799ede93e92daa87144e345d5b086aac4e8c037.
alex wennerberg alex@alexwennerberg.com
Mon, 09 Nov 2020 10:03:59 -0800
1 files changed,
3 insertions(+),
21 deletions(-)
jump to
M
gmi2html.go
→
gmi2html.go
@@ -3,9 +3,6 @@
import ( "fmt" "html" - "mime" - neturl "net/url" - "path" "strings" "git.sr.ht/~adnano/go-gemini"@@ -30,28 +27,13 @@ case gemini.LineLink:
link := l.(gemini.LineLink) url := html.EscapeString(link.URL) name := html.EscapeString(link.Name) - var internal bool - parsedUrl, err := neturl.Parse(url) // simpler way to do this? - if err == nil { - // only show images inline if they are relative links - internal = parsedUrl.Host == "" - } - if strings.HasPrefix(mime.TypeByExtension(path.Ext(url)), "image") && internal { - fmt.Fprintf(&b, "<img src='%s' alt='%s'>\n", url, name) - } else { - if name == "" { - name = url - } - fmt.Fprintf(&b, "<p><a href='%s'>%s</a></p>\n", url, name) + if name == "" { + name = url } + fmt.Fprintf(&b, "<p><a href='%s'>%s</a></p>\n", url, name) case gemini.LinePreformattingToggle: pre = !pre if pre { - altText := string(l.(gemini.LinePreformattingToggle)) - if altText != "" { - altText = html.EscapeString(altText) - fmt.Fprintf(&b, "<pre title='%s'>\n", altText) - } fmt.Fprint(&b, "<pre>\n") } else { fmt.Fprint(&b, "</pre>\n")