miki

Miki: personal wiki with the fmd markup format
git clone https://wtenison.com/repo/miki.git
Log | Files | Refs | README | LICENSE

commit acf3ea53f035cf711f77cc403fe9c24391e152cb
parent e2d4abf77068b55125ae7ad3e4066577afaf12c6
Author: weetat <wtenison@protonmail.com>
Date:   Fri, 28 Feb 2025 00:13:39 +0000

Emit <br> for newlines in the interpreter

Diffstat:
Msrc/fmd/interpreter.go | 5+++--
Msrc/network/routes.go | 8++++----
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/fmd/interpreter.go b/src/fmd/interpreter.go @@ -5,7 +5,8 @@ import ( "strings" ) -// TODO: Implment cleaner solution to sanitization. +// TODO: Implment better solution to sanitization. +// NOTE: Solution; move sanitization to separate package and let the interpreter work fast, then clean? var invalidHTML = []string{"<script>", "</script>", "<object>", "</object>", "<embed", "<link>", "</link>"} func interpret(n node) string { @@ -55,7 +56,7 @@ func interpret(n node) string { } _res.WriteString("</div>") case nodeNewline: - return n.value + return "<br>" case nodeSpace: return n.value case nodeLiteral: diff --git a/src/network/routes.go b/src/network/routes.go @@ -74,7 +74,7 @@ func handlePageHome(w http.ResponseWriter, r *http.Request) { return } - log.Printf("DONE\thandlePage:%s", r.URL) + log.Printf("DONE:handlePage:%s", r.URL) } func handlePageSubject(w http.ResponseWriter, r *http.Request) { @@ -131,7 +131,7 @@ func handlePageSubject(w http.ResponseWriter, r *http.Request) { return } - log.Printf("DONE\thandlePage:%s", r.URL) + log.Printf("DONE:handlePage:%s", r.URL) } func handlePageEdit(w http.ResponseWriter, r *http.Request) { @@ -186,7 +186,7 @@ func handlePageEdit(w http.ResponseWriter, r *http.Request) { return } - log.Printf("DONE\thandlePage:%s", r.URL) + log.Printf("DONE:handlePage:%s", r.URL) } func handlePagePreview(w http.ResponseWriter, r *http.Request) { @@ -236,5 +236,5 @@ func handlePagePreview(w http.ResponseWriter, r *http.Request) { return } - log.Printf("DONE\thandlePage:%s", r.URL) + log.Printf("DONE:handlePage:%s", r.URL) }