Movatterモバイル変換


[0]ホーム

URL:


Содержанийышке куснаш
Википедийэрыкан энциклопедий
Кычалмаш

Модуль:Navbox

Википедий — эрыкан энциклопедий гыч материал
Тӱткӧ лийза! Тидемоткоч чӱчкыдын кучылтмо шаблон (20 тӱжем гана наре кучылталтеш).
Кажне вашталтымаш «Викимедиа» фонд сервер-влакланкугу пашам пуа. Аралыме деч ончыч тендан тӧрлатымаш-влакда чын да тӱрыс улмо шотышто тергыза. Тӧрлатымашдаммодмо верыште да шымлымашлан ыштыме лаштыклаше тергыза.
Кызытсе оптымаш нерген увертарымашымстатистик лаштыкыште, «Паша черет кугытшо» ужашыште ончен кертыда.
Этот модуль относится ккритическим. У него очень много включений или он используется с подстановкой. Из-за опасности вандализма или ошибочного редактирования он был защищён.

Кышкар:Используйте песочницу

Этот модуль используется группой основных навигационных шаблонов —{{Навигационные шаблоны}}. В частности шаблоном{{Навигационная таблица}}. Пожалуйста, просмотрите страницу шаблона, чтобы увидеть инструкцию по его использованию.

Отслеживающие/служебные категории

[кодым тӧрлаташ]

---- Реализует {{Навигаций четлык}} и {{Подгруппы навигационной таблицы}}.-- Основной объём кода заимствован из английского Module:Navbox.--localp={}localgetArgs-- lazily initializedlocalyesno-- lazily initializedlocalargslocalborderlocallistnums={}localODD_EVEN_MARKER='\127_ODDEVEN_\127'localRESTART_MARKER='\127_ODDEVEN0_\127'localREGEX_MARKER='\127_ODDEVEN(%d?)_\127'localmaintitlelocalnamelocalnavigationlocalnavbarlocalabovelocalimagelocalbelowlocaltitlestylelocalgroupstylelocalbodystylelocalbasestylelocalliststylelocalevenodd_VARIABLElocalabovestylelocalbelowstylelocalimageleftlocalimageleftstylelocalstylelocalgroupwidthlocallistpaddinglocalbodyclasslocaltitleclasslocalaboveclasslocalbelowclasslocalgroupclasslocallistclasslocalimageclasslocalfunctionstriped(wikitext)-- Return wikitext with markers replaced for odd/even striping.-- Child (subgroup) navboxes are flagged with a category that is removed-- by parent navboxes. The result is that the category shows all pages-- where a child navbox is not contained in a parent navbox.localorphanCat='[[Категорий:Навигационные шаблоны без родителя]]'ifborder=='subgroup'andargs.orphan~='yes'then-- No change; striping occurs in outermost navbox.returnwikitext..orphanCatendlocalfirst,second='odd','even'ifevenodd_VARIABLEthenifevenodd_VARIABLE=='swap'thenfirst,second=second,firstelsefirst=evenodd_VARIABLEsecond=firstendendlocalchangeriffirst==secondthenchanger=firstelselocalindex=0changer=function(code)ifcode=='0'then-- Current occurrence is for a group before a nested table.-- Set it to first as a valid although pointless class.-- The next occurrence will be the first row after a title-- in a subgroup and will also be first.index=0returnfirstendindex=index+1returnindex%2==1andfirstorsecondendendlocalregex=orphanCat:gsub('([%[%]])','%%%1')return(wikitext:gsub(regex,''):gsub(REGEX_MARKER,changer))-- () omits gsub countendlocalfunctionaddNewline(s)ifs:match('^[*:;#]')ors:match('^{|')thenreturn'\n'..s..'\n'elsereturnsendendlocalfunctionrenderNavBar(titleCell)ifnavbar~='off'andnavbar~='plain'andnot(notnameandmw.getCurrentFrame():getParent():getTitle():gsub('/песочница$','')=='Кышкар:Навигаций четлык')then-- Check color contrast of the gear iconlocalstyleratio=require('Module:Color contrast')._styleratiolocalgearColor=''localcontrastStyle=titlestyleorbasestylelocalgearStyleBlack=(contrastStyleandmw.text.unstripNoWiki(contrastStyle)..'; color:#666;'or'')localgearStyleWhite=(contrastStyleandmw.text.unstripNoWiki(contrastStyle)..'; color:#fff;'or'')ifstyleratio{gearStyleBlack}<styleratio{gearStyleWhite}thengearColor=' white'end--- Gear creationtitleCell:tag('span'):css('float','left'):css('text-align','left'):css('width','5em'):css('margin-right','0.5em'):wikitext('[[Файл:Wikipedia interwiki section gear icon'..gearColor..'.svg|14px|Просмотр этого шаблона|link=Кышкар:'..name..'|alt=⛭]]')endend----   Title row--localfunctionrenderTitleRow(tbl)ifnotmaintitlethenreturnendlocaltitleRow=tbl:tag('tr')ifargs.titlegroupthentitleRow:tag('th'):attr('scope','row'):addClass('navbox-group'):addClass(args.titlegroupclass):cssText(basestyle):cssText(groupstyle):cssText(args.titlegroupstyle):wikitext(args.titlegroup)endlocaltitleCell=titleRow:tag('th'):attr('scope','col')ifargs.titlegroupthentitleCell:css('border-left','2px solid #fdfdfd'):css('width','100%')endlocaltitleColspan=2ifimageleftthentitleColspan=titleColspan+1endifimagethentitleColspan=titleColspan+1endifargs.titlegroupthentitleColspan=titleColspan-1endtitleCell:cssText(basestyle):cssText(titlestyle):addClass('navbox-title'):attr('colspan',titleColspan)renderNavBar(titleCell)titleCell:tag('div'):attr('id',mw.uri.anchorEncode(maintitle)):addClass(titleclass):css('font-size','114%'):css('margin','0 5em'):wikitext(addNewline(maintitle))end----   Above/Below rows--localfunctiongetAboveBelowColspan()localret=2ifimageleftthenret=ret+1endifimagethenret=ret+1endreturnretendlocalfunctionrenderAboveRow(tbl)ifnotabovethenreturnendtbl:tag('tr'):tag('td'):addClass('navbox-abovebelow'):addClass(aboveclass):cssText(basestyle):cssText(abovestyle):attr('colspan',getAboveBelowColspan()):tag('div'):wikitext(addNewline(above))endlocalfunctionrenderBelowRow(tbl)ifnotbelowthenreturnendtbl:tag('tr'):tag('td'):addClass('navbox-abovebelow'):addClass(belowclass):cssText(basestyle):cssText(belowstyle):attr('colspan',getAboveBelowColspan()):tag('div'):wikitext(addNewline(below))end----   List rows--localfunctionhaveSubgroups()fori=1,23doif(args['group'..i]orargs['вуймут'..i]orargs['тӱшка'..i])and(args['list'..i]orargs['лӱмер'..i])thenreturntrueendendreturnfalseendlocalfunctionrenderListRow(tbl,index,listnum)localrow=tbl:tag('tr')ifindex==1andimageleftthenrow:tag('td'):addClass('navbox-image'):addClass(imageclass):css('width','1px'):css('padding','0px 7px 0px 0px'):cssText(imageleftstyle):attr('rowspan',#listnums):tag('div'):wikitext(addNewline(imageleft))endif(args['group'..listnum]orargs['вуймут'..listnum]orargs['тӱшка'..listnum])thenlocalgroupCell=row:tag('th')groupCell:attr('scope','row'):addClass('navbox-group'):addClass(groupclass):cssText(basestyle):css('width',groupwidthor'1px')-- If groupwidth not specified, minimize widthgroupCell:cssText(groupstyle):cssText(args['group'..listnum..'style']orargs['тӱшка_стиль'..listnum]orargs['вуймут_стиль'..listnum]):wikitext(args['group'..listnum]orargs['вуймут'..listnum]orargs['тӱшка'..listnum])endlocallistCell=row:tag('td')if(args['group'..listnum]orargs['вуймут'..listnum]orargs['тӱшка'..listnum])thenlistCell:css('text-align','left'):css('border-left-width','2px'):css('border-left-style','solid')elseifhaveSubgroups()thenlistCell:attr('colspan',2)endendifnotgroupwidththenlistCell:css('width','100%')endlocallistText=args['list'..listnum]orargs['лӱмер'..listnum]localoddEven=ODD_EVEN_MARKERiflistText:sub(1,12)=='</div><table'then-- Assume list text is for a subgroup navbox so no automatic striping for this row.oddEven=listText:find('<th[^>]*"navbox%-title"')andRESTART_MARKERor'odd'endlistCell:css('padding','0px'):cssText(liststyle):cssText(args['list'..listnum..'style']orargs['лӱмер_стиль'..listnum]):addClass('navbox-list'):addClass('navbox-'..oddEven):addClass(listclass):tag('div'):css('padding',args['list'..listnum..'padding']orlistpaddingor'0em 0.25em'):wikitext(addNewline(listText))ifindex==1andimagethenrow:tag('td'):addClass('navbox-image'):addClass(imageclass):css('width','1px'):css('padding','0px 0px 0px 7px'):cssText(imagestyle):attr('rowspan',#listnums):tag('div'):wikitext(addNewline(image))endend----   Tracking categories--localfunctionneedsChangetoSubgroups()fori=1,23doif(args['group'..i]orargs['вуймут'..i]orargs['тӱшка'..i])andnot(args['list'..i]orargs['лӱмер'..i])thenreturntrueendendreturnfalseendlocalfunctionneedsHorizontalLists()ifborder=='subgroup'orargs.tracking=='no'thenreturnfalseendlocallistClasses={['plainlist']=true,['hlist']=true,['hlist hnum']=true,['hlist hwrap']=true,['hlist vcard']=true,['vcard hlist']=true,['hlist vevent']=true,['hlist hlist-items-nowrap']=true,['hlist-items-nowrap']=true,}returnnot(listClasses[listclass]orlistClasses[bodyclass])end-- local function hasBackgroundColors()--return mw.ustring.match(titlestyle or '','background') or mw.ustring.match(groupstyle or '','background') or mw.ustring.match(basestyle or '','background')-- endlocalfunctionisIllegible()localstyleratio=require('Module:Color contrast')._styleratioforkey,styleinpairs(args)doiftostring(key):match("style$")ortostring(key):match("^стиль")thenifstyleratio{mw.text.unstripNoWiki(style)}<4.5thenreturntrueendendendreturnfalseendlocalfunctiongetTrackingCategories()localcats={}ifneedsChangetoSubgroups()thentable.insert(cats,'Навигационные шаблоны с ошибочным использованием заголовков')endifneedsHorizontalLists()thentable.insert(cats,'Навигационные шаблоны без горизонтальных списков')endifisIllegible()thentable.insert(cats,'Потенциально нечитаемые навигационные шаблоны')endreturncatsendlocalfunctionrenderTrackingCategories(builder)localtitle=mw.title.getCurrentTitle()iftitle.namespace~=10thenreturnend-- not in template spacelocalsubpage=title.subpageTextifsubpage=='doc'orsubpage=='песочница'orsubpage=='тесты'thenreturnendfori,catinipairs(getTrackingCategories())dobuilder:wikitext('[[Категорий:'..cat..']]')endend----   Main navbox tables--localfunctionrenderMainTable()localtbl=mw.html.create('table'):addClass('nowraplinks'):addClass(bodyclass)ifmaintitleand(args.state~='plain'andargs.state~='off')thentbl:addClass('collapsible'):addClass(args.stateor'autocollapse')endtbl:css('border-spacing',0)ifborder=='subgroup'orborder=='none'thentbl:addClass('navbox-subgroup'):cssText(bodystyle):cssText(style)else-- regular navbox - bodystyle and style will be applied to the wrapper tabletbl:addClass('navbox-inner'):css('background','transparent'):css('color','inherit')endtbl:cssText(args.innerstyle)renderTitleRow(tbl)renderAboveRow(tbl)fori,listnuminipairs(listnums)dorenderListRow(tbl,i,listnum)endrenderBelowRow(tbl)returntblendfunctionp._navbox(navboxArgs)args=navboxArgsifnotyesnothenyesno=require('Module:Yesno');endfork,vinpairs(args)dolocallistnum=(''..k):match('^list(%d+)$')or(''..k):match('^лӱмер(%d+)$')iflistnumthentable.insert(listnums,tonumber(listnum))endendtable.sort(listnums)border=mw.text.trim(args.borderorargs[1]or'')ifborder=='child'thenborder='subgroup'endmaintitle=args.titleorargs['вуймут']navbar=args.navbarorargs['ссылка_на_просмотр']name=args.nameorargs['лӱм']navigation=yesno(args.navigationorargs['навигаций'],'')above=args.aboveorargs['ӱмбалне']image=args.imageorargs['сӱрет']imagestyle=args.imagestyleorargs['сӱрет_стиль']imageleft=args.imageleftorargs['сӱрет2']orargs['изображение_слева']imageleftstyle=args.imageleftstyleorargs.imagestyle2orargs['стиль_изображения_слева']below=args.beloworargs['ӱлнӧ']titlestyle=args.titlestyleorargs['тӱҥ_вуймутын_стильже']orargs['вуймут_стиль']groupstyle=args.groupstyleorargs['вуймут_стиль']orargs['тӱшка-влак_стиль']bodystyle=args.bodystyleorargs['кап_стиль']basestyle=args.basestyleorargs['стиль_базовый']orargs['стиль']style=args.styleliststyle=args.liststyleorargs['лӱмер-влак_стиль']abovestyle=args.abovestyleorargs['стиль_ӱмбалне']belowstyle=args.belowstyleorargs['стиль_ӱлнӧ']evenodd_VARIABLE=args.evenoddorargs['мужыран-влак_мужырдымо-влак']orargs['мужыран-влак_мужырдымо-влак']groupwidth=args.groupwidthorargs['ширина_групп']listpadding=args.listpaddingorargs['отступ_списков']bodyclass=args.bodyclassorargs['кап_класс']titleclass=args.titleclassorargs['вуймут_класс']aboveclass=args.aboveclassorargs['класс_ӱмбалне']belowclass=args.belowclassorargs['класс_ӱлнӧ']groupclass=args.groupclassorargs['тӱшка-влак_класс']listclass=args.listclassorargs['лӱмер_класс']imageclass=args.imageclassorargs['сӱрет_класс']-- render the main body of the navboxlocaltbl=renderMainTable()-- render the appropriate wrapper around the navbox, depending on the border paramlocalres=mw.html.create()ifborder=='none'thenlocalnav=res:tag('div'):attr('role','navigation'):node(tbl)ifmaintitlethennav:attr('aria-labelledby',mw.uri.anchorEncode(maintitle))elsenav:attr('aria-label','Навигаций кышкар')endifnameandname~='-'thennav:attr('data-name',name)endifnavigation==truethennav:attr('data-navboxnavigation','1')elseifnavigation==falsethennav:attr('data-navboxnavigation','0')endelseifborder=='subgroup'then-- We assume that this navbox is being rendered in a list cell of a parent navbox, and is-- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the-- padding being applied, and at the end add a <div> to balance out the parent's </div>res:wikitext('</div>')-- XXX: hack due to lack of unclosed support in mw.html.:node(tbl):wikitext('<div>')-- XXX: hack due to lack of unclosed support in mw.html.elselocalnav=res:tag('div'):attr('role','navigation'):addClass('navbox'):cssText(bodystyle):cssText(style):css('padding','3px'):node(tbl)ifmaintitlethennav:attr('aria-labelledby',mw.uri.anchorEncode(maintitle))elsenav:attr('aria-label','Навигаций кышкар')endifnameandname~='-'thennav:attr('data-name',name)endifnavigation==truethennav:attr('data-navboxnavigation','1')elseifnavigation==falsethennav:attr('data-navboxnavigation','0')endendrenderTrackingCategories(res)returnstriped(tostring(res))endfunctionp.navbox(frame)ifnotgetArgsthengetArgs=require('Module:Arguments').getArgsendifnotyesnothenyesno=require('Module:Yesno');endargs=getArgs(frame,{wrappers={'Кышкар:Навигаций четлык','Кышкар:Подгруппы навигационной таблицы'}})ifframe.args.borderthen-- This allows Template:Navbox_subgroup to use {{#invoke:Navbox|navbox|border=...}}.args.border=frame.args.borderend-- Read the arguments in the order they'll be output in, to make references number in the right order.local__=maintitle_=abovefori=1,23do_=args["group"..tostring(i)]andargs["вуймут"..tostring(i)]andargs["тӱшка"..tostring(i)]_=args["list"..tostring(i)]andargs["лӱмер"..tostring(i)]end_=belowreturnp._navbox(args)endreturnp
"https://mhr.wikipedia.org/w/index.php?title=Модуль:Navbox&oldid=197084" гыч налме
Категорий:

[8]ページ先頭

©2009-2026 Movatter.jp