Anonymous user
Module:Hatnote: Difference between revisions
m
Reverted edits by Mr. Stradivarius (talk) to last version by JJMC89
(add "italicizepage" and "italicizesection" options to formatLink, per protected edit request by User:Psiĥedelisto, with edits by myself) |
m (Reverted edits by Mr. Stradivarius (talk) to last version by JJMC89) |
||
Line 9:
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
Line 57 ⟶ 56:
local ret = {}
for i, page in ipairs(pages) do
ret[i] = p._formatLink
end
return ret
Line 71 ⟶ 70:
local link = t[1]
local display = t[2]
links[i] = p._formatLink
end
return links
Line 131 ⟶ 130:
function p.formatLink(frame)
local args = getArgs(frame)
local link = args[1]
if not link then
return p.makeWikitextError(
Line 142 ⟶ 140:
)
end
return p._formatLink
link = link,▼
▲ display = args[2],
end
end▼
else▼
end▼
-- 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
-- word.
▲ end
-- Find the
page = page,▼
▲ display = display,
▲ checkType('_formatLink', 1, options, 'table')
▲ checkTypeForNamedArg('_formatLink', 'link', options.link, 'string', false)
'display',▼
return string.format('[[:%s]]', parsed.link)▼
if not display then
local page, section =
if section then▼
▲ display = string.format('%s § %s', page, section)
end
end
-- Assemble the link.
return string.format(
'[[:%s|%s]]',
string.gsub(link, '|(.*)$', ''), --display overwrites manual piping
)
▲ else
▲ end
end
|