Модуль:GeoInfobox

ХӀокху модулах лаьцна хааман Модуль:GeoInfobox/doc агӀо кхолла мега

local geo = {};function geo.renderId( frame )local idArray = {['p884'] = '[[Пачхьалкхан хин реестр|ПХР]]',['p1566'] = '[[GeoNames]]',['p1886'] = '[[Global Volcanism Program|GVP]]',['p4708'] = '{{comment|VOGRIPA|Volcano Global Risk Identification and Analysis Project}}'}local text = ''for i, j in pairs( idArray ) dolocal tmp = frame:expandTemplate{ title = 'Wikidata', args = {i} }if tmp and tmp ~= '' thentext = text .. '<li>' .. frame:preprocess(j) .. ':&nbsp;' .. tmp .. '</li>'endendif text ~= '' thenreturn '<tr><td class="hlist" colspan="2"><hr><ul>' .. text .. '</ul></td></tr>'endendfunction geo.renderLine( frame )local args = frame:getParent().args;frame.args = frame:getParent().args;local cat = ''local prefix = {['~'] = 'гергга',['>'] = 'сов',['<'] = 'кӀезигаха'}local before = ''local ref = ''local text = args[1] or '';local label = args[2] or ''; -- одиночная меткаlocal label2 = args[3] or ''; -- множественная меткаlocal wikify = args[4] or '';local after = args[5] or '';if text == '-' then return ''; end    if text ~= '' then    if label2 ~= '' then    if mw.ustring.match( text, "[^/]+/[^/]+") then    label = label2    end    if wikify == '1' then frame.args['o'] = '[[%]]'frame.args['nodis'] = '1'end    local split = require('Module:String/split').split    frame.args[1] = text    text = split(frame)    else        if after ~= ''  then        if mw.ustring.match( text, '\127' ) and not mw.ustring.match( text, 'templatestyles' ) then    text, ref = mw.ustring.match( text, '[^\127]+' ), mw.ustring.match( text, '\127.+' )    end    if not mw.ustring.match( text, '[-—×]' ) then     local tmp_text = mw.ustring.gsub( text, '[≈−, ]', {['≈'] = '~', ['−'] = '-', [','] = '.', [' '] = ''} )    if  mw.ustring.match( text, '^[≈~<>]%s*%d' ) and prefix[tmp_text:sub(1, 1)] then    before = prefix[tmp_text:sub(1, 1)] .. '&nbsp;'    text = mw.ustring.gsub(text, '^[≈~<>]%s*', '')    elseif mw.ustring.match( text, '^[бдмо][еко][лно]?[ел]?[ео]?' ) then -- до|около|более|менее    before = mw.ustring.match( text, '^[бдмо][еко][лно]?[ел]?[ео]?' ) .. '&nbsp;'    text = mw.ustring.gsub(text, '^[бдмо][еко][лно]?[ел]?[ео]?%s*', '')    end    tmp_text = mw.ustring.gsub(tmp_text, '^[≈~<>бдмо][еко]?[лно]?[ел]?[ео]?%s*', '')        if tonumber(tmp_text) then           local lang = mw.language.getContentLanguage()           text = lang:formatNum( tonumber( tmp_text ) )        elseif mw.title.getCurrentTitle():inNamespace(0) then        cat = '[[Категори:Геокарен кеп: нисйе: терхьийн параметраш]]'        end        end    end    if wikify == '1' then    text = '[[' .. text .. '|' .. mw.ustring.gsub(text, '%s?%(.*%)$', '' ) .. ']]'endtext = before .. text .. ref .. '&nbsp;' .. after endelseif args[ 'd' ] and args[ 'd' ] ~= '' thentext = frame:expandTemplate{ title = 'Wikidata', args = {args[ 'd' ],text,separator = args['r'] or ''} };endend if text ~= '' then return '<tr><th>' .. label .. '</th><td>' .. text .. '</td></tr>' .. cat;end    return '';endfunction geo.findImage( frame )local page = mw.title.getCurrentTitle()local txt, args = page:getContent(), frame.argsif args and args[1] and args[1] ~= '' thenif txt:match(':' .. args[1]) and mw.title.getCurrentTitle():inNamespace(0) then return '[[Категори:Геокарен кеп: нисде сурт]]' endendendreturn geo