Anonymous user
Module:Hatnote: Difference between revisions
tidy up the code now that we are adding colons to all the links
(prefix all links with colons to allow interwiki links to work.) |
(tidy up the code now that we are adding colons to all the links) |
||
Line 28:
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
Line 135 ⟶ 115:
function p._formatLink(link, display)
checkType('_formatLink', 1, link, 'string')
checkType('_formatLink', 2, display, 'string', true)
-- Remove the initial colon for links where it was specified manually.
link = removeInitialColon(link)
-- Find whether a faux display value has been added with the {{!}} magic
Line 169 ⟶ 139:
-- Assemble the link.
if display then
return string.format('[[
else
return string.format('[[
end
end
|