Модуль:Sources-utils: відмінності між версіями

[неперевірена версія][неперевірена версія]
Вилучено вміст Додано вміст
Yelysavet (обговорення | внесок)
Немає опису редагування
Yelysavet (обговорення | внесок)
Немає опису редагування
Рядок 423:
 
return result;
end
 
function getPlaceName( lang, placeId )
-- ГОСТ Р 7.0.12—2011
if ( lang == 'ru' ) then
if ( placeId == 'Q649' ) then return toTextWithTip('М.', 'Москва'); end
if ( placeId == 'Q656' ) then return toTextWithTip('СПб.', 'Санкт-Петербург'); end
if ( placeId == 'Q891' ) then return toTextWithTip('Н. Новгород', 'Нижний Новгород'); end
if ( placeId == 'Q908' ) then return toTextWithTip('Ростов н/Д.', 'Ростов-на-Дону'); end
end
return nil;
end
 
Рядок 554 ⟶ 543:
 
return plainData;
end
 
function preprocessPlaces( data, lang )
if ( not data.place ) then
return;
end;
 
local newPlaces = {};
for index, place in pairs( data.place ) do
if ( place.id ) then
local newPlaceStr = getPlaceName(lang, place.id)
if ( newPlaceStr ) then
newPlaces[index] = newPlaceStr;
else
newPlaces[index] = place;
end
else
newPlaces[index] = place;
end
end
data.place = newPlaces;
end