Module:GetShortDescription/sandbox: Difference between revisions

Content deleted Content added
all done bar the testing and cleanup I think; very tired
+ redlink assumption
Line 46:
local function getShortDescription( title_table, args_name )
local page_content = title_table:getContent()
-- Assume no content is a nonexistent title because it's cheaper than testing if it exists.
if isEmpty( page_content ) then return nil{ redlink = true } end
local contents_of_all_short_description_templates = {}
-- Because there could be any number of short description templates, and not all where there should be; get all the templates.
Line 162 ⟶ 163:
if prefer == 'explicit' then
local short_description = getShortDescription( title_table, args_name )
if short_description and short_description.redlink or ( not isNone( short_description.explicit ) or args.none_is_valid ) then return short_description end
return getWikidataDescription( title, args ) end
if prefer == 'wikidata' then return getWikidataDescription( title, args ) or getShortDescription( title_table, args_name ) end
Line 204 ⟶ 205:
-- p.main{ name="" }
-- p.main{ name="", stringify=true }
 
-- p.main{ name="jhgfd" }
-- p.main{ name="jhgfd", stringify=true }
 
-- p.main{ name="Wikipedia:example of a double redirect" }