User:Mtew/Documents/TOC framework
General, Talk, Projects, Documents, Special Pages, TOC
The '/TOC' framework[edit]
The '/TOC' framework is a method for building a distributed Table Of Contents.
Introduction[edit]
The distributed table of contents is based on the hierarchy of WIKI sub-pages. The table of contents consists of a series of links at the top of the page that look something like the tabs on file folders. There are rows of links for each level in the WIKI sub-page hierarchy. The levels in the hierarchy are separated by blank lines.
Each level has links to all the indexed pages on that level. The link that is currently active at each level in the hierarchy is highlighted. The other links at that level of the hierarchy are muted.
Usage[edit]
There are two kinds of pages in the hierarchy:
- Branch pages – pages that have sub-pages of their own.
- Leaf pages – pages the do not have sub-pages.
What makes the framework useful is that each contents page needs only a single line of WIKI code to display the entire relevant table of contents. That line's contents depends only on whether a page is a branch page or a leaf page. Each line is very generic and does not have to be changes if a page (and its sub pages) are moved to a different point in the page hierarchy.
Content page requirements[edit]
Each content page that is to display the table of contents should start with one or the other of the following lines. The necessary line is:
- Leaf pages
- {{{{NAMESPACE}}:{{BASEPAGENAME}}/TOC}}
- Branch page
- {{{{FULLPAGENAME}}/TOC|level=/TOC}}
Table of content page requirements[edit]
The table of content (TOC) pages have a more complex structure. Because they are not content pages, they are not always linked to in any of the normal table of contents tabs. Without such links, it is difficult to get to the TOC pages when revisions are needed. For this reason, TOC pages have a header that is not displayed as part of the table of contents; Instead, it explains the purpose of the page and lists all the TOC pages so they can be quickly accessed; After the header, the table of contents of the parent page is displayed and then the links to the indexed sub-pages are displayed.
If the page hierarchy is under active development, it is often convenient to include the TOC page in the links.
A TOC page will typically have the form:
<noinclude>{{TOC index page}}
==Purpose==
This page is used to make the tabs consistent on all description pages.
==Code==
</noinclude>{{{{#rel2abs:{{FULLPAGENAME}}{{{level|}}}/../../TOC}}|level={{{level|}}}/..|ns={{{ns|{{NAMESPACE}}}}}}}
code to display links to the indexed sub-pages
TOC index page requirements[edit]
The TOC index page consists of two parts.
The first part is a normal contents page, complete with a normal leaf page header line; The header is followed by a DPL report listing all '/TOC' pages.
The second part is not included in /TOC pages (by using <noinclude>...</noinclude>). A description of or reference to the documentation of the '/TOC' framework belongs in this part of the TOC index page.
See also[edit]
- [[Template:Folder tab/DOC]].
Work items/Questions[edit]
- Can '|level=/TOC' be removed from the branch page header line?
- The restructuring of 'Folder Tabs' may have an impact on this.
- How should discussion pages (or other cross name space connections) be handled?