Module:GetShortDescription/doc: Difference between revisions

Content deleted Content added
information for requisition and about objectify_alarm
Line 50:
=== 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 {{para|lang_no|yes}} or adjusted via the parameters for {{tlc|lang}}: {{para|lang_italic}}, {{para|lang_nocat}}, {{para|lang_size}}, {{para|lang_cat}} and {{para|lang_rtl}}; see [[Template:Lang/doc|lang's documentation]] for details.
 
== Requiring this module ==
=== objectify_alarm ===
'''For use via other modules'''; application of this option via template or direct invocation will return "table" instead of the alarming message.
 
Providing a value for {{para|objectify_alarm}} will cause alarming messages (red informational messages) to be returned as [[mw:Extension:Scribunto/Lua reference manual#table|tables]]; this allows for a simple test instead of needing to parse the return value; see below for use case.
 
<syntaxhighlight lang="lua">local getShortDescription = require( 'Module:GetShortDescription' ).main
 
local short_description = getShortDescription( {
args = {
-- required
name = 'page name',
 
-- optional
prefer = 'explicit' or 'wikidata',
only = 'explicit' or 'wikidata',
fallback = 'fallback',
objectify_alarm = true or false,
lang_no = true or false,
 
-- optional {{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 objectify_alarm was true...
if type( short_description ) == 'table' then
-- An alarming message has been returned
return short_description.alarm
end</syntaxhighlight>
 
<includeonly>{{Sandbox other||