From 483734704003c7355ec9b9a3adabbbccd1be1e5b Mon Sep 17 00:00:00 2001 From: Lanius Trolling Date: Thu, 28 Dec 2023 13:18:35 -0500 Subject: [PATCH] Mark links in comments as UGC --- .../kotlin/info/mechyrdia/lore/parser_tags.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/jvmMain/kotlin/info/mechyrdia/lore/parser_tags.kt b/src/jvmMain/kotlin/info/mechyrdia/lore/parser_tags.kt index 60479cd..7f1d524 100644 --- a/src/jvmMain/kotlin/info/mechyrdia/lore/parser_tags.kt +++ b/src/jvmMain/kotlin/info/mechyrdia/lore/parser_tags.kt @@ -393,7 +393,15 @@ enum class TextParserCommentTags(val type: TextParserTagType) { TR(TextParserFormattingTag.TR.type), TD(TextParserFormattingTag.TD.type), TH(TextParserFormattingTag.TH.type), - URL(TextParserFormattingTag.EXTLINK.type), + URL(TextParserTagType.Direct( + { tagParam, _ -> + val url = tagParam?.let { TextParserState.censorText(it) } + val attr = url?.let { " href=\"$it\" rel=\"ugc nofollow\"" } ?: "" + + "" + }, + { "" }, + )), LANG(TextParserFormattingTag.LANG.type), @@ -417,7 +425,7 @@ enum class TextParserCommentTags(val type: TextParserTagType) { REPLY( TextParserTagType.Indirect { _, content, _ -> sanitizeId(content)?.let { id -> - ">>$id" + ">>$id" } ?: "[reply]$content[/reply]" } ), -- 2.25.1