Modulo:European and national party data/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
Test xlate_comp referring to Seggi |
import from en-wiki sandbox following addition of "year" functions |
||
Riga 157:
local function xlate_wikidata (data_requested, qid, property_id, qualifier_id, value_of_qualifier, reference, preferred, raw, linked)
mw.logObject( {data_requested, qid, property_id, qualifier_id, value_of_qualifier, reference, preferred, raw, linked}, "xlate_wikidata()" )
local local_reference = reference;
local local_preferred = preferred;
Riga 173 ⟶ 174:
table.insert(wdargs, 5, qid)
end
if '' ~= qualifier_id
if '' ~= value_of_qualifier then wdargs[qualifier_id] = value_of_qualifier;
else
table.insert(wdargs, qualifier_id)
end
end
mw.logObject( wdargs, "wdargs" )
return Wd['_' .. data_requested](wdargs);
end
Riga 197 ⟶ 202:
local function xlate_composition_bar (frame, seats, total_seats, color, width, percentage, background_color, border)
if '
return frame:expandTemplate ({title='Infobox Parti politique/Sièges', args = {seats, total_seats, ['hex'] = color}});▼
elseif 'it' == cfg.this_project_language then▼
return frame:expandTemplate ({title='Seggi', args = {seats, total_seats, ['c'] = color}});▼
elseif 'nl' == cfg.this_project_language then
local comp_bar_args_t = {
seats,
total_seats,
color,
width=width,
per=percentage,
['background-color'] = background_color,
border = border,
};
return frame:expandTemplate ({title='Percentagebalk', args = comp_bar_args_t});
else -- for all other languages the assumption is that the template is called composition bar
local comp_bar_args_t = {
seats,
Riga 208 ⟶ 230:
};
return frame:expandTemplate ({title='Composition bar', args = comp_bar_args_t});
▲ elseif 'fr' == cfg.this_project_language then
▲ return frame:expandTemplate ({title='Infobox Parti politique/Sièges', args = {seats, total_seats, ['hex'] = color}});
▲ elseif 'it' == cfg.this_project_language then
▲ return frame:expandTemplate ({title='Seggi', args = {seats, total_seats, ['c'] = color}});
end
end
Riga 324 ⟶ 342:
elseif property_id == "individual members date" then -- special case
if not party then
data = xlate_wikidata ('qualifier', '', 'P2124', 'P585',
else
data = xlate_wikidata ('qualifier', party_qid, 'P2124', 'P585', '
end
else -- for all other cases
Riga 1 048 ⟶ 1 066:
elseif data_type == "foundation date" then
return allpp_get_data (frame, party, cfg.data_prop_t.foundation_date);
elseif data_type == "foundation year" then
elseif data_type == "individual members" then
return allpp_get_data (frame, party, cfg.data_prop_t.individual_members);
elseif data_type == "individual members date" then
return allpp_get_data (frame, party, 'individual members date');
elseif data_type == "individual members year" then
return string.match (allpp_get_data (frame, party, 'individual members date'), '%d%d%d%d');
elseif data_type == "label" then
return allpp_get_data (frame, party, 'label');
Riga 1 171 ⟶ 1 193:
local function test2 (frame)
return cfg.this_project_language;
▲ --return allpp_get_data (frame, party_qid, cfg.data_prop_t.country, 'raw-noref');
▲ return frame:expandTemplate ({title='wikidata', args = {["entity"] = party, cfg.data_prop_t.website, ['link'] = "-", ['numval'] = 1}});
end
Riga 1 193 ⟶ 1 205:
test2 = test2,
test_wikidata_entries = test_wikidata_entries,
-- xlate_wikidata = xlate_wikidata
}
|