יחידה:תבנית מידע: הבדלים בין גרסאות בדף
מ תיעוד אוטומטי בסיסי |
מ מיון לפי מספר הפרמטר |
||
| שורה 238: | שורה 238: | ||
local styleSuffix = '-עיצוב' | local styleSuffix = '-עיצוב' | ||
local k=0 | local k=0 | ||
local | local processedParams = {} | ||
for k,v in pairs(templateParams) do | |||
local i= string.match(k, '.-([0-9]+)$') | |||
local | if i and not (processedParams[i]) then | ||
if | indic = tonumber(i) | ||
processedParams[i]=1 | |||
local subHeaderName = templateParams[subheader..i] | |||
if subHeaderName then --subheader type | |||
table.insert(templateStructure, {header=subHeaderName,rowstyle=templateParams[rowStylePrefix..i], indic=indic}) | |||
table.insert(templateStructure, { | |||
else | else | ||
local labelName = templateParams[labelPrefix..i] | |||
local dataTemplate = templateParams[dataPrefix..i] | |||
if labelName and dataTemplate then | |||
--label: data type | |||
table.insert(templateStructure, {label=labelName, data=dataTemplate, rowstyle=templateParams[rowStylePrefix..i], datastyle=templateParams[dataPrefix..i..styleSuffix], | |||
labelstyle=templateParams[labelPrefix..i..styleSuffix], indic=indic}) | |||
elseif labelName and not dataTemplate then | |||
--skip it. no only label [use subheader] | |||
elseif not labelName and dataTemplate then | |||
--only data type | |||
table.insert(templateStructure, {data=dataTemplate, rowstyle=templateParams[rowStylePrefix..i], datastyle=templateParams[dataPrefix..i..styleSuffix], indic=indic}) | |||
else | |||
local label_data_names = templateParams[labelDataPrefix..i] | |||
if label_data_names then | |||
labelName = label_data_names | |||
if templateArgs[label_data_names] and #templateArgs[label_data_names]>0 then | |||
dataTemplate = templateArgs[label_data_names] | |||
else | |||
dataTemplate = '{{{' ..label_data_names.. '}}}' | |||
end | |||
table.insert(templateStructure, {label=labelName, data=dataTemplate, rowstyle=templateParams[rowStylePrefix..i], datastyle=templateParams[dataPrefix..i..styleSuffix], | |||
labelstyle=templateParams[labelPrefix..i..styleSuffix], indic=indic}) | |||
end | end | ||
end | |||
end | end | ||
end | end | ||
end | end | ||
table.sort(templateStructure, function (x, y) return x.indic<y.indic end) | |||
-- use wikidata / remove unused parameters | -- use wikidata / remove unused parameters | ||