יחידה:Sister project links – הבדלי גרסאות
אין תקציר עריכה |
אין תקציר עריכה |
||
| (5 גרסאות ביניים של אותו משתמש אינן מוצגות) | |||
| שורה 8: | שורה 8: | ||
}, | }, | ||
['chabadtext'] = { | ['chabadtext'] = { | ||
['logo']=' | ['logo']='חבדטקסט.png', | ||
['projectName'] = 'חב"דטקסט', | ['projectName'] = 'חב"דטקסט', | ||
['description']='טקסט', | ['description']='טקסט', | ||
| שורה 15: | שורה 15: | ||
}, | }, | ||
['chabadquote'] = { | ['chabadquote'] = { | ||
['logo']=' | ['logo']='חבדציטוט.png', | ||
['projectName'] = 'חב"דציטוט', | ['projectName'] = 'חב"דציטוט', | ||
['description']='ציטוטים', | ['description']='ציטוטים', | ||
| שורה 23: | שורה 23: | ||
} | } | ||
function render(frame) | |||
local args = require('Module:Arguments').getArgs(frame) | local args = require('Module:Arguments').getArgs(frame) | ||
local title = mw.title.getCurrentTitle().text | local title = mw.title.getCurrentTitle().text | ||
| שורה 54: | שורה 38: | ||
local projects = { | local projects = { | ||
{ arg='חב"דציטוט', template='chabadquote', name='chabadquote' }, | { | ||
{ arg='חב"דטקסט', template='chabadtext', name='chabadtext' } | arg='חב"דציטוט', | ||
template='chabadquote', | |||
name='chabadquote' | |||
}, | |||
{ | |||
arg='חב"דטקסט', | |||
template='chabadtext', | |||
name='chabadtext' | |||
} | |||
} | } | ||
for | for i, proj in ipairs(projects) do | ||
if entity and (not args[proj['arg']] or args[proj['arg']] == nil) and proj['name'] then | if entity~=nil and (not args[proj['arg']] or args[proj['arg']]==nil) and proj['name'] then | ||
args[proj['arg']] = mw.wikibase.sitelink(entity, proj['name']) | args[proj['arg']] = mw.wikibase.sitelink(entity, proj['name']) | ||
args['שם ' .. proj['arg']] = title | args['שם ' .. proj['arg']] = title | ||
| שורה 68: | שורה 60: | ||
t['pageDisplay'] = args['שם ' .. proj['arg']] or t['pageName'] | t['pageDisplay'] = args['שם ' .. proj['arg']] or t['pageName'] | ||
table.insert(projectLinks, t) | table.insert(projectLinks, t) | ||
end | end | ||
local i = 2 | local i = 2 | ||
| שורה 77: | שורה 69: | ||
t['pageDisplay'] = args[mw.ustring.format('שם %s %i', proj['arg'], i)] or t['pageName'] | 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['arg'], i) | additionalArg = mw.ustring.format('%s %i', proj['arg'], i) | ||
end | end | ||
| שורה 83: | שורה 75: | ||
local float = 'float: left;' | local float = 'float: left;' | ||
if args['1'] == 'ימין' then float = ' | if args['1'] == 'ימין' then | ||
float = '' | |||
end | |||
local templatestyles = frame:extensionTag{ | local templatestyles = frame:extensionTag{ | ||
| שורה 96: | שורה 90: | ||
:addClass('noprint') | :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 = '' | ||
| שורה 109: | שורה 102: | ||
end | end | ||
return templatestyles .. | return tostring(root) .. templatestyles .. cat | ||
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 | end | ||