Module:MwJson: Difference between revisions

Update package: OSW Core
(Update package: OSW Core)
(Update package: OSW Core)
 
(2 intermediate revisions by one other user not shown)
Line 376: Line 376:
end
end
--local display_label = ""
--if (jsondata[p.keys.label] ~= nil) then display_label = p.splitString(jsondata[p.keys.label], '@')[1] end
local set_categories_in_wikitext = {}
local set_categories_in_wikitext = {}
p.tableMerge(set_categories_in_wikitext, json_res_store.res[p.keys.subcategory])  --classes/categories, nil for items
p.tableMerge(set_categories_in_wikitext, json_res_store.res[p.keys.subcategory])  --classes/categories, nil for items
Line 386: Line 384:
-- Todo: Consider moving the category and this block to p.getSemanticProperties with store=true. However, settings categories with @category is only possible for subobjects
-- Todo: Consider moving the category and this block to p.getSemanticProperties with store=true. However, settings categories with @category is only possible for subobjects
if (smw_res ~= nil) then
if (smw_res ~= nil) then
local display_label = p.getDisplayLabel(jsondata, smw_res.properties)
local display_label = p.getDisplayLabel(json_res_store.res, smw_res.properties)
if title.nsText == "Property" then display_label = p.defaultArgPath(jsondata, {p.keys.name}, display_label) end
if title.nsText == "Property" then display_label = p.defaultArgPath(json_res_store.res, {p.keys.name}, display_label) end


if (debug) then msg = msg .. "Store page properties" end
if (debug) then msg = msg .. "Store page properties" end
Line 1,053: Line 1,051:
else display_label = properties["HasName"] end
else display_label = properties["HasName"] end
-- fall back to unmapped keywords
-- fall back to unmapped keywords
elseif (jsondata[p.keys.label] ~= nil and jsondata[p.keys.label][1] ~= nil) then display_label = p.splitString(jsondata[p.keys.label][1], '@')[1]  
elseif (jsondata[p.keys.label] ~= nil and jsondata[p.keys.label][1] ~= nil) then
if type(jsondata[p.keys.label][1]) ~= 'table' then display_label = p.splitString(jsondata[p.keys.label][1], '@')[1]
else display_label = jsondata[p.keys.label][1][p.keys.text] end -- no eval_template applied
elseif (jsondata[p.keys.name] ~= nil) then display_label = jsondata[p.keys.name]  
elseif (jsondata[p.keys.name] ~= nil) then display_label = jsondata[p.keys.name]  
end
end