fix .txt
This commit is contained in:
parent
d02b465035
commit
1bf0a3dacb
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ var tpltext = `<!doctype html>
|
|||
{{end}}
|
||||
</pre>
|
||||
{{else}}
|
||||
{{if .Pre}}<pre>{{end}}
|
||||
{{.MdText}}
|
||||
{{if .Pre}}</pre>{{end}}
|
||||
{{end}}
|
||||
</section>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue