flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit fe128dfe1438dd8da1e03851f6b77a938665d7ea
parent 6b3c7281a94fa0e8efbe12901b526fcb17dd29a1
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon,  9 Nov 2020 10:03:59 -0800

Revert "add inline images and preformatted alt text"

This reverts commit 2799ede93e92daa87144e345d5b086aac4e8c037.

Diffstat:
Mgmi2html.go | 24+++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/gmi2html.go b/gmi2html.go @@ -3,9 +3,6 @@ package main import ( "fmt" "html" - "mime" - neturl "net/url" - "path" "strings" "git.sr.ht/~adnano/go-gemini" @@ -30,28 +27,13 @@ func textToHTML(text gemini.Text) string { 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")