Module:GetShortDescription/doc explained

Module:GetShortDescription/doc should not be confused with Module:Get short description.

Usage

<nowiki>{{#invoke:GetShortDescription|main |name= |only= |prefer= |fallback= |lang_italic= |lang_nocat= |lang_size= |lang_cat= |lang_rtl= |lang_no= }}</nowiki>

name

By providing only the required page name (including namespace), the module will look for an explicit in that page, but if not found, will try to fetch the wikidata description. If neither are found, the result will be an empty string.

If the result is a wikidata description, and it is declared (at the source) as being of a foreign language (i.e. not en), the result will be appropriately formatted by (the module powering), in accordance with ; see

  1. Foreign language wikidata descriptions
(below).

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Wikipedia}}</nowiki>

Result: This is equivalent to stating ; see

  1. prefer
(below).

only

Providing a value for will limit the search to being only for the stated description. If no description is found, the result will be an empty string, unless a fallback is provided; see

  1. fallback
(below).

explicit

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Wikipedia |only=explicit }}</nowiki>

Result:

wikidata

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Wikipedia |only=wikidata }}</nowiki>

Result:

prefer

Providing a value for will initiate the search for the stated description, but try for the alternative if none is found. If no description is found, the result will be an empty string, unless a fallback is provided; see

  1. fallback
(below).

explicit or wikidata

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Wikipedia |prefer=explicit }}</nowiki>

Result:

wikidata or explicit

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Wikipedia |prefer=wikidata }}</nowiki>

Result:

fallback

If a value for is provided, and no description is found by the expressed route, the result will be the stated fallback.

only or fallback

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Example |only=explicit |fallback=This is a fallback }}</nowiki>

Result:

prefer or fallback

Markup: <nowiki>{{#invoke:GetShortDescription|main |name=Example |prefer=wikidata |fallback=This is a fallback }}</nowiki>

Result:

Foreign language wikidata descriptions

Should a wikidata description be retrieved, which is declared (at the source) as being of a foreign language (i.e. not en), per, the return will be formatted as appropriate by Module:Lang by default. This may be disabled with or adjusted via the parameters for :,,, and ; see lang's documentation for details.

Requiring this module

Instances when a table is returned

Providing a value for will cause alarming messages (red informational messages) to be returned as tables.

Providing a value for will cause the return of a report instead of nothing in the event that the page named is nonexistent (i.e. a) and a search for a template is processed.

A table will also be returned in the event that the module is instructed to (its default), and returns a Wikidata description. If the reason for there being no explicit short description is because it was set to none; the table will include a value for table.none

See below for examples of these behaviors:

local getShortDescription = require('Module:GetShortDescription').main

local short_description = getShortDescription

-- If we've requested to report_redlinks or to objectify_alarm thenif type(short_description)

'table' then if short_description.alarm then -- An alarming message has been returned local alarming_message = short_description.alarm elseif short_description.redlink then -- Do something about that elseif short_description.wikidata then -- A Wikidata description was returned without being explicitly requested local wikidata_description = short_description.wikidata if short_description.none then -- Because the explicit short desc was 'none' end endend