Module:Navbar
- Afrikaans
- Alemannisch
- Алтай тил
- አማርኛ
- Anarâškielâ
- Аԥсшәа
- العربية
- Aragonés
- অসমীয়া
- Asturianu
- Авар
- Azərbaycanca
- تۆرکجه
- Basa Bali
- Bamanankan
- বাংলা
- Banjar
- 閩南語 / Bân-lâm-gí
- Basa Banyumasan
- Башҡортса
- Беларуская
- Беларуская (тарашкевіца)
- भोजपुरी
- Bikol Central
- Bislama
- Български
- བོད་ཡིག
- Bosanski
- Brezhoneg
- Буряад
- Català
- Чӑвашла
- Cebuano
- Čeština
- Chamoru
- Chavacano de Zamboanga
- ChiShona
- ChiTumbuka
- Corsu
- Cymraeg
- Dagbanli
- Dansk
- الدارجة
- Davvisámegiella
- Deutsch
- डोटेली
- Eesti
- Ελληνικά
- Español
- Esperanto
- Euskara
- Eʋegbe
- فارسی
- Fiji Hindi
- Føroyskt
- Français
- Frysk
- Gaeilge
- Gaelg
- Galego
- 贛語
- گیلکی
- ગુજરાતી
- गोंयची कोंकणी / Gõychi Konknni
- 客家語 / Hak-kâ-ngî
- 한국어
- Hausa
- Hawaiʻi
- Հայերեն
- हिन्दी
- Hrvatski
- Bahasa Hulontalo
- Ido
- Igbo
- Ilokano
- Bahasa Indonesia
- Interlingua
- Interlingue
- Ирон
- IsiXhosa
- Íslenska
- Italiano
- עברית
- Jawa
- ಕನ್ನಡ
- ქართული
- Қазақша
- Kernowek
- Ikirundi
- Kiswahili
- Kongo
- Kurdî
- Ladin
- Ladino
- ລາວ
- Latgaļu
- Latina
- Latviešu
- Lëtzebuergesch
- Lietuvių
- Lingua Franca Nova
- Luganda
- Magyar
- Madhurâ
- मैथिली
- Македонски
- Malagasy
- മലയാളം
- Malti
- Māori
- मराठी
- مصرى
- ဘာသာမန်
- مازِرونی
- Bahasa Melayu
- Minangkabau
- 閩東語 / Mìng-dĕ̤ng-ngṳ̄
- Mirandés
- Мокшень
- Монгол
- မြန်မာဘာသာ
- Na Vosa Vakaviti
- Nederlands
- नेपाली
- नेपाल भाषा
- 日本語
- Нохчийн
- Norsk bokmål
- Norsk nynorsk
- Occitan
- ଓଡ଼ିଆ
- Oʻzbekcha / ўзбекча
- ਪੰਜਾਬੀ
- पालि
- Pälzisch
- Pangasinan
- پنجابی
- ပအိုဝ်ႏဘာႏသာႏ
- Papiamentu
- پښتو
- Patois
- Перем коми
- Tok Pisin
- Polski
- Português
- Qırımtatarca
- Română
- Runa Simi
- Русский
- Саха тыла
- Sakizaya
- संस्कृतम्
- ᱥᱟᱱᱛᱟᱲᱤ
- سرائیکی
- Scots
- Setswana
- සිංහල
- Simple English
- سنڌي
- Slovenčina
- Slovenščina
- کوردی
- Српски / srpski
- Srpskohrvatski / српскохрватски
- Suomi
- Tagalog
- தமிழ்
- Taclḥit
- Taqbaylit
- Татарча / tatarça
- တႆး
- తెలుగు
- Tetun
- ไทย
- Thuɔŋjäŋ
- Тоҷикӣ
- Türkçe
- Türkmençe
- Тыва дыл
- Українська
- اردو
- ئۇيغۇرچە / Uyghurche
- Vèneto
- Tiếng Việt
- Volapük
- Wayuunaiki
- 文言
- Winaray
- 吴语
- Yorùbá
- 粵語
- Zazaki
- 中文
- Batak Mandailing
- Dagaare
- Igala
- Kumoring
- Руски
- ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ
- Tolışi
Appearance
From Wikipedia, the free encyclopedia
[画像:Warning] This Lua module is used in system messages, and on approximately 5,090,000 pages, or roughly 8% of all pages.
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them.
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them.
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
Page protected This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
This module depends on the following other modules:
This is a Lua implementation of {{Navbar }}. It is used in Module:Navbox.
The above documentation is transcluded from Module:Navbar/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Subpages of this module.
localp={} localcfg=mw.loadData('Module:Navbar/configuration') localfunctionget_title_arg(is_collapsible,template) localtitle_arg=1 ifis_collapsiblethentitle_arg=2end iftemplatethentitle_arg='template'end returntitle_arg end localfunctionchoose_links(template,args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. localshow={true,true,true,false,false,false} iftemplatethen show[2]=false show[3]=false localindex={t=2,d=2,e=3,h=4,m=5,w=6, talk=2,edit=3,hist=4,move=5,watch=6} -- TODO: Consider removing TableTools dependency. for_,vinipairs(require('Module:TableTools').compressSparseArray(args))do localnum=index[v] ifnumthenshow[num]=trueend end end localremove_edit_link=args.noedit ifremove_edit_linkthenshow[3]=falseend returnshow end localfunctionadd_link(link_description,ul,is_mini,font_style) locall iflink_description.urlthen l={'[','',']'} else l={'[[','|',']]'} end ul:tag('li') :addClass('nv-'..link_description.full) :wikitext(l[1]..link_description.link..l[2]) :tag(is_miniand'abbr'or'span') :attr('title',link_description.html_title) :cssText(font_style) :wikitext(is_miniandlink_description.miniorlink_description.full) :done() :wikitext(l[3]) :done() end localfunctionmake_list(title_text,has_brackets,displayed_links,is_mini,font_style) localtitle=mw.title.new(mw.text.trim(title_text),cfg.title_namespace) ifnottitlethen error(cfg.invalid_title..title_text) end localtalkpage=title.talkPageTitleandtitle.talkPageTitle.fullTextor'' -- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... locallink_descriptions={ {['mini']='v',['full']='view',['html_title']='View this template', ['link']=title.fullText,['url']=false}, {['mini']='t',['full']='talk',['html_title']='Discuss this template', ['link']=talkpage,['url']=false}, {['mini']='e',['full']='edit',['html_title']='Edit this template', ['link']='Special:EditPage/'..title.fullText,['url']=false}, {['mini']='h',['full']='hist',['html_title']='History of this template', ['link']='Special:PageHistory/'..title.fullText,['url']=false}, {['mini']='m',['full']='move',['html_title']='Move this template', ['link']=mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText),['url']=true}, {['mini']='w',['full']='watch',['html_title']='Watch this template', ['link']=title:fullUrl('action=watch'),['url']=true} } localul=mw.html.create('ul') ifhas_bracketsthen ul:addClass(cfg.classes.brackets) :cssText(font_style) end fori,_inipairs(displayed_links)do ifdisplayed_links[i]thenadd_link(link_descriptions[i],ul,is_mini,font_style)end end returnul:done() end functionp._navbar(args) -- TODO: We probably don't need both fontstyle and fontcolor... localfont_style=args.fontstyle localfont_color=args.fontcolor localis_collapsible=args.collapsible localis_mini=args.mini localis_plain=args.plain localcollapsible_class=nil ifis_collapsiblethen collapsible_class=cfg.classes.collapsible ifnotis_plainthenis_mini=1end iffont_colorthen font_style=(font_styleor'')..'; color: '..font_color..';' end end localnavbar_style=args.style localdiv=mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class)-- we made the determination earlier :cssText(navbar_style) ifis_minithendiv:addClass(cfg.classes.mini)end localbox_text=(args.textorcfg.box_text)..' ' -- the concatenated space guarantees the box text is separated ifnot(is_minioris_plain)then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end localtemplate=args.template localdisplayed_links=choose_links(template,args) localhas_brackets=args.brackets localtitle_arg=get_title_arg(is_collapsible,template) localtitle_text=args[title_arg]or(':'..mw.getCurrentFrame():getParent():getTitle()) locallist=make_list(title_text,has_brackets,displayed_links,is_mini,font_style) div:node(list) ifis_collapsiblethen localtitle_text_class ifis_minithen title_text_class=cfg.classes.collapsible_title_mini else title_text_class=cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end localframe=mw.getCurrentFrame() -- hlist -> navbar is best-effort to preserve old Common.css ordering. returnframe:extensionTag{ name='templatestyles',args={src=cfg.hlist_templatestyles} }..frame:extensionTag{ name='templatestyles',args={src=cfg.templatestyles} }..tostring(div:done()) end functionp.navbar(frame) returnp._navbar(require('Module:Arguments').getArgs(frame)) end returnp