doctools::idx::structure(n)
π doctools::idx::structure β the manual page, bestie edition π
okay so this is doctools::idx::structure(n), a manual page from the Documentation tools section, and honestly? it's giving backstage-pass energy. it's the serialization utility corner of the doctools universe and i'm obsessed. let's go π¦
β¨ NAME β¨
doctools::idx::structure β Docidx serialization utilities πΈ
π SYNOPSIS π
package require doctools::idx::structure ?0.2?
package require Tcl 8.5 9
package require logger
package require snit
::doctools::idx::structure verify serial ?canonvar?
::doctools::idx::structure verify-as-canonical serial
::doctools::idx::structure canonicalize serial
::doctools::idx::structure print serial
::doctools::idx::structure merge seriala serialb
π DESCRIPTION π
so this package hands you the commands to work with the serializations of keyword indices β the kind that the doctools system v2 manages, and the kind specified over in the section called Keyword index serialization format. periodt.
and lowkey important: this is an internal package of doctools. it's not the main character, it's the bestie behind the main character β it's there for the higher-level packages that handle keyword indices and convert them into and out of all sorts of other formats, like documents written using docidx markup. π
π API π
::doctools::idx::structure verify serial ?canonvar?
this one does a vibe check on serial. it verifies that the content of serial is a valid regular serialization of a keyword index, and it will throw an error if that is not the case. the result of the command is the empty string.
if you pass the argument canonvar, it gets interpreted as the name of a variable in the calling context. that variable gets written to if and only if serial is a valid regular serialization. its value will be a boolean, where True means the serialization isn't just valid but also canonical, and False gets written for a valid but non-canonical serialization.
for the spec of regular and canonical keyword index serializations, go read the section Keyword index serialization format. iykyk β¨
::doctools::idx::structure verify-as-canonical serial
this one verifies that the content of serial is a valid canonical serialization of a keyword index, and it will throw an error if that is not the case. the result of the command is the empty string.
for the spec of canonical keyword index serializations, see the section Keyword index serialization format.
::doctools::idx::structure canonicalize serial
this command assumes the content of serial is a valid regular serialization of a keyword index β and it will throw an error if that is not the case. no cap, it checks.
then it converts the input into the canonical serialization of the contained keyword index and returns it as its result. and if the input is already canonical? it gets returned unchanged. glow-up not required, bestie was already slaying. π
for the spec of regular and canonical keyword index serializations, see the section Keyword index serialization format.
::doctools::idx::structure print serial
this one assumes the argument serial contains a valid regular serialization of a keyword index, and returns a string containing that index in a human readable form.
the exact format of this form is not specified and cannot be relied on for parsing or other machine-based activities. it's for your eyes only, not your scripts. π
for the spec of regular keyword index serializations, see the section Keyword index serialization format.
::doctools::idx::structure merge seriala serialb
this one accepts the regular serializations of two keyword indices and uses them to create their union. the result of the command is the canonical serialization of this unified keyword index. friendship merger, but for indices. π«Ά
title and label of the resulting index are taken from the index contained in serialb. the set of keys, references and their connections is the union of the set of keys and references of the two inputs.
for the spec of regular and canonical keyword index serializations, see the section Keyword index serialization format.
π KEYWORD INDEX SERIALIZATION FORMAT π
here we specify the format used by the doctools v2 packages to serialize keyword indices as immutable values for transport, comparison, etc. iconic behaviour honestly.
we distinguish between regular and canonical serializations. while a keyword index may have more than one regular serialization, only exactly one of them will be canonical. there can only be one main character. π
regular serialization
- an index serialization is a nested Tcl dictionary.
- this dictionary holds a single key,
doctools::idx, and its value. this value holds the contents of the index. - the contents of the index are a Tcl dictionary holding the title of the index, a label, and the keywords and references. the relevant keys and their values are:
titleβ the value is a string containing the title of the index.labelβ the value is a string containing a label for the index.keywordsβ the value is a Tcl dictionary, using the keywords known to the index as keys. the associated values are lists containing the identifiers of the references associated with that particular keyword.
any reference identifier used in these lists has to exist as a key in the references dictionary, see the next item for its definition. no ghost references, bestie. π
referencesβ the value is a Tcl dictionary, using the identifiers for the references known to the index as keys. the associated values are 2-element lists containing the type and label of the reference, in this order.
any key here has to be associated with at least one keyword, i.e. occur in at least one of the reference lists which are the values in the keywords dictionary, see the previous item for its definition. no lonely references allowed. π
- the type of a reference can be one of two values:
manpageβ the identifier of the reference is interpreted as a symbolic file name, referring to one of the documents the index was made for.urlβ the identifier of the reference is interpreted as a url, referring to some external location, like a website, etc.
canonical serialization
the canonical serialization of a keyword index has the format as specified in the previous item, and then additionally satisfies the constraints below, which make it unique among all the possible serializations of the keyword index.
- the keys found in all the nested Tcl dictionaries are sorted in ascending dictionary order, as generated by Tcl's builtin command
lsort -increasing -dict. - the references listed for each keyword of the index, if any, are listed in ascending dictionary order of their labels, as generated by Tcl's builtin command
lsort -increasing -dict.
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. (they said it, not me, but fr fr.) please report such in the category doctools of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either the package and/or the documentation. we love feedback, it's self-care. π
when proposing code changes, please provide unified diffs, i.e the output of diff -u.
note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. go do the thing. π
β KEYWORDS β
deserialization, docidx, doctools, serialization
π¦ CATEGORY π¦
Documentation tools
πΈ COPYRIGHT πΈ
Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page, bestie!! π this was tcllib version 0.2 of doctools::idx::structure(n), and honestly? slay. go forth and serialize responsibly. mwah π«Άβ¨
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2009 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms