This is the current revision of this page, as edited by imported>Izno at 00:37, 27 November 2021(sync). The present address (URL) is a permanent link to this version.Revision as of 00:37, 27 November 2021 by imported>Izno(sync)
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.
{{Wikipedia:WikiProject Military history/Military navigation}}
localp={}localNavbox=require('Module:Navbox')localStyles=require('Module:WPMILHIST Infobox style')localfunctionisblank(s)return(nots)ors==''endlocalfunctionisnotblank(s)returnsands~=''endfunctionp.main(frame)localargs={}localpargs=frame:getParent().argslocalsargs={}localtcats=''-- process bodystyle and titlestyleif(pargs['style']or'')=='wide'thenargs['titlestyle']=Styles['nav_box_wide_header']args['bodystyle']=Styles['nav_box_wide']elseargs['titlestyle']=Styles['nav_box_header']if(pargs['border']or'')=='child'or(pargs['border']or'')=='subgroup'thenargs['bodystyle']=Styles['nav_box_child']tcats=tcats..'[[Category:Pages using military navigation subgroups without wide style]]'elseargs['bodystyle']=Styles['nav_box']endendsargs['titlestyle']=1sargs['bodystyle']=1-- process groupstyle, abovestyle, belowstyleargs['groupstyle']=Styles['nav_box_label']..(pargs['groupstyle']or'')sargs['groupstyle']=1args['abovestyle']=Styles['nav_box_label']..(pargs['abovestyle']or'')sargs['abovestyle']=1args['belowstyle']=Styles['nav_box_label']..(pargs['belowstyle']or'')sargs['belowstyle']=1-- process oddstyle, evenstyleargs['oddstyle']=isnotblank(pargs['odd_color'])and('background:'..pargs['odd_color'])ornilsargs['oddstyle']=1args['evenstyle']=isnotblank(pargs['even_color'])and('background:'..pargs['even_color'])ornilsargs['evenstyle']=1-- process name and rawnameargs['name']=(isnotblank(pargs['name'])andpargs['name'])orpargs['rawname']ifisblank(args['name'])thenargs['navbar']='plain'endsargs['name']=1sargs['rawname']=1-- copy the remaining argsfork,vinpairs(pargs)doifvandv~=''andsargs[k]==nilthenargs[k]=vendend-- add allow wrapifargs['title']and(pargs['style']or'')~='wide'thenifnotmw.ustring.match(args['title'],'<span class="wrap">')then-- probably a more efficient way to match 15 or more characterslocalm='[^%[%]<>|][^%[%]<>|][^%[%]<>|][^%[%]<>|][^%[%]<>|]'m=m..m..margs['title']=mw.ustring.gsub(args['title'],'%[%[('..m..'[^%[%]<>|]*)%]%]','[[%1|<span class="wrap">%1</span>]]')args['title']=mw.ustring.gsub(args['title'],'%[%[([^%[%]<>|]*)|('..m..'[^%[%]<>|]*)%]%]','[[%1|<span class="wrap">%2</span>]]')endend-- add navbox-vertical for non-wide formatif(pargs['style']or'')~='wide'thenargs['bodyclass']='navbox-vertical'..(args['bodyclass']and(' '..args['bodyclass'])or'')endreturntcats..Navbox._navbox(args)endreturnp