Module:Redirect template: Difference between revisions

From Roses, Tulips, & Liberty
Content added Content deleted
(Reverted good faith edits by Jackmcbarn: The result of this would always be true, because Module:Arguments changes empty arguments to nil. That is not what we want. (TW))
(restore the new version, with a fix for blanks becoming nils)
Line 22: Line 22:
if type(val) == 'string' then
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
val = val:match('^%s*(.-)%s*$')
if val == '' and key ~= 'category' then
if val == '' and key ~= 'category' and key ~= 'embed' then
return nil
return nil
end
end
Line 44: Line 44:
local namespace = mw.title.getCurrentTitle().namespace
local namespace = mw.title.getCurrentTitle().namespace
local otherCategory = args['other category'] and (args.category or string.format('[[Category:%s]]', args['other category']))
local otherCategory = args['other category'] and (args.category or string.format('[[Category:%s]]', args['other category']))
local embedPossible = (frame.args.embed or frame:getParent().args.embed or 'yes') == 'yes'
local embedPossible = args.embed == nil or args.embed == 'yes'


--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed
--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed