Module:Underscore to Space
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Underscore to Space/doc
local str = {}
function str._getParameters( frame_args, arg_list )
local new_args = {};
local index = 1;
local value;
for i,arg in ipairs( arg_list ) do
value = frame_args[arg]
if value == nil then
value = frame_args[index];
index = index + 1;
end
new_args[arg] = value;
end
return new_args;
end
function str.replace( frame )
local result;
local new_args = str._getParameters( frame.args, {'source'} );
local source_str = new_args['source'] or '';
if source_str == '' then
return source_str;
end
result = mw.ustring.gsub( source_str, '_', ' ' );
return result;
end
return str