Module:Script-IS: Difference between revisions
Jump to navigation
Jump to search
(Add a space to the separator) |
(Wrong separator) Tag: Manual revert |
||
Line 7: | Line 7: | ||
local str = frame.args[1] | local str = frame.args[1] | ||
local sep = ", " | local sep = "," | ||
local t={} | local t={} | ||
--split properties | --split properties | ||
Line 22: | Line 22: | ||
end | end | ||
ret = table.concat(t,",") | ret = table.concat(t,", ") | ||
return ret | return ret |
Revision as of 19:59, 12 May 2023
Documentation for this module may be created at Module:Script-IS/doc
local p = {}
--custom script for the IS wiki, feel free to make a copy of it or take any part of the code for other wikis
--split multiple properties passed as a single param to a template call and return the converted property text
function p.multiprop(frame)
local str = frame.args[1]
local sep = ","
local t={}
--split properties
for str in string.gmatch(str, "([^"..sep.."]+)") do
table.insert(t, str)
end
--get the string done
for index, prop in ipairs(t) do
if prop:sub(1,1) == "%s" then
prop = prop:sub(2,-1)
end
expanded = frame:expandTemplate{ title="Property-IS", args={prop,"IGNOREPROPERTYERROR"}}
t[index] = expanded
end
ret = table.concat(t,", ")
return ret
end
return p