Skip to content

Commit

Permalink
fix(waline): Replace vemoji class attr to atk-emoticon.
Browse files Browse the repository at this point in the history
Signed-off-by: qwqcode <[email protected]>
  • Loading branch information
qwqcode committed Apr 25, 2022
1 parent 3e44c6c commit 8c86e81
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion waline/waline.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ func WalineToArtrans(wComments []Comment) []lib.Artran {
content := strings.TrimSpace(wC.Comment)

// 移除 "[@USERNAME](#rid): "
replyAtMatcher := regexp.MustCompile(`^\[@(.*?)\]\(#[a-zA-Z0-9]+?\)(: )?`)
replyAtMatcher := regexp.MustCompile(`^\[@(.*?)\]\(#[a-zA-Z0-9]+?\)(: | , )?`)
replyAtMatcher2 := regexp.MustCompile(`<a\s+(?:[^>]*?\s+)?href="#([a-zA-Z0-9]+)?"[^>]*>@(.*?)<\/a>(: | , )?`)
content = replyAtMatcher.ReplaceAllString(content, "")
content = replyAtMatcher2.ReplaceAllString(content, "")

vEmojiMatcher := regexp.MustCompile(`(<img[^>]*)(class=['"]vemoji['"])`)
content = vEmojiMatcher.ReplaceAllString(content, "${1}atk-emoticon")

artran := lib.Artran{
ID: lib.ToString(wC.ID),
Expand Down

0 comments on commit 8c86e81

Please sign in to comment.