Moduł:Wskaźnik: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
| [wersja przejrzana] | [wersja przejrzana] |
poprawki modułu (usprawniono podstawianie wartości wskutek wyodrębnienia wewnętrznej funkcji "give") |
rozszerzono moduł (umożliwiono obsługę z argumentem "text" zamiast dedykowanej grafiki poprzez argument "file", modyfikacja celem uzgodnienia z "Użytkownik:Kacpereng166/vote"; test logiczny i komunikat "error" został zastąpiony przez "assert") |
||
| Linia 6: | Linia 6: | ||
function p.indicator(frame) | function p.indicator(frame) | ||
local file = give(frame, 'file') | local file = give(frame, 'file') | ||
local text = file and '[[Plik:'..file..']]' or give(frame, 'text') | |||
assert(text, 'text') | |||
assert(file ~= '{{{1}}}.png|32px|{{{1}}}|link=|alt={{{1}}}', 'file') | |||
frame:extensionTag | |||
{ | |||
name = 'indicator', | |||
content = text, | |||
args = | |||
{ | { | ||
name = give(frame, 'name') or tostring(os.time()) | |||
}, | |||
} | |||
} | |||
end | end | ||
return p | return p | ||
Wersja z 23:41, 29 maj 2025
W tym module nie ma dokumentacji. Jeśli wiesz jak używać tego modułu, proszę, podaj odpowiednie informacje.
local p = {}
function give(frame, key)
local result = mw.text.trim(frame.args[key] or '')
return #result > 0 and result or nil
end
function p.indicator(frame)
local file = give(frame, 'file')
local text = file and '[[Plik:'..file..']]' or give(frame, 'text')
assert(text, 'text')
assert(file ~= '{{{1}}}.png|32px|{{{1}}}|link=|alt={{{1}}}', 'file')
frame:extensionTag
{
name = 'indicator',
content = text,
args =
{
name = give(frame, 'name') or tostring(os.time())
},
}
end
return p