Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Large category TOC

Permanently protected module
From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
Thismodule is rated asready 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 onhelp pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed throughsandbox testing rather than repeated trial-and-error editing.
Page template-protectedThis module is currentlyprotected from editing.
See theprotection policy andprotection log for more details. Please discuss any changes on thetalk page; you maysubmit an edit request to ask anadministrator to make an edit if it isuncontroversial or supported byconsensus. You may alsorequest that this page be unprotected.
WarningThis Lua module is used onapproximately 11,000 pages and changes may be widely noticed. Test changes in the module's/sandbox or/testcases subpages, or in your ownmodule sandbox. Consider discussing changes on thetalk page before implementing them.

Usage

This module implementsTemplate:Large category TOC and similar templates. It is used on categories with many members to provide a means of indexing them by first letter and first two letters

For full lists (Template:Large category TOC):

{{#invoke:Large category TOC|aejot}}

For collapsible lists (Template:Collapsible large category TOC):

{{#invoke:Large category TOC|collapsible}}
The abovedocumentation istranscluded fromModule:Large category TOC/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) and testcases(create) pages.
Subpages of this module.

localp={}localazupper=mw.text.split('ABCDEFGHIJKLMNOPQRSTUVWXYZ','')localazlower=mw.text.split('abcdefghijklmnopqrstuvwxyz','')localaejot=mw.text.split('aejot','')localfunctionmain(toc_type)localtoc_frame=mw.html.create('div'):addClass('large-cat-toc'):addClass('plainlinks'):addClass('toc')-- :attr('id','toc')-- Contains "Content: Top 0-9 A - Z"localheader=toc_frame:tag('div'):attr('class','toctitle')-- Contains all the restlocalbody_wrapperlocalbody=toc_frame:tag('div'):addClass('large-cat-toc-body')localjumpy_collapse=mw.html.create('div'):addClass('large-cat-toc-jumpy-title')iftoc_type=='collapsible'thentoc_frame:addClass('mw-collapsible mw-collapsed')body:addClass('mw-collapsible-content')elseiftoc_type=='scrollable'thentoc_frame:addClass('large-cat-toc-scroll')endlocalpageurl=mw.title.getCurrentTitle():fullUrl()localheader_content={string.format('<span class="large-cat-toc-title">%s:</span> [%s Top] [%s?from=0 0–9]',mw.message.new('Toc'):plain(),pageurl,pageurl)}for_,vinipairs(azupper)dotable.insert(header_content,string.format(' [%s?from=%s %s]',pageurl,v,v))endiftoc_type=='collapsible'thenjumpy_collapse:wikitext(table.concat(header_content))header:node(jumpy_collapse)elseheader:wikitext(table.concat(header_content))endlocalbody_content={}iftoc_type~='collapsible'thentable.insert(body_content,' <span class="large-cat-toc-anum">['..pageurl..'?from=* *]</span>')endtable.insert(body_content,' <span class="large-cat-toc-anum">#</span>')body_wrapper=body:tag('span')fori=0,9dotable.insert(body_content,string.format(' [%s?from=%s %s]',pageurl,i,i))endlocalfunctionatoz(letter)localazlist={}localletterlistiftoc_type=='aejot'thenletterlist=aejotelseletterlist=azlowerendiftoc_type=='aejot'ortoc_type=='scrollable'thentable.insert(azlist,' • <span class="large-cat-toc-anum">'..letter..'</span>')elsetable.insert(azlist,' <br /><span class="large-cat-toc-anum">'..letter..'</span>')endfori,vinipairs(letterlist)dolocallead=(i==1)and'&nbsp;'or' '-- non-breaking space before the first linktable.insert(azlist,string.format('%s[%s?from=%s%s %s%s]',lead,pageurl,letter,v,letter,v))endreturntable.concat(azlist)endfor_,vinipairs(azupper)dotable.insert(body_content,atoz(v))endbody_wrapper:wikitext(table.concat(body_content))return'__NOTOC__\n'..mw.getCurrentFrame():extensionTag{name='templatestyles',args={src='Module:Large category TOC/styles.css'}}..tostring(toc_frame)endfunctionp.scrollable(frame)returnmain('scrollable')endfunctionp.collapsible(frame)returnmain('collapsible')endfunctionp.aejot(frame)returnmain('aejot')endreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Large_category_TOC&oldid=1316959896"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp