-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLinks.lua
More file actions
169 lines (136 loc) · 3.77 KB
/
Links.lua
File metadata and controls
169 lines (136 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
-- Modulo per le chiamate interne ai template collegamento
local l = {}
-- stylua: ignore start
local txt = require('Wikilib-strings')
local tab = require('Wikilib-tables')
local c = require("Colore-data")
-- stylua: ignore end
--[[
Template:ColoreTipo
Tipo colorato in campo colorato: il colore
della scritta ha default #FFF, il campo il
colore normale del tipo
--]]
l.colorType = function(type, bgColor, textColor)
return txt.interp(
'<span style="padding: 0.1ex 0.3em 0.2ex 0.3em; background: #${bg};">[[${type}|<span style="color: #${tc};">${type}</span>]]</span>',
{
type = txt.fu(type),
bg = bgColor or c[type].normale,
tc = textColor or "FFF",
}
)
end
l.color_type, l.typeColor, l.type_color = l.colorType, l.colorType, l.colorType
--[[
Template:Coloretipo2
Tipo colorato (preceduto da 'tipo') in campo colorato:
il colore della scritta è di default #fff,
il campo è del colore del tipo
--]]
l.colorType2 = function(type, bgColor, textColor)
return txt.interp(
'<span style="padding: 0.1ex 0.3em 0.2ex 0.3em; background: #${bgColor}">[[${type}|<span style="color: #${tc};">tipo ${type}</span>]]</span>',
{
bgColor = bgColor or c[type].normale,
type = txt.fu(type),
tc = textColor or "fff",
}
)
end
l.color_type2, l.typeColor2, l.type_color2 =
l.colorType2, l.colorType2, l.colorType2
--[[
Template:Acolore
Collegamento all'abilità con scritta colorata:
il colore della scritta è di default #000
--]]
l.aColor = function(ability, textColor, name)
return txt.interp(
'[[${ability}|<span style="color:#${tc};">${name}</span>]]',
{
ability = ability,
tc = textColor or "000",
name = name or txt.fu(ability),
}
)
end
l.a_color = l.aColor
--[[
Template:catColore
Collegamento alla categoria danno con scritta colorata:
il colore è di default cat_text
--]]
l.catColor = function(category, textColor)
local cat = txt.fu(category) or "Fisico"
return txt.interp(
'[[${cat} (categoria danno)|<span style="color: #${tc};">${cat}</span>]]',
{
cat = cat,
tc = textColor or c[cat .. "_text"],
}
)
end
l.cat_color = l.catColor
--[[
Template:Bag
Returns the sprite of an item with a link to its page. The item name is case
sensitive because the module can't handle something like 'Fune di Fuga'.
The second parameter is for all optional named arguments. Done this way because
they are (potentially) many, all optional and each one may be there
independently of the others.
--]]
local NOSPRITEITEMS = {
"Genefurioso",
"Fiocco Pois",
"Messaggio Visione",
"Messaggio Surf",
"Messaggio Ritratto",
"Messaggio Musica",
"Messaggio Morph",
"Messaggio Fiore",
"Messaggio Eon",
"Messaggio Dolce",
"Messaggio Cielo",
"Messaggio Azzurro",
"Bacca Misteriosa",
"Bacca Miracolosa",
"Bacca Menta",
"Bacca Ghiaccio",
"Bacca Bruciata",
"Bacca Amara",
"Baccantiveleno",
"Baccantiparalisi",
"Bacca Oro",
"Bacca",
}
l.bag = function(item, args)
args = args or {}
if tab.search(NOSPRITEITEMS, item) then
return ""
else
return txt.interp(
"[[File:${item} Sprite Zaino.png|${size}|${item}|link=${link}]]",
{
item = item,
link = args.link
or (item == "Perla" and "Perla (strumento)" or item),
size = "24px",
}
)
end
end
--[[
Template:tt
Used to add a tooltip to a text.
--]]
l.tt = function(text, title)
return table.concat({
'<span class="explain tooltips" title="',
title,
'">',
text,
"</span>",
})
end
return l