יחידה:תבנית מידע: הבדלים בין גרסאות בדף

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