Content deleted Content added
Fred Gandt (talk | contribs) lua is -_- |
Fred Gandt (talk | contribs) fix returning empty explicits + identify fellback |
||
Line 23:
end
local function getWikidataDescription( title, args, fallback )
local wikidata_id = mw.wikibase.getEntityIdForTitle( title )
if isEmpty( wikidata_id ) then return nil end
Line 41:
}
end
result.fellback = fallback
return result
end
local function getShortDescription( title_table, args_name, fallback )
local page_content = title_table:getContent()
-- Assume no content is a nonexistent title because it's cheaper than testing if it exists.
Line 106 ⟶ 107:
-- Let previewWarning() work out if these numbers are bad.
previewWarning( args_name, quantity_of_things )
if #short_descriptions >= 1 then
local if notEmpty( short_description ) then return { explicit = short_description, fellback = fallback } end
end
return nil
end
Line 166 ⟶ 170:
if short_description.redlink or ( not isNone( short_description.explicit ) or args.none_is_valid ) then return short_description end
end
return getWikidataDescription( title, args, true ) end
if prefer == 'wikidata' then return getWikidataDescription( title, args ) or getShortDescription( title_table, args_name, true ) end
return { alarm = 'accepts either "explicit" or "wikidata" as the value of |prefer=' }
end
Line 196 ⟶ 200:
--[[ DON'T FORGET THIS ]]
--mw.logObject( result )
return
--[[ DON'T FORGET THIS ]]
|