1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-10-26 05:07:40 +00:00

Make account system concurrent-safe and refactor it a little

This commit is contained in:
bouncepaw
2021-01-10 01:49:48 +05:00
parent 184aa1ae32
commit b1f33c872c
19 changed files with 385 additions and 358 deletions

View File

@@ -120,6 +120,9 @@ func ParagraphToHtml(hyphaName, input string) string {
startsWith = func(t string) bool {
return bytes.HasPrefix(p.Bytes(), []byte(t))
}
noTagsActive = func() bool {
return !(tagState[spanItalic] || tagState[spanBold] || tagState[spanMono] || tagState[spanSuper] || tagState[spanSub] || tagState[spanMark] || tagState[spanLink])
}
)
for p.Len() != 0 {
@@ -147,7 +150,7 @@ func ParagraphToHtml(hyphaName, input string) string {
p.Next(2)
case startsWith("[["):
ret.WriteString(getLinkNode(p, hyphaName, true))
case startsWith("https://"), startsWith("http://"), startsWith("gemini://"), startsWith("gopher://"), startsWith("ftp://"):
case (startsWith("https://") || startsWith("http://") || startsWith("gemini://") || startsWith("gopher://") || startsWith("ftp://")) && noTagsActive():
ret.WriteString(getLinkNode(p, hyphaName, false))
default:
ret.WriteString(html.EscapeString(getTextNode(p)))