Jump to content
Wikipedia The Free Encyclopedia

Module:GetShortDescription/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Fred Gandt (talk | contribs) at 18:49, 22 January 2023 (Name: improved "This is equivalent ..." statement). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision .Revision as of 18:49, 22 January 2023 by Fred Gandt (talk | contribs) (Name: improved "This is equivalent ..." statement)
icon This is a documentation subpage for Module:GetShortDescription.
It may contain usage information, categories and other content that is not part of the original module page.
This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected.
This module depends on the following other modules:

Usage

{{#invoke:User:Fred Gandt/getShortDescription|main |name= |only= |prefer= |fallback= |lang_italic= |lang_nocat= |lang_size= |lang_cat= |lang_rtl= }}

Name

By providing only the required page name (including namespace), the module will look for an explicit {{short description}} 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 as being non-English (en), the result will be wrapped in {{lang}}; see #Non-English wikidata descriptions (below).

This is equivalent to stating |prefer=explicit; see #Prefer (below).

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Only

Stating |only= 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 #Fallback (below).

Explicit or nothing

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example |only=explicit }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Wikidata or nothing

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example |only=wikidata }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Prefer

Stating |prefer= 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 #Fallback (below).

Explicit or wikidata or nothing

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example |prefer=explicit }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Wikidata or explicit or nothing

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example |prefer=wikidata }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Fallback

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

Only or fallback

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example |only=explicit |fallback=This is a fallback }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Prefer or fallback

Code: {{#invoke:User:Fred Gandt/getShortDescription|main |name=Example |prefer=wikidata |fallback=This is a fallback }}

Result: Script error: No such module "User:Fred Gandt/getShortDescription".

Non-English wikidata descriptions

Should a wikidata description be retrieved, which is declared as being non-English (en), the return will be wrapped in {{lang}}.

The parameters for {{lang}} may be provided via: |lang_italic=, |lang_nocat=, |lang_size=, |lang_cat= and |lang_rtl=.


AltStyle によって変換されたページ (->オリジナル) /