removed unnecessary comments
This commit is contained in:
parent
af16863256
commit
eac5b4d87b
1 changed files with 3 additions and 7 deletions
10
main.go
10
main.go
|
|
@ -97,11 +97,7 @@ func renderMarkdown(content string) template.HTML {
|
|||
content = ulPattern.ReplaceAllString(content, "<li>$1</li>")
|
||||
content = olPattern.ReplaceAllString(content, "<li>$1</li>")
|
||||
content = linkPattern.ReplaceAllString(content, `<a href="$2">$1</a>`)
|
||||
|
||||
// wrap list items in <ul> or <ol>
|
||||
content = regexp.MustCompile(`(<li>.+?</li>)`).ReplaceAllString(content, "<ul>$1</ul>")
|
||||
|
||||
// convert newlines to paragraphs
|
||||
content = newlinePattern.ReplaceAllString(content, "<p>$1</p>")
|
||||
|
||||
return template.HTML(content)
|
||||
|
|
@ -159,15 +155,15 @@ func main() {
|
|||
path := strings.TrimPrefix(r.URL.Path, "/")
|
||||
if strings.HasSuffix(path, ".md") {
|
||||
postHandler(w, r)
|
||||
} else if strings.Contains(path, ".") { // detect non-md files
|
||||
http.ServeFile(w, r, filepath.Join(FILES_DIR, path)) // serve raw file
|
||||
} else if strings.Contains(path, ".") {
|
||||
http.ServeFile(w, r, filepath.Join(FILES_DIR, path))
|
||||
} else {
|
||||
indexHandler(w, r)
|
||||
}
|
||||
})
|
||||
|
||||
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "static/post.gif") // or just `w.WriteHeader(http.StatusNoContent)`
|
||||
http.ServeFile(w, r, "static/post.gif")
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue