Index tables
a generated table over a named set of pages, with their subtitles and the pages beneath each
Draft — not approved yet.
A page can carry a table of other pages that the build writes from those pages themselves.[1] It differs from the member table described on Families in what it lists: a family is a page and its children, and an index is any set of pages a pattern names.[1] A wiki whose index follows its tree wants the family table; one whose index does not wants this.[1]
Declaring
pages names the pages to list and columns what each row shows, and {index-table} marks where the
table goes.[1] Both go after the last ordinary key, or the keys below them are read as part of
the index.[1]
[index]
pages = "area/*"
total = true
columns = [
{ heading = "Subject", field = "subtitle" },
{ heading = "Pages", count = true },
]
A pattern names addresses under pages: * stops at a / and ** does not, so area/* lists the
pages directly under area and area/** lists everything beneath it.[2] Several patterns may be
given as a list.[1] A pattern matching no page is refused, because a table that empties itself
after a page moves looks exactly like a table over a set that is empty.[3]
Columns
Each column states a heading and exactly one of three sources.[4]
| Source | Shows |
|---|---|
field |
the listed page's own front matter: subtitle or status[4] |
label |
the value of that infobox label on the listed page, empty where it states none[4] |
count |
how many pages sit beneath the listed page, however deep[4] |
The first cell of every row is the listed page's title, linked, so no column needs to
name it.[5] total = true adds a totals row summing each counted column, and leaves the other
cells empty, because summing what a page happened to write in a cell would invent a number no page
states.[6]
A count is a property of the tree, which no page states and no infobox could carry, and it is the value a writer keeping an index by hand gets wrong first: a page added beneath a listed page changes it.[4]
Writing
The table is written where the marker stands, in the page and in its markdown copy, after the page is
rendered.[5] A marker the build cannot replace, such as one inside a list or an indented block,
is refused, and so is a marker written more than once, a marker with no [index], and an [index] with
no marker.[3]