יחידה:פרמטרים: הבדלים בין גרסאות בדף
חירום |
אין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
kipod = {"אלבום", "תותח", "סטטיסטיקה עירונית", "סינגל", "טבלת אירוויזיון", "חומצת אמינו"} | kipod = {"אלבום", "תותח", "סטטיסטיקה עירונית", "סינגל", "טבלת אירוויזיון", "חומצת אמינו"} | ||
function equaldata(d, dd) | |||
if d[1] ~= dd[1] then | |||
templatedatacheck = templatedatacheck .. "<br/>מספר פרמטרים שונה ללא שם ב[[תבנית:" .. templatename .. "]] ב-templatedata<br/>" | |||
end | |||
equaltable(d[2], dd[2]) | |||
equaltable(d[3], dd[3], true) | |||
end | |||
function equaltable(d, dd, must) | |||
local found | |||
for c, cc in pairs(d) do | |||
found = false | |||
for e, ee in pairs(dd) do | |||
if cc == ee then | |||
found = true | |||
end | |||
end | |||
if not found then | |||
templatedatacheck = templatedatacheck .. "<br/>לא נמצא פרמטר " .. cc .. " ב[[תבנית:" .. templatename .. "]] ב-templatedata" | |||
if must then | |||
templatedatacheck = templatedatacheck .. "בפרמטריפ חובה" | |||
end | |||
templatedatacheck = templatedatacheck .. "<br/>" | |||
end | |||
end | |||
end | |||
-- This is the main module function | -- This is the main module function | ||
function main(frame) | function main(frame) | ||
| שורה 35: | שורה 59: | ||
table.insert(data[2], frame.args[1]) | table.insert(data[2], frame.args[1]) | ||
end | end | ||
------------- | |||
templatedatacheck = '' | |||
if mw.title.makeTitle( 0, subpageName ).exists then | |||
copydata = mw.loadData(subpageName) -- read template variables data | |||
if copydata then | |||
equaldata(data, copydata) | |||
if templatedatacheck ~= '' then | |||
templatedatacheck = '<div class="error parameters">' .. templatedatacheck .. "</div>[[קטגוריה:שגיאה במידע מובנה על תבנית]]" | |||
end | |||
end | |||
end | |||
------------ | |||
local numbered = 0 -- real nonnamed parameters counter | local numbered = 0 -- real nonnamed parameters counter | ||
local parnum = 0 -- template data parameters counter | local parnum = 0 -- template data parameters counter | ||
| שורה 61: | שורה 96: | ||
if ans == "" -- no problems | if ans == "" -- no problems | ||
then return | then return templatedatacheck end | ||
if errors > 1 -- plural | if errors > 1 -- plural | ||
then errors = "ו" | then errors = "ו" | ||
| שורה 67: | שורה 102: | ||
return '<div class="error parameters"><small>' .. " '''שגיא" .. errors .. "ת פרמטרים ב[[" | return '<div class="error parameters"><small>' .. " '''שגיא" .. errors .. "ת פרמטרים ב[[" | ||
.. template .. "]]:<br/>" .. ans .. "'''</td></tr></table></small></div>" -- answer | .. template .. "]]:<br/>" .. ans .. "'''</td></tr></table></small></div>" -- answer | ||
.. "[[קטגוריה:שגיאות פרמטריות]][[קטגוריה:שגיאות פרמטריות בתבנית " .. templatename .. "]]" | .. "[[קטגוריה:שגיאות פרמטריות]][[קטגוריה:שגיאות פרמטריות בתבנית " .. templatename .. "]]" .. templatedatacheck | ||
end | end | ||