יחידה:Sister project links – הבדלי גרסאות
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 30: | שורה 30: | ||
:addClass('sistersitebox') | :addClass('sistersitebox') | ||
:wikitext(mw.ustring.format( | :wikitext(mw.ustring.format( | ||
"[[File:%s|20px|link=|%s]] %s ב%s: | "[[File:%s|20px|link=|%s]] %s ב%s: %s", | ||
projectTemplate['logo'], | projectTemplate['logo'], | ||
projectTemplate['projectName'], | projectTemplate['projectName'], | ||
| שורה 43: | שורה 43: | ||
local title = mw.title.getCurrentTitle().text | local title = mw.title.getCurrentTitle().text | ||
local projectLinks = {} | local projectLinks = {} | ||
-- projects from arguments | |||
if args['חב"דפדיה'] then | if args['חב"דפדיה'] then | ||
local t = mw.clone(projectsTemplate['cphe']) | local t = mw.clone(projectsTemplate['cphe']) | ||
| שורה 50: | שורה 50: | ||
t['pageName'] = args['חב"דפדיה'] | t['pageName'] = args['חב"דפדיה'] | ||
t['pageDisplay'] = args['שם חב"דפדיה'] or title | t['pageDisplay'] = args['שם חב"דפדיה'] or title | ||
table.insert(projectLinks, t) | |||
end | |||
if args['חב"דפדיה 2'] then | |||
local t = mw.clone(projectsTemplate['cphe']) | |||
t['projectPrefix'] = args['חב"דפדיה 2'] | |||
t['pageName'] = args['חב"דפדיה 2'] | |||
t['pageDisplay'] = args['שם חב"דפדיה 2'] or title | |||
table.insert(projectLinks, t) | table.insert(projectLinks, t) | ||
end | end | ||
local projects = { | local projects = { | ||
{ arg='חב"דציטוט', template | {arg='חב"דציטוט', template='chabadquote'}, | ||
{ arg='חב"דטקסט', template | {arg='חב"דטקסט', template='chabadtext'} | ||
} | } | ||
for _, proj in ipairs(projects) do | for _, proj in ipairs(projects) do | ||
if | if args[proj.arg] then | ||
local t = mw.clone(projectsTemplate[proj.template]) | |||
t.pageName = args[proj.arg] | |||
t.pageDisplay = args['שם ' .. proj.arg] or t.pageName | |||
local t = mw.clone(projectsTemplate[proj | |||
t | |||
t | |||
table.insert(projectLinks, t) | table.insert(projectLinks, t) | ||
end | end | ||
-- handle multiple numbered args | |||
local i = 2 | local i = 2 | ||
local additionalArg = mw.ustring.format('%s %i', proj | local additionalArg = mw.ustring.format('%s %i', proj.arg, i) | ||
while args[additionalArg] do | while args[additionalArg] do | ||
local t = mw.clone(projectsTemplate[proj | local t = mw.clone(projectsTemplate[proj.template]) | ||
t | t.pageName = args[additionalArg] | ||
t | t.pageDisplay = args[mw.ustring.format('שם %s %i', proj.arg, i)] or t.pageName | ||
table.insert(projectLinks, t) | table.insert(projectLinks, t) | ||
i = i + 1 | i = i + 1 | ||
additionalArg = mw.ustring.format('%s %i', proj | additionalArg = mw.ustring.format('%s %i', proj.arg, i) | ||
end | end | ||
end | end | ||
| שורה 86: | שורה 90: | ||
local templatestyles = frame:extensionTag{ | local templatestyles = frame:extensionTag{ | ||
name = 'templatestyles', | name='templatestyles', args={src='יחידה:Sister project links/styles.css'} | ||
} | } | ||
local root = mw.html.create('table') | local root = mw.html.create('table') | ||
root | root:addClass('sistersitebox'):addClass('plainlinks'):addClass('noprint') | ||
:cssText('margin: 0 1em 0.5em 0;' .. float) | :cssText('margin: 0 1em 0.5em 0;' .. float) | ||
root:tag('tr'):tag('th'):css('text-align','center'):wikitext('מיזמי [[חב"דפדיה]]') | |||
root:tag('tr'):tag('th'):css('text-align', 'center'):wikitext('מיזמי [[חב"דפדיה]]') | |||
local cat = '' | local cat = '' | ||
| שורה 112: | שורה 111: | ||
end | end | ||
return { | return { render = render } | ||
} | |||