Movatterモバイル変換


[0]ホーム

URL:


Μετάβαση στο περιεχόμενο
Βικιπαίδεια
Αράεμαν

Module:Namespace detect/data

Ασό Βικιπαίδεια
<Module:Namespace detect

Documentation for this module may be created atModule:Namespace detect/data/τεκμηρίωση

----------------------------------------------------------------------------------                          Namespace detect data                             ---- This module holds data for [[Module:Namespace detect]] to be loaded per    ---- page, rather than per #invoke, for performance reasons.                    ----------------------------------------------------------------------------------localcfg=require('Module:Namespace detect/config')localfunctionaddKey(t,key,defaultKey)ifkey~=defaultKeythent[#t+1]=keyendend-- Get a table of parameters to query for each default parameter name.-- This allows wikis to customise parameter names in the cfg table while-- ensuring that default parameter names will always work. The cfg table-- values can be added as a string, or as an array of strings.localdefaultKeys={'main','talk','other','subjectns','demospace','demopage'}localargKeys={}fori,defaultKeyinipairs(defaultKeys)doargKeys[defaultKey]={defaultKey}endfordefaultKey,tinpairs(argKeys)dolocalcfgValue=cfg[defaultKey]localcfgValueType=type(cfgValue)ifcfgValueType=='string'thenaddKey(t,cfgValue,defaultKey)elseifcfgValueType=='table'thenfori,keyinipairs(cfgValue)doaddKey(t,key,defaultKey)endendcfg[defaultKey]=nil-- Free the cfg value as we don't need it any more.endlocalfunctiongetParamMappings()--[[-- Returns a table of how parameter names map to namespace names. The keys-- are the actual namespace names, in lower case, and the values are the-- possible parameter names for that namespace, also in lower case. The-- table entries are structured like this:-- {--   [''] = {'main'},--   ['wikipedia'] = {'wikipedia', 'project', 'wp'},--   ...-- }--]]localmappings={}localmainNsName=mw.site.subjectNamespaces[0].namemainNsName=mw.ustring.lower(mainNsName)mappings[mainNsName]=mw.clone(argKeys.main)mappings['talk']=mw.clone(argKeys.talk)fornsid,nsinpairs(mw.site.subjectNamespaces)doifnsid~=0then-- Exclude main namespace.localnsname=mw.ustring.lower(ns.name)localcanonicalName=mw.ustring.lower(ns.canonicalName)mappings[nsname]={nsname}ifcanonicalName~=nsnamethentable.insert(mappings[nsname],canonicalName)endfor_,aliasinipairs(ns.aliases)dotable.insert(mappings[nsname],mw.ustring.lower(alias))endendendreturnmappingsendreturn{argKeys=argKeys,cfg=cfg,mappings=getParamMappings()}
Ασο "https://pnt.wikipedia.org/w/index.php?title=Module:Namespace_detect/data&oldid=36519"

[8]ページ先頭

©2009-2026 Movatter.jp