Modul:Hatnote: Unterschied zwischen den Versionen
Added a simple p.disambiguate(page [, disambiguator]) helper function |
K 64 Versionen von skanwiki:Modul:Hatnote importiert |
||
| (21 dazwischenliegende Versionen von 7 Benutzern werden nicht angezeigt) | |||
| Zeile 162: | Zeile 162: | ||
local page, section = link:match('^(.-)#(.*)$') | local page, section = link:match('^(.-)#(.*)$') | ||
if page then | if page then | ||
display = page .. ' § ' .. section | display = page .. ' § ' .. section | ||
end | end | ||
end | end | ||
| Zeile 168: | Zeile 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) | ||
| Zeile 200: | Zeile 204: | ||
checkType('_hatnote', 2, options, 'table', true) | checkType('_hatnote', 2, options, 'table', true) | ||
options = options or {} | options = options or {} | ||
local classes = {'hatnote'} | local classes = {'hatnote', 'navigation-not-searchable'} | ||
local extraclasses = options.extraclasses | local extraclasses = options.extraclasses | ||
local selfref = options.selfref | local selfref = options.selfref | ||