Content deleted Content added
reset sandbox |
implement tooltips |
||
Line 40:
end
function p._renderLink(code, searchTerms, display, tooltip)
-- Renders the external link wikicode for one link, given the link code,
-- a table of search terms, and an optional display value and tooltip.
-- Get link config.
Line 65:
url = substituteParams(linkCfg.url, searchString)
end
if tooltip then
return string.format('[%s %s]', url, display or linkCfg.display)▼
return string.format('<span title="%s">[%s %s]<span>',
mw.text.encode(tooltip), url, display or linkCfg.display)
else
end
end
Line 131 ⟶ 136:
' '
)
local code = templateCfg.introLink.tooltip
introLink = p._renderLink(code, searchTerms, display, tooltip)
else
introLink = ''
Line 141 ⟶ 147:
local sep = ''
for i, t in ipairs(templateCfg.links) do
links[i] = sep .. p._renderLink(t.code, searchTerms, t.display, t.tooltip) ..
(t.afterDisplay or '')
sep = t.separator or separator
|