Module:Lua banner
- Адыгабзэ
- Afrikaans
- Anarâškielâ
- Аԥсшәа
- العربية
- Արեւմտահայերէն
- অসমীয়া
- Asturianu
- Авар
- Azərbaycanca
- تۆرکجه
- Basa Bali
- বাংলা
- 閩南語 / Bân-lâm-gí
- Беларуская
- Беларуская (тарашкевіца)
- भोजपुरी
- Bikol Central
- Български
- Català
- Cebuano
- Chamoru
- Chavacano de Zamboanga
- Chi-Chewa
- ChiTumbuka
- Corsu
- Cymraeg
- Dansk
- الدارجة
- Eesti
- Ελληνικά
- Euskara
- فارسی
- Fiji Hindi
- Føroyskt
- Galego
- 贛語
- ગુજરાતી
- गोंयची कोंकणी / Gõychi Konknni
- 客家語 / Hak-kâ-ngî
- 한국어
- Hawaiʻi
- Հայերեն
- हिन्दी
- Hrvatski
- Ido
- Ilokano
- Bahasa Indonesia
- Íslenska
- Jawa
- ಕನ್ನಡ
- ქართული
- Kernowek
- Ikirundi
- Kurdî
- Latgaļu
- Latviešu
- Lietuvių
- Li Niha
- Magyar
- मैथिली
- Македонски
- മലയാളം
- Māori
- मराठी
- مصرى
- ဘာသာမန်
- Bahasa Melayu
- Mfantse
- Minangkabau
- 閩東語 / Mìng-dĕ̤ng-ngṳ̄
- Mirandés
- Мокшень
- Монгол
- မြန်မာဘာသာ
- Nederlands
- नेपाली
- नेपाल भाषा
- 日本語
- ߒߞߏ
- Norsk bokmål
- Norsk nynorsk
- Occitan
- ଓଡ଼ିଆ
- Oʻzbekcha / ўзбекча
- ਪੰਜਾਬੀ
- ပအိုဝ်ႏဘာႏသာႏ
- پښتو
- Português
- Qaraqalpaqsha
- Qırımtatarca
- Română
- Sakizaya
- Gagana Samoa
- संस्कृतम्
- ᱥᱟᱱᱛᱟᱲᱤ
- Scots
- Setswana
- Shqip
- සිංහල
- Simple English
- سنڌي
- Slovenščina
- کوردی
- Српски / srpski
- Srpskohrvatski / српскохрватски
- Sunda
- Suomi
- தமிழ்
- တႆး
- తెలుగు
- ไทย
- Thuɔŋjäŋ
- Тоҷикӣ
- Türkçe
- Türkmençe
- Українська
- اردو
- Tiếng Việt
- 文言
- Winaray
- 吴语
- Yorùbá
- 粵語
- Zazaki
- 中文
- Jaku Iban
- Kumoring
- Руски
- ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ
Appearance
From Wikipedia, the free encyclopedia
Warning This Lua module is used on approximately 11,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them.
This module depends on the following other modules:
This module implements the {{lua }} template.
Usage from wikitext
This module cannot be used directly from wikitext. It can only be used through the {{lua }} template. Please see the template page for documentation.
Usage from Lua modules
To use this module from other Lua modules, first load the module.
localmLuaBanner=require('Module:Lua banner')
You can then generate a side box using the _main function.
mLuaBanner._main(args)
The args variable should be a table containing the arguments to pass to the module. To see the different arguments that can be specified and how they affect the module output, please refer to the {{lua }} template documentation.
Tracking category
The above documentation is transcluded from Module:Lua banner/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit) pages.
Subpages of this module.
-- This module implements the {{lua}} template. localyesno=require('Module:Yesno') localmList=require('Module:List') localmTableTools=require('Module:TableTools') localmMessageBox=require('Module:Message box') localp={} functionp.main(frame) localorigArgs=frame:getParent().args localargs={} fork,vinpairs(origArgs)do v=v:match('^%s*(.-)%s*$') ifv~=''then args[k]=v end end returnp._main(args) end functionp._main(args) localmodules=mTableTools.compressSparseArray(args) localbox=p.renderBox(modules) localtrackingCategories=p.renderTrackingCategories(args,modules) returnbox..trackingCategories end functionp.renderBox(modules) localboxArgs={} if#modules<1then boxArgs.text='<strong class="error">Error: no modules specified</strong>' else localmoduleLinks={} fori,moduleinipairs(modules)do moduleLinks[i]=string.format('[[:%s]]',module) localmaybeSandbox=mw.title.new(module..'/sandbox') ifmaybeSandboxandmaybeSandbox.existsthen moduleLinks[i]=moduleLinks[i]..string.format(' ([[:%s|sandbox]])',maybeSandbox.fullText) end end localmoduleList=mList.makeList('bulleted',moduleLinks) localtitle=mw.title.getCurrentTitle() iftitle.subpageText=="doc"then title=title.basePageTitle end iftitle.contentModel=="Scribunto"then boxArgs.text='This module depends on the following other modules:'..moduleList else boxArgs.text='This template uses [[Wikipedia:Lua|Lua]]:\n'..moduleList end end boxArgs.type='notice' boxArgs.small=true boxArgs.image='[[File:Lua-Logo.svg|30px|alt=|link=]]' returnmMessageBox.main('mbox',boxArgs) end functionp.renderTrackingCategories(args,modules,titleObj) ifyesno(args.nocat)then return'' end localcats={} -- Error category if#modules<1then cats[#cats+1]='Lua templates with errors' end -- Lua templates category titleObj=titleObjormw.title.getCurrentTitle() localsubpageBlacklist={ doc=true, sandbox=true, sandbox2=true, testcases=true } ifnotsubpageBlacklist[titleObj.subpageText]then localprotCatName iftitleObj.namespace==10then localcategory=args.category ifnotcategorythen localcategories={ ['Module:String']='Templates based on the String Lua module', ['Module:Math']='Templates based on the Math Lua module', ['Module:BaseConvert']='Templates based on the BaseConvert Lua module', ['Module:Citation/CS1']='Templates based on the Citation/CS1 Lua module' } category=modules[1]andcategories[modules[1]] category=categoryor'Lua-based templates' end cats[#cats+1]=category protCatName="Templates using under-protected Lua modules" elseiftitleObj.namespace==828then protCatName="Modules depending on under-protected modules" end ifnotargs.noprotcatandprotCatNamethen localprotLevels={ autoconfirmed=1, extendedconfirmed=2, templateeditor=3, sysop=4 } localcurrentProt iftitleObj.id~=0then -- id is 0 (page does not exist) if am previewing before creating a template. currentProt=titleObj.protectionLevels["edit"][1] end ifcurrentProt==nilthencurrentProt=0elsecurrentProt=protLevels[currentProt]end fori,moduleinipairs(modules)do ifmodule~="WP:libraryUtil"then localmoduleTitle=mw.title.new(module) localmoduleProt=moduleTitleandmoduleTitle.protectionLevels["edit"][1] ifmoduleProt==nilthenmoduleProt=0elsemoduleProt=protLevels[moduleProt]end ifmoduleProt<currentProtthen cats[#cats+1]=protCatName break end end end end end fori,catinipairs(cats)do cats[i]=string.format('[[Category:%s]]',cat) end returntable.concat(cats) end returnp