Module:Hatnote: Difference between revisions

375 bytes added ,  8 years ago
Added a simple p.disambiguate(page [, disambiguator]) helper function
(add role="note" for screen readers per protected edit request by User:Matt Fitzpatrick)
(Added a simple p.disambiguate(page [, disambiguator]) helper function)
Line 109:
category
)
end
 
function p.disambiguate(page, disambiguator)
-- Formats a page title with a disambiguation parenthetical,
-- i.e. "Example" → "Example (disambiguation)".
checkType('disambiguate', 1, page, 'string')
checkType('disambiguate', 2, disambiguator, 'string', true)
disambiguator = disambiguator or 'disambiguation'
return string.format('%s (%s)', page, disambiguator)
end
 
Anonymous user