Modulo:DTBase: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
mNessun oggetto della modifica
mNessun oggetto della modifica
Riga 299: Riga 299:
return Value
return Value
end
end
function p.LabelOrLink(QItem, SMWProperty, AddSemantic, ForcedLabel)
 
--------------------------------------------------------------------------------
-- Return a label ora wikilink or a link to the special Placeholder page for a
-- given Property
-- Return string containing label or link
--
-- @param QItem The item identifier in the from 'Q0'
-- @param[opt=nil] SMWProperty Name of the semantic property to add
-- @param[opt=false] AddSemantic Wether to add sematinc or not
-- @param[opt=""] ForcedLabel Specific label to show regardless DataTrek values
-- @param[opt=false] ForceString Force to return string even in case of Page
--                              that should return link
--
-- @treturn string String containing label or wikilink
--------------------------------------------------------------------------------
function p.LabelOrLink(QItem, SMWProperty, AddSemantic, ForcedLabel, ForceString)
local Label
local Label
local WTLink
local WTLink
Riga 308: Riga 323:
AddSemantic = false
AddSemantic = false
end
end
ForceString = ForceString or false
local Item = mw.wikibase.getEntity(QItem)
local Item = mw.wikibase.getEntity(QItem)
Riga 344: Riga 361:
Label = WTLink
Label = WTLink
end
end
if ForceString then
return WTLink
end
if string.find(WTLink, "Categoria:", 1, true) ~= nil then
if string.find(WTLink, "Categoria:", 1, true) ~= nil then
return "[[" .. WTLink .. "]]"
return "[[" .. WTLink .. "]]"