diff options
author | FChannel <> | 2022-06-19 12:47:32 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 16:03:29 -0700 |
commit | b02f813e519dc890f2eb4827ff52cff3ff90c828 (patch) | |
tree | d020fbdefda52542aab3f4250bf93533e9f38504 /post/util.go | |
parent | cd99df8d6781c3f0a191d119ea0ddf8c4a16089f (diff) |
v0.1.0
Diffstat (limited to 'post/util.go')
-rw-r--r-- | post/util.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/post/util.go b/post/util.go index bc2580b..922dd11 100644 --- a/post/util.go +++ b/post/util.go @@ -472,15 +472,17 @@ func ParseAttachment(obj activitypub.ObjectBase, catalog bool) template.HTML { func ParseContent(board activitypub.Actor, op string, content string, thread activitypub.ObjectBase, id string, _type string) (template.HTML, error) { // TODO: should escape more than just < and >, should also escape &, ", and ' nContent := strings.ReplaceAll(content, `<`, "<") + + if _type == "new" { + nContent = ParseTruncate(nContent, board, op, id) + } + nContent, err := ParseLinkComments(board, op, nContent, thread) if err != nil { return "", util.MakeError(err, "ParseContent") } - if _type == "new" { - nContent = ParseTruncate(nContent, board, op, id) - } nContent = ParseCommentQuotes(nContent) nContent = strings.ReplaceAll(nContent, `/\<`, ">") @@ -497,7 +499,7 @@ func ParseTruncate(content string, board activitypub.Actor, op string, id string content += lines[i] } - content += fmt.Sprintf("<a href=\"%s\">(view full post...)</a>", board.Id+"/"+util.ShortURL(board.Outbox, op)+"#"+util.ShortURL(board.Outbox+"/outbox", id)) + content += fmt.Sprintf("<a href=\"%s\">(view full post...)</a>", board.Id+"/"+util.ShortURL(board.Outbox, op)+"#"+util.ShortURL(board.Outbox, id)) } return content |