Module:GetShortDescription
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This Lua module is used on approximately 9,600 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module depends on the following other modules: |
![]() | This module is required by Module:Annotated link. |
![]() | This module may, by design, output alarming informational messages under certain circumstances; if these messages are displayed on any page invoking this module directly or via any other module or template using it, the page will be added to Category:Pages displaying alarming messages about Module:GetShortDescription. |
Usage
{{#invoke:GetShortDescription|main |name= |only= |prefer= |fallback= |lang_italic= |lang_nocat= |lang_size= |lang_cat= |lang_rtl= |lang_no= }}
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 (at the source) as being of a foreign language (i.e. not en), the result will be appropriately formatted by Module:Lang (the module powering {{lang}}
), in accordance with MOS:OTHERLANG; see #Foreign language wikidata descriptions (below).
- Markup:
{{#invoke:GetShortDescription|main |name=Wikipedia}}
- Result: to sender
This is equivalent to stating |prefer=explicit
; see #prefer (below).
only
Providing a value for |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
- Markup:
{{#invoke:GetShortDescription|main |name=Wikipedia |only=explicit }}
- Result: to sender
wikidata
- Markup:
{{#invoke:GetShortDescription|main |name=Wikipedia |only=wikidata }}
- Result: to sender
prefer
Providing a value for |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
- Markup:
{{#invoke:GetShortDescription|main |name=Wikipedia |prefer=explicit }}
- Result: to sender
wikidata or explicit
- Markup:
{{#invoke:GetShortDescription|main |name=Wikipedia |prefer=wikidata }}
- Result: to sender
fallback
If a value for |fallback=
is provided, and no description is found by the expressed route, the result will be the stated fallback.
only or fallback
- Markup:
{{#invoke:GetShortDescription|main |name=Example |only=explicit |fallback=This is a fallback }}
- Result: to sender
prefer or fallback
- Markup:
{{#invoke:GetShortDescription|main |name=Example |prefer=wikidata |fallback=This is a fallback }}
- Result: to sender
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 MOS:OTHERLANG, the return will be formatted as appropriate by Module:Lang by default. This may be disabled with |lang_no=yes
or adjusted via the parameters for {{lang}}
: |lang_italic=
, |lang_nocat=
, |lang_size=
, |lang_cat=
and |lang_rtl=
; see lang's documentation for details.
Requiring this module
Instances when a table is returned
Providing a value for |objectify_alarm=
will cause alarming messages (red informational messages) to be returned as tables.
Providing a value for |report_redlinks=
will cause the return of a report instead of nothing in the event that the page named is nonexistent (i.e. a WP:REDLINK) and a search for a {{short description}}
template is processed.
A table will also be returned in the event that the module is instructed to |prefer=explicit
(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( {
-- required
name = 'page name',
-- optional
prefer = 'explicit' or 'wikidata',
only = 'explicit' or 'wikidata',
fallback = 'fallback',
objectify_alarm = true,
report_redlinks = true,
lang_no = 'yes',
-- {{lang}} options
lang_italic = <yes, no, unset, invert, default>,
lang_nocat = <yes, y, true, t, on, 1>,
lang_size = <CSS font-size e.g. '1.5em'>,
lang_cat = <no, n, false, f, off, 0>,
lang_rtl = <no (default), yes>
} )
-- If we've requested to report_redlinks or to objectify_alarm then
if 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
end
end
- ^ a b c d e Cite error: The named reference
autogenerated1
was invoked but never defined (see the help page). - ^ a b c d e Chapman, Roger (September 6, 2011). "Top 40 Website Programming Languages". rogchap.com. Archived from the original on September 22, 2013. Retrieved September 6, 2011.
- ^ a b c d e f g h i j "Wikipedia is 20, and its reputation has never been higher". The Economist. January 9, 2021. Archived from the original on January 7, 2021. Retrieved February 25, 2021.
- ^ a b c d e Anderson, Chris (May 8, 2006). "Jimmy Wales – The 2006 Time 100". Time. Archived from the original on October 12, 2022. Retrieved November 11, 2017.
- ^ "Most Visited Websites in Worldwide 2024". Semrush. Retrieved 19 June 2024.
- ^ "Most viewed website". Similarweb. Retrieved 19 June 2024.
- ^ a b c d e Seitz-Gruwell, Lisa (October 23, 2023). "7 reasons you should donate to Wikipedia". Wikimedia Foundation. Archived from the original on December 27, 2023. Retrieved December 27, 2023.
- ^ "wikipedia.org". similarweb.com. Archived from the original on June 5, 2020. Retrieved November 8, 2023.
- ^ Noor, Poppy (29 July 2018). "Wikipedia biases". The Guardian. Retrieved 31 May 2024.
- ^ Hern, Alex (15 September 2015). "Wikipedia's view of the world is written by the west". The Guardian. Retrieved 31 May 2024.
- ^ a b c d e "Happy Birthday, Wikipedia". The Economist. January 9, 2021. Archived from the original on January 1, 2023. Retrieved January 22, 2023.
- ^ a b c d e Cooke, Richard (February 17, 2020). "Wikipedia Is the Last Best Place on the Internet". Wired. Archived from the original on December 17, 2022. Retrieved October 13, 2020.
- ^ a b c d e Hughes, Taylor; Smith, Jeff; Leavitt, Alex (April 3, 2018). "Helping People Better Assess the Stories They See in News Feed with the Context Button". Meta. Archived from the original on January 11, 2023. Retrieved January 23, 2023.
- ^ a b c d e Cite error: The named reference
auto
was invoked but never defined (see the help page). - ^ Treisman, Rachel (April 1, 2022). "Russia threatens to fine Wikipedia if it doesn't remove some details about the war". NPR. Archived from the original on December 2, 2022. Retrieved January 22, 2023.
- ^ a b c d e Cite error: The named reference
:1
was invoked but never defined (see the help page). - ^ Kelly, Samantha Murphy (May 20, 2022). "Meet the Wikipedia editor who published the Buffalo shooting entry minutes after it started". CNN. Archived from the original on October 12, 2022. Retrieved May 24, 2022.
- ^ McNamee, Kai (September 15, 2022). "Fastest 'was' in the West: Inside Wikipedia's race to cover the queen's death". NPR. Archived from the original on January 15, 2023. Retrieved January 22, 2023.
- ^ "Most Visited Websites in Worldwide 2024". Semrush. Retrieved 19 June 2024.
- ^ "Most viewed website". Similarweb. Retrieved 19 June 2024.
- ^ "wikipedia.org". similarweb.com. Archived from the original on June 5, 2020. Retrieved November 8, 2023.
- ^ Noor, Poppy (29 July 2018). "Wikipedia biases". The Guardian. Retrieved 31 May 2024.
- ^ Hern, Alex (15 September 2015). "Wikipedia's view of the world is written by the west". The Guardian. Retrieved 31 May 2024.
- ^ Treisman, Rachel (April 1, 2022). "Russia threatens to fine Wikipedia if it doesn't remove some details about the war". NPR. Archived from the original on December 2, 2022. Retrieved January 22, 2023.
- ^ Kelly, Samantha Murphy (May 20, 2022). "Meet the Wikipedia editor who published the Buffalo shooting entry minutes after it started". CNN. Archived from the original on October 12, 2022. Retrieved May 24, 2022.
- ^ McNamee, Kai (September 15, 2022). "Fastest 'was' in the West: Inside Wikipedia's race to cover the queen's death". NPR. Archived from the original on January 15, 2023. Retrieved January 22, 2023.
- ^ "Most Visited Websites in Worldwide 2024". Semrush. Retrieved 19 June 2024.
- ^ "Most viewed website". Similarweb. Retrieved 19 June 2024.
- ^ "wikipedia.org". similarweb.com. Archived from the original on June 5, 2020. Retrieved November 8, 2023.
- ^ Noor, Poppy (29 July 2018). "Wikipedia biases". The Guardian. Retrieved 31 May 2024.
- ^ Hern, Alex (15 September 2015). "Wikipedia's view of the world is written by the west". The Guardian. Retrieved 31 May 2024.
- ^ Treisman, Rachel (April 1, 2022). "Russia threatens to fine Wikipedia if it doesn't remove some details about the war". NPR. Archived from the original on December 2, 2022. Retrieved January 22, 2023.
- ^ Kelly, Samantha Murphy (May 20, 2022). "Meet the Wikipedia editor who published the Buffalo shooting entry minutes after it started". CNN. Archived from the original on October 12, 2022. Retrieved May 24, 2022.
- ^ McNamee, Kai (September 15, 2022). "Fastest 'was' in the West: Inside Wikipedia's race to cover the queen's death". NPR. Archived from the original on January 15, 2023. Retrieved January 22, 2023.
- ^ "Most Visited Websites in Worldwide 2024". Semrush. Retrieved 19 June 2024.
- ^ "Most viewed website". Similarweb. Retrieved 19 June 2024.
- ^ "wikipedia.org". similarweb.com. Archived from the original on June 5, 2020. Retrieved November 8, 2023.
- ^ Noor, Poppy (29 July 2018). "Wikipedia biases". The Guardian. Retrieved 31 May 2024.
- ^ Hern, Alex (15 September 2015). "Wikipedia's view of the world is written by the west". The Guardian. Retrieved 31 May 2024.
- ^ Treisman, Rachel (April 1, 2022). "Russia threatens to fine Wikipedia if it doesn't remove some details about the war". NPR. Archived from the original on December 2, 2022. Retrieved January 22, 2023.
- ^ Kelly, Samantha Murphy (May 20, 2022). "Meet the Wikipedia editor who published the Buffalo shooting entry minutes after it started". CNN. Archived from the original on October 12, 2022. Retrieved May 24, 2022.
- ^ McNamee, Kai (September 15, 2022). "Fastest 'was' in the West: Inside Wikipedia's race to cover the queen's death". NPR. Archived from the original on January 15, 2023. Retrieved January 22, 2023.
- ^ "Most Visited Websites in Worldwide 2024". Semrush. Retrieved 19 June 2024.
- ^ "Most viewed website". Similarweb. Retrieved 19 June 2024.
- ^ "wikipedia.org". similarweb.com. Archived from the original on June 5, 2020. Retrieved November 8, 2023.
- ^ Noor, Poppy (29 July 2018). "Wikipedia biases". The Guardian. Retrieved 31 May 2024.
- ^ Hern, Alex (15 September 2015). "Wikipedia's view of the world is written by the west". The Guardian. Retrieved 31 May 2024.
- ^ Treisman, Rachel (April 1, 2022). "Russia threatens to fine Wikipedia if it doesn't remove some details about the war". NPR. Archived from the original on December 2, 2022. Retrieved January 22, 2023.
- ^ Kelly, Samantha Murphy (May 20, 2022). "Meet the Wikipedia editor who published the Buffalo shooting entry minutes after it started". CNN. Archived from the original on October 12, 2022. Retrieved May 24, 2022.
- ^ McNamee, Kai (September 15, 2022). "Fastest 'was' in the West: Inside Wikipedia's race to cover the queen's death". NPR. Archived from the original on January 15, 2023. Retrieved January 22, 2023.
Cite error: There are <ref group=lower-alpha>
tags or {{efn}}
templates on this page, but the references will not show without a {{reflist|group=lower-alpha}}
template or {{notelist}}
template (see the help page).
Cite error: There are <ref group=W>
tags on this page, but the references will not show without a {{reflist|group=W}}
template (see the help page).
local p = {}
local getArgs = require( 'Module:Arguments' ).getArgs
local getLead = require( 'Module:Transcluder' ).get
local function _main( args )
local name = args.name
if name then
local lead = getLead( name .. "#" )
mw.log( lead )
if lead then
local current_frame = mw.getCurrentFrame()
--check it
local child_frame = current_frame:newChild{ title = name }--why are you not working?
--<strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Lua error in Module:Infobox_television_episode at line 672: bad argument #1 to 'find' (string expected, got nil).</span></strong>
--because (I think) the infobox Module doesn't know the article it's supposedly on
--I need to convince it that it's being processed in the args.name article
--check it
local preprocessed_lead = child_frame:preprocess( lead )
--check it
mw.log( "preprocessed_lead" )
mw.log( preprocessed_lead )
--if no short desc then
local wikidata_id = mw.wikibase.getEntityIdForTitle( name )
--check it
mw.log( "wikidata_id" )
mw.log( wikidata_id )
local wikidata_description = mw.wikibase.getDescription( wikidata_id )
--check it
mw.log( "wikidata_description" )
mw.log( wikidata_description )
end
end
return "to sender"
end
function p.main( frame )
local args = getArgs( frame.args )
return _main( args )
end
return p
--p.main{args={name="Author, Author (Star Trek: Voyager)"}}
--p.main{args={name="The Partisan"}}