ماڈیول:معلومات

Documentation icon دستاویز
-- Credits:-- Original from fr:Module:Infobox-- forked by وهراني @arwiki-- Version: 20240128local p = {}local wikiLang = 'ur' -- زبانlocal localdata = require( 'ماڈیول:معلومات/مواد')   -- بيانات مضمنة في القالبlocal wdexpandQuery = require("ماڈیول:معلومات/ویکی مواد").expandQuerylocal page = { -- بيانات حول الصفحة التي ستعرض عليها البطاقة name = mw.title.getCurrentTitle().prefixedText,namespace =  mw.title.getCurrentTitle().namespace}local maincolor, secondcolor, thirdcolor = '#E1E1E1', '#E1E1E1', '#000000'-- نتائج ثانويةlocal maintenance = '' -- نص مضاف للنتيجة يستعمل لإدراج التصنيفات عادةlocal externaltext = '' -- نص مضاف عام يستعمل لعرض إضافات مثل القوالب خارج قالب المعلومات-- وحدات مستعملةlocal i18n = {['see doc'] = 'سانچہ دیکھیے',['edit'] = 'ترمیم',['edit code'] = 'کوڈ میں ترمیم',['edit item'] = 'ایٹم میں ترمیم',['tracking cat'] = "سیکی ڈیٹا کا استعمال کرنے والے صفحات",['invalid block type'] = "لبنة بيانات غير صحيحة في القالب", ['default cat'] = "صيانة بطاقات",    ['pages_using_bitaqa_with_no_params_cat'] = 'صفحات_تستخدم_وحدة_بطاقة/بلا_مدخلات',    ['pages_using_bitaqa_cat'] = 'صفحات_تستخدم_وحدة_بطاقة',    ['pages_with_empty_bitaqa_cat'] = 'صفحات_تستخدم_وحدة_بطاقة/بقالب_فارغ',    ['pages_using_bitaqa_with_errors_cat'] = 'صفحات_تستخدم_وحدة_بطاقة/بها_أخطاء',    ['pages_using_infobox_cat'] = 'مقالات تستعمل قوالب معلومات',}local function addWikidataCat(prop)if type(prop) == 'table' then prop = prop[1] endif page.namespace == 0 thenmaintenance = maintenance .. '[[زمرہ:صفحات_تستخدم_خاصية_' .. prop .. ']]'endendlocal function addMaintenanceCat(cat, sortkey)if page.namespace == 0 and cat thenmaintenance = maintenance .. '[[Category:' .. cat .. '|' .. (sortkey or page.name) .. ']]'end    return ''endlocal getValue = localdata.getValuelocal function expandQuery(query)local function expand1Query(query,wikimod)local noerr,data, nbnoerr,data, nb = pcall(wdexpandQuery,localdata.item ,wikimod,query)if noerr then return data, nb else addMaintenanceCat(i18n['pages_using_bitaqa_with_errors_cat'])mw.log("WD Query Error : "..mw.dumpObject(data))mw.log(debug.traceback('>>ERROR :>>'))return '<span class="error">' .. (data) .. '</span>' ,1endendlocal v, valnum -- نتيجة ، عدد النتائج للضبط الصرفي للعنوانif(type(query) ~= 'table') then return nil end-- الوحدات المستعملةlocal wikimod = query.wikimod or localdata.wikimod or 'Wikidata2' --'Wikidata/fr'if type(query["wikidata" .. 2]) ~= 'nil'  thenlocal answers = {}local maxNbAns v,valnum = expand1Query(query["wikidata"] or query["wikidata" .. 1],wikimod)maxNbAns = valnum or 0table.insert(answers,v)local i = 2while type(query["wikidata" .. i]) ~= 'nil'  dov,valnum =expand1Query(query["wikidata" .. i],wikimod)maxNbAns = math.max(maxNbAns,valnum or 0)table.insert(answers,v)i = i+1endif #answers>0 then return table.concat(answers, query.sep or "\n<br />"),maxNbAnselse return nilendelsereturn expand1Query(query,wikimod)endendlocal function getWikidataValue(params, wikidataparam)if not localdata.item thenreturn nilendif params.blockers then -- blockers are local parameters that disable the wikidata querylocal blockers = params.blockersif (type(blockers) == 'string') thenblockers = {blockers}endfor i, blocker in ipairs(blockers) doif getValue(blocker) then return nilendendendlocal v, valnum -- قيم النتائج وعددها (لعرض مناسب في حالة الجمع)if not wikidataparam then wikidataparam = 'wikidata' endif params[wikidataparam] thenif type(params[wikidataparam]) == 'function' thenv, valnum = params[wikidataparam](localdata.item)elseif type(params[wikidataparam]) == 'table' thenv, valnum = expandQuery(params[wikidataparam])elsev, valnum = params[wikidataparam]endendlocal i = 2while not v  and type(params["wikidata" .. i]) ~= 'nil'  dowikidataparam = "wikidata" .. ii = i + 1if params[wikidataparam] thenif type(params[wikidataparam]) == 'function' thenv, valnum = params[wikidataparam](localdata.item)elseif type(params[wikidataparam]) == 'table' thenv, valnum = expandQuery(params[wikidataparam])elsev, valnum = params[wikidataparam]endendendif not v or valnum==0 then return nilendreturn v, valnumendfunction p.separator(params)local style = params['separator style'] or {}style.height = style.height or '2px'style['background-color'] = style['background-color'] or maincolorreturn mw.html.create('hr'):css( style )end--[=[تحضير لبنة العنوان في البطاقة]=]function p.buildtitle(params)local text = getValue(params.value, params) or params.textdefaultvalue or getWikidataValue(params) or mw.title.getCurrentTitle().textlocal subtext = getValue(params.subtitle) or getWikidataValue(params, 'wikidatasubtitle') or params.subtitledefaultvalueif subtext and (subtext ~= text) thentext = text .. '<br /><small>' .. subtext .. '</small>'endlocal class = 'entete ' .. (params.icon or '')-- overwrites with those provided in the modulelocal style = {}style['background-color'] = maincolorstyle['color'] = thirdcolorif params.style thenfor i, j in pairs(params.style) dostyle[i] = jendendlocal title = mw.html.create('div'):addClass(class):css(style):tag('div'):wikitext(text):allDone()return titleendp.buildTitle = p.buildtitlefunction p.buildimages(params)    local function getwdImage(Q, property)        property = property         local QID        if type(Q) == 'table' and Q.id and Q.id ~= '-'             then QID = Q.id            else return        end        local wdata         if (type(property) == 'string')             then wdata = mw.wikibase.getBestStatements(QID, property)             elseif(type(property) == 'table')            then for _,prop in ipairs(property) do                    wdata = mw.wikibase.getBestStatements(QID,prop)                    if(wdata) then break end                end            else return        end        local first        for _, image in pairs(wdata) do          if image.mainsnak.snaktype == 'value' then            if not first then                first = image.mainsnak.datavalue.value            end            local q = image.qualifiers            if q and q.P2096 then                for _, caption in pairs(q.P2096) do -- P2096 is 'caption'                    if caption.snaktype == 'value'                     and caption.datavalue.value.language == wikiLang then                        return                        image.mainsnak.datavalue.value, caption.datavalue.value.text                    end                end            end          end        end        return first,nil    endlocal images = {}local upright, link, caption, captionfromwd, alt, size  -- size is deprecatedif type(params.imageparameters) == 'string' thenparams.imageparameters = {params.imageparameters}endif not params.imageparameters then -- في حالة غياب أي مدخل لصورةparams.imageparameters = {}endfor j, k in ipairs(params.imageparameters) dotable.insert(images, getValue(k))end    -- Images from Wikidata if #images == 0 and localdata.item thenif params.property thenparams.wikidata = {entity = localdata.item, property = params.property}endif params.wikidata thenlocal wdq = params.wikidataif type(params.wikidata.property) == 'table' then  params.wikidata.property = mw.text.listToText(params.wikidata.property, '**', '**') endif type(wdq) == 'table' thenfor p in string.gmatch(params.wikidata.property, 'P%d+') doimages,captionfromwd = getwdImage(localdata.item, p)if images thenparams.wikidata.property = pbreakendendif images thenaddWikidataCat(params.wikidata.property)endendif type(wdq) == 'function' thenimages = params.wikidata()if type(images) == 'string' thenreturn imagesend endif type(images) == 'string' thenimages = {images}endif (not images) thenimages = {}endendend-- استعمال صور افتراضبة في حال عرفتif #images == 0 thenif params.maintenancecat thenaddMaintenanceCat(params.maintenancecat, params.sortkey)endif params.defaultimages thenimages = params.defaultimagesif type(images) == 'string' thenimages = {images}endupright = params.defaultimageuprightcaption = params.defaultimagecaptionlink = params.defaultimagelinkalt = params.defaultimagealtif not alt and ( images[1] == 'DefautAr.svg' or images[1] == 'Defaut 2.svg' ) thenalt = 'نحتاج صورة تكون من الأفضل حرة'endendendif #images == 0 thenreturn nilendupright = upright or getValue(params.uprightparameter) or params.defaultupright or "1.2"link = link or getValue(params.linkparameter) or params.defaultlinkcaption = captionfromwd or caption or getValue(params.captionparameter) or params.defaultcaption alt = alt or getValue( params.altparameter) or params.defaultaltsize = size or getValue(params.sizeparameter) or params.defaultsizeif size thenlocal numsize = size:gsub('px', '')numsize = size:gsub('پک', '')numsize = mw.ustring.gsub(numsize, 'x.*', '')numsize = tonumber(numsize)if type(numsize) ~= 'number' or numsize > 280 thenaddMaintenanceCat("مقالات تسيء استعمال حجم الصورة")endif tonumber(size) thensize = size .. 'px'endsize = '|' .. sizeelsesize = ''endif tonumber(upright) thenupright = tostring(tonumber(upright) ) / #imagesendif tonumber(size) thensize = tostring(tonumber(size) ) / #imagesendlocal style = params.style or {padding ='2px 0',}-- تحضير عرض الصورةlocal imagesString = ''for i,image in pairs(images) doif image == '-' thenreturnendif(string.find(image, '<table',1,true) ~= nil or string.find(image, '<div',1,true) ~= nil) thenimagesString = imagesString .. imageelseimage = string.match(image, '[^:]*:([^|%]]*)') or imageimagesString = imagesString ..  '[[file:' .. image .. size .. '|frameless'-- [[if alt then  imagesString = imagesString .. '|alt=' .. alt endif link then imagesString = imagesString .. '|link=' .. link endif upright thenimagesString = imagesString .. '|upright=' .. uprightelseif #images > 1 thenimagesString = imagesString .. '|upright=' .. ( 1 / #images )endimagesString = imagesString .. ']]'endendlocal image = mw.html.create('div'):addClass("images"):css(style):wikitext(imagesString):done()-- التعليقlocal captionobjif caption thencaptionobj = mw.html.create('div'):wikitext(caption):css(params.legendstyle or {}):addClass("legend"):done()end-- الفاصلlocal separatorif params.separator thenseparator = separator(params)endlocal imgoutif params.inner then -- في حالة التواجد داخل الجدولimgout = mw.html.create('tr'):tag('th'):attr('colspan', 2)elseimgout = mw.html.create('div'):css({border="unset",padding="unset"})endreturn imgout:node(image):node(captionobj):node(separator):done()endp.buildImages = p.buildimagesfunction p.buildtext(params)local class = params.class or ''local style = {['text-align'] = 'center',['font-weight'] = 'bold'}if params.style thenfor i, j in pairs(params.style) dostyle[i] = jendendlocal text = getValue(params.value, params) or getWikidataValue(params) or params.defaultvalueif text == '-' thenreturnendif not text thenaddMaintenanceCat(params.maintenancecat, params.sortkey)return nilendlocal formattedtext = mw.html.create('p'):addClass(class):css(style):wikitext(text):done()return formattedtextendp.buildText = p.buildtextfunction p.buildrow(params)local class = params.class or ''local style = params.style or {}local valueClass = params.valueClass or ''local valueStyle = params.valueStyle or {}local value, number =  getValue(params.value, params)if (not value) thenvalue, number =  getWikidataValue(params, 'wikidata')endif (not value) and (params.property) thenvalue, number = expandQuery{ property = params.property } --, ucfirst = params.ucfirstendif not value thenvalue = params.defaultvalueendif value == '-' thenreturn nilendif not value thenif params.maintenancecat thenlocal maintenancecat = getValue(params.maintenancecat, params)addMaintenanceCat(maintenancecat, params.sortkey)endreturn nilendif not number thennumber = 0 -- == غير معرفendlocal label = params.labelif type(label) == 'table' then label= getValue(params.label, params) end if number > 1 and (params.plurallabel) thenlabel = params.plurallabelelseif number == 1 and (params.singularlabel) thenlabel = params.singularlabelendif type(label) == 'function' thenlabel = label(localdata, localdata.item)endif not label and type(params.defaultlabel) == 'string' thenlabel = params.defaultlabelendif number > 4 then   --- إخفاء النتيجة في حال تجاوز عددها 4params.hidden = trueend-- formatlocal formattedvalue = mw.html.create('div'):wikitext('\n' .. value) -- رمز '\n' مطلوب عندما تكون value قائمة تبدأ بـ '*' ou '#'if (params.hidden == true)thenlocal divNavHead = mw.html.create('div'):attr({class="nomobile", style="text-align:right;border: none; padding: 0; background:none; font-size: 75%;"}):wikitext("&nbsp;[[file:Incomplete list.svg|20x20px|link=]] فہرست ...") --[عرض]/[إخفاء]        formattedvalue:addClass('mw-collapsible-content')        divNavHead = mw.html.create('div'):node(divNavHead)formattedvalue = mw.html.create('div'):attr({class="mw-collapsible mw-collapsed ", style="border: none; padding: 0;"}):node(divNavHead):node(formattedvalue)endformattedvalue =  mw.html.create('td'):node(formattedvalue):addClass(valueClass):css(valueStyle):allDone()local formattedlabelif label thenformattedlabel = mw.html.create('th'):attr('scope', 'row'):wikitext(label):done()endlocal row = mw.html.create('tr'):addClass(class):css(style):node(formattedlabel):node(formattedvalue):done()return rowendp.buildRow = p.buildrowfunction p.buildnavbox(params)-- définition du stylelocal class = "overflow nav " .. (params.class or '')local style = params.style or {}if params.separated then -- خيار إضافة فاصل مسبقclass = class .. ' bordered'style['border-top'] = '1px solid' .. maincolorend-- ترتيب البياناتparams.previousval = params.previousval or params.previousparameter params.nextval = params.nextval or params.nextparameterif params.previousproperty thenparams.previouswikidata = {property = params.previousproperty, conjtype='<br />'}endif params.nextproperty thenparams.nextwikidata = {property = params.nextproperty, conjtype='<br />'}endlocal previousval = getValue(params.previousval, params) or getWikidataValue(params, 'previouswikidata')local nextval = getValue(params.nextval, params)  or getWikidataValue(params, 'nextwikidata')local navboxif params.inner then -- في حالة التواجد داخل الجدولnavbox = mw.html.create('tr'):tag('th'):attr('colspan', 2)style['font-weight'] = style['font-weight'] or 'normal'elsenavbox = mw.html.create('div')endlocal prevNode, nextNodeif previousval thenprevNode = mw.html.create('div'):addClass('prev_bloc'):wikitext(previousval):done()endif nextval thennextNode = mw.html.create('div'):addClass('next_bloc'):wikitext(nextval):done()endif previousval or nextval thennavbox:addClass(class):css(style):node(prevNode):node(nextNode):allDone()return navboxendreturn nilendp.buildNavbox = p.buildnavboxfunction p.buildsuccession(params)if not params.value thenreturn nilendlocal rowI = mw.html.create('tr')cellI = mw.html.create('td'):attr({colspan = '2'}):attr({align = 'center'})local styleT = {}styleT['background-color'] = 'transparent'styleT['width'] = '100%'tabC = mw.html.create('table'):attr({cellspacing = '0'}):addClass('navigation-not-searchable'):css(styleT)local row = mw.html.create('tr')local color = params.colorlocal style = {}local arrowLeftlocal arrowRightif color == 'default' thenstyle['background-color'] = '#E6E6E6'arrowLeft = '[[file:Fleche-defaut-droite.png|13px|alt=سابق|link=]]'arrowRight = '[[file:Fleche-defaut-gauche.png|13px|alt=سابق|link=]]'elsestyle['background-color'] = colorarrowLeft = '[[file:Fleche-defaut-droite-gris-32.png|13px|alt=لاحق|link=]]'arrowRight = '[[file:Fleche-defaut-gauche-gris-32.png|13px|alt=لاحق|link=]]'endlocal styleTrans = {}styleTrans['background-color'] = '#F9F9F9'-- ترتيب البياناتparams.previousval = params.previousval or params.previousparameter params.nextval = params.nextval or params.nextparameterif params.previousproperty thenparams.previouswikidata = {property = params.previousproperty}endif params.nextproperty thenparams.nextwikidata = {property = params.nextproperty}endlocal before = params.value['before']  or getValue(params.previousval, params) or getWikidataValue(params, 'previouswikidata')local after = params.value['after']  or getValue(params.nextval, params) or getWikidataValue(params, 'nextwikidata')local center = params.value['center']--local widthCell = '44%'if center thenwidthCenter = '28%'widthCell = '29%'endlocal formattedbeforeif before thenformattedbefore = mw.html.create('td'):attr({valign = 'middle'}):attr({align = 'right'}):attr({width = '5%'}):css(style):wikitext(arrowLeft):done()row:node(formattedbefore)formattedbefore = mw.html.create('td'):attr({width = '1%'}):css(style):wikitext(''):done()row:node(formattedbefore)formattedbefore = mw.html.create('td'):attr({align = 'right'}):attr({valign = 'middle'}):attr({width = widthCell}):css(style):wikitext(before):done()row:node(formattedbefore)elseformattedbefore = mw.html.create('td'):attr({valign = 'middle'}):attr({align = 'right'}):attr({width = '5%'}):css(styleTrans):wikitext(''):done()row:node(formattedbefore)formattedbefore = mw.html.create('td'):attr({width = '1%'}):css(styleTrans):wikitext(''):done()row:node(formattedbefore)formattedbefore = mw.html.create('td'):attr({align = 'right'}):attr({valign = 'middle'}):attr({width = widthCell}):css(styleTrans):wikitext(''):done()row:node(formattedbefore)endlocal formattedcenterformattedcenter = mw.html.create('td'):attr({width = '1%'}):css(styleTrans):wikitext(''):done()row:node(formattedcenter)if center thenformattedcenter = mw.html.create('td'):attr({align = 'center'}):attr({valign = 'middle'}):attr({width = widthCenter}):css(style):wikitext(center):done()row:node(formattedcenter)formattedcenter = mw.html.create('td'):attr({width = '1%'}):css(styleTrans):wikitext(''):done()row:node(formattedcenter)endlocal formattedafterif after thenformattedafter = mw.html.create('td'):attr({align = 'left'}):attr({valign = 'middle'}):attr({width = widthCell}):css(style):wikitext(after):done()row:node(formattedafter)formattedbefore = mw.html.create('td'):attr({width = '1%'}):css(style):wikitext(''):done()row:node(formattedbefore)formattedafter = mw.html.create('td'):attr({align = 'left'}):attr({valign = 'middle'}):attr({width = '5%'}):css(style):wikitext(arrowRight):done()row:node(formattedafter)elseformattedafter = mw.html.create('td'):attr({align = 'left'}):attr({valign = 'middle'}):attr({width = widthCell}):css(styleTrans):wikitext(''):done()row:node(formattedafter)formattedbefore = mw.html.create('td'):attr({width = '1%'}):css(styleTrans):wikitext(''):done()row:node(formattedbefore)formattedafter = mw.html.create('td'):attr({align = 'left'}):attr({valign = 'middle'}):attr({width = '5%'}):css(styleTrans):wikitext(''):done()row:node(formattedafter)endrow:done()tabC:node(row)tabC:done()cellI:node(tabC)cellI:done()rowI:node(cellI)rowI:allDone()return rowIendp.buildSuccession = p.buildsuccessionfunction p.buildrow1col(params)local value, number =  getValue(params.value, params)if (not value) thenvalue, number =  getWikidataValue(params, 'wikidata')endif (not value) and (params.property) thenvalue, number = expandQuery{ property = params.property } endif not value thenvalue = params.defaultvalueendif value == '-' or type(value)== 'nil' thenreturn nilendlocal class = params.classlocal rowcolorif params.color == 'secondcolor' thenrowcolor = secondcolorelserowcolor = params.colorendlocal style = {}style['padding'] = '4px'style['text-align'] = 'center'style['background-color'] = rowcolor or '#F9F9F9'style['color'] = '#000000'if number and number > 4 then   --- اخفاء النتيجة في حال تجاوز عددها 4params.hidden = trueendlocal formattedvalue = mw.html.create('div'):wikitext('\n' .. value) -- رمز '\n' مطلوب عندما تكون value قائمة تبدأ بـ '*' ou '#'if (params.hidden == true) thenlocal divNavHead = mw.html.create('div'):attr({class="nomobile", style="text-align:right;border: none; padding: 0; background:none; font-size: 75%;"}):wikitext("&nbsp;[[file:Incomplete list.svg|20x20px|link=]] فہرست ...") --[عرض]/[إخفاء]        formattedvalue:addClass('mw-collapsible-content')        divNavHead = mw.html.create('div'):node(divNavHead)formattedvalue = mw.html.create('div'):attr({class="mw-collapsible mw-collapsed ", style="border: none; padding: 0;"}):node(divNavHead):node(formattedvalue)endformattedvalue =  mw.html.create('td'):node(formattedvalue):attr({colspan = '2'}):css(style):done()local row = mw.html.create('tr'):addClass(class):css(style):node(formattedvalue):done()return rowendp.buildRow1Col = p.buildrow1colfunction p.buildsubtitle(params)local class = params.class or ''local style = { ['margin-top'] ='-8px',['margin-bottom'] ='10px',['text-align'] = 'center',['font-size'] = '90%',['background-color'] = maincolor,['color'] = thirdcolor,flex= "auto",width="100%"}if params.style thenfor i, j in pairs(params.style) dostyle[i] = jendendlocal text = getValue(params.value, params) or getWikidataValue(params) or params.defaultvalueif text == '-' thenreturnendif not text thenaddMaintenanceCat(params.maintenancecat, params.sortkey)return nilendlocal title = mw.html.create('div'):addClass(class):css(style):tag('div'):wikitext(text):allDone()return titleendp.buildSubTitle = p.buildsubtitlefunction p.buildtable(params)local tab = mw.html.create('table'):css(params.style or {})local rows = params.rows-- expand parameters so that we have a list of tableslocal i = 1while (i <= #rows) do local l = rows[i]if type(l) == 'function' then l = l(localdata, localdata.item)endif (type(l) == 'table') and (l.type == 'multi') thentable.remove(rows, i)  for j, row in ipairs(l.rows) dotable.insert(rows, i + j - 1, row) endelseif type(l) == 'nil' thentable.remove(rows, i)elseif type(l) ~= 'table' then return error('أسطر قالب البطاقة ("rows") على شكل جداول (table), وليست ' .. type(l))elsei = i + 1endend -- CREATE ROWlocal expandedrows = {}for k, row in ipairs(rows) dolocal v = p.buildblock(row, true)if v thentable.insert(expandedrows, v)endendif (#expandedrows == 0) thenreturn nilendrows = expandedrows-- ADD TITLElocal titleif params.title or params.singulartitle or params.pluraltitle thenlocal textif #rows > 1 and params.pluraltitle thentext = params.pluraltitleelseif #rows == 1 and params.singulartitle thentext = params.singulartitleelsetext = params.titleendlocal style = params.titlestyle or {display = 'table-caption'}style['text-align'] = style['text-align'] or 'center'style['color'] = style['color'] or thirdcolorstyle['background-color'] = style['background-color'] or secondcolortitle = mw.html.create('caption'):attr({colspan = '2'}):css(style):wikitext(text):done()endif title thentab:node(title)endfor i, j in pairs (rows) dotab:node(j)endif params.separator thenlocal separator = p.separator(params)tab:node(separator)endtab:allDone()return tabendp.buildTable = p.buildtablefunction p.buildinvalidblock(args)addMaintenanceCat(defaultcat)local text = ''if type(args) ~= 'table' thentext = "لبنات قالب بطاقة يجب أن تكتب على شكل جداول (table)"elsetext = i18n["invalid block type"] .. ' : ' .. (args.type or '??')endreturn textendp.buildInvalidBlock = p.buildinvalidblockfunction p.buildmap(params)local latitude = getValue({'latitude','دائرة العرض','دائرة عرض'})local longitude = getValue({'longitude','خط الطول','خط طول'})local itemidif localdata.item and localdata.item.id then itemid = localdata.item.id endif(not params.ids  and not longitude and not itemid) then return nil end    if itemid and not (    #(mw.wikibase.getBestStatements(itemid, 'P625'))~=0     or params.ids or longitude    ) then return nil end--mw.logObject(#(mw.wikibase.getBestStatements(itemid, 'P625')))local width = tonumber(params.width) or 260if width > 260 then--addMaintenanceCat("خطأ في بطاقة/صورة بأبعاد كبيرة") width = 260endnewparams = {  ['marker-symbol'] = params.marker or 'marker', ['marker-color'] = params.markercolor or '#FF0000', ['marker-size'] =  params.markersize, frameless='yes', ['width']=width, ['height']=width, ['latitude']= latitude, ['longitude']=  longitude, ['align']='center', type='mapframe', geotype= params.geotype, item = itemid, ids = params.ids, zoom= params.zoom or params.default_zoom or 9, lang="ur"        , title = mw.title.getCurrentTitle().text, debug = params.debug --or 1}if params.params and type(params.params) == 'table' then -- بيانات اضافيةfor i, j in pairs(params.params) doif(not newparams[i]) then newparams[i] = j endendend    local f_tag = require('Module:Map')._tagnoerr,data = pcall(f_tag,newparams)if noerr == truethen return dataelse addMaintenanceCat(i18n["pages_using_bitaqa_with_errors_cat"])mw.log("Error from [[Module:Map]] : "..mw.dumpObject(data))mw.log(debug.traceback('>>ERROR :>>'))return nil end    endp.buildMap = p.buildmapfunction p.buildexternaltext(params)local value = getValue(params.value)if value and (type(value) == 'string') thenexternaltext = externaltext .. valueendendp.buildExternalText = p.buildexternaltextfunction p.buildfooter(params)if not params thenparams = {}endlocal class = 'navbar noprint bordered ' .. (params.class or '')local style = params.style or {flex= "auto";}style['border-top'] = style['border-top'] or '2px dotted ' .. maincolorstyle['display'] =  'block'local backlinkstr = '[' .. tostring( mw.uri.fullUrl( page.name, 'veaction=edit&section=0' ) ) .. ' ' .. i18n['edit'] .. ']'.. ' - [' .. tostring( mw.uri.fullUrl( page.name, 'action=edit&section=0' ) ) .. ' ' .. i18n['edit code'] .. ']'local itemlinkstrif localdata.item and  localdata.item.id thenitemlinkstr = '[[d:' .. localdata.item.id .. '|' .. i18n['edit item'] .. ']]'endlocal editstr = backlinkstrif itemlinkstr theneditstr = editstr .. ' - ' .. itemlinkstrendlocal editlinkspan =  mw.html.create('span'):css({['text-align'] = "right", ['font-size'] = "80%",['background'] = "inherit"}):addClass('plainlinks'):wikitext(editstr):done()local doclinkstr = '[[File:Test_Template_Info-Icon_-_Version_(2).svg|30x15px|link=' .. localdata.templatename .. '|' .. i18n['see doc'] .. ']]'local doclinkspan = mw.html.create('span'):css({['text-align'] = "left",['float'] = "left"}):wikitext(doclinkstr):done()local footer = mw.html.create('p'):addClass(class):css(style):node(editlinkspan):node(doclinkspan)return footerendp.buildFooter = p.buildfooterfunction p.buildblock(block, inner)if type(block) == 'function' thenblock = block( localdata )end    if(inner) then block.inner = true endlocal blocktypes = { -- list of functions for block buildings['invalid'] = p.buildinvalidblock,['external text'] = p.buildexternaltext,['footer'] = p.buildfooter,['images'] = p.buildimages,['map']= p.buildmap,['navbox'] = p.buildnavbox,['table'] = p.buildtable,['mixed'] = p.buildrow,['row'] = p.buildrow,['row1col'] = p.buildrow1col,['succession'] = p.buildsuccession,['text'] = p.buildtext,['title'] = p.buildtitle,['subtitle'] = p.buildsubtitle,}if type(block) ~= 'table'  or (not block.type) or (not blocktypes[block.type]) thenreturn blocktypes['invalid'](block)endreturn blocktypes[block.type](block) endp.buildBlock = p.buildblocklocal function _modbuild()    local function _table_size(tab)    local tab_size = 0        for k, v in pairs( tab ) do tab_size = tab_size + 1 end        return tab_size    end    if _table_size(localdata) <= 5 and page.namespace == 0 then addMaintenanceCat(i18n["pages_using_bitaqa_with_no_params_cat"])end-- assign rank to the infobox, "secondary" means special formatting like no displaytitle for coordinateslocal infoboxrank = 'main' -- main infobox of the page, with coordinates displayed in title etc.if page.namespace ~= 0 theninfoboxrank = 'secondary'    else        addMaintenanceCat(i18n["pages_using_bitaqa_cat"])       addMaintenanceCat(i18n["pages_using_infobox_cat"])end-- if infobox is linked to another item: rank = secondaryif localdata.item and localdata.item.id thenlocal itemlink = mw.wikibase.sitelink(localdata.item.id)local pagetitle = mw.title.getCurrentTitle().textif (itemlink or '') ~= pagetitle theninfoboxrank = 'secondary'endendlocaldata.infoboxrank = infoboxrank-- load infobox module pagelocal moduledata = require('ماڈیول:معلومات/سانچہ/' .. localdata.modulename )moduledata.name = localdata.modulenamelocaldata.wikimod = moduledata.wikimod or moduledata.wikidatamod or moduledata.wdmod-- defines main colormaincolor = getValue({'infobox_color','لون_البطاقة'}) or moduledata.maincolor or maincolorsecondcolor = moduledata.secondcolor or secondcolorthirdcolor = getValue({'text_color','لون_النص'}) or moduledata.thirdcolor or thirdcolorif maincolor:match( '^%x%x%x%x%x%x$' ) or maincolor:match( '^%x%x%x$' ) thenmaincolor = '#' .. maincolorendif thirdcolor:match ('ہاں') or thirdcolor:match( 'true' ) thenthirdcolor = '#000'endif thirdcolor:match ('نہیں') or thirdcolor:match( 'false' ) thenthirdcolor = '#fff'end-- classlocal class = 'infobox_v3b mainTable infobox'if moduledata.class thenclass = class .. ' ' .. moduledata.classend-- stylelocal style = moduledata.style or {}-- build infobox-- النتيجة النهائيةlocal infobox = mw.html.create('td') --mw.html.create('div')         --:addClass(class)         :css({display= "flex"         ,["flex-wrap"]= "wrap"         ,["flex-direction"]= "row"         ,["justify-content"]= "center"         ,["align-items"]= "center"})          :done()local nbblock = 0for i, j in pairs( moduledata.parts ) do-- accepted only in table if(not(j =='mixed' or j == 'multi' or j == 'row' or j == 'row1col')) thenlocal mdp=  p.buildblock(j)infobox:node(mdp)       if(mdp) then nbblock = nbblock + 1  endendendif nbblock < 2 and page.namespace == 0 then addMaintenanceCat(i18n["pages_with_empty_bitaqa_cat"])endinfobox:node(p.buildfooter(moduledata.footer)):done()    infobox=mw.html.create('table')          :addClass(class)         :css(style)         :node(infobox)         :done()         local templatestyles    templatestyles = mw.getCurrentFrame():extensionTag( 'templatestyles', '', {src = "معلومات/infobox v3b/styles.css"})..mw.getCurrentFrame():extensionTag( 'templatestyles', '', { src = "معلومات/icones.css"});return templatestyles .. tostring(infobox) .. externaltext .. maintenanceendfunction p.build()local noerr,data, nbnoerr,data = pcall(_modbuild)if noerr then return dataelse mw.log("Bitaqa Error : "..mw.dumpObject(data))mw.log(debug.traceback('>>ERROR :>>'))addMaintenanceCat(i18n['pages_using_bitaqa_with_errors_cat'])return '<span class="error">' .. (data) .. '</span>' endendp['تركيب'] = p.buildreturn p