Lompat ke isi

Modul:Available: Perbedaan antara revisi

Dari Wikipedia bahasa Indonesia, ensiklopedia bebas
Konten dihapus Konten ditambahkan
Tidak ada ringkasan suntingan
Tidak ada ringkasan suntingan
 
(10 revisi perantara oleh pengguna yang sama tidak ditampilkan)
Baris 4: Baris 4:
local label = ""
local label = ""
for i,v in ipairs(frame.args) do
for i,v in ipairs(frame.args) do
-- if ( mw.wikibase.label( frame.args[i] ) ) then
if ( mw.wikibase.label( frame.args[i] ) ) then
-- label = mw.wikibase.label( frame.args[i] )
label = mw.wikibase.label( frame.args[i] )
-- else
else
-- label = "[[w:d:" .. frame.args[i] .. "|" .. frame.args[i] .. "]]"
label = "[[:d:" .. trim(frame.args[i]) .. "|" .. trim(frame.args[i]) .. "]]"
-- end
end
link_available = link_available .. "\n| " .. label .. "\n| "

link_available = link_available .. "\n| " .. mw.wikibase.label( frame.args[i] ) .. "\n| "
if ( mw.wikibase.sitelink( frame.args[i] ) ) then
link_available = link_available .. "[[" .. mw.wikibase.sitelink( frame.args[i] ) .. "]]"

else
local kodebahasa = frame.args[2]
link_available = link_available .. '<span style="color:red">' .. label .. '</span>'
--local nilai = mw.wikibase.getEntity().labels[kode_bahasa]
end

-- link_available = link_available .. "\n| en:[[:en:" .. nilai.value .. "|" .. mw.wikibase.getEntity().labels.en.value .. "]]\n| "
link_available = link_available .. "\n|-\n"
link_available = link_available .. "\n| " .. kodebahasa .. "\n| "


-- if ( mw.wikibase.sitelink( frame.args[i] ) ) then
-- link_available = link_available .. "[[" .. mw.wikibase.sitelink( frame.args[i] ) .. "]]"
-- else
-- link_available = link_available .. '<span style="color:red">' .. label .. '</span>'
-- end

local code = mw.language.getContentLanguage():getCode()
--[[
if code == nil then return nil end
local entity = php.getEntity( frame.args[i] )
if entity == nil or entity.labels == nil then return nil end
local label = entity.labels[code]
if label == nil then return nil end
return label.value
--]]
link_available = link_available .. code .. ":[[" .. mw.wikibase.sitelink( frame.args[i] ) .. "]]"
end
end
link_available = link_available .. "\n|}"
link_available = link_available .. "\n|}"

Revisi terkini sejak 18 September 2013 17.40

p = {}
p.link = function ( frame )
    local link_available =  "{| "
    local label = ""
    for i,v in ipairs(frame.args) do
        if ( mw.wikibase.label( frame.args[i] ) ) then 
            label = mw.wikibase.label( frame.args[i] )
        else
            label = "[[:d:" .. trim(frame.args[i]) .. "|" .. trim(frame.args[i]) .. "]]"
        end
        link_available = link_available .. "\n| " .. label .. "\n| "
        if ( mw.wikibase.sitelink( frame.args[i] ) ) then
            link_available = link_available .. "[[" .. mw.wikibase.sitelink( frame.args[i] ) .. "]]"
        else
            link_available = link_available .. '<span style="color:red">' .. label .. '</span>'
        end
        link_available = link_available .. "\n|-\n"
    end
    link_available = link_available .. "\n|}"
    return link_available
end
 
return p