Allow multiline blockquotes
alex wennerberg alex@alexwennerberg.com
Thu, 04 Feb 2021 19:10:35 -0800
1 files changed,
11 insertions(+),
1 deletions(-)
jump to
M
gmi2html.go
→
gmi2html.go
@@ -17,9 +17,19 @@
func textToHTML(reqUrl *url.URL, text gemini.Text) ConvertedGmiDoc { var b strings.Builder var pre bool + var blockquote bool var list bool var title string for _, l := range text { + if _, ok := l.(gemini.LineQuote); ok { + if !blockquote { + blockquote = true + fmt.Fprintf(&b, "<blockquote>\n") + } + } else if blockquote { + blockquote = false + fmt.Fprintf(&b, "</blockquote>\n") + } if _, ok := l.(gemini.LineListItem); ok { if !list { list = true@@ -96,7 +106,7 @@ text := string(l.(gemini.LineListItem))
fmt.Fprintf(&b, "<li>%s</li>\n", html.EscapeString(text)) case gemini.LineQuote: text := string(l.(gemini.LineQuote)) - fmt.Fprintf(&b, "<blockquote>%s</blockquote>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "<p>%s</p>\n", html.EscapeString(text)) case gemini.LineText: text := string(l.(gemini.LineText)) if text == "" {