Module:GetShortDescription/sandbox: Difference between revisions

Content deleted Content added
testing redirect changes
cleanup; still testing
Line 72:
if title ~= args_name then
contents_of_all_short_description_templates = getShortDescriptionTemplates( args_name_title_table )
if contents_of_all_short_description_templates.redlink then return contents_of_all_short_description_templates end
end
if contents_of_all_short_description_templates.redlink then return contents_of_all_short_description_templates end
-- If the provided name was not for a redirect page, or the redirect page had no short description templates:
if #contents_of_all_short_description_templates < 1 then
contents_of_all_short_description_templates = getShortDescriptionTemplates( title_table )
Line 176 ⟶ 174:
 
-- Literally testing if title_table.isRedirect can be expensive;
-- processing this way reolvesresolves (multiple) redirects without the possibly expensive check.
local function getTitleAndTable( orig_name )
local title_table = mw.title.new( orig_name )
Line 191 ⟶ 189:
if isEmpty( args_name ) then return { alarm = 'requires a page name (including namespace)' } end
-- Keep the orginal name, cleaned up, and its title_table for later.
local args_name_title_table = mw.title.new( args_name )
args_name = args_name_title_table.prefixedText
if isSisterProjectLink( args_name ) then return nil end
local title, title_table = getTitleAndTable( args_name )
if title ~= args_name then
if isSisterProjectLink( title ) then return nil end
end
local only = args.only
Line 244 ⟶ 248:
local args = require( 'Module:Arguments' ).getArgs( frame )
if isEmpty( args ) then return alarmingMessage( 'could not getArgs' ) end -- This really would be alarming.
local d =return main( args )
mw.logObject( d )
return d
end