summaryrefslogtreecommitdiffstats
path: root/modules/markup/orgmode/orgmode.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-02-21 18:08:08 +0800
committerGitHub <noreply@github.com>2024-02-21 10:08:08 +0000
commit6130522aa86316c7d87e130cc8c440fd06920928 (patch)
treee3b27d8a797977fe431f03f0d70ce168edbad10b /modules/markup/orgmode/orgmode.go
parent4e536edaead97d61a64508db0e93cf781a889472 (diff)
downloadgitea-6130522aa86316c7d87e130cc8c440fd06920928.tar.gz
gitea-6130522aa86316c7d87e130cc8c440fd06920928.zip
Refactor markup rendering to accept general "protocol:" prefix (#29276)
Follow #29024 Major changes: * refactor validLinksPattern to fullURLPattern and add comments, now it accepts "protocol:" prefix * rename `IsLink*` to `IsFullURL*`, and remove unnecessray "mailto:" check * fix some comments (by the way) * rename EmojiShortCodeRegex -> emojiShortCodeRegex (by the way)
Diffstat (limited to 'modules/markup/orgmode/orgmode.go')
-rw-r--r--modules/markup/orgmode/orgmode.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/markup/orgmode/orgmode.go b/modules/markup/orgmode/orgmode.go
index ac1cedff6d..7f253ae5f1 100644
--- a/modules/markup/orgmode/orgmode.go
+++ b/modules/markup/orgmode/orgmode.go
@@ -136,8 +136,7 @@ type Writer struct {
func (r *Writer) resolveLink(kind, link string) string {
link = strings.TrimPrefix(link, "file:")
if !strings.HasPrefix(link, "#") && // not a URL fragment
- !markup.IsLinkStr(link) && // not an absolute URL
- !strings.HasPrefix(link, "mailto:") {
+ !markup.IsFullURLString(link) {
if kind == "regular" {
// orgmode reports the link kind as "regular" for "[[ImageLink.svg][The Image Desc]]"
// so we need to try to guess the link kind again here