Module

PuduLangDocgen.Navigation.Resolve

View source

Tables of contents bound to published pages

Types

Name Description
Links Where a table of contents may point
Candidate A published table of contents competing to govern pages

Functions

Name Description
resolve Items of the table of contents at a project-relative path with every destination made root-relative to the published site. Folder links and links to other tables of contents bring in those items as children.
outputOf The published path of a table of contents: its source path ending in `toc.json`.
governing The table of contents governing a page, or the empty text. Tables that link the page win, lower `order` first and then the nearest folder; otherwise the nearest table in a folder holding the page is used, again preferring lower `order`.
pagesOf Local pages a tree links, without fragments.
trail The items from the top of a tree down to the deepest one linking a page; a group that links its first page yields to that page's own item.
neighbors The pages before and after a page in reading order, when it is listed.
readingOrder Local pages in the order a reader meets them, each listed once.

resolve

fn resolve(path: Str, links: &Links) -> (Array[Docgen.TocItem], Array[Docgen.Diagnostic])

Items of the table of contents at a project-relative path with every destination made root-relative to the published site. Folder links and links to other tables of contents bring in those items as children.

Parameters

path
Str
links
&Links

Returns

(Array[Docgen.TocItem], Array[Docgen.Diagnostic])

View source

outputOf

fn outputOf(path: Str) -> Str

The published path of a table of contents: its source path ending in toc.json.

Parameters

path
Str

Returns

Str

View source

governing

fn governing(page: Str, candidates: &Array[Candidate]) -> Str

The table of contents governing a page, or the empty text. Tables that link the page win, lower order first and then the nearest folder; otherwise the nearest table in a folder holding the page is used, again preferring lower order.

Parameters

page
Str
candidates
&Array[Candidate]

Returns

Str

View source

pagesOf

fn pagesOf(items: &Array[Docgen.TocItem]) -> Array[Str]

Local pages a tree links, without fragments.

Parameters

items
&Array[Docgen.TocItem]

Returns

Array[Str]

View source

trail

fn trail(items: &Array[Docgen.TocItem], page: Str) -> Array[Docgen.TocItem]

The items from the top of a tree down to the deepest one linking a page; a group that links its first page yields to that page's own item.

Parameters

items
&Array[Docgen.TocItem]
page
Str

Returns

Array[Docgen.TocItem]

View source

neighbors

fn neighbors(items: &Array[Docgen.TocItem], page: Str) -> (Option[Docgen.TocItem], Option[Docgen.TocItem])

The pages before and after a page in reading order, when it is listed.

Parameters

items
&Array[Docgen.TocItem]
page
Str

Returns

(Option[Docgen.TocItem], Option[Docgen.TocItem])

View source

readingOrder

fn readingOrder(items: &Array[Docgen.TocItem]) -> Array[Docgen.TocItem]

Local pages in the order a reader meets them, each listed once.

Parameters

items
&Array[Docgen.TocItem]

Returns

Array[Docgen.TocItem]

View source