Module:Template link general and Module:Template link general/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
put subst on if nolink |
linkTitle: try to simplify logic |
||
Line 33: | Line 33: | ||
local function linkTitle(args) |
local function linkTitle(args) |
||
⚫ | |||
if _ne(args.subst) then |
|||
return 'subst:' .. args['1'] |
|||
⚫ | |||
return args['1'] |
|||
⚫ | |||
end |
|||
local titleObj |
local titleObj |
||
⚫ | |||
if args['1'] then |
if args['1'] then |
||
-- This handles :Page and other NS |
-- This handles :Page and other NS |
||
Line 49: | Line 40: | ||
titleObj = mw.title.getCurrentTitle() |
titleObj = mw.title.getCurrentTitle() |
||
end |
end |
||
⚫ | |||
addTemplate(args['1'])) |
|||
local textPart = args.alttext |
local textPart = args.alttext |
||
if not _ne(textPart) then |
if not _ne(textPart) then |
||
Line 73: | Line 61: | ||
textPart = nw('{') .. textPart .. nw('}') |
textPart = nw('{') .. textPart .. nw('}') |
||
end |
end |
||
local titlePart |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
'|' .. textPart .. ']]' |
|||
⚫ | |||
if _ne(args.braceinside) then |
if _ne(args.braceinside) then |
||
titlePart = nw('{') .. titlePart .. nw('}') |
titlePart = nw('{') .. titlePart .. nw('}') |
||
Line 152: | Line 146: | ||
if show_result then |
if show_result then |
||
codeArguments['nocat'] = true |
|||
local result = mw.getCurrentFrame():expandTemplate{title = addTemplate(args[1]), args = codeArguments} |
local result = mw.getCurrentFrame():expandTemplate{title = addTemplate(args[1]), args = codeArguments} |
||
ret = ret .. " → " .. result |
ret = ret .. " → " .. result |