Modulo:DTBase: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
New labels for Interwiki
Nessun oggetto della modifica
(New labels for Interwiki)
(19 versioni intermedie di uno stesso utente non sono mostrate)
Riga 4: Riga 4:
-- Add other authors below
-- Add other authors below
-- Keyword: wikitrek
-- Keyword: wikitrek
local LabelOrLink = require('Modulo:DTBase').LabelOrLink
local p = {}
local p = {}
function p.Epilogo(frame)
function p.Epilogo(frame)
Riga 48: Riga 46:
end
end
function p.Categories(frame)
function p.Categories(frame)
local Opening = '[[Categoria:'
local Opening = '[[Category:'
local CategoryP = 'P30'
local CategoryP = 'P30'
local AbbrP = 'P24'
local AbbrP = 'P24'
Riga 118: Riga 116:
itwiki = 'Wikipedia (inglese)',
itwiki = 'Wikipedia (inglese)',
dema = 'Memory Alpha (tedesco)',
dema = 'Memory Alpha (tedesco)',
demb = 'Memory Beta (tedesco)'
demb = 'Memory Beta (tedesco)',
fanlore = 'Fanlore',
trekipedia = 'Trekipedia'
}
}
Riga 289: Riga 289:
local WTLink
local WTLink
if (not AddSemantic) and SMWProperty and (SMWProperty ~= "") then
if AddSemantic and SMWProperty and (SMWProperty ~= "") then
AddSemantic = true
AddSemantic = true
else
else
Riga 310: Riga 310:
end
end
if not mw.wikibase.getSitelink(QItem) then
if not mw.wikibase.getSitelink(QItem) and string.find(Label, "Categoria:", 1, true) == nil then
--if mw.wikibase.getSitelink(QItem) == nil or (not mw.wikibase.getSitelink(QItem)) then
--if mw.wikibase.getSitelink(QItem) == nil or (not mw.wikibase.getSitelink(QItem)) then
return Label
--return Label
--https://wikitrek.org/wiki/Speciale:AboutTopic/Q64
return "[[Special:AboutTopic/" .. QItem .. "|" .. Label .. "]]"
else
else
WTLink = Item.sitelinks['wikitrek'].title
if Item.sitelinks == nil then
WTLink = Label
else
WTLink = Item.sitelinks['wikitrek'].title
end
if not Label then
if not Label then
Label = WTLink
Label = WTLink
end
end
if string.find(WTLink, "Categoria:", 1, true) ~= nil then
if string.find(WTLink, "Categoria:", 1, true) ~= nil then
return "[[" .. WTLink .. "]]"
return "[[" .. WTLink .. "]]"
elseif AddSemantic then
elseif AddSemantic then
Riga 356: Riga 363:
if not Item["P7"] then
if not Item["P7"] then
Previous = "no prev"
Previous = "''nessuno''"
else
else
Previous = p.LabelOrLink(Item["P7"][1].datavalue.value.id)
Previous = p.LabelOrLink(Item["P7"][1].mainsnak.datavalue.value.id)
end
end
if not Item["P23"] then
if not Item["P23"] then
Next = "no next"
Next = "''nessuno''"
else
else
Next = p.LabelOrLink(Item["P23"][1].datavalue.value.id)
Next = p.LabelOrLink(Item["P23"][1].mainsnak.datavalue.value.id)
end
end
Riga 480: Riga 487:
--- Writes a gneric UL list from property, adding SMW link if specified
--- Writes a gneric UL list from property, adding SMW link if specified
--  
--  
-- @PName Info from MW session
-- @param PName Info from MW session
-- @SMWPrefix  
-- @param SMWPrefix  
-- @return A bullet list of backlinks
-- @return A bullet list of backlinks
function p.PropertyList(frame)
function p.PropertyList(frame)
Riga 495: Riga 502:
return "Nessun riferimento trovato"
return "Nessun riferimento trovato"
elseif table.getn(Statements) == 1 then
elseif table.getn(Statements) == 1 then
return Statements[1].mainsnak.datavalue.value.id
return p.LabelOrLink(Statements[1].mainsnak.datavalue.value.id, frame.args["SMWPrefix"], true)
else
else
for _, Statement in pairs(Statements) do
for _, Statement in pairs(Statements) do
--local ReferenceItem = Statement.mainsnak.datavalue.value.id
--local ReferenceItem = Statement.mainsnak.datavalue.value.id
AllReferences[#AllReferences + 1] = "<li>" .. Statement.mainsnak.datavalue.value.id .. " " .. LabelOrLink(Statement.mainsnak.datavalue.value.id) .. "</li>"
AllReferences[#AllReferences + 1] = "<li>" .. p.LabelOrLink(Statement.mainsnak.datavalue.value.id, frame.args["SMWPrefix"], true) .. "</li>"
end
end
return "<ul>" .. table.concat(AllReferences, string.char(10)) .. "</ul>"
return "<ul>" .. table.concat(AllReferences, string.char(10)) .. "</ul>"

Menu di navigazione