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

בחירת פרמטרים שיילקחו אם הקודמים לא קיימים
תיקון הפרמטר מהגרסא הקודמת
שורה 435: שורה 435:
-- split optional params to include ONLY the first one of them (e.g: "P1/P2")
-- split optional params to include ONLY the first one of them (e.g: "P1/P2")
for optionalParam in string.gmatch(paramToFetch, '([^/]+)') do
for optionalParam in string.gmatch(paramToFetch, '([^/]+)') do
if (string.sub(optionalParam, 1, 1) == 'P' or string.sub(paramToFetch, 1, 1) == 'Q') then
if (string.sub(optionalParam, 1, 1) == 'P' or string.sub(optionalParam, 1, 1) == 'Q') then
if getPropertyByOptions(paramToFetch, entityId,  wikidataOptions) then
if getPropertyByOptions(optionalParam, entityId,  wikidataOptions) then
table.insert(paramsData, getPropertyByOptions(paramToFetch, entityId,  wikidataOptions) or nil)
table.insert(paramsData, getPropertyByOptions(optionalParam, entityId,  wikidataOptions) or nil)
-- found one of the optionals - stop the loop
-- found one of the optionals - stop the loop
break
break
שורה 443: שורה 443:
else
else
-- one of the optionals is static data - take it and stop the loop
-- one of the optionals is static data - take it and stop the loop
table.insert(paramsData, paramToFetch)
table.insert(paramsData, optionalParam)
break
break
end
end