Modulo:FunzioniGeneriche: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
First version of PerformersToSemantic
Nessun oggetto della modifica
(First version of PerformersToSemantic)
(8 versioni intermedie di uno stesso utente non sono mostrate)
Riga 222: Riga 222:
--
--
-- @param frame The interface to the parameters passed to {{#invoke:}}
-- @param frame The interface to the parameters passed to {{#invoke:}}
-- @return Bare name- of the ship
-- @return Bare name of the ship
function p.ShipName(frame)
function p.ShipName(frame)
local FullName = frame.args[1]
local FullName = frame.args[1]
local Prefixes = {"USS ", "IKS ", "ECS ", "''", "<i>", "</i>"}
return p.ShipNameCore(FullName)
end
--- Extract the name of a ship from its full designation
--
-- @param designation The full designation to process
-- @return Bare name of the ship
function p.ShipNameCore(designation)
local FullName = designation
local Prefixes = {"USS ", "IKS ", "ECS ", "''", "<i>", "</i>", " %(reboot%)", " %((Kelvin Timeline%)"}
-- Removes prefix
-- Removes prefix
Riga 283: Riga 292:
     end
     end
mw.smw.set(PropName .. " = " .. PropValue)
mw.smw.set(PropName .. " = " .. PropValue)
end
--- Process the value assigned to "EpisodioPersonaggi" 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 The interface to the parameters passed to {{#invoke:}}
-- No return @return Sanitized string representing one or more property values
function p.PerformersToSemantic(frame)
local InputString
local Character
local Performer
local Pattern = "%*.-%[%[(.-)%]%].-:%s?%[%[(.-)%]%]"
--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]]"
InputString = frame.args[1]
--_, _, Character, Performer = string.find(InputString, Pattern)
for Character, Performer in string.gmatch(InputString, Pattern) do 
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)

Menu di navigazione