יחידה:פרמטרים: הבדלים בין גרסאות בדף
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
kipod = {"אלבום", "תותח", "סינגל", "טבלת אירוויזיון", "חומצת אמינו"} | kipod = {"אלבום", "תותח", "סינגל", "טבלת אירוויזיון", "חומצת אמינו"} | ||
-- This is the main module function | -- This is the main module function | ||
| שורה 14: | שורה 12: | ||
local template = pframe:getTitle() -- template full name | local template = pframe:getTitle() -- template full name | ||
templatename = template -- template name to remove namespace | templatename = template -- template name to remove namespace | ||
if find1(templatename, namespace) == 1 --remove namespace from template name | if find1(templatename, namespace) == 1 --remove namespace from template name | ||
then templatename = mw.ustring.sub(templatename, len1(namespace) + 1) end | then templatename = mw.ustring.sub(templatename, len1(namespace) + 1) end | ||
| שורה 37: | שורה 33: | ||
end | end | ||
if frame.args[1] then | if frame.args[1] then | ||
data[2] | table.insert(data[2], frame.args[1]) | ||
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 | ||
local mustnum = data[1] -- template data maximum unnamed parameters number | local mustnum = data[1] -- template data maximum unnamed parameters number | ||
parameters = data[2] -- template data parameters list | parameters = data[2] -- template data parameters list | ||
| שורה 54: | שורה 43: | ||
local suggestionslist = require( 'Module:פרמטרים/הצעות' ) | local suggestionslist = require( 'Module:פרמטרים/הצעות' ) | ||
suggestions = suggestionslist[templatename] -- template data suggestions table | suggestions = suggestionslist[templatename] -- template data suggestions table | ||
for tt, t in pairs(must) do -- check all must parameters indeed here | for tt, t in pairs(must) do -- check all must parameters indeed here | ||
checkmust(t) end | checkmust(t) end | ||
| שורה 83: | שורה 61: | ||
if ans == "" -- no problems | if ans == "" -- no problems | ||
then return | then return ans end | ||
if errors > 1 -- plural | if errors > 1 -- plural | ||
then errors = "ו" | then errors = "ו" | ||
| שורה 91: | שורה 67: | ||
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 .. "]]" | ||
end | end | ||