flounder

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

commit fbd4cd275edc8abf859876a108e9a2d1abee19f6
parent 427348063f7b9c9eaab913ff30459b2ae957866b
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu,  4 Feb 2021 19:10:35 -0800

Allow multiline blockquotes

Diffstat:
Mgmi2html.go | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gmi2html.go b/gmi2html.go @@ -17,9 +17,19 @@ type ConvertedGmiDoc struct { 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 @@ func textToHTML(reqUrl *url.URL, text gemini.Text) ConvertedGmiDoc { 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 == "" {