Anonimo

Modulo:FunzioniGeneriche: differenze tra le versioni

Da Wikitrek.
ParameterToSemantic
(Test sort)
(ParameterToSemantic)
Riga 229: Riga 229:
return table.concat(AllP, ",")
return table.concat(AllP, ",")
end
--- Process the value assigned to parameter of the "old"-style template
-- (pre-DataTrek) to sanitize it and pass it as clean value to
-- SMW property using the #set function
--
-- @param frame
-- @return Sanitized string representing one or more property values
function p.ParameterToSemantic(frame)
local Separator = ";"
local SepDeclaration = "|+sep=" .. Separator
local TestString = "<ul><li>[[Michael Perricone]]</li><li>[[Greg Elliot]]</li></ul>"
local FinalArray = {}
for Item in string.gmatch(TestString, "<li>(.–)</li>") do
table.insert(Item)
end
return mw.text.nowiki(table.concat(FinalArray, Separator) .. SepDeclaration)
end
end
return p
return p