Content deleted Content added
Fred Gandt (talk | contribs) searching for descriptions for pages in sister projects is currently not possible; testing filter against wasted effort trying for sister project link targets |
Fred Gandt (talk | contribs) provide indicator if falling back to wikidata |
||
Line 31:
end
local function getWikidataDescription( name, lang, not_explicit )
local wikidata_id = mw.wikibase.getEntityIdForTitle( name )
if isEmpty( wikidata_id ) then return nil end
local wikidata_description, wikidata_description_lang = mw.wikibase.getDescriptionWithLang( wikidata_id )
if isEmpty( wikidata_description ) or wikidata_description:match( '^[Nn]one$' ) then return nil end
if
wikidata_description,
▲ wikidata_description,
}
▲ rtl = lang.rtl
if notEmpty( not_explicit ) then wikidata_description = { wikidata = wikidata_description } end
return wikidata_description
end
Line 123 ⟶ 125:
end
local function
local sister_project_prefixes = {
'wiktionary', 'wikt',
Line 156 ⟶ 158:
if isEmpty( name ) then return alarmingMessage( 'requires a page name (including namespace)' ) end
local fallback = args.fallback
if
local prefer = args.prefer or 'explicit'
local only = args.only
Line 170 ⟶ 172:
if only == 'explicit' then result = getExplicitDescription( name )
elseif only == 'wikidata' then result = getWikidataDescription( name, lang )
elseif prefer == 'explicit' then result = getExplicitDescription( name ) or getWikidataDescription( name, lang, true )
elseif prefer == 'wikidata' then result = getWikidataDescription( name, lang ) or getExplicitDescription( name )
end
Line 181 ⟶ 183:
local args = getArgs( frame )
if isEmpty( args ) then return alarmingMessage( 'could not getArgs' ) end
local
mw.
return
end
|