all repos — flounder @ fbd4cd275edc8abf859876a108e9a2d1abee19f6

A small site builder for the Gemini protocol

Allow multiline blockquotes
alex wennerberg alex@alexwennerberg.com
Thu, 04 Feb 2021 19:10:35 -0800
commit

fbd4cd275edc8abf859876a108e9a2d1abee19f6

parent

427348063f7b9c9eaab913ff30459b2ae957866b

1 files changed, 11 insertions(+), 1 deletions(-)

jump to
M gmi2html.gogmi2html.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 == "" {