모듈:Plain sister

Ernst (토론 | 기여)님의 2020년 1월 12일 (일) 22:14 판

local p = {}

local sites = { -- interwiki prefix, parameter, label and site id (for Wikidata) { 'w', '위키백과', '위키백과 문서', 'kowiki' }, { 'commons', '공용', '공용 갤러리', 'commonswiki' }, { 'commons:Category', '공용분류', '공용 분류', }, { 'q', '위키인용집', '인용', 'kowikiquote' }, { 'n', '위키뉴스', '뉴스', 'kowikinews' }, { 'wikt', '위키낱말사전', '사전 정의', 'kowiktionary' }, { 'b', '위키책', '교과서', 'kowikibooks' }, { 'v', '위키배움터', '교육 과정', 'kowikiversity' }, { 'wikispecies', '위키스피시즈', '생물 분류', 'specieswiki' }, { 'voy', '위키여행', '여행 가이드', 'enwikivoyage' }, { 'd', '위키데이터', '위키데이터 항목', 'wikidatawiki' }, { 'bibliowiki', '비블리오위키', '비블리오위키', }, { 'm', '메타', '메타', 'metawiki' } }

function p.interprojetPart( frame ) local frame = frame:getParent() local item = mw.wikibase.getEntityObject() local links = {}

for _, site in pairs( sites ) do local val = if val == and frame.args[site[2]] ~= nil then val = frame.args[site[2]] end if val == and site[4] ~= and item ~= nil then if site[4] == 'wikidatawiki' then val = item.id or else val = item:getSitelink( site[4] ) or end end

if val ~= then table.insert( links, '[[' .. site[1] .. ':' .. val .. '|' .. site[3] .. ']]' ) end end

if next( links ) == nil then return end

return end

return p