flounder

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

commit 239150b9876056a44d5c442b28059adb169bf4b7
parent 4ef29f5b6813e3343f9a3743881320f8dd37ce67
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Tue, 24 Nov 2020 11:17:08 -0800

Add pre word wrap css

Diffstat:
Mgmi2html.go | 16++++++++--------
Mtemplates/static/style.css | 3+++
Mtemplates/user_page.html | 2++
3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/gmi2html.go b/gmi2html.go @@ -30,7 +30,7 @@ func textToHTML(text gemini.Text) string { if name == "" { name = url } - fmt.Fprintf(&b, "<p><a href='%s'>%s</a></p>\n", url, name) + fmt.Fprintf(&b, "<a href='%s'>%s</a>\n", url, name) case gemini.LinePreformattingToggle: pre = !pre if pre { @@ -49,25 +49,25 @@ func textToHTML(text gemini.Text) string { fmt.Fprintf(&b, "%s\n", html.EscapeString(text)) case gemini.LineHeading1: text := string(l.(gemini.LineHeading1)) - fmt.Fprintf(&b, "<h1>%s</h1>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "<h1>%s</h1>", html.EscapeString(text)) case gemini.LineHeading2: text := string(l.(gemini.LineHeading2)) - fmt.Fprintf(&b, "<h2>%s</h2>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "<h2>%s</h2>", html.EscapeString(text)) case gemini.LineHeading3: text := string(l.(gemini.LineHeading3)) - fmt.Fprintf(&b, "<h3>%s</h3>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "<h3>%s</h3>", html.EscapeString(text)) case gemini.LineListItem: text := string(l.(gemini.LineListItem)) - fmt.Fprintf(&b, "<li>%s</li>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "<li>%s</li>", html.EscapeString(text)) case gemini.LineQuote: text := string(l.(gemini.LineQuote)) - fmt.Fprintf(&b, "<blockquote>%s</blockquote>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "<blockquote>%s</blockquote>", html.EscapeString(text)) case gemini.LineText: text := string(l.(gemini.LineText)) if text == "" { - fmt.Fprint(&b, "<br>\n") + fmt.Fprint(&b, "\n") } else { - fmt.Fprintf(&b, "<p>%s</p>\n", html.EscapeString(text)) + fmt.Fprintf(&b, "%s\n", html.EscapeString(text)) } } } diff --git a/templates/static/style.css b/templates/static/style.css @@ -13,6 +13,9 @@ h1, h2, h3, h4, h5, h6{ margin-bottom:.2em; } +.gemini { +white-space: pre-wrap; +} body { } diff --git a/templates/user_page.html b/templates/user_page.html @@ -9,7 +9,9 @@ </head> <body> <main> + <div class="gemini"> {{.SiteBody}} + </div> </main> </body> </html>