Expand description
The include module handles generated content (format specification §9).
It finds the regions of a file, chooses the length and language tag of the
code fence around each file-form include, builds the include graph, and
works out the expected content of every generated block.
Structs§
- Definition
Entry - A
DefinitionEntryis one line of a definition block. - Expected
- An
Expectedholds what every generated block should hold. - Extraction
- An
Extractionis the text thatextractreturns, with the line of the file, counted from 1, of each of its lines. - Fenced
- A
Fencedis the source of an include block that holds a file, whole or one region of it, in a fence.
Enums§
- Region
Error - A
RegionErrorreports a region marker that breaks the pairing ofbeginandendmarkers (SOKF_FORMAT_95,SOKF_FORMAT_112), and gives the name of the region and the number of the line.
Functions§
- definition_
pair definition_pairreturns the pair of the definition block of the file atpath, which sokf would write asrenderedand which holdswritten, both read as a part of a Markdown file under the file’s path, or its path with.mdadded where same-same doesn’t read its name as Markdown, such as an additional file/README(CLI-4_AC-112, CLI-4_AC-113).- expected
expectedcomputes the expected content of every generated block.- expected_
for expected_forcomputes the expected content of the generated blocks of the files inonly, or of every file whenonlyisNone. It expands the include targets of those files too. It reads the body of a summarised document from the disk when a file that depends on it needs the body (CACHE-3_AC-1).- extract
extractreturns the lines ofregionintext, or of the whole file whenregionisNone, with every marker line stripped. It returnsOk(None)when no region has that name. It joins regions that share a name in file order.- extract_
lines extract_linesreturns whatextractreturns, with the line of the file of each line of the text.- includes_
body includes_bodysays whether an id-form include oftargetwithfragmentmaterialises the document’s body (SOKF_FORMAT_85, FORMAT-2_AC-5). An include with an empty fragment includes the body of any document, an include with no fragment includes the body of a document that isn’t an asset’s sidecar, and an include with a named fragment never includes the body.- index_
pair index_pairreturns the pair of the index atpath, which sokf would write asexpectedand which holdsactual, both read as a whole Markdown file under the index’s path (CLI-4_AC-113).- knowledge_
of_ additional knowledge_of_additionalreturns the knowledge in which the includes of an additional file resolve: the knowledge of its schema, or else the knowledge that holds the file.- labels_
as_ written labels_as_writtenreturns whether the definition blockwrittenholds the labels ofentriesas sokf writes them, in their order. Markdown matches a label whatever its case, so same-same reads a label written in another case as the same, which no formatter writes, and sokf compares the labels itself (CLI-4_AC-112).- pairs
pairsreturns the pairs of the files inunits, or of every file whenunitsisNone, and of each index inindexes. A block that holds its expected text gives no pair, so a pass whose blocks are current needs no comparison (CLI-4_AC-44).- path_
link_ label path_link_labelreturns the canonical label of a path link inpath, when the link points to a document or an asset of any store. When the fragment is the text of a key, the label uses the key’s slug instead. It also returns whether--fixwrites the label.--fixwrites the label of an inline link when the label resolves (SOKF_VALIDATION_24). It returnsNonefor a link to any other file, for a link that ends with/, which names only a directory (SOKF_FORMAT_157), and for an image link whose target is not an asset.- render_
definitions render_definitionsreturns the text of the definition block forentries, or an empty string when there are no entries.