1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Fix incorrect display text in links

This commit is contained in:
bouncepaw 2020-12-17 19:58:11 +05:00
parent e8f9bf608f
commit 598a87f878

View File

@ -22,9 +22,11 @@ func LinkParts(addr, display, hyphaName string) (href, text, class, icon string)
case strings.ContainsRune(addr, ':'):
pos := strings.IndexRune(addr, ':')
destination := addr[:pos]
text = addr[pos+1:]
if strings.HasPrefix(text, "//") && len(text) > 2 {
text = text[2:]
if display == "" {
text = addr[pos+1:]
if strings.HasPrefix(text, "//") && len(text) > 2 {
text = text[2:]
}
}
return addr, text, "wikilink_external", fmt.Sprintf(`<img class="wikilink__destination-type" src="/static/icon/%s" width="16" height="16"/>`, destination)
case strings.HasPrefix(addr, "/"):