This commit is contained in:
Ben Harris 2018-11-07 21:23:07 -05:00
parent d02b465035
commit 1bf0a3dacb
Signed by untrusted user: ben
GPG Key ID: 4E0AF802FFF7960C
2 changed files with 6 additions and 2 deletions

View File

@ -132,7 +132,8 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, uri
Title string
MdText template.HTML
Gophermap bool
}{uri, renderMd(res.Body), false})
Pre bool
}{uri, renderMd(res.Body), false, false})
} else if strings.HasSuffix(uri, ".txt") {
// handle .txt files
@ -142,7 +143,8 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, uri
Title string
MdText string
Gophermap bool
}{uri, buf.String(), false})
Pre bool
}{uri, buf.String(), false, true})
} else {
io.Copy(w, res.Body)
}

View File

@ -17,7 +17,9 @@ var tpltext = `<!doctype html>
{{end}}
</pre>
{{else}}
{{if .Pre}}<pre>{{end}}
{{.MdText}}
{{if .Pre}}</pre>{{end}}
{{end}}
</section>
</div>