diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-02-21 18:08:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-21 10:08:08 +0000 |
commit | 6130522aa86316c7d87e130cc8c440fd06920928 (patch) | |
tree | e3b27d8a797977fe431f03f0d70ce168edbad10b /modules/markup/orgmode/orgmode.go | |
parent | 4e536edaead97d61a64508db0e93cf781a889472 (diff) | |
download | gitea-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.go | 3 |
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 |