Module:Hatnote: Difference between revisions
Jump to navigation
Jump to search
Updated from sandbox: tweaked _formatLink() to overwrite, rather than stack, manual piping with "display"-based piping
>Nihiltres (Added a simple p.disambiguate(page [, disambiguator]) helper function) |
>Nihiltres (Updated from sandbox: tweaked _formatLink() to overwrite, rather than stack, manual piping with "display"-based piping) |
||
Line 168: | Line 168: | ||
-- Assemble the link. | -- Assemble the link. | ||
if display then | if display then | ||
return string.format('[[:%s|%s]]', link, display) | return string.format( | ||
'[[:%s|%s]]', | |||
string.gsub(link, '|(.*)$', ''), --display overwrites manual piping | |||
display | |||
) | |||
else | else | ||
return string.format('[[:%s]]', link) | return string.format('[[:%s]]', link) |