Anonimo

Modulo:FunzioniGeneriche: differenze tra le versioni

Da Wikitrek.
First version of PerformersToSemantic
Nessun oggetto della modifica
(First version of PerformersToSemantic)
Riga 293: Riga 293:
mw.smw.set(PropName .. " = " .. PropValue)
mw.smw.set(PropName .. " = " .. PropValue)
end
end
--- Process the value assigned to parameter of the "old"-style template
--- Process the value assigned to "EpisodioPersonaggi" of the "old-style"
-- (pre-DataTrek) to sanitize it and pass it as clean value to
-- template (pre-DataTrek) to sanitize it and pass it as clean value to
-- SMW property using the #set function
-- SMW property using the #set function
--
--
Riga 300: Riga 300:
-- No return @return Sanitized string representing one or more property values
-- No return @return Sanitized string representing one or more property values
function p.PerformersToSemantic(frame)
function p.PerformersToSemantic(frame)
local InputString = "* [[Vina]]: [[Melissa George]]* [[Spock]]: [[Ethan Peck]]* [[Leland]]: [[Alan van Sprang]]* [[Nhan]]: [[Rachael Ancheril]]* Un [[Talosiani|Talosiano]]: [[Dee Pelletier]]* Il ''Keeper'' [[Talosiani|Talosiano]]: [[Rob Brownstein]]* Lt. Cmdr. [[Airiam]]: [[Hannah Cheesman]]* Lt. [[Keyla Detmer]]: [[Emily Coutts]]* [[Talosiani|Talosiano]] n.3: [[Nicole Dickinson]]"
local InputString
local Character
local Character
local Performer
local Performer
local Pattern = "%*.-%[%[(.-)%]%].-:%s?%[%[(.-)%]%]"
local Pattern = "%*.-%[%[(.-)%]%].-:%s?%[%[(.-)%]%]"


_, _, Character, Performer = string.find(InputString, Pattern)
--InputString = "* [[Vina]]: [[Melissa George]]* [[Spock]]: [[Ethan Peck]]* [[Leland]]: [[Alan van Sprang]]* [[Nhan]]: [[Rachael Ancheril]]* Un [[Talosiani|Talosiano]]: [[Dee Pelletier]]* Il ''Keeper'' [[Talosiani|Talosiano]]: [[Rob Brownstein]]* Lt. Cmdr. [[Airiam]]: [[Hannah Cheesman]]* Lt. [[Keyla Detmer]]: [[Emily Coutts]]* [[Talosiani|Talosiano]] n.3: [[Nicole Dickinson]]"
--print(Character, Performer)
InputString = frame.args[1]
 
for Character, Performer in string.gmatch(InputString, Pattern) do   
--_, _, Character, Performer = string.find(InputString, Pattern)
  Character = string.gsub(Character, "|.*","")
  print("Character: " .. Character, "Performer: " .. Performer)
for Character, Performer in string.gmatch(InputString, Pattern) do   
end
Character = string.gsub(Character, "|.*","")
--print("Character: " .. Character, "Performer: " .. Performer)
mw.smw.set("Personaggio=" .. Character)
mw.smw.set("Interprete=" .. Performer)
mw.smw.set(Performer .. " = " .. Character)
end
end
end
function p.ParameterToSemanticTest(frame)
function p.ParameterToSemanticTest(frame)