17 214
contributi
(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
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
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
black if the game has no color. The shade default is 'normale'.
Arguments:
return q.mapDisplay(data, function(text, gameColor)
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
black if the game has no color. The shade default is 'normale'.
Arguments:
--[[
This function
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▼
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:
--]]
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
space-seaparated within a single argument. For this intended use, an example
{{#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)
|
contributi