Added kmb and refactored query.Parse

This commit is contained in:
2022-09-17 04:33:47 +08:00
parent 292665c49b
commit 3376d9eb96
21 changed files with 762 additions and 241 deletions

View File

@@ -9,4 +9,4 @@ var WORKDIR string = TryGetEnv( "GOLIFEHK_WORKDIR", filepath.Join( os.TempDir(),
var BOM string = bytes.NewBuffer([]byte{ 0xEF, 0xBB, 0xBF }).String()
const ROUTE_CHARS string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"
const KEY_CHARS string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"

View File

@@ -3,8 +3,19 @@ package utils
import (
"os"
"strconv"
"strings"
)
var MARKDOWN_ESC []string = []string{"_", "*", "[", "]", "(", ")", "~", "`", ">", "#", "+", "-", "=", "|", "{", "}", ".", "!"}
func WriteMDv2Text( sb *strings.Builder, t string ) {
for _, c := range MARKDOWN_ESC {
t = strings.Replace( t, c, "\\" + c, -1 )
}
sb.WriteString( t )
}
func TryGetEnv[T any]( name string, fallback T ) T {
v := os.Getenv( name )