Modulo:String/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
fix |
rimuovo funzione incompleta e rimpiazzata da Modulo:IP validator |
||
(4 versioni intermedie di un altro utente non mostrate) | |||
Riga 148:
]]
function str.match(
return str._match(frame.args)
local new_args = str._getParameters( frame.args, {'s', 'pattern', 'start', 'match', 'plain', 'nomatch'} );▼
end▼
--[[▼
Entry point per chiamata diretta da un modulo
]]▼
▲ local new_args = str._getParameters(
local s = new_args['s'] or '';
local start = tonumber( new_args['start'] ) or 1;
Line 444 ⟶ 451:
{'[ĥȟḧḣḩħḥḫẖ]', 'h'},
{'[ĤȞḦḢḨĦḤḪ]', 'H'},
{'[
{'[
{'[ĵǰ]', 'j'},
{'[Ĵ]', 'J'},
Line 619 ⟶ 626:
pre: eventuale stringa che precede l'unione delle stringhe
post: eventuale stringa che segue l'unione delle stringhe
indentazione: una stringa da ripetere cumulativamente per ogni messaggio (tipicamente ' ')
lista: se valorizzata a:
'puntata' imposta i parametri per una lista puntata
'ordinata' imposta i
'infobox' imposta l'unione come una lista, eccetto che nel caso ci sia
solo un elemento
Line 663 ⟶ 671:
local index = tonumber(base_args.Nmin) or tonumber(base_args.nmin) or base_index
local Nobbligatori = tonumber(base_args.Nobbligatori) or tonumber(base_args.nobbligatori) or base_index-1
local indentazione = base_args.indentazione or nil
local args = frame:getParent().args
-- estraggo il primo valore
Line 695 ⟶ 704:
if #elements == 0 then return '' end
-- carico separatori, congiunzione, pre e postazione
local pre, post, separatore, congiunzione, indent = '', '', '', '', ''
local lista = base_args.lista or ''
if lista == 'puntata' or (lista =='infobox' and #elements >1) then
Line 712 ⟶ 721:
separatore = base_args.separatore or ''
congiunzione = base_args.congiunzione or separatore
end▼
local current_indentazione = indentazione
for i, msg in ipairs(elements) do
elements[i] = current_indentazione .. elements[i]
current_indentazione = current_indentazione .. indentazione
end
return pre .. mw.text.listToText(elements, separatore, congiunzione) .. post
Line 806 ⟶ 822:
end
return pre .. mw.text.listToText(elements, separatore, congiunzione) .. post
▲end
▲--[[
▲]]
▲function str.isnumber( frame )
▲ if tonumber(s) then
▲ return s
▲ end
end
|