Editing Module:Hatnote
From MINR.ORG WIKI
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 28: | Line 28: | ||
-- Removes the initial colon from a string, if present. | -- Removes the initial colon from a string, if present. | ||
return s:match('^:?(.*)') | return s:match('^:?(.*)') | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
Line 75: | Line 55: | ||
end | end | ||
− | function p.makeWikitextError(msg, helpLink, addTrackingCategory | + | function p.makeWikitextError(msg, helpLink, addTrackingCategory) |
-- Formats an error message to be returned to wikitext. If | -- Formats an error message to be returned to wikitext. If | ||
-- addTrackingCategory is not false after being returned from | -- addTrackingCategory is not false after being returned from | ||
Line 83: | Line 63: | ||
checkType('makeWikitextError', 2, helpLink, 'string', true) | checkType('makeWikitextError', 2, helpLink, 'string', true) | ||
yesno = require('Module:Yesno') | yesno = require('Module:Yesno') | ||
− | title = | + | local title = mw.title.getCurrentTitle() |
-- Make the help link text. | -- Make the help link text. | ||
local helpText | local helpText | ||
Line 109: | Line 89: | ||
category | category | ||
) | ) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
Line 162: | Line 133: | ||
local page, section = link:match('^(.-)#(.*)$') | local page, section = link:match('^(.-)#(.*)$') | ||
if page then | if page then | ||
− | display = page .. ' § | + | display = page .. ' § ' .. section |
end | end | ||
end | end | ||
Line 168: | Line 139: | ||
-- Assemble the link. | -- Assemble the link. | ||
if display then | if display then | ||
− | return string.format( | + | return string.format('[[:%s|%s]]', link, display) |
− | |||
− | |||
− | |||
− | |||
else | else | ||
return string.format('[[:%s]]', link) | return string.format('[[:%s]]', link) | ||
Line 203: | Line 170: | ||
checkType('_hatnote', 1, s, 'string') | checkType('_hatnote', 1, s, 'string') | ||
checkType('_hatnote', 2, options, 'table', true) | checkType('_hatnote', 2, options, 'table', true) | ||
− | + | local classes = {'hatnote'} | |
− | local classes = {'hatnote | ||
local extraclasses = options.extraclasses | local extraclasses = options.extraclasses | ||
local selfref = options.selfref | local selfref = options.selfref | ||
Line 214: | Line 180: | ||
end | end | ||
return string.format( | return string.format( | ||
− | '<div | + | '<div class="%s">%s</div>', |
table.concat(classes, ' '), | table.concat(classes, ' '), | ||
s | s |