mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 13:30:26 +00:00
Fix incorrect display text in links
This commit is contained in:
parent
e8f9bf608f
commit
598a87f878
@ -22,10 +22,12 @@ func LinkParts(addr, display, hyphaName string) (href, text, class, icon string)
|
|||||||
case strings.ContainsRune(addr, ':'):
|
case strings.ContainsRune(addr, ':'):
|
||||||
pos := strings.IndexRune(addr, ':')
|
pos := strings.IndexRune(addr, ':')
|
||||||
destination := addr[:pos]
|
destination := addr[:pos]
|
||||||
|
if display == "" {
|
||||||
text = addr[pos+1:]
|
text = addr[pos+1:]
|
||||||
if strings.HasPrefix(text, "//") && len(text) > 2 {
|
if strings.HasPrefix(text, "//") && len(text) > 2 {
|
||||||
text = 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)
|
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, "/"):
|
case strings.HasPrefix(addr, "/"):
|
||||||
return addr, text, class, ""
|
return addr, text, class, ""
|
||||||
|
Loading…
Reference in New Issue
Block a user