יחידה:Sister project links: הבדלים בין גרסאות בדף
מראה
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 41: | שורה 41: | ||
['display']='וויקיחדשות', | ['display']='וויקיחדשות', | ||
['projectPrefix']='n' | ['projectPrefix']='n' | ||
}, | |||
['wikivoyage'] = { | |||
['logo']='Wikivoyage-Logo-v3-icon - mirrored.svg', | |||
['projectName'] = 'ויקימסע', | |||
['description']='מדריך למטייל', | |||
['display']='וויקימסע', | |||
['projectPrefix']='voy' | |||
}, | }, | ||
['commons'] = { | ['commons'] = { | ||
| שורה 48: | שורה 55: | ||
['display']='וויקישיתוף', | ['display']='וויקישיתוף', | ||
['projectPrefix']='commons' | ['projectPrefix']='commons' | ||
}, | |||
['wikispecies'] = { | |||
['logo']='Wikispecies-logo.svg', | |||
['projectName'] = 'ויקימינים', | |||
['description']='טקסונומיה', | |||
['display']='וויקימינים', | |||
['projectPrefix']='wikispecies' | |||
}, | }, | ||
['meta'] = { | ['meta'] = { | ||
| שורה 55: | שורה 69: | ||
['display']='מטא-ויקי', | ['display']='מטא-ויקי', | ||
['projectPrefix']='m' | ['projectPrefix']='m' | ||
}, | |||
['mediawiki'] = { | |||
['logo']='MediaWiki.svg', | |||
['projectName'] = 'מדיה-ויקי', | |||
['description']='דפי התוכנה', | |||
['display']='מדיה-ויקי', | |||
['projectPrefix']='mw' | |||
} | } | ||
-- TODO: add other projects | -- TODO: add other projects | ||
| שורה 102: | שורה 123: | ||
template='wikinews', | template='wikinews', | ||
name='hewikinews' | name='hewikinews' | ||
}, | |||
{ | |||
arg='ויקימסע', | |||
template='wikivoyage', | |||
name='hewikivoyage' | |||
}, | }, | ||
{ | { | ||
| שורה 107: | שורה 133: | ||
template='commons', | template='commons', | ||
name='commons' | name='commons' | ||
}, | |||
{ | |||
arg='ויקימינים', | |||
template='wikispecies', | |||
name='wikispecies' | |||
}, | |||
{ | |||
arg='מטא-ויקי', | |||
template='meta', | |||
}, | |||
{ | |||
arg='מדיה-ויקי', | |||
template='mediawiki' | |||
} | } | ||
} | } | ||
גרסה מ־08:19, 7 בפברואר 2020
ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:Sister project links/תיעוד
local projectsTemplate = {
['wikipedia'] = {
['logo']='Wikipedia-logo-v2.svg',
['projectName'] = 'ויקיפדיה',
['description']='[[ויקיפדיה]]',
['display']='שפה זו',
['pageName'] = ''
},
['wiktionary'] = {
['logo']='Wiktionary-logo-he.png',
['projectName'] = 'ויקימילון',
['description']='ערך מילוני',
['display']='וויקימילון',
['projectPrefix']='wikt'
},
['wikiquote'] = {
['logo']='Wikiquote-logo.svg',
['projectName'] = 'ויקיציטוט',
['description']='ציטוטים',
['display']='וויקיציטוט',
['projectPrefix']='q'
},
['wikibooks'] = {
['logo']='Wikibooks-logo.svg',
['projectName'] = 'ויקיספר',
['description']='ספר לימוד',
['display']='וויקיספר',
['projectPrefix']='b'
},
['wikisource'] = {
['logo']='Wikisource-logo.svg',
['projectName'] = 'ויקיטקסט',
['description']='טקסט',
['display']='וויקיטקסט',
['projectPrefix']='s'
},
['wikinews'] = {
['logo']='Wikinews-logo.svg',
['projectName'] = 'ויקיחדשות',
['description']='דיווחים',
['display']='וויקיחדשות',
['projectPrefix']='n'
},
['wikivoyage'] = {
['logo']='Wikivoyage-Logo-v3-icon - mirrored.svg',
['projectName'] = 'ויקימסע',
['description']='מדריך למטייל',
['display']='וויקימסע',
['projectPrefix']='voy'
},
['commons'] = {
['logo']='Commons-logo.svg',
['projectName'] = 'ויקישיתוף',
['description']='תמונות ומדיה',
['display']='וויקישיתוף',
['projectPrefix']='commons'
},
['wikispecies'] = {
['logo']='Wikispecies-logo.svg',
['projectName'] = 'ויקימינים',
['description']='טקסונומיה',
['display']='וויקימינים',
['projectPrefix']='wikispecies'
},
['meta'] = {
['logo']='Wikimedia Community Logo.svg',
['projectName'] = 'מטא-ויקי',
['description']='דפי מיזמים',
['display']='מטא-ויקי',
['projectPrefix']='m'
},
['mediawiki'] = {
['logo']='MediaWiki.svg',
['projectName'] = 'מדיה-ויקי',
['description']='דפי התוכנה',
['display']='מדיה-ויקי',
['projectPrefix']='mw'
}
-- TODO: add other projects
}
function render(frame)
local args = frame:getParent().args
local projectLinks = {}
local entity = mw.wikibase.getEntityIdForCurrentPage()
if args['ויקיפדיה'] then
local t = projectsTemplate['wikipedia']
t['projectPrefix'] = args['ויקיפדיה']
t['pageDisplay'] = args['שם ויקיפדיה'] or frame:getTitle()
table.insert(projectLinks, t)
end
if args['ויקיפדיה 2'] then
local t = projectsTemplate['wikipedia']
t['projectPrefix'] = args['ויקיפדיה 2']
t['pageDisplay'] = args['שם ויקיפדיה 2'] or frame:getTitle()
table.insert(projectLinks, t)
end
local projects = {
{
arg='ויקימילון',
template='wiktionary',
name='hewiktionary'
},
{
arg='ויקיציטוט',
template='wikiquote',
name='hewikiquote'
},
{
arg='ויקיספר',
template='wikibooks',
name='hewikibooks'
},
{
arg='ויקיטקסט',
template='wikisource',
name='hewikisource'
},
{
arg='ויקיחדשות',
template='wikinews',
name='hewikinews'
},
{
arg='ויקימסע',
template='wikivoyage',
name='hewikivoyage'
},
{
arg='ויקישיתוף',
template='commons',
name='commons'
},
{
arg='ויקימינים',
template='wikispecies',
name='wikispecies'
},
{
arg='מטא-ויקי',
template='meta',
},
{
arg='מדיה-ויקי',
template='mediawiki'
}
}
for i, proj in ipairs(projects) do
if not args[proj['arg']] and proj['name'] then
args[proj['arg']] = mw.wikibase.sitelink(entity, proj['name'])
args[proj['arg']] = args[proj['arg']] and args[proj['arg']]['title']
end
if args[proj['arg']] then
local t = projectsTemplate[proj['template']]
t['pageName'] = args[proj['arg']]
t['pageDisplay'] = args['שם ' .. proj['arg']] or args[proj['arg']]
table.insert(projectLinks, t)
else
end
local i = 2
while args[proj['arg'] .. ' ' .. i] do
local t = projectsTemplate['wiktionary']
t['pageName'] = args[proj['arg'] .. ' ' .. i]
t['pageDisplay'] = args['שם ' .. proj['arg'] .. i] or args[proj['arg']]
table.insert(projectLinks, t)
i=i+1
end
end
local root = mw.html.create('table')
root:addClass('toccolours')
:addClass('sistersitebox')
:addClass('plainlinks')
:addClass('noprint')
:cssText('width: margin: 0 1em 0.5em 0;')
root:tag('tr'):tag('th'):css('text-align', 'center'):wikitext('מיזמי [[קרן ויקימדיה]]')
for k,v in pairs(projectLinks) do
root:tag('tr'):tag('td'):node(renderProject(v))
end
return root
end
function renderProject(projectTemplate)
return mw.html.create('div')
:addClass('sisterwikilinkT')
:wikitext(mw.ustring.format("[[File:%s|20px|link=|%s]] %s ב%s: '''[[:%s:%s|%s]]'''",
projectTemplate['logo'], projectTemplate['projectName'],
projectTemplate['description'], projectTemplate['display'],
projectTemplate['projectPrefix'], projectTemplate['pageName'], projectTemplate['pageDisplay']))
end
return {
render=render
}