Wikipedia
piwiki
https://pi.wikipedia.org/wiki/%E0%A4%AA%E0%A4%AE%E0%A5%81%E0%A4%96_%E0%A4%AA%E0%A4%A4%E0%A5%8D%E0%A4%A4_Pamukha_patta
MediaWiki 1.47.0-wmf.22
first-letter
मीडिया
विसेस
सम्भासित
अवयव
अवयव सम्भासित
Wikipedia
Wikipedia सम्भासित
पटिमा
पटिमा सम्भासित
मीडियाविकि
मीडियाविकि सम्भासित
पटिरूप
पटिरूप सम्भासित
अवस्सय
अवस्सय सम्भासित
विभाग
विभाग सम्भासित
TimedText
TimedText talk
Module
Module talk
Event
Event talk
पटिरूप:Commonscat
10
7614
104571
104454
2026-10-05T07:32:17Z
咽頭べさ
6149
咽頭べさ moved page [[पटिरूप:Commons category]] to [[पटिरूप:Commonscat]]
104453
wikitext
text/x-wiki
{{Commons
| position = {{{position|}}}
<!-- {{#if:x|}} strips whitespace from parameter 1,
in case it is fed like this: {{Commons category| Some cat }}. -->
|Category:{{#if:x| {{{1| {{PAGENAME}} }}} }}<!--
-->|{{{2|{{{1|{{PAGENAME}}}}}}}}<!--
-->}}<includeonly>{{#if:{{{1|}}}||[[Category:अनुपविभत्त अक्खणिक कॉमन्स वग्ग पटिरूप]]}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
80n360wcybfzmc61l5gqdwlcsbd7q9k
सीतगूलोक बुद्धविज्जालयो (जेय्यापूर)
0
7682
104566
2026-10-05T06:48:04Z
咽頭べさ
6149
Created page with "{{Infobox university | name =सीतगूलोक बुद्धविज्जालयो | other_name = <!--or, other_names--> | former_name = <!--or, former_names--> | image =Sitagu International Buddhist University.jpg | image_upright = | image_alt = | caption = | motto =सद्धम्मधातु सुधम्मो सब्बलोके पतिट्ठतु MAY THE SUBLIME DHAMMA PREVAIL IN ITS PRISTINE PURITY | motto_lang = | mottoeng =..."
104566
wikitext
text/x-wiki
{{Infobox university
| name =सीतगूलोक बुद्धविज्जालयो
| other_name = <!--or, other_names-->
| former_name = <!--or, former_names-->
| image =Sitagu International Buddhist University.jpg
| image_upright =
| image_alt =
| caption =
| motto =सद्धम्मधातु सुधम्मो सब्बलोके पतिट्ठतु
MAY THE SUBLIME DHAMMA PREVAIL IN ITS PRISTINE PURITY
| motto_lang =
| mottoeng =
| established = १९९४
| closed = <!-- {{end date|YYYY}} -->
| type = साधारणो
| affiliation =
| academic_affiliation =
| endowment =
| budget =
| rector =डॉ.भद्दन्तनन्दमालाभिवंस
| academic_staff =
| administrative_staff =
| students =
| undergrad =
| postgrad =
| doctoral =
| other =
| address =
| city = [[जेय्यापूरनगरं]]
| state =
| province = [[जेय्यापूरमहादेसो]]
| postcode = <!--or, postalcode or zipcode-->
| country = [[मरम्मरट्ठं]]
| coordinates = {{coords|21|54|06|N|95|59|09|E|region:MM|display=inline,title}}
| campus =
| language =
| colors = <!--or, colours= -->
| website =https://www.thesitagu.org/
| logo =
| footnotes =
| founder =
| logo_size =
| logo_alt =
|chancellor=सीतगूमहाथेरो डॉ.भद्दन्तञाणिस्सर}}
'''सीतगूलोकबुद्धविज्जालयो''' ति [[जेय्यापूरमहादेसो]]। [[जेय्यापूरनगरं]] थितो एको बुद्धसासनब्यापारविज्जालयो होति॥ १९९४ वस्से [[सीतगूमहाथेरो]]न पतिट्ठापितो॥ विज्जालये यतीनं सीलधरीनं मनुस्सानञ्च बुद्धसासनगन्थे सिक्खापेन्ति॥<ref name="mmn">{{Cite web |url=http://www.myanmarnet.net/nibbana/stacdamy.htm |title=မော်ကွန်းတင်ပြီးမိတ္တူ |access-date=4 December 2018 |archive-date=10 December 2018 |archive-url=https://web.archive.org/web/20181210144459/http://www.myanmarnet.net/nibbana/stacdamy.htm |url-status=dead }}</ref>
==ठानं==
विज्जालयो [[भत्तंपथमपुञ्ञचेति]]यस्स अधोभागे थितो होति॥ छ अग्गारानि सन्ति। चेतसु सिक्खासालायो। कारियालयानि। झानभावनाठानानि। पिटकत्थानञ्च अन्तोगधं होन्ति॥ तेसु अग्गारेसु सावत्थिसाला। कपिलवत्थुसाला। लुम्बिनीसाला। नालन्दासाला। अधिपतिभवनं। गन्धारसाला। राजगहसाला। देवदहसाला च सन्ति॥<ref name="mmn"/>
==इतिहासो==
सीतगूलोकबुद्धविज्जालयस्स १९९४ वेसाखमासस्स २४ दिवसे। मरम्मसक्कराजे १३५६ वेसाखपुण्णमायं पठममङ्गलाकम्मं अकंसु॥ १९९८ चित्तमासस्स २७ दिवसे दीपलिुमासिक्खापनपत्तदानेन सद्धिं विज्जालयं आरभित्वा उग्घोसेसि। २००३ जेट्ठमासस्स १७ दिवसे भीअे(B.A) सिक्खानि सिक्खापेतुं आरभि॥<ref>ဓမ္မအသံမဂ္ဂဇင်း (သီတဂူ ကမ္ဘာ့ဗုဒ္ဓတက္ကသိုလ် ဆယ်နှစ်ပြည့် အထိမ်းအမှတ်)၊ P-168,170,173၊ (၂၀၀၇) မတ်လ</ref>
==दिय्यमानउपधियो==
विज्जालये हेट्ठाकथेता दीपलिुमाउपधियो च दीगरीउपधियो च देन्ति॥
# Diploma in Language Studies (English, Pali, Sanskrit, or Hindi)
# Diploma in Buddhist Studies
# B.A. in Buddhist Studies
# M.A. in Buddhist Studies
# 2 of 3 2018-12-03, 1:45 PM
# Ph.D. in Buddhist Studies<ref name="mmn"/>
==निस्सै==
{{reflist}}
{{Universities in Myanmar}}
[[Category:मरम्मरट्ठे बुद्धसासनं]]
[[Category:जेय्यापूर महादेसिय विज्जालयानि]]
[[Category:बुद्धसासनिक विज्जालयानि च विज्जालयपरिवेणानि]]
mnue8b962eexl6qqv934vrhf9uz07dx
पटिरूप:Infobox university
10
7683
104567
2026-10-05T07:20:34Z
咽頭べさ
6149
Created page with "<includeonly>{{Infobox | bodyclass = vcard | titleclass = fn org | title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} | subheader = {{#if:{{{native_name|}}} |<div class="nickname" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}} | image = {{#invoke:InfoboxImage|InfoboxImage |image={{{image|}}}|size={{{image_size|}}} |upright={{if empty|{{{image_upright|}}}|1}} |alt={{{image_alt|}}} | class = {{{image_class|}}}}} | capt..."
104567
wikitext
text/x-wiki
<includeonly>{{Infobox
| bodyclass = vcard
| titleclass = fn org
| title = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}
| subheader = {{#if:{{{native_name|}}} |<div class="nickname" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}}
| image = {{#invoke:InfoboxImage|InfoboxImage |image={{{image|}}}|size={{{image_size|}}} |upright={{if empty|{{{image_upright|}}}|1}} |alt={{{image_alt|}}} | class = {{{image_class|}}}}}
| caption = {{{caption|}}}
| labelstyle = padding-right:0.65em;<!--(to ensure sufficient gap between (long/unwrapped) labels and subsequent data on same line)-->
<!--------------------- Names, motto ---------------------->
| class1 = nickname
| data1 = {{#if:{{{latin_name|}}} |{{langx|la|{{{latin_name}}}}} }}
| label2 = {{longitem|अञ्ञनामानि{{pluralize from text|{{{other_names|}}}|plural=}}}}
| class2 = nickname
| data2 = {{{other_names|}}}
| label3 = {{longitem|पुब्बनामानि{{pluralize from text|{{{former_names|}}}|plural=}}}}
| class3 = nickname
| data3 = {{{former_names|}}}
| label4 = आदिट्ठपदं
| data4 = {{#if:{{both|{{{motto|}}}|{{{motto_lang|}}}}}|<div lang="{{{motto_lang}}}">{{{motto}}}</div>|{{{motto|}}}}}
| label5 = {{longitem|अङ्गलि आदिट्ठपदं}}
| data5 = {{{motto_eng|}}}
| label6 = {{{top_free_label|}}}
| data6 = {{#if:{{{top_free_label|}}} |{{{top_free|}}} }}
| label7 = {{{top_free_label1|}}}
| data7 = {{#if:{{{top_free_label1|}}} |{{{top_free1}}} }}
| label8 = {{{top_free_label2|}}}
| data8 = {{#if:{{{top_free_label2|}}} |{{{top_free2}}} }}
<!---------- Date/s, type, affiliation, finance ----------->
| label9 = पकारो
| data9 = {{{type|}}}
| label10 = {{#if:{{{closed|}}} |पवत्ति |पातुभावो}}
| data10 = {{#if:{{{established|}}} |{{{established}}}{{#if:{{{closed|}}}|–{{{closed}}}}} }}
| label11 = निम्मातारो{{pluralize from text|{{{founders|}}}|plural=}}
| data11 = {{{founders|}}}
| label12 = {{longitem|जनकसंघो}}
| data12 = {{{parent|}}}
| label13 = [[:en:Higher education accreditation|सम्मति]]
| data13 = {{{accreditation|}}}
| label14 = सम्बन्धसंघो
| data14 = {{{affiliations|}}}
| label15 = {{longitem|समयसम्बन्धो}}
| data15 = {{{religious_affiliation|}}}
| label16 = {{longitem|विज्जालयसम्बन्धो}}
| data16 = {{{academic_affiliations|}}}
| label17 = [[:en:Financial endowment|निधि]]
| data17 = {{{endowment|}}}
| label18 = धनप्पमाणं
| data18 = {{{budget|}}}
<!--------------------- Personnel ------------------------->
| label19 = {{longitem|कम्मकारी}}
| data19 = {{{officer_in_charge|}}}
| label20 = [[:en:Chair (officer)|नायको]]
| data20 = {{{chair|}}}
| label21 = [[:en:Chair (officer)|नायको]]
| data21 = {{{chairman|}}}
| label22 = [[:en:Chair (officer)|नायदारका]]
| data22 = {{{chairperson|}}}
| label23 = [[अपेक्खको]]
| data23 = {{{visitor|}}}
| label24 = [[:en:Chancellor (education)|अधिपति]]
| data24 = {{{chancellor|}}}
| label25 = [[:en:University president|पधानी]]
| data25 = {{{president|}}}
| label26 = {{nowrap|उपपधानी}}
| data26 = {{{vice_president|}}}
| label27 = [[:en:Superintendent (education)|अधिकरी]]
| data27 = {{#if:{{{superintendent|}}} |{{{superintendent}}} |}}
| label28 = {{nowrap|[[उपाधिपति]]}}
| data28 = {{{vice_chancellor|}}}
| label29 = [[:en:Provost (education)|पालको]]
| data29 = {{{provost|}}}
| label30 = [[:en:Rector (academia)|गरुट्ठानीयो]]
| data30 = {{{rector|}}}
| label31 = [[:en:Principal (academia)|पधानाचरियो]]
| data31 = {{{principal|}}}
| label32 = [[:en:Dean (education)|साखाचरियो]]
| data32 = {{{dean|}}}
| label33 = निूत्तारो
| data33 = {{{director|}}}
| label34 = {{if empty|{{{head_label|}}}|Head}}
| data34 = {{{head|}}}
| label35 = {{longitem|आचरियसङ्ख्या}}
| data35 = {{{academic_staff|}}}
| label36 = कम्मकारीसङ्ख्या
| data36 = {{{faculty|}}}
| label37 = {{longitem|सब्बसङ्ख्या}}
| data37 = {{{administrative_staff|}}}
| label38 = {{longitem|सिक्खिता}}
| data38 = {{{total_staff|}}}
| label39 = पठमभूमिसिक्खितसङ्ख्या
| data39 = {{{students|}}}
| label40 = [[:en:Undergraduate education|उपरिभूमिसिक्खितसङ्ख्या]]
| data40 = {{{undergrad|}}}
| label41 = [[:en:Postgraduate education|पारगूसिक्खिता]]
| data41 = {{{postgrad|}}}
| label42 = {{longitem|[[:en:Doctorate|अञ्ञसिक्खिता]]}}
| data42 = {{{doctoral|}}}
| label43 = {{longitem|पटिठानं}}
| data43 = {{{other_students|}}}
<!------------ Location, language, {{{free}}} ------------->
| label44 = ठानं
| class44 = adr
| data44 = {{Br separated entries
| 1 = {{Comma separated entries
| 1 = {{#if:{{{location|}}}| <div style="display:inline" class="extended-address">{{{location}}}</div>}}
| 2 = {{#if:{{{address|}}}|<div style="display:inline" class="street-address">{{{address}}}</div>}}
| 3 = {{#if:{{{city|}}}|<div style="display:inline" class="locality">{{{city}}}</div>}}
| 4 = {{#if:{{{canton|}}}{{{prefecture|}}}{{{province|}}}{{{region|}}}{{{state|}}}|<div style="display:inline" class="state">{{Comma separated entries|{{{canton|}}}|{{{prefecture|}}}|{{{province|}}}|{{{region|}}}|{{{state|}}}}}</div>}}
| 5 = {{#if:{{{postal_code|}}}|<div style="display:inline" class="postal-code">{{{postal_code|}}}</div>}}
| 6 = {{#if:{{{country|}}}|<div style="display:inline" class="country-name">{{{country}}}</div>}}
}}
| 2 = {{{coordinates|}}}
}}
| label45 = आरामो
| data45 = {{ubl|
| {{{campus_size|}}}
| {{{campus_type|}}}
| {{{campus|}}}
}}
| label46 = भासा
| data46 = {{{language|}}}
| label47 = {{{free_label|}}}
| data47 = {{#if:{{{free_label|}}} | {{{free|}}} }}
| label48 = {{{free_label1|}}}
| data48 = {{#if:{{{free_label1|}}} | {{{free1|}}} }}
| label49 = {{{free_label2|}}}
| data49 = {{#if:{{{free_label2|}}} | {{{free2|}}} }}
<!------------ Colo/urs, sports, website, etc ------------->
| label50 = [[:en:School colors|लक्खण{{#if:{{{colours|}}}|व}}ण्णो]]
| data50 = {{{colors|}}}{{{colours|}}}
| label51 = [[Athletic nickname|कीळासंघनामं{{pluralize from text|{{{sports_nickname|}}}|plural=}}]]
| data51 = {{{sports_nickname|}}}
| label52 = {{longitem|कीळासम्बन्धो}}
| data52 = {{{sporting_affiliations|}}}
| label53 = मङ्गलसत्तो{{pluralize from text|{{{mascot|}}}|plural=}}
| data53 = {{{mascot|}}}
| label54 = {{{sports_free_label|}}}
| data54 = {{{sports_free|}}}
| label55 = {{{sports_free_label1|}}}
| data55 = {{{sports_free1|}}}
| label56 = {{{sports_free_label2|}}}
| data56 = {{{sports_free2|}}}
| label57 = {{{sports_free_label3|}}}
| data57 = {{{sports_free3|}}}
| label58 = वेबसाइट
| data58 = {{{website|}}}
| data59 = {{#invoke:InfoboxImage|InfoboxImage |image={{{logo|}}}|size={{{logo_size|}}}|upright={{{logo_upright|}}}|alt={{{logo_alt|}}}| class = {{{logo_class|}}}}}
| data60 = {{{nrhp|}}}
| data61 = {{{embedded|}}}
| data62 = {{{module|}}}
<!-------------------- Location map ----------------------->
| data63 = {{#invoke:Location map|infobox_pushpin_map
| default_size = 250
}}
| data64 = {{#invoke:Infobox mapframe
| autoWithCaption
| onByDefault = {{#if:{{{pushpin_map|}}}|no|yes}}
| mapframe-type = landmark
| mapframe-marker = college
| mapframe-shape = yes
}}
| below = {{{footnotes|}}}
}}{{#if:{{{affiliations|}}}|{{Main other| }}
}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other| }}|preview=Page using [[Template:Infobox university]] with unknown parameter "_VALUE_"| ignoreblank = y | mapframe_args = y | pushpin_map_args = y | academic_affiliations | academic_staff | accreditation | address | administrative_staff | affiliations | budget | campus | campus_size | campus_type | canton | caption | chair | chairman | chairperson | chancellor | city | closed | colors | colours | coordinates | country | dean | director | doctoral | embedded | endowment | established | faculty | footnotes | former_names | founders | free | free_label | free_label1 | free_label2 | free1 | free2 | head | head_label | image | image_alt | image_class | image_size | image_upright | language | latin_name | location | logo | logo_alt | logo_class | logo_size | logo_upright | mascot | module | motto | motto_eng | motto_lang | name | native_name | native_name_lang | nrhp | officer_in_charge | other_names | other_students | parent | postal_code | postgrad | prefecture | president | principal | province | provost | rector | region | religious_affiliation | sporting_affiliations | sports_free | sports_free_label | sports_free_label1 | sports_free_label2 | sports_free_label3 | sports_free1 | sports_free2 | sports_free3 | sports_nickname | state | students | superintendent | top_free | top_free_label | top_free_label1 | top_free_label2 | top_free1 | top_free2 | total_staff | type | undergrad | vice_chancellor | vice_president | visitor | website }}<noinclude>
{{documentation}}
</noinclude>
0o1xsq66m7en0umjm5rr0picp0zyh6b
Module:Infobox mapframe
828
7684
104568
2026-10-05T07:23:56Z
咽頭べさ
6149
Created page with "local mf = require('Module:Mapframe') local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') local infoboxImage = require('Module:InfoboxImage').InfoboxImage -- Defaults local DEFAULT_FRAME_WIDTH = "270" local DEFAULT_FRAME_HEIGHT = "200" local DEFAULT_ZOOM = 10 local DEFAULT_GEOMASK_STROKE_WIDTH = "1" local DEFAULT_GEOMASK_STROKE_COLOR = "#777777" local DEFAULT_GEOMASK_FILL = "#888888" local DEFAULT_GEOMASK_FILL_OPACITY = "0.25" local..."
104568
Scribunto
text/plain
local mf = require('Module:Mapframe')
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local infoboxImage = require('Module:InfoboxImage').InfoboxImage
-- Defaults
local DEFAULT_FRAME_WIDTH = "270"
local DEFAULT_FRAME_HEIGHT = "200"
local DEFAULT_ZOOM = 10
local DEFAULT_GEOMASK_STROKE_WIDTH = "1"
local DEFAULT_GEOMASK_STROKE_COLOR = "#777777"
local DEFAULT_GEOMASK_FILL = "#888888"
local DEFAULT_GEOMASK_FILL_OPACITY = "0.25"
local DEFAULT_SHAPE_STROKE_WIDTH = "2"
local DEFAULT_SHAPE_STROKE_COLOR = "#FF0000"
local DEFAULT_SHAPE_FILL = "#606060"
local DEFAULT_SHAPE_FILL_OPACITY = "0.1"
local DEFAULT_LINE_STROKE_WIDTH = "5"
local DEFAULT_LINE_STROKE_COLOR = "#FF0000"
local DEFAULT_MARKER_COLOR = "#5E74F3"
local util = {}
function util.noop(info)
local DEFAULT_NOOP_OUTPUT = ""
-- uncomment this when debugging
-- DEFAULT_NOOP_OUTPUT = "debug: mapframe no-op: " .. info
-- mw.log(DEFAULT_NOOP_OUTPUT)
return DEFAULT_NOOP_OUTPUT
end
-- Trim whitespace from args, and remove empty args
function util.trimArgs(argsTable)
local cleanArgs = {}
for key, val in pairs(argsTable) do
if type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val ~= '' then
cleanArgs[key] = val
end
else
cleanArgs[key] = val
end
end
return cleanArgs
end
function util.getBestStatement(item_id, property_id)
if not(item_id) or not(mw.wikibase.isValidEntityId(item_id)) or not(mw.wikibase.entityExists(item_id)) then
return false
end
local statements = mw.wikibase.getBestStatements(item_id, property_id)
if not statements or #statements == 0 then
return false
end
local hasNoValue = ( statements[1].mainsnak and statements[1].mainsnak.snaktype == 'novalue' )
if hasNoValue then
return false
end
return statements[1]
end
function util.hasWikidataProperty(item_id, property_id)
return util.getBestStatement(item_id, property_id) and true or false
end
function util.getStatementValue(statement)
return statement and statement.mainsnak and statement.mainsnak.datavalue and statement.mainsnak.datavalue.value or nil
end
function util.relatedEntity(item_id, property_id)
local value = util.getStatementValue( util.getBestStatement(item_id, property_id) )
return value and value.id or false
end
function util.idType(id)
if not id then
return nil
elseif mw.ustring.match(id, "[Pp]%d+") then
return "property"
elseif mw.ustring.match(id, "[Qq]%d+") then
return "item"
else
return nil
end
end
function util.shouldAutoRun(frame)
-- Check if should be running
local pargs = frame.getParent(frame).args
local explicitlyOn = yesno(mw.text.trim(pargs.mapframe or "")) -- true of false or nil
if pargs.coordinates == "{{{coordinates}}}" then explicitlyOn = false end
if type(pargs.coordinates) == 'string' and string.match(pargs.coordinates, 'coord.missing') then explicitlyOn = false end
local onByDefault = (explicitlyOn == nil) and yesno(mw.text.trim(frame.args.onByDefault or ""), false) -- true or false
return explicitlyOn or onByDefault
end
function util.argsFromAuto(frame)
-- Get args from the frame (invoke call) and the parent (template call).
-- Frame arguments are default values which are overridden by parent values
-- when both are present
local args = getArgs(frame, {parentFirst = true})
-- Discard args not prefixed with "mapframe-", remove that prefix from those that remain
local fixedArgs = {}
for name, val in pairs(args) do
local fixedName = string.match(name, "^mapframe%-(.+)$" )
if fixedName then
fixedArgs[fixedName] = val
-- allow coord, coordinates, etc to be unprefixed
elseif name == "coordinates" or name == "coordinate" and not fixedArgs.coord then
fixedArgs.coord = val
-- allow id, qid to be unprefixed, map to id (if not already present)
elseif name == "id" or name == "qid" and not fixedArgs.id then
fixedArgs.id = val
-- allow captionstyle to be unprefixed, for compatibility with [[Module:Infobox]]
elseif name == "captionstyle" and not fixedArgs.captionstyle then
fixedArgs.captionstyle = val
end
end
return fixedArgs
end
function util.parseCustomWikitext(customWikitext)
-- infoboxImage will format an image if given wikitext containing an
-- image, or else pass through the wikitext unmodified
return infoboxImage({
args = {
image = customWikitext
}
})
end
function util.trackAndWarn(trackingCat, warning)
local title = mw.title.getCurrentTitle()
local results = title and title.namespace == 0 and trackingCat and '[[Category:'..trackingCat..']]' or ''
if warning then
local warn = require('Module:If preview')._warning
results = results..warn({warning})
end
return results
end
function util.ternary(flag, other)
other = other or 'other'
flag = flag == 'none' and 'no' or flag
local yesNoOut = yesno(flag,other)
local yes = (yesNoOut == true)
local no = (yesNoOut == false)
return yes, no
end
local p = {}
p._caption = function(args)
if args.caption then
return args.caption
elseif args.switcher then
return util.noop("no caption or switcher")
end
local maskItem
local maskType = util.idType(args.geomask)
if maskType == 'item' then
maskItem = args.geomask
elseif maskType == "property" then
maskItem = util.relatedEntity(args.id or mw.wikibase.getEntityIdForCurrentPage(), args.geomask)
end
local maskItemLabel = maskItem and mw.wikibase.getLabel( maskItem )
return maskItemLabel and "Location in "..maskItemLabel
or util.noop("missing maskItemLabel with type " .. (maskType or "nil") .. " and item " .. (maskItem or "nil"))
end
--A list of types for objects that are too small to allow Kartographer to take over zoom
local tinyType = {
landmark=true,
railwaystation=true,
edu=true,
pass=true,
camera=true
}
p._main = function(_config)
-- accumulate tracking cats
local tracking = ''
-- `config` is the args passed to this module
local config = util.trimArgs(_config)
-- allow alias for config.coord
config.coord = config.coord or config.coordinates
-- Require wikidata item, or specified coords
local wikidataId = config.id or mw.wikibase.getEntityIdForCurrentPage()
if not(wikidataId) and not(config.coord) then
return false, util.trackAndWarn('Pages using infobox mapframe with missing coordinates')
end
-- Require coords (specified or from wikidata), so that map will be centred somewhere
-- (P625 = coordinate location)
local wdCoordinates = util.getStatementValue(util.getBestStatement(wikidataId, 'P625'))
if not (config.coord or wdCoordinates) then
return false, util.trackAndWarn('Pages using infobox mapframe with missing coordinates')
end
-- `args` is the arguments which will be passed to the mapframe module
local args = {}
-- Some defaults/overrides for infobox presentation
args.display = "inline"
args.frame = "yes"
args.plain = "yes"
args["frame-width"] = config["frame-width"] or config.width or DEFAULT_FRAME_WIDTH
args["frame-height"] = config["frame-height"] or config.height or DEFAULT_FRAME_HEIGHT
args["frame-align"] = "center"
args["frame-coord"] = config["frame-coordinates"] or config["frame-coord"]
-- Note: config["coordinates"] or config["coord"] should not be used for the alignment of the frame;
-- see talk page ( https://en.wikipedia.org/wiki/Special:Diff/876492931 )
-- deprecated lat and long parameters
args["frame-lat"] = config["frame-lat"] or config["frame-latitude"]
args["frame-long"] = config["frame-long"] or config["frame-longitude"]
-- if zoom isn't specified from config, first check wikidata
local zoom = config.zoom or util.getStatementValue(util.getBestStatement(wikidataId, 'P6592'))
if not zoom then
-- Calculate zoom from length or area (converted to km or km2)
-- Zoom so that length or area is completely included in mapframe
local getZoom = require('Module:Infobox dim')._zoom
zoom = getZoom({length_km=config.length_km, length_mi=config.length_mi,
width_km=config.width_km, width_mi=config.width_mi,
area_km2=config.area_km2, area_mi2=config.area_mi2,
area_ha=config.area_ha, area_acre=config.area_acre,
type=config.type, population=config.population,
viewport_px=math.min(args["frame-width"],args["frame-height"]),
latitude=wdCoordinates and wdCoordinates.latitude})
end
args.zoom = zoom or DEFAULT_ZOOM
-- Use OSM relation ID if available; otherwise use geoshape if that is available
-- (geoshape is required for defunct entities, which are outside OSM's scope)
local hasOsmRelationId = util.hasWikidataProperty(wikidataId, 'P402') -- P402 is OSM relation ID
local hasGeoshape = util.hasWikidataProperty(wikidataId, 'P3896') -- P3896 is geoshape
local wikidataProvidesGeo = hasOsmRelationId or hasGeoshape
-- determine marker argument value, determine whether to show marker
local forcePoint, suppressPoint = util.ternary(config.point)
local forceMarker, suppressMarker = util.ternary(config.marker,true)
forcePoint = forcePoint or forceMarker
suppressPoint = suppressPoint or suppressMarker
local showMarker = not suppressPoint and (forcePoint or not wikidataProvidesGeo or config.coord)
-- wikidata = "yes" turns on both shape and line
-- wikidata = "no" turns off both shape and line
-- otherwise show both if wikidata provides geo
local forceWikidata, suppressWikidata = util.ternary(config.wikidata)
local showShape = not suppressWikidata and (forceWikidata or wikidataProvidesGeo or not config.coord)
local showLine = showShape
-- determine shape parameter value, determine whether to show or suppress shape
-- also determine whether to invert shape
local forceShape, suppressShape = util.ternary(config.shape)
showShape = wikidataId and not suppressShape and (forceShape or showShape)
local shapeType = config.shape == 'inverse' and 'shape-inverse' or 'shape'
-- determine line parameter value, determine whether to show or suppress line
local forceLine, suppressLine = util.ternary(config.line)
showLine = wikidataId and not suppressLine and (forceLine or showLine)
local maskItem
-- Switcher
if config.switcher == "zooms" then
-- switching between zoom levels
local maxZoom = math.max(tonumber(args.zoom), 3) -- what zoom would have otherwise been (if 3 or more, otherwise 3)
local minZoom = 1 -- completely zoomed out
local midZoom = math.floor((maxZoom + minZoom)/2) -- midway between maxn and min
args.switch = "zoomed in, zoomed midway, zoomed out"
args.zoom = string.format("SWITCH:%d,%d,%d", maxZoom, midZoom, minZoom)
elseif config.switcher == "auto" then
-- switching between P276 and P131 areas with recursive lookup, e.g. item's city,
-- that city's state, and that state's country
args.zoom = nil -- let kartographer determine the zoom
local maskLabels = {}
local maskItems = {}
local maskItemId = util.relatedEntity(wikidataId, "P276") or util.relatedEntity(wikidataId, "P131")
local maskLabel = mw.wikibase.getLabel(maskItemId)
while maskItemId and maskLabel and mw.text.trim(maskLabel) ~= "" do
table.insert(maskLabels, maskLabel)
table.insert(maskItems, maskItemId)
maskItemId = maskItemId and util.relatedEntity(maskItemId, "P131")
maskLabel = maskItemId and mw.wikibase.getLabel(maskItemId)
end
if #maskLabels > 1 then
args.switch = table.concat(maskLabels, "###")
maskItem = "SWITCH:" .. table.concat(maskItems, ",")
elseif #maskLabels == 1 then
maskItem = maskItemId[1]
end
elseif config.switcher == "geomasks" and config.geomask then
-- switching between items in geomask parameter
args.zoom = nil -- let kartographer determine the zoom
local separator = (mw.ustring.find(config.geomask, "###", 0, true ) and "###") or
(mw.ustring.find(config.geomask, ";", 0, true ) and ";") or ","
local pattern = "%s*"..separator.."%s*"
local maskItems = mw.text.split(mw.ustring.gsub(config.geomask, "SWITCH:", ""), pattern)
local maskLabels = {}
if #maskItems > 1 then
for i, item in ipairs(maskItems) do
table.insert(maskLabels, mw.wikibase.getLabel(item))
end
args.switch = table.concat(maskLabels, "###")
maskItem = "SWITCH:" .. table.concat(maskItems, ",")
end
end
-- resolve geomask item id (if not using geomask switcher)
if not maskItem then --
local maskType = util.idType(config.geomask)
if maskType == 'item' then
maskItem = config.geomask
elseif maskType == "property" then
maskItem = util.relatedEntity(wikidataId, config.geomask)
end
end
-- if asking for shape or line from Wikidata
-- and if Wikidata actually has shape/line data (wikidataProvidesGeo=true)
-- and if no geomask
-- and if zoom not explicitly set
-- and if the object size inferred from its type is not too small
-- then let Kartographer "take over" zoom
if (showLine or showShape) and wikidataProvidesGeo and not maskItem
and not config.zoom and not (config.type and tinyType[config.type]) then
args.zoom = nil
end
if not maskItem and not showShape and not showLine and not showMarker then
return false, util.trackAndWarn('Pages using infobox mapframe with no geometry','No geometry specified for mapframe')
end
-- Keep track of arg numbering
local argNumber = ''
local function incrementArgNumber()
if argNumber == '' then
argNumber = 2
else
argNumber = argNumber + 1
end
end
-- Geomask
if maskItem then
args["type"..argNumber] = "shape-inverse"
args["id"..argNumber] = maskItem
args["stroke-width"..argNumber] = config["geomask-stroke-width"] or DEFAULT_GEOMASK_STROKE_WIDTH
args["stroke-color"..argNumber] = config["geomask-stroke-color"] or config["geomask-stroke-colour"] or DEFAULT_GEOMASK_STROKE_COLOR
args["fill"..argNumber] = config["geomask-fill"] or DEFAULT_GEOMASK_FILL
args["fill-opacity"..argNumber] = config["geomask-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY
-- Let kartographer determine zoom and position, unless it is explicitly set in config
if not config.zoom and not config.switcher then
args.zoom = nil
args["frame-coord"] = nil
args["frame-lat"] = nil
args["frame-long"] = nil
local maskArea = util.getStatementValue( util.getBestStatement(maskItem, 'P2046') )
end
incrementArgNumber()
-- Hack to fix phab:T255932
if not args.zoom then
args["type"..argNumber] = "line"
args["id"..argNumber] = maskItem
args["stroke-width"..argNumber] = 0
incrementArgNumber()
end
end
-- Shape (or shape-inverse)
if showShape then
args["type"..argNumber] = shapeType
if hasGeoshape and not hasOsmRelationId then
args["from"..argNumber] = string.sub( util.getStatementValue( util.getBestStatement(wikidataId, 'P3896') ), 6)
elseif config.id then
args["id"..argNumber] = config.id
end
args["stroke-width"..argNumber] = config["shape-stroke-width"] or config["stroke-width"] or DEFAULT_SHAPE_STROKE_WIDTH
args["stroke-color"..argNumber] = config["shape-stroke-color"] or config["shape-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_SHAPE_STROKE_COLOR
args["fill"..argNumber] = config["shape-fill"] or DEFAULT_SHAPE_FILL
args["fill-opacity"..argNumber] = config["shape-fill-opacity"] or DEFAULT_SHAPE_FILL_OPACITY
incrementArgNumber()
end
-- Line
if showLine then
args["type"..argNumber] = "line"
if hasGeoshape and not hasOsmRelationId then
args["from"..argNumber] = string.sub( util.getStatementValue( util.getBestStatement(wikidataId, 'P3896') ), 6)
elseif config.id then
args["id"..argNumber] = config.id
end
args["stroke-width"..argNumber] = config["line-stroke-width"] or config["stroke-width"] or DEFAULT_LINE_STROKE_WIDTH
args["stroke-color"..argNumber] = config["line-stroke-color"] or config["line-stroke-colour"] or config["stroke-color"] or config["stroke-colour"] or DEFAULT_LINE_STROKE_COLOR
incrementArgNumber()
end
-- Point marker
if showMarker then
args["type"..argNumber] = "point"
if config.id then args["id"..argNumber] = config.id end
if config.coord then args["coord"..argNumber] = config.coord end
if config.marker then args["marker"..argNumber] = config.marker end
args["marker-color"..argNumber] = config["marker-color"] or config["marker-colour"] or DEFAULT_MARKER_COLOR
incrementArgNumber()
end
-- if Wikidata doesn't link to OSM and the map has no mask or point,
-- then center the map on the coordinates either from the infobox or from wikidata
if not maskItem and not showMarker and not wikidataProvidesGeo then
if config.coord then
args["frame-coord"] = args["frame-coord"] or config.coord
else
args["frame-lat"] = args["frame-lat"] or wdCoordinates.latitude
args["frame-long"] = args["frame-long"] or wdCoordinates.longitude
end
tracking = tracking..util.trackAndWarn('Pages using infobox mapframe with forced centering')
end
-- protect against nil frame arguments
args["frame-coord"] = args["frame-coord"] or ""
args["frame-lat"] = args["frame-lat"] or ""
args["frame-long"] = args["frame-long"] or ""
local mapframe = args.switch and mf.multi(args) or mf._main(args)
tracking = tracking..((showLine or showShape) and not wikidataProvidesGeo
and util.trackAndWarn('Pages using infobox mapframe without shape links in Wikidata')
or '')
return true, mapframe.. tracking
end
-- Entry points
p.main = function(frame)
local parent = frame.getParent(frame)
local parentArgs = parent.args
local _, mapframe = p._main(parentArgs)
return frame:preprocess(mapframe)
end
p.auto = function(frame)
if not util.shouldAutoRun(frame) then
return util.noop("auto should not autorun")
end
local args = util.argsFromAuto(frame)
if args.custom then
return frame:preprocess(util.parseCustomWikitext(args.custom))
end
local _, mapframe = p._main(args)
return frame:preprocess(mapframe)
end
p.autocaption = function(frame)
if not util.shouldAutoRun(frame) then
return util.noop("autocaption should not autorun")
end
local args = util.argsFromAuto(frame)
local caption = p._caption(args)
return caption
end
p.autoWithCaption = function(frame)
if not util.shouldAutoRun(frame) then
return util.noop("autoWithCaption should not autorun")
end
local args = util.argsFromAuto(frame)
local wikitext
local caption
local ok
if args.custom then
ok = true
wikitext = util.parseCustomWikitext(args.custom)
else
ok, wikitext = p._main(args)
end
if not ok then return wikitext end
wikitext = frame:preprocess(wikitext)
caption = p._caption(args)
local data = mw.html.create():wikitext(wikitext)
data:tag('div')
:addClass('infobox-caption')
:cssText(args.captionstyle)
:wikitext(caption)
return tostring(data)
end
return p
875oxmrlaiy3xr3n98jl2ndg6rcmzou
Module:Mapframe
828
7685
104569
2026-10-05T07:26:07Z
咽頭べさ
6149
Created page with "-- Note: Originally written on English Wikipedia at https://en.wikipedia.org/wiki/Module:Mapframe --[[---------------------------------------------------------------------------- ##### Localisation (L10n) settings ##### Replace values in quotes ("") with localised values ----------------------------------------------------------------------------]]-- local L10n = {} local wb = mw.wikibase -- Modue dependencies local parser -- local copy of https://www.mediawiki.org/w..."
104569
Scribunto
text/plain
-- Note: Originally written on English Wikipedia at https://en.wikipedia.org/wiki/Module:Mapframe
--[[----------------------------------------------------------------------------
##### Localisation (L10n) settings #####
Replace values in quotes ("") with localised values
----------------------------------------------------------------------------]]--
local L10n = {}
local wb = mw.wikibase
-- Modue dependencies
local parser -- local copy of https://www.mediawiki.org/wiki/Module:WikitextParser loaded lazily
-- "strict" should not be used, at least until all other modules which require this module are not using globals.
-- Template parameter names (unnumbered versions only)
-- Specify each as either a single string, or a table of strings (aliases)
-- Aliases are checked left-to-right, i.e. `{ "one", "two" }` is equivalent to using `{{{one| {{{two|}}} }}}` in a template
L10n.para = {
display = "display",
type = "type",
id = { "id", "ids" },
from = "from",
raw = "raw",
title = "title",
description = "description",
strokeColor = { "stroke-color", "stroke-colour" },
strokeWidth = "stroke-width",
strokeOpacity = "stroke-opacity",
fill = "fill",
fillOpacity = "fill-opacity",
coord = "coord",
marker = "marker",
markerColor = { "marker-color", "marker-colour" },
markerSize = "marker-size",
radius = { "radius", "radius_m" },
radiusKm = "radius_km",
radiusFt = "radius_ft",
radiusMi = "radius_mi",
edges = "edges",
text = "text",
icon = "icon",
zoom = "zoom",
frame = "frame",
plain = "plain",
frameWidth = "frame-width",
frameHeight = "frame-height",
frameCoordinates= { "frame-coordinates", "frame-coord" },
frameLatitude = { "frame-lat", "frame-latitude" },
frameLongitude = { "frame-long", "frame-longitude" },
frameAlign = "frame-align",
switch = "switch",
overlay = "overlay",
overlayBorder = "overlay-border",
overlayHorizontalAlignment = "overlay-horizontal-alignment",
overlayVerticalAlignment = "overlay-vertical-alignment",
overlayHorizontalOffset = "overlay-horizontal-offset",
overlayVerticalOffset = "overlay-vertical-offset"
}
-- Names of other templates this module can extract coordinates from
L10n.template = {
templates = { -- The coord template, as well as templates with output that contains {{coord}}
"Coord", "Coord/sandbox",
"NRHP row", "NRHP row/sandbox",
"WikidataCoord", "WikidataCoord/sandbox", "Wikidatacoord", "Wikidata coord"
},
modules = { -- The coordinates module, as well as modules with output that contains {{coord}}
"Coordinates", "Coordinates/sandbox",
"WikidataCoord", "WikidataCoord/sandbox"
}
}
-- Error messages
L10n.error = {
badDisplayPara = "Invalid display parameter",
noCoords = "Coordinates must be specified on Wikidata or in |" .. ( type(L10n.para.coord)== 'table' and L10n.para.coord[1] or L10n.para.coord ) .. "=",
wikidataCoords = "Coordinates not found on Wikidata",
noCircleCoords = "Circle centre coordinates must be specified, or available via Wikidata",
negativeRadius = "Circle radius must be a positive number",
noRadius = "Circle radius must be specified",
negativeEdges = "Circle edges must be a positive number",
noSwitchPara = "Found only one switch value in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
oneSwitchLabel = "Found only one label in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
noSwitchLists = "At least one parameter must have a SWITCH: list",
switchMismatches = "All SWITCH: lists must have the same number of values",
-- "%s" and "%d" tokens will be replaced with strings and numbers when used
oneSwitchValue = "Found only one switch value in |%s=",
fewerSwitchLabels = "Found %d switch values but only %d labels in |" .. ( type(L10n.para.switch)== 'table' and L10n.para.switch[1] or L10n.para.switch ) .. "=",
noNamedCoords = "No named coordinates found in %s"
}
-- Other strings
L10n.str = {
-- valid values for display parameter, e.g. (|display=inline) or (|display=title) or (|display=inline,title) or (|display=title,inline)
inline = "inline",
title = "title",
dsep = ",", -- separator between inline and title (comma in the example above)
-- valid values for type parameter
line = "line", -- geoline feature (e.g. a road)
shape = "shape", -- geoshape feature (e.g. a state or province)
shapeInverse = "shape-inverse", -- geomask feature (the inverse of a geoshape)
data = "data", -- geoJSON data page on Commons
point = "point", -- single point feature (coordinates)
circle = "circle", -- circular area around a point
named = "named", -- all named coordinates in an article or section
-- Keyword to indicate a switch list. Must NOT use the special characters ^$()%.[]*+-?
switch = "SWITCH",
-- valid values for icon, frame, and plain parameters
affirmedWords = ' '..table.concat({
"add",
"added",
"affirm",
"affirmed",
"include",
"included",
"on",
"true",
"yes",
"y"
}, ' ')..' ',
declinedWords = ' '..table.concat({
"decline",
"declined",
"exclude",
"excluded",
"false",
"none",
"not",
"no",
"n",
"off",
"omit",
"omitted",
"remove",
"removed"
}, ' ')..' '
}
-- Default values for parameters
L10n.defaults = {
display = L10n.str.inline,
text = "Map",
frameWidth = "300",
frameHeight = "200",
frameAlign = "right",
markerColor = "5E74F3",
markerSize = nil,
strokeColor = "#ff0000",
strokeWidth = 6,
edges = 32, -- number of edges used to approximate a circle
overlayBorder = "1px solid white",
overlayHorizontalAlignment = "right",
overlayHorizontalOffset = "0",
overlayVerticalAlignment = "bottom",
overlayVerticalOffset = "0"
}
-- #### End of L10n settings ####
--[[----------------------------------------------------------------------------
Utility methods
----------------------------------------------------------------------------]]--
local util = {}
--[[
Looks up a parameter value based on the id (a key from the L10n.para table) and
optionally a suffix, for parameters that can be suffixed (e.g. type2 is type
with suffix 2).
@param {table} args key-value pairs of parameter names and their values
@param {string} param_id id for parameter name (key from the L10n.para table)
@param {string} [suffix] suffix for parameter name
@returns {string|nil} parameter value if found, or nil if not found
]]--
function util.getParameterValue(args, param_id, suffix)
suffix = suffix or ''
if type( L10n.para[param_id] ) ~= 'table' then
return args[L10n.para[param_id]..suffix]
end
for _i, paramAlias in ipairs(L10n.para[param_id]) do
if args[paramAlias..suffix] then
return args[paramAlias..suffix]
end
end
return nil
end
--[[
Trim whitespace from args, and remove empty args. Also fix control characters.
@param {table} argsTable
@returns {table} trimmed args table
]]--
function util.trimArgs(argsTable)
local cleanArgs = {}
for key, val in pairs(argsTable) do
if type(key) == 'string' and type(val) == 'string' then
val = val:match('^%s*(.-)%s*$')
if val ~= '' then
-- control characters inside json need to be escaped, but stripping them is simpler
-- See also T214984
-- However, *don't* strip control characters from wikitext (text or description parameters) or you'll break strip markers
-- Alternatively it might be better to only strip control char from raw parameter content
if util.matchesParam('text', key) or util.matchesParam('description', key, key:gsub('^%D+(%d+)$', '%1') ) then
cleanArgs[key] = val
else
cleanArgs[key] = val:gsub('%c',' ')
end
end
else
cleanArgs[key] = val
end
end
return cleanArgs
end
--[[
Check if a parameter name matches an unlocalized parameter key
@param {string} key - the unlocalized parameter name to search through
@param {string} name - the localized parameter name to check
@param {string|nil} - an optional suffix to apply to the value(s) from the localization key
@returns {boolean} true if the name matches the parameter, false otherwise
]]--
function util.matchesParam(key, name, suffix)
local param = L10n.para[key]
suffix = suffix or ''
if type(param) == 'table' then
for _, v in pairs(param) do
if (v .. suffix) == name then return true end
end
return false
end
return ((param .. suffix) == name)
end
--[[
Check if a value is affirmed (one of the values in L10n.str.affirmedWords)
@param {string} val Value to be checked
@returns {boolean} true if affirmed, false otherwise
]]--
function util.isAffirmed(val)
if not(val) then return false end
return string.find(L10n.str.affirmedWords, ' '..val..' ', 1, true ) and true or false
end
--[[
Check if a value is declined (one of the values in L10n.str.declinedWords)
@param {string} val Value to be checked
@returns {boolean} true if declined, false otherwise
]]--
function util.isDeclined(val)
if not(val) then return false end
return string.find(L10n.str.declinedWords , ' '..val..' ', 1, true ) and true or false
end
--[[
Check if the name of a template matches the known coord templates or wrappers
(in L10n.template.templates and L10n.template.modules). The name is normalised
when checked, so e.g. the names "Coord", "coord", and " Coord" all return true.
@param {string} name
@returns {boolean} true if it is a coord template or wrapper, false otherwise
]]--
function util.isCoordTemplateOrWrapper(name)
name = mw.text.trim(name)
local modName = mw.ustring.gsub(name, '#invoke:', '')
local inputTitle = mw.title.new(modName, (name ~= modName) and 'Module' or 'Template')
if not inputTitle then
return false
end
-- Create (or reuse) mw.title objects for each known coord template/wrapper.
-- Stored in L10n.template.title so that they don't need to be recreated
-- each time this function is called
if not L10n.template.titles then
L10n.template.titles = {}
for _, v in pairs(L10n.template.templates) do
table.insert(L10n.template.titles, mw.title.new(v, 'Template'))
end
for _, v in pairs(L10n.template.modules) do
table.insert(L10n.template.titles, mw.title.new(v, 'Module'))
end
end
for _, templateTitle in pairs(L10n.template.titles) do
if mw.title.equals(inputTitle, templateTitle) then
return true
end
end
return false
end
--[[
Recursively extract coord templates which have a name parameter.
@param {string} wikitext
@returns {table} table sequence of coord templates
]]--
function util.extractCoordTemplates(wikitext)
local output = {}
local templates = mw.ustring.gmatch(wikitext, '{%b{}}')
for template in templates do
local templateName = mw.ustring.match(template, '{{([^}|]+)')
local nameParam = mw.ustring.match(template, "|%s*name%s*=%s*[^}|]+")
if util.isCoordTemplateOrWrapper(templateName) then
if nameParam then table.insert(output, template) end
elseif mw.ustring.find(mw.ustring.sub(template, 2), "{{") then
local subOutput = util.extractCoordTemplates(mw.ustring.sub(template, 2))
for _, t in pairs(subOutput) do
table.insert(output, t)
end
end
end
-- ensure coords are not using title display
for k, v in pairs(output) do
output[k] = mw.ustring.gsub(v, "|%s*display%s*=[^|}]+", "|display=inline")
end
return output
end
--[[
Gets all named coordiates from a page or a section of a page.
@param {string|nil} page Page name, or name#section, to get named coordinates
from. If the name is omitted, i.e. #section or nil or empty string, then
the current page will be used.
@returns {table} sequence of {coord, name, description} tables where coord is
the coordinates in a format suitable for #util.parseCoords, name is a string,
and description is a string (coordinates in a format suitable for displaying
to the reader). If for some reason the name can't be found, the description
is nil and the name contains display-format coordinates.
@throws {L10n.error.noNamedCoords} if no named coordinates are found.
]]--
function util.getNamedCoords(page)
local parts = mw.text.split(page or "", "#", true)
local name = parts[1] == "" and mw.title.getCurrentTitle().prefixedText or parts[1]
local section = parts[2]
local title = mw.title.new(name)
if title.isRedirect then
title = title.redirectTarget
end
local pageWikitext = title:getContent()
if section then
if parser == nil then
-- load [[Module:WikitextParser]] lazily so it is only transcluded on pages that use it
parser = require("Module:WikitextParser")
end
pageWikitext = parser.getSection(pageWikitext, section) or ''
end
local coordTemplates = util.extractCoordTemplates(pageWikitext)
if #coordTemplates == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end
local frame = mw.getCurrentFrame()
local sep = "________"
local expandedContent = frame:preprocess(table.concat(coordTemplates, sep))
local expandedTemplates = mw.text.split(expandedContent, sep)
local namedCoords = {}
for _, expandedTemplate in pairs(expandedTemplates) do
local coord = mw.ustring.match(expandedTemplate, "<span class=\"geo%-dec\".->(.-)</span>")
if coord then
local coordname = (
-- name specified by a wrapper template, e.g [[Article|Name]]
mw.ustring.match(expandedTemplate, "<span class=\"mapframe%-coord%-name\">(.-)</span>") or
-- name passed into coord template
mw.ustring.match(expandedTemplate, "<span class=\"fn org\">(.-)</span>") or
-- default to the coordinates if the name can't be retrieved
coord
)
local description = coordname ~= coord and coord
table.insert(namedCoords, {
coord=mw.ustring.gsub(coord, "[° ]", "_"),
name=coordname, description=description
})
end
end
if #namedCoords == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end
return namedCoords
end
--[[
Parse coordinate values from the params passed in a GeoHack url (such as
//tools.wmflabs.org/geohack/geohack.php?pagename=Example¶ms=1_2_N_3_4_W_ or
//tools.wmflabs.org/geohack/geohack.php?pagename=Example¶ms=1.23_S_4.56_E_ )
or non-url string in the same format (such as `1_2_N_3_4_W_` or `1.23_S_4.56_E_`)
@param {string} coords string containing coordinates
@returns {number, number} latitude, longitude
]]--
function util.parseCoords(coords)
local coordsPatt
if mw.ustring.find(coords, "params=", 1, true) then
-- prevent false matches from page name, e.g. ?pagename=Lorem_S._Ipsum
coordsPatt = 'params=([_%.%d]+[NS][_%.%d]+[EW])'
else
-- not actually a geohack url, just the same format
coordsPatt = '[_%.%d]+[NS][_%.%d]+[EW]'
end
local parts = mw.text.split((mw.ustring.match(coords, coordsPatt) or ''), '_')
local lat_d = tonumber(parts[1])
assert(lat_d, "Unable to get latitude from input '"..coords.."'.")
local lat_m = tonumber(parts[2]) -- nil if coords are in decimal format
local lat_s = lat_m and tonumber(parts[3]) -- nil if coords are either in decimal format or degrees and minutes only
local lat = lat_d + (lat_m or 0)/60 + (lat_s or 0)/3600
if parts[#parts/2] == 'S' then
lat = lat * -1
end
local long_d = tonumber(parts[1+#parts/2])
assert(long_d, "Unable to get longitude from input '"..coords.."'.")
local long_m = tonumber(parts[2+#parts/2]) -- nil if coords are in decimal format
local long_s = long_m and tonumber(parts[3+#parts/2]) -- nil if coords are either in decimal format or degrees and minutes only
local long = long_d + (long_m or 0)/60 + (long_s or 0)/3600
if parts[#parts] == 'W' then
long = long * -1
end
return lat, long
end
--[[
Get coordinates from a Wikidata item
@param {string} item_id Wikidata item id (Q number)
@returns {number, number} latitude, longitude
@throws {L10n.error.noCoords} if item_id is invalid or the item does not exist
@throws {L10n.error.wikidataCoords} if the the item does not have a P625
statement (coordinates), or it is set to "no value"
]]--
function util.wikidataCoords(item_id)
if not (item_id and wb.isValidEntityId(item_id) and wb.entityExists(item_id)) then
error(L10n.error.noCoords, 0)
end
local coordStatements = wb.getBestStatements(item_id, 'P625')
if not coordStatements or #coordStatements == 0 then
error(L10n.error.wikidataCoords, 0)
end
local hasNoValue = ( coordStatements[1].mainsnak and (coordStatements[1].mainsnak.snaktype == 'novalue' or coordStatements[1].mainsnak.snaktype == 'somevalue') )
if hasNoValue then
error(L10n.error.wikidataCoords, 0)
end
local wdCoords = coordStatements[1]['mainsnak']['datavalue']['value']
return tonumber(wdCoords['latitude']), tonumber(wdCoords['longitude'])
end
--[[
Creates a polygon that approximates a circle
@param {number} lat Latitude
@param {number} long Longitude
@param {number} radius Radius in metres
@param {number} n Number of edges for the polygon
@returns {table} sequence of {latitude, longitude} table sequences, where
latitude and longitude are both numbers
]]--
function util.circleToPolygon(lat, long, radius, n) -- n is number of edges
-- Based on https://github.com/gabzim/circle-to-polygon, ISC licence
local function offset(cLat, cLon, distance, bearing)
local lat1 = math.rad(cLat)
local lon1 = math.rad(cLon)
local dByR = distance / 6378137 -- distance divided by 6378137 (radius of the earth) wgs84
local offet_lat = math.asin(
math.sin(lat1) * math.cos(dByR) +
math.cos(lat1) * math.sin(dByR) * math.cos(bearing)
)
local offet_lon = lon1 + math.atan2(
math.sin(bearing) * math.sin(dByR) * math.cos(lat1),
math.cos(dByR) - math.sin(lat1) * math.sin(offet_lat)
)
return {math.deg(offet_lon), math.deg(offet_lat)}
end
local coordinates = {};
local i = 0;
while i < n do
table.insert(coordinates,
offset(lat, long, radius, (2*math.pi*i*-1)/n)
)
i = i + 1
end
table.insert(coordinates, offset(lat, long, radius, 0))
return coordinates
end
--[[
Get the number of key-value pairs in a table, which might not be a sequence.
@param {table} t
@returns {number} count of key-value pairs
]]--
function util.tableCount(t)
local count = 0
for k, v in pairs(t) do
count = count + 1
end
return count
end
--[[
For a table where the values are all tables, returns either the util.tableCount
of the subtables if they are all the same, or nil if they are not all the same.
@param {table} t
@returns {number|nil} count of key-value pairs of subtable, or nil if subtables
have different counts
]]--
function util.subTablesCount(t)
local count = nil
for k, v in pairs(t) do
if count == nil then
count = util.tableCount(v)
elseif count ~= util.tableCount(v) then
return nil
end
end
return count
end
--[[
Splits a list into a table sequence. The items in the list may be separated by
commas, or by semicolons (if items may contain commas), or by "###" (if items
may contain semicolons).
@param {string} listString
@returns {table} sequence of list items
]]--
function util.tableFromList(listString)
if type(listString) ~= "string" or listString == "" then return nil end
local separator = (mw.ustring.find(listString, "###", 0, true ) and "###") or
(mw.ustring.find(listString, ";", 0, true ) and ";") or ","
local pattern = "%s*"..separator.."%s*"
return mw.text.split(listString, pattern)
end
-- Boolean in outer scope indicating if Kartographer should be able to
-- automatically calculate coordinates (see phab:T227402)
local coordsDerivedFromFeatures = false;
--[[----------------------------------------------------------------------------
Make methods: These take in a table of arguments, and return either a string
or a table to be used in the eventual output.
----------------------------------------------------------------------------]]--
local make = {}
--[[
Makes content to go inside the maplink or mapframe tag.
@param {table} args
@returns {string} tag content
]]--
function make.content(args)
if util.getParameterValue(args, 'raw') then
coordsDerivedFromFeatures = true -- Kartographer should be able to automatically calculate coords from raw geoJSON
return util.getParameterValue(args, 'raw')
end
local content = {}
local argsExpanded = {}
for k, v in pairs(args) do
local index = string.match( k, '^[^0-9]+([0-9]*)$' )
if index ~= nil then
local indexNumber
if index ~= '' then
indexNumber = tonumber(index)
else
indexNumber = 1
end
if argsExpanded[indexNumber] == nil then
argsExpanded[indexNumber] = {}
end
argsExpanded[indexNumber][ string.gsub(k, index, '') ] = v
end
end
for contentIndex, contentArgs in pairs(argsExpanded) do
local argType = util.getParameterValue(contentArgs, "type")
-- Kartographer automatically calculates coords if geolines/shapes are used (T227402)
if not coordsDerivedFromFeatures then
coordsDerivedFromFeatures = ( argType == L10n.str.line or argType == L10n.str.shape ) and true or false
end
if argType == L10n.str.named then
local namedCoords = util.getNamedCoords(util.getParameterValue(contentArgs, "from"))
local typeKey = type(L10n.para.type) == "table" and L10n.para.type[1] or L10n.para.type
local coordKey = type(L10n.para.coord) == "table" and L10n.para.coord[1] or L10n.para.coord
local titleKey = type(L10n.para.title) == "table" and L10n.para.title[1] or L10n.para.title
local descKey = type(L10n.para.description) == "table" and L10n.para.description[1] or L10n.para.description
for _, namedCoord in pairs(namedCoords) do
contentArgs[typeKey] = "point"
contentArgs[coordKey] = namedCoord.coord
contentArgs[titleKey] = namedCoord.name
contentArgs[descKey] = namedCoord.description
content[#content+1] = make.contentJson(contentArgs)
end
else
content[#content + 1] = make.contentJson(contentArgs)
end
end
--Single item, no array needed
if #content==1 then return content[1] end
--Multiple items get placed in a FeatureCollection
local contentArray = '[\n' .. table.concat( content, ',\n') .. '\n]'
return contentArray
end
--[[
Make coordinates from the coord arg, or the id arg, or the current page's
Wikidata item.
@param {table} args
@param {boolean} [plainOutput]
@returns {Mixed} Either:
{number, number} latitude, longitude if plainOutput is true; or
{table} table sequence of longitude, then latitude (gives the required format
for GeoJSON when encoded)
]]--
function make.coords(args, plainOutput)
local coords, lat, long
local frame = mw.getCurrentFrame()
if util.getParameterValue(args, 'coord') then
coords = frame:preprocess( util.getParameterValue(args, 'coord') )
lat, long = util.parseCoords(coords)
else
lat, long = util.wikidataCoords(util.getParameterValue(args, 'id') or wb.getEntityIdForCurrentPage())
end
if plainOutput then
return lat, long
end
return {[0] = long, [1] = lat}
end
--[[
Makes a table of coordinates that approximate a circle.
@param {table} args
@returns {table} sequence of {latitude, longitude} table sequences, where
latitude and longitude are both numbers
@throws {L10n.error.noCircleCoords} if centre coordinates are not specified
@throws {L10n.error.noRadius} if radius is not specified
@throws {L10n.error.negativeRadius} if radius is negative or zero
@throws {L10n.error.negativeEdges} if edges is negative or zero
]]--
function make.circleCoords(args)
local lat, long = make.coords(args, true)
local radius = util.getParameterValue(args, 'radius')
if not radius then
radius = util.getParameterValue(args, 'radiusKm') and tonumber(util.getParameterValue(args, 'radiusKm'))*1000
if not radius then
radius = util.getParameterValue(args, 'radiusMi') and tonumber(util.getParameterValue(args, 'radiusMi'))*1609.344
if not radius then
radius = util.getParameterValue(args, 'radiusFt') and tonumber(util.getParameterValue(args, 'radiusFt'))*0.3048
end
end
end
local edges = util.getParameterValue(args, 'edges') or L10n.defaults.edges
if not lat or not long then
error(L10n.error.noCircleCoords, 0)
elseif not radius then
error(L10n.error.noRadius, 0)
elseif tonumber(radius) <= 0 then
error(L10n.error.negativeRadius, 0)
elseif tonumber(edges) <= 0 then
error(L10n.error.negativeEdges, 0)
end
return util.circleToPolygon(lat, long, radius, tonumber(edges))
end
--[[
Makes JSON data for a feature
@param contentArgs args for this feature. Keys must be the non-suffixed version
of the parameter names, i.e. use type, stroke, fill,... rather than type3,
stroke3, fill3,...
@returns {string} JSON encoded data
]]--
function make.contentJson(contentArgs)
local data = {}
if util.getParameterValue(contentArgs, 'type') == L10n.str.point or util.getParameterValue(contentArgs, 'type') == L10n.str.circle then
local isCircle = util.getParameterValue(contentArgs, 'type') == L10n.str.circle
data.type = "Feature"
data.geometry = {
type = isCircle and "LineString" or "Point",
coordinates = isCircle and make.circleCoords(contentArgs) or make.coords(contentArgs)
}
data.properties = {
title = util.getParameterValue(contentArgs, 'title') or mw.getCurrentFrame():getParent():getTitle()
}
if isCircle then
-- TODO: This is very similar to below, should be extracted into a function
data.properties.stroke = util.getParameterValue(contentArgs, 'strokeColor') or L10n.defaults.strokeColor
data.properties["stroke-width"] = tonumber(util.getParameterValue(contentArgs, 'strokeWidth')) or L10n.defaults.strokeWidth
local strokeOpacity = util.getParameterValue(contentArgs, 'strokeOpacity')
if strokeOpacity then
data.properties['stroke-opacity'] = tonumber(strokeOpacity)
end
local fill = util.getParameterValue(contentArgs, 'fill')
if fill then
data.properties.fill = fill
local fillOpacity = util.getParameterValue(contentArgs, 'fillOpacity')
data.properties['fill-opacity'] = fillOpacity and tonumber(fillOpacity) or 0.6
end
else -- is a point
local markerSymbol = util.getParameterValue(contentArgs, 'marker') or L10n.defaults.marker
-- allow blank to be explicitly specified, for overriding infoboxes or other templates with a default value
if markerSymbol ~= "blank" then
data.properties["marker-symbol"] = markerSymbol
end
data.properties["marker-color"] = util.getParameterValue(contentArgs, 'markerColor') or L10n.defaults.markerColor
data.properties["marker-size"] = util.getParameterValue(contentArgs, 'markerSize') or L10n.defaults.markerSize
end
else
data.type = "ExternalData"
if util.getParameterValue(contentArgs, 'type') == L10n.str.data or util.getParameterValue(contentArgs, 'from') then
data.service = "page"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.line then
data.service = "geoline"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.shape then
data.service = "geoshape"
elseif util.getParameterValue(contentArgs, 'type') == L10n.str.shapeInverse then
data.service = "geomask"
end
if util.getParameterValue(contentArgs, 'id') or (not (util.getParameterValue(contentArgs, 'from')) and wb.getEntityIdForCurrentPage()) then
data.ids = util.getParameterValue(contentArgs, 'id') or wb.getEntityIdForCurrentPage()
else
data.title = util.getParameterValue(contentArgs, 'from')
end
data.properties = {
stroke = util.getParameterValue(contentArgs, 'strokeColor') or L10n.defaults.strokeColor,
["stroke-width"] = tonumber(util.getParameterValue(contentArgs, 'strokeWidth')) or L10n.defaults.strokeWidth
}
local strokeOpacity = util.getParameterValue(contentArgs, 'strokeOpacity')
if strokeOpacity then
data.properties['stroke-opacity'] = tonumber(strokeOpacity)
end
local fill = util.getParameterValue(contentArgs, 'fill')
if fill and (data.service == "geoshape" or data.service == "geomask") then
data.properties.fill = fill
local fillOpacity = util.getParameterValue(contentArgs, 'fillOpacity')
if fillOpacity then
data.properties['fill-opacity'] = tonumber(fillOpacity)
end
end
end
data.properties.title = util.getParameterValue(contentArgs, 'title') or mw.title.getCurrentTitle().text
if util.getParameterValue(contentArgs, 'description') then
data.properties.description = util.getParameterValue(contentArgs, 'description')
end
return mw.text.jsonEncode(data)
end
--[[
Makes attributes for the maplink or mapframe tag.
@param {table} args
@param {boolean} [isTitle] Tag is to be displayed in the title of page rather
than inline
@returns {table<string,string>} key-value pairs of attribute names and values
]]--
function make.tagAttribs(args, isTitle)
local attribs = {}
if util.getParameterValue(args, 'zoom') then
attribs.zoom = util.getParameterValue(args, 'zoom')
end
if util.isDeclined(util.getParameterValue(args, 'icon')) then
attribs.class = "no-icon"
end
if util.getParameterValue(args, 'type') == L10n.str.point and not coordsDerivedFromFeatures then
local lat, long = make.coords(args, 'plainOutput')
attribs.latitude = tostring(lat)
attribs.longitude = tostring(long)
end
if util.isAffirmed(util.getParameterValue(args, 'frame')) and not(isTitle) then
attribs.width = util.getParameterValue(args, 'frameWidth') or L10n.defaults.frameWidth
attribs.height = util.getParameterValue(args, 'frameHeight') or L10n.defaults.frameHeight
if util.getParameterValue(args, 'frameCoordinates') then
local frameLat, frameLong = util.parseCoords(util.getParameterValue(args, 'frameCoordinates'))
attribs.latitude = frameLat
attribs.longitude = frameLong
else
if util.getParameterValue(args, 'frameLatitude') then
attribs.latitude = util.getParameterValue(args, 'frameLatitude')
end
if util.getParameterValue(args, 'frameLongitude') then
attribs.longitude = util.getParameterValue(args, 'frameLongitude')
end
end
if not attribs.latitude and not attribs.longitude and not coordsDerivedFromFeatures then
local success, lat, long = pcall(util.wikidataCoords, util.getParameterValue(args, 'id') or wb.getEntityIdForCurrentPage())
if success then
attribs.latitude = tostring(lat)
attribs.longitude = tostring(long)
end
end
if util.getParameterValue(args, 'frameAlign') then
attribs.align = util.getParameterValue(args, 'frameAlign')
end
if util.isAffirmed(util.getParameterValue(args, 'plain')) then
attribs.frameless = "1"
else
attribs.text = util.getParameterValue(args, 'text') or L10n.defaults.text
end
else
attribs.text = util.getParameterValue(args, 'text') or L10n.defaults.text
end
return attribs
end
--[[
Makes maplink wikitext that will be located in the top-right of the title of the
page (the same place where coords with |display=title are positioned).
@param {table} args
@param {string} tagContent Content for the maplink tag
@returns {string}
]]--
function make.titleOutput(args, tagContent)
local titleTag = mw.text.tag('maplink', make.tagAttribs(args, true), tagContent)
local spanAttribs = {
style = "font-size: small;",
id = "mapframe-coordinates"
}
local indicatorContent = mw.text.tag('span', spanAttribs, titleTag)
return mw.getCurrentFrame():extensionTag {
name = "indicator",
content = indicatorContent,
args = {
name = "zzz-mapframe" --zzz: show as last indicator
}
}
end
--[[
Makes maplink or mapframe wikitext that will be located inline.
@param {table} args
@param {string} tagContent Content for the maplink tag
@returns {string}
]]--
function make.inlineOutput(args, tagContent)
local tagName = 'maplink'
if util.getParameterValue(args, 'frame') then
tagName = 'mapframe'
end
return mw.text.tag(tagName, make.tagAttribs(args), tagContent)
end
--[[
Makes the HTML required for the swicther to work, including the templatestyles
tag.
@param {table} params table sequence of {map, label} tables
@param {string} params{}.map Wikitext for mapframe map
@param {string} params{}.label Label text for swicther option
@param {table} options
@param {string} options.alignment "left" or "center" or "right"
@param {boolean} options.isThumbnail Display in a thumbnail
@param {string} options.width Width of frame, e.g. "200"
@param {string} [options.caption] Caption wikitext for thumnail
@retruns {string} swicther HTML
]]--
function make.switcherHtml(params, options)
options = options or {}
local frame = mw.getCurrentFrame()
local styles = frame:extensionTag{
name = "templatestyles",
args = {src = "Template:Maplink/styles-multi.css"}
}
local container = mw.html.create("div")
:addClass("switcher-container")
:addClass("mapframe-multi-container")
if options.alignment == "left" or options.alignment == "right" then
container:addClass("float"..options.alignment)
else -- alignment is "center"
container:addClass("center")
end
for i = 1, #params do
container
:tag("div")
:wikitext(params[i].map)
:tag("span")
:addClass("switcher-label")
:css("display", "none")
:wikitext(mw.text.trim(params[i].label))
end
if not options.isThumbnail then
return styles .. tostring(container)
end
local classlist = container:getAttr("class")
classlist = mw.ustring.gsub(classlist, "%a*"..options.alignment, "")
container:attr("class", classlist)
local outerCountainer = mw.html.create("div")
:addClass("mapframe-multi-outer-container")
:addClass("mw-kartographer-container")
:addClass("thumb")
if options.alignment == "left" or options.alignment == "right" then
outerCountainer:addClass("float"..options.alignment)
else -- alignment is "center"
outerCountainer
:addClass("tnone")
:addClass("center")
end
outerCountainer
:tag("div")
:addClass("thumbinner")
:css("width", options.width.."px")
:node(container)
:node(options.caption and mw.html.create("div")
:addClass("thumbcaption")
:wikitext(options.caption)
)
return styles .. tostring(outerCountainer)
end
--[[
Makes the HTML required for an overlay map to work
tag.
@param {string} overlayMap wikitext for the overlay map
@param {string} baseMap wikitext for the base map
@param {table} options various styling/display options
@param {string} options.align "left" or "center" or "right"
@param {string|number} options.width Width of the base map, e.g. "300"
@param {string|number} options.width Height of the base map, e.g. "200"
@param {string} options.border Border style for the overlayed map, e.g. "1px solid white"
@param {string} options.horizontalAlignment Horizontal alignment for overlay map, "left" or "right"
@param {string|number} options.horizontalOffset Horizontal offset in pixels from the alignment edge, e.g "10"
@param {string} options.verticalAlignment Vertical alignment for overlay map, "top" or "bottom"
@param {string|number} options.verticalOffset Vertical offset in pixels from the alignment edge, e.g. is "10"
@param {boolean} options.isThumbnail Display in a thumbnail
@param {string} [options.caption] Caption wikitext for thumnail
@retruns {string} HTML for basemap with overlay
]]--
function make.overlayHtml(overlayMap, baseMap, options)
options = options or {}
local containerFloatClass = "float"..(options.align or "none")
if options.align == "center" then
containerFloatClass = "center"
end
local containerStyle = {
position = "relative",
width = options.width .. "px",
height = options.height .. "px",
overflow = "hidden" -- mobile/minerva tends to add scrollbars for a couple of pixels
}
if options.align == "center" then
containerStyle["margin-left"] = "auto"
containerStyle["margin-right"] = "auto"
end
local container = mw.html.create("div")
:addClass("mapframe-withOverlay-container")
:addClass(containerFloatClass)
:addClass("noresize")
:css(containerStyle)
local overlayStyle = {
position = "absolute",
["z-index"] = "1",
border = options.border or "1px solid white"
}
if options.horizontalAlignment == "right" then
overlayStyle.right = options.horizontalOffset .. "px"
else
overlayStyle.left = options.horizontalOffset .. "px"
end
if options.verticalAlignment == "bottom" then
overlayStyle.bottom = options.verticalOffset .. "px"
else
overlayStyle.top = options.verticalOffset .. "px"
end
local overlayDiv = mw.html.create("div")
:css(overlayStyle)
:wikitext(overlayMap)
container
:node(overlayDiv)
:wikitext(baseMap)
if not options.isThumbnail then
return tostring(container)
end
local classlist = container:getAttr("class")
classlist = mw.ustring.gsub(classlist, "%a*"..options.align, "")
container:attr("class", classlist)
local outerCountainer = mw.html.create("div")
:addClass("mapframe-withOverlay-outerContainer")
:addClass("mw-kartographer-container")
:addClass("thumb")
if options.align == "left" or options.align == "right" then
outerCountainer:addClass("t"..options.align)
else -- alignment is "center"
outerCountainer
:addClass("tnone")
:addClass("center")
end
outerCountainer
:tag("div")
:addClass("thumbinner")
:css("width", options.width.."px")
:node(container)
:node(options.caption and mw.html.create("div")
:addClass("thumbcaption")
:wikitext(options.caption)
)
return tostring(outerCountainer)
end
--[[----------------------------------------------------------------------------
Package to be exported, i.e. methods which will available to templates and
other modules.
----------------------------------------------------------------------------]]--
local p = {}
-- Entry point for templates
function p.main(frame)
local parent = frame.getParent(frame)
-- Check for overlay option
local overlay = util.getParameterValue(parent.args, 'overlay')
local hasOverlay = overlay and mw.text.trim(overlay) ~= ""
-- Check for switch option
local switch = util.getParameterValue(parent.args, 'switch')
local isMulti = switch and mw.text.trim(switch) ~= ""
-- Create output by choosing method to suit options
local output
if hasOverlay then
output = p.withOverlay(parent.args)
elseif isMulti then
output = p.multi(parent.args)
else
output = p._main(parent.args)
end
-- Preprocess output before returning it
return frame:preprocess(output)
end
-- Entry points for modules
function p._main(_args)
local args = util.trimArgs(_args)
local tagContent = make.content(args)
local display = mw.text.split(util.getParameterValue(args, 'display') or L10n.defaults.display, '%s*' .. L10n.str.dsep .. '%s*')
local displayInTitle = display[1] == L10n.str.title or display[2] == L10n.str.title
local displayInline = display[1] == L10n.str.inline or display[2] == L10n.str.inline
local output
if displayInTitle and displayInline then
output = make.titleOutput(args, tagContent) .. make.inlineOutput(args, tagContent)
elseif displayInTitle then
output = make.titleOutput(args, tagContent)
elseif displayInline then
output = make.inlineOutput(args, tagContent)
else
error(L10n.error.badDisplayPara)
end
return output
end
function p.multi(_args)
local args = util.trimArgs(_args)
if not args[L10n.para.switch] then error(L10n.error.noSwitchPara, 0) end
local switchParamValue = util.getParameterValue(args, 'switch')
local switchLabels = util.tableFromList(switchParamValue)
if #switchLabels == 1 then error(L10n.error.oneSwitchLabel, 0) end
local mapframeArgs = {}
local switchParams = {}
for name, val in pairs(args) do
-- Copy to mapframeArgs, if not the switch labels or a switch parameter
if val ~= switchParamValue and not string.match(val, "^"..L10n.str.switch..":") then
mapframeArgs[name] = val
end
-- Check if this is a param to switch. If so, store the name and switch
-- values in switchParams table.
local switchList = string.match(val, "^"..L10n.str.switch..":(.+)")
if switchList ~= nil then
local values = util.tableFromList(switchList)
if #values == 1 then
error(string.format(L10n.error.oneSwitchValue, name), 0)
end
switchParams[name] = values
end
end
if util.tableCount(switchParams) == 0 then
error(L10n.error.noSwitchLists, 0)
end
local switchCount = util.subTablesCount(switchParams)
if not switchCount then
error(L10n.error.switchMismatches, 0)
elseif switchCount > #switchLabels then
error(string.format(L10n.error.fewerSwitchLabels, switchCount, #switchLabels), 0)
end
-- Ensure a plain frame will be used (thumbnail will be built by the
-- make.switcherHtml function if required, so that switcher options are
-- inside the thumnail)
mapframeArgs.plain = "yes"
local switcher = {}
for i = 1, switchCount do
local label = switchLabels[i]
for name, values in pairs(switchParams) do
mapframeArgs[name] = values[i]
end
table.insert(switcher, {
map = p._main(mapframeArgs),
label = "Show "..label
})
end
return make.switcherHtml(switcher, {
alignment = args["frame-align"] or "right",
isThumbnail = (args.frame and not args.plain) and true or false,
width = args["frame-width"] or L10n.defaults.frameWidth,
caption = args.text
})
end
function p.withOverlay(_args)
-- Get and trim wikitext for overlay map
local overlayMap = _args.overlay
if type(overlayMap) == 'string' then
overlayMap = overlayMap:match('^%s*(.-)%s*$')
end
local isThumbnail = (util.getParameterValue(_args, "frame") and not util.getParameterValue(_args, "plain")) and true or false
-- Get base map using the _main function, as a plain map
local args = util.trimArgs(_args)
args.plain = "yes"
local basemap = p._main(args)
-- Extract overlay options from args
local overlayOptions = {
width = util.getParameterValue(args, "frameWidth") or L10n.defaults.frameWidth,
height = util.getParameterValue(args, "frameHeight") or L10n.defaults.frameHeight,
align = util.getParameterValue(args, "frameAlign") or L10n.defaults.frameAlign,
border = util.getParameterValue(args, "overlayBorder") or L10n.defaults.overlayBorder,
horizontalAlignment = util.getParameterValue(args, "overlayHorizontalAlignment") or L10n.defaults.overlayHorizontalAlignment,
horizontalOffset = util.getParameterValue(args, "overlayHorizontalOffset") or L10n.defaults.overlayHorizontalOffset,
verticalAlignment = util.getParameterValue(args, "overlayVerticalAlignment") or L10n.defaults.overlayVerticalAlignment,
verticalOffset = util.getParameterValue(args, "overlayVerticalOffset") or L10n.defaults.overlayVerticalOffset,
isThumbnail = isThumbnail,
caption = util.getParameterValue(args, "text") or L10n.defaults.text
}
-- Make the HTML for the overlaying maps
return make.overlayHtml(overlayMap, basemap, overlayOptions)
end
-- Entry point for testcase tests
p.test = util
return p
ctsgv4ln5giysy1bit377346v8nejri
विभाग:बुद्धसासनिक विज्जालयानि च विज्जालयपरिवेणानि
14
7686
104570
2026-10-05T07:30:44Z
咽頭べさ
6149
Created page with "{{Commonscat|Buddhist universities}} [[Category:बुद्धसासनिक गरुकट्ठानानि]]"
104570
wikitext
text/x-wiki
{{Commonscat|Buddhist universities}}
[[Category:बुद्धसासनिक गरुकट्ठानानि]]
mwtci0fu8plnpiqocm4uhxqenus1g2w
पटिरूप:Commons category
10
7687
104572
2026-10-05T07:32:17Z
咽頭べさ
6149
咽頭べさ moved page [[पटिरूप:Commons category]] to [[पटिरूप:Commonscat]]
104572
wikitext
text/x-wiki
#REDIRECT [[पटिरूप:Commonscat]]
9jx3clx02ruooqfnlx4o9fkqijkbwvp
विभाग:बुद्धसासनिक गरुकट्ठानानि
14
7688
104573
2026-10-05T07:40:34Z
咽頭べさ
6149
Created page with "{{commonscat|Buddhist buildings|बुद्धिकगेहानि}} :*'''[[बुद्धसासनं]] [[गेह]]नि''' ::::::::*''See also: [[:Category:बुद्धिसासनं बिसुकानि|विभाग: '''बुद्धिसासनं बिसुकानि'']]॥'' {{-}} [[Category:बुद्धिसासनं बिसुकानि| गेह]] Category:धम्मानुरूपपूजनट्ठान..."
104573
wikitext
text/x-wiki
{{commonscat|Buddhist buildings|बुद्धिकगेहानि}}
:*'''[[बुद्धसासनं]] [[गेह]]नि'''
::::::::*''See also: [[:Category:बुद्धिसासनं बिसुकानि|विभाग: '''बुद्धिसासनं बिसुकानि'']]॥''
{{-}}
[[Category:बुद्धिसासनं बिसुकानि| गेह]]
[[Category:धम्मानुरूपपूजनट्ठानानि]]
[[Category:बुद्धसासनं|गेह]]
[[Category:बुद्धसासनं अभिपूजनट्ठानानि|गेह]]
nwyudhf4zprgps5hjfz8ep2egoxmg0i
विभाग:जेय्यापूर महादेसिय विज्जालयानि
14
7689
104574
2026-10-05T07:45:18Z
咽頭べさ
6149
Created page with "[[Category:जेय्यापूरमहादेसो|तक्कसिलाये]] [[Category:मरम्मरट्ठिकतक्कसिलायो च निगमकोलियो]]"
104574
wikitext
text/x-wiki
[[Category:जेय्यापूरमहादेसो|तक्कसिलाये]]
[[Category:मरम्मरट्ठिकतक्कसिलायो च निगमकोलियो]]
2s7jhs6a90qe3hygcivmhr6yehlptra
विभाग:मरम्मरट्ठिकतक्कसिलायो च निगमकोलियो
14
7690
104575
2026-10-05T07:49:02Z
咽頭べさ
6149
Created page with "{{cat main|मरम्मरट्ठिय विज्जालयकोलिचा}} {{commonscat|Higher education institutions in Myanmar}} [[Category:မြमरम्मरट्ठस्स सिक्खा|विज्जालया च कोलिचा]] [[Category:आस्ह्यय महादीपे विज्जालया च कोलेचा]] [[Category:रट्ठानुरूपं विज्जालया च कोलिचा]]"
104575
wikitext
text/x-wiki
{{cat main|मरम्मरट्ठिय विज्जालयकोलिचा}}
{{commonscat|Higher education institutions in Myanmar}}
[[Category:မြमरम्मरट्ठस्स सिक्खा|विज्जालया च कोलिचा]]
[[Category:आस्ह्यय महादीपे विज्जालया च कोलेचा]]
[[Category:रट्ठानुरूपं विज्जालया च कोलिचा]]
q6geu4a8z0ex4lh2lzvzfdzs8sm8qfg
104576
104575
2026-10-05T07:49:15Z
咽頭べさ
6149
104576
wikitext
text/x-wiki
{{cat main|मरम्मरट्ठिय विज्जालयकोलिचा}}
{{commonscat|Higher education institutions in Myanmar}}
[[Category:मरम्मरट्ठस्स सिक्खा|विज्जालया च कोलिचा]]
[[Category:आस्ह्यय महादीपे विज्जालया च कोलेचा]]
[[Category:रट्ठानुरूपं विज्जालया च कोलिचा]]
h7fvj5itvup5rd8et5herdyxjzorf27
विभाग:मरम्मरट्ठे बुद्धसासनं
14
7691
104577
2026-10-05T07:53:21Z
咽頭べさ
6149
Created page with "{{cat main}} {{Commonscat|Buddhism in Myanmar}} [[Category:मरम्मरट्ठिकासासनं|बुद्धसासनं]] [[Category:रट्ठानुसारी बुद्धसासनं]]"
104577
wikitext
text/x-wiki
{{cat main}}
{{Commonscat|Buddhism in Myanmar}}
[[Category:मरम्मरट्ठिकासासनं|बुद्धसासनं]]
[[Category:रट्ठानुसारी बुद्धसासनं]]
p1d40t1gmut8c9g5y6oicezn27ywjmx
विभाग:रट्ठानुसारी बुद्धसासनं
14
7692
104578
2026-10-05T07:55:30Z
咽頭べさ
6149
Created page with "{{cat main}} {{Commonscat|Buddhism by country}} [[Category: नानारट्ठेसु सासनानि|बुद्धसासनं]] [[Category:बुद्धसासनं| ]]"
104578
wikitext
text/x-wiki
{{cat main}}
{{Commonscat|Buddhism by country}}
[[Category: नानारट्ठेसु सासनानि|बुद्धसासनं]]
[[Category:बुद्धसासनं| ]]
4xqn1x0g6brs9kaswz4vojji3w8g8ca
Module:Infobox dim
828
7693
104579
2026-10-05T07:57:33Z
咽頭べさ
6149
Created page with "require('strict') local getArgs = require('Module:Arguments').getArgs local p = {} local log2 = 0.693147181 local ppm = 1000/0.3 -- pixels per meter, from 0.3 mm / pixel from https://wiki.openstreetmap.org/wiki/Zoom_levels -- To convert to OSM zoom level, we need to know meters per pixel at zoom level 9 -- On the equator, it's 305.748 meters/pixel according to https://wiki.openstreetmap.org/wiki/Zoom_levels -- This quantity depends on the latitude (which we usually do..."
104579
Scribunto
text/plain
require('strict')
local getArgs = require('Module:Arguments').getArgs
local p = {}
local log2 = 0.693147181
local ppm = 1000/0.3 -- pixels per meter, from 0.3 mm / pixel from https://wiki.openstreetmap.org/wiki/Zoom_levels
-- To convert to OSM zoom level, we need to know meters per pixel at zoom level 9
-- On the equator, it's 305.748 meters/pixel according to https://wiki.openstreetmap.org/wiki/Zoom_levels
-- This quantity depends on the latitude (which we usually don't have easy access to)
-- Instead, we'll be correct at 38 degrees N, given en-WP bias towards NA and Europe
-- 38N was chosen because:
-- * It's the furthest north where scale=100000 maps to zoom=12
-- * One hemisphere (20000km) maps to zoom=1
local mppl9Equator = 305.748
-- Convert from Geohack's scale to OSM style zoom levels as used by <maplink>
local function geohackScaleToMapZoom(scale,latitude)
scale = tonumber(scale)
if not scale or scale <= 0 then return end
latitude = latitude or 38
local mppl9 = mppl9Equator*math.cos(math.rad(latitude))
return math.log(mppl9*ppm/scale)/log2 + 9
end
-- compute the viewport size (on screen) in meters, assuming ppm pixels per meter on screen
local function computeViewport(args)
local viewport_cm = tonumber(args.viewport_cm)
local viewport_px = tonumber(args.viewport_px)
return viewport_cm and viewport_cm / 100 or viewport_px and viewport_px / ppm
or tonumber(args.default_viewport) or 0.1
end
-- convert from geohack dim (knowing the viewpoint size on screen) to geohack scale
local function geohackDimToScale(dim, args)
dim = tonumber(dim)
args = args or {}
if not dim or dim <= 0 then return end
local units = args.units
if units and string.lower(units) == 'km' then
dim = dim*1000
end
return dim / computeViewport(args)
end
-- inverse of above function, returning dim in km
local function geohackScaleToDim(scale, args)
scale = tonumber(scale)
args = args or {}
if not scale or scale <= 0 then return end
return scale * computeViewport(args) * 1e-3
end
local oddShape = 2.09 --- length/sqrt(area) of Boston (to choose an example)
-- Convert from Geohack's types to Geohack dim
local function geohackTypeToDim(args)
local t = args.type
if not t then return end
local typeDim = mw.loadData('Module:Infobox_dim/data')
local dim = typeDim[t]
local population = tonumber(args.population)
if t == 'city' and population and population > 0 then
-- assume city is a circle with density of 1000/square kilometer
-- compute diameter, in meters. Then multiply by oddShape to account for weird shapes
dim = 35.68e-3*math.sqrt(population)*oddShape
-- don't zoom in too far
if dim < 5 then
dim = 5
end
end
return dim
end
-- Convert from dimension of object to Geohack dim
local function computeDim(length,width,area)
if length and width then
return math.max(length,width)
end
if length then return length end
if width then return width end
if area then return oddShape*math.sqrt(area) end
end
-- compute geohack dim from unit arguments (e.g., length_mi)
local function convertDim(args)
local length = args.length_mi and 1.60934*args.length_mi or args.length_km
local width = args.width_mi and 1.60934*args.width_mi or args.width_km
local area = args.area_acre and 0.00404686*args.area_acre or
args.area_ha and 0.01*args.area_ha or
args.area_mi2 and 2.58999*args.area_mi2 or args.area_km2
local dim = computeDim(length, width, area)
return dim
end
local function computeScale(args)
if args.scale then return args.scale end
local dim, units, scale
if args.dim then
dim, units = mw.ustring.match(args.dim,"^([-%d%.]+)%s*(%D*)")
args.units = units
args.default_viewport = 0.1 -- default geohack viewpoirt
scale = geohackDimToScale(dim, args)
end
if not scale then
dim = convertDim(args) or geohackTypeToDim(args)
args.units = 'km'
args.default_viewport = 0.2 --- when object dimensions or type is specified, assume 20cm viewport
scale = dim and geohackDimToScale(dim, args)
end
if not scale then return end
scale = math.floor(scale+0.5)
-- keep scale within sane bounds (OSM zoom levels 1-17)
if scale < 1600 then
scale = 1600
end
if scale > 200e6 then
scale = 200e6
end
return scale
end
-- Argument checking
local positiveNumericArgs = {viewport_cm=true,viewport_px=true,length_mi=true,length_km=true,
width_mi=true,width_km=true,area_mi2=true,area_km2=true,
area_acre=true,area_ha=true,scale=true,population=true}
local function cleanArgs(args)
local clean = {}
if type(args) == 'table' then
for k, v in pairs(args) do
if positiveNumericArgs[k] then
v = v and mw.ustring.gsub(v,",","") -- clean out any commas
v = tonumber(v) -- ensure argument is numeric
if v and v <= 0 then -- if non-positive, ignore value
v = nil
end
end
clean[k] = v
end
end
return clean
end
-- Module entry points
function p._dim(args)
args = cleanArgs(args)
if args.dim then return args.dim end
-- compute scale for geohack
local scale = args.scale
local dim
if not scale then
args.default_viewport = 0.2 -- when specifying a object dimension or type, assume output spans 20cm
dim = convertDim(args) or geohackTypeToDim(args)
args.units = 'km'
scale = dim and geohackDimToScale(dim, args)
end
-- reset back to 10cm viewport for correct geohack dim output
args.viewport_cm = 10
dim = scale and geohackScaleToDim(scale, args)
return dim and tostring(math.floor(dim+0.5))..'km'
end
function p._scale(args)
args = cleanArgs(args)
return computeScale(args)
end
function p._zoom(args)
args = cleanArgs(args)
args.viewport_px = args.viewport_px or 200 --- viewport for Kartographer is 200px high
local scale = computeScale(args)
if scale then
local latitude = tonumber(args.latitude)
latitude = latitude and (latitude > 70 and 70 or latitude < -70 and -70 or latitude)
local zoom = geohackScaleToMapZoom(scale,latitude)
return zoom and math.floor(zoom)
end
end
-- Template entry points
function p.dim(frame)
return p._dim(getArgs(frame)) or ''
end
function p.scale(frame)
return p._scale(getArgs(frame)) or ''
end
function p.zoom(frame)
return p._zoom(getArgs(frame)) or ''
end
return p
jy5fyn8gcmhd8ajqw0ljt5qgmzyo4hz
Module:Infobox dim/data
828
7694
104580
2026-10-05T07:58:55Z
咽頭べさ
6149
Created page with "local typeToDim = { -- typical size of object (in km) country = 2000, satellite = 2000, state = 600, adm1st = 200, adm2nd = 60, adm3rd = 20, city = 20, isle = 20, mountain = 20, river = 20, waterbody = 20, event = 10, forest = 10, glacier = 10, airport = 6, landmark = 2, railwaystation = 2, edu = 2, pass = 2, camera = 2 } return typeToDim"
104580
Scribunto
text/plain
local typeToDim = { -- typical size of object (in km)
country = 2000,
satellite = 2000,
state = 600,
adm1st = 200,
adm2nd = 60,
adm3rd = 20,
city = 20,
isle = 20,
mountain = 20,
river = 20,
waterbody = 20,
event = 10,
forest = 10,
glacier = 10,
airport = 6,
landmark = 2,
railwaystation = 2,
edu = 2,
pass = 2,
camera = 2
}
return typeToDim
q8gk4m0g59kpt1szm28fnnl9cyh4rhi