Module:String: Diferans ant vèsyon yo

Contenu supprimé Contenu ajouté
Aucun résumé des modifications
Aucun résumé des modifications
Baliz : Révoqué
Liy 115 :
{{#invoke:String|match|source_string|pattern_string|start_index|match_number|plain_flag|nomatch_output}}
OR
{{#invoke:String|posmatch|s=source_string|pattern=pattern_string|start=start_index
|match=match_number|plain=plain_flag|nomatch=nomatch_output}}
 
Liy 333 :
local source_str = new_args[ 'source' ] or ''
local pattern = new_args[ 'pattern' ] or ''
local replace = new_args[ 'replaceranplase' ] or ''
local count = tonumber( new_args[ 'count' ] )
local plain = new_args[ 'plain' ] or true
Liy 344 :
if plain then
pattern = str._escapePattern( pattern )
replace = mw.ustringstring.gsub( replace, "%%", "%%%%" ); --Only need to escape replacement sequences.
end
 
Liy 374 :
local s = new_args[ 's' ] or ''
local n = tonumber( new_args[ 'n' ] ) or 1
if not s or s == '' then
return ''
end
if not n or n <0 then
return s
end
return mw.ustring.rep( s, n )
end
Ligne 440 ⟶ 434 :
Helper function to handle error messages.
]]
function str._error( error_strerror_msg )
local frame = mw.getCurrentFrame()
local error_category = frame.args.error_category or 'Errors reported by Module String'
Ligne 450 ⟶ 444 :
end
 
local error_str = '<strong class="error">String Module Error: ' .. error_strerror_msg .. '</strong>'
if error_category ~= '' and not str._getBoolean( no_category ) then
error_str = '[[Category:' .. error_category .. ']]' .. error_str
Ligne 485 ⟶ 479 :
]]
function str._escapePattern( pattern_str )
return mw.ustring( string.gsub( pattern_str, "([%(%)%.%%%+%-%*%?%[%^%$%]])", "%%%1" ) )
end