Differenze tra le versioni di "Modulo:Wikilib/sigle"

Adding support for black and black-on-gray colors and space-separated arguments in onMergedAbbrs
(New interface for client modules needing arguments other than the abbreviations *** sovrascritto il testo esistente ***)
(Adding support for black and black-on-gray colors and space-separated arguments in onMergedAbbrs)
 
This function returns the abbreviations of all the games in an abbreviaton
data, displayed in a background of the color of the game., or a very light gray
if the game has no color.
 
Arguments:
 
This function returns the links to all of the games in an abbreviation data,
displayed as abbreviations with a background of the color of the game., or
a very light gray if the game has no color.
 
Arguments:
This function returns the abbreviations of all the games in an abbreviaton
data, displayed in the specified color and shade. The color can be passed as
an hexadecimal or as a named color; it defaults to each game's own color., Theor
black if the game has no color. The shade default is 'normale'.
 
Arguments:
 
return q.mapDisplay(data, function(text, gameColor)
local-- If the game has no color, =using textColorthe text color orfrom gameColorq.colorAndText
local color = textColor or gameColor or ({q.colorAndText()})[2]
return string.interp('<span style="color: #${color};">${text}</span>', {
-- This is ok also for when c[color][shade] evaluates to false
This function returns the links to all of the games in an abbreviation data,
displayed displayed in the specified color and shade. The color can be passed
as an hexadecimal or as a named color; it defaults to each game's own color., or
black if the game has no color. The shade default is 'normale'.
 
Arguments:
--[[
 
This function returnstakes theas normal shade ofinput a color, andas found in the colorelements theif display textkey
in abbreviation data. It returns two hexadecimal colors: the first one is the
should have is such color is used as a background. The color can be given
eitherpassed ascolor aone, namedthe colorsecond orone asis anthe hexadecimal. Incolor the lattertext case,should however,have if the first
should have is such color is used as a background. The color can be given
text color will always be black, except for black hexadecimal.
 
The color can be passed in the following formats. A named color, in which case
the normale shade will be returned. An hexadecimal, that will be returned
unchanged: however, in this case the text color will always be black. Nil, that
implies returning a very light gray and black, as background and text color
respectively.
 
Arguments:
- color: theinput namecolor, ofas thefound colorin ordisplay ankeys hexadecimalitems.
 
--]]
q.colorAndText = function(color)
if not color then
return c.background, '000'
end
 
-- This is ok also for when c[color].normale evaluates to false
local background = c[color] and c[color].normale or color
and c.background
or '000'
 
return background, text
end
 
This function is meant to be named after an abbreviation, and can take an
arbitrary number of additional abbreviations as arguments., For this intendedeven
space-seaparated within a single argument. For this intended use, an example
use, an example call would be:
 
{{#invoke: ClientModule | abbr0 | abbr1 | abbr2 abbr3 | abbr4 }}
 
The returned function processes every abbreviaton, including the one it is
return function(frame)
local args = w.trimAll(table.copy(frame.args))
args = table.flatMap(args, function(argument)
return mw.text.split(argument, ' ')
end)
table.insert(args, 1, abbr)