doctools::t...port::nroff(n)
π doctools::toc::export::nroff(n) π
okay bestie, sit down, hydrate, because we're talking about the nroff export plugin from the Documentation tools manual family. it's an internal lil guy, it does one job, and it does it adorably. let's go π¦
β¨ NAME β¨
doctools::toc::export::nroff β the nroff export plugin. that's it, that's the name, she's lowkey iconic π
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require doctools::toc::export::nroff ?0.3?
package require doctools::text
package require doctools::nroff::man_macros
export serial configuration
look at her. four package requires and one command. minimalist queen π
π DESCRIPTION π
so basically this package implements the doctools table of contents export plugin for generating nroff markup. it takes your ToC and turns it into nroff. slay.
and here's the tea: this is an internal package of doctools. it exists for the higher-level management packages that handle tables of contents β especially doctools::toc::export, the export manager. it's a backstage girly, not a front-of-house girly.
can you use it from a regular interpreter? technically yes. should you? no bestie. it's possible "only with contortions" and it is not recommended. π the proper way to use this functionality is through the package doctools::toc::export and the export manager objects it hands you. periodt.
π API π
the API this package gives you satisfies the spec of the doctoc export plugin API version 2. fancy. certified. no cap.
export serial configurationβ this command takes the canonical serialization of a table of contents (the format is fully specified down in the section ToC serialization format, iykyk), which lives in serial, plus the configuration, which is a dictionary, and it generates nroff markup encoding the table. the created string then gets returned as the result of the command. that's the whole thing. queen of one task π
π CONFIGURATION π
the nroff export plugin recognizes these configuration variables and changes its behaviour based on them. vibe check time:
string userβ this standard config variable holds the name of the user running the process that invoked the export plugin. the plugin puts this info into the provenance comment at the beginning of the generated document. credit where credit is due πstring fileβ this standard config variable holds the name of the file the table of contents came from. β οΈ heads up: this variable may not be set or may contain the empty string. the plugin puts this info into the provenance comment at the beginning of the generated document β but only if it's defined, meaning set and not the empty string. otherwise she simply doesn't mention it. respect.boolean inlineβ if this flag is set (which is the default), the plugin places the definitions of the man macro set directly into the output. if this flag is not set, the plugin places a reference to the definitions of the man macro set into the output instead β but not the macro definitions themselves. choose your fighter π«Ά
π note note note: this plugin ignores the standard configuration variablesformatandmap, and whatever values they carry. they simply do not move her. π
π TOC SERIALIZATION FORMAT π
here's where we specify the format the doctools v2 packages use to serialize tables of contents as immutable values β for transport, comparison, etc. we distinguish between regular and canonical serializations. a table of contents may have more than one regular serialization, but exactly one of them will be canonical. there can only be one main character, and it's the canonical one. β¨
π regular serialization π
- the serialization of any table of contents is a nested Tcl dictionary.
- this dictionary holds a single key,
doctools::toc, and its value. that value holds the contents of the table of contents. - the contents of the table of contents are a Tcl dictionary holding the title of the table of contents, a label, and its elements. the relevant keys and their values are:
titleβ the value is a string containing the title of the table of contents.labelβ the value is a string containing a label for the table of contents.itemsβ the value is a Tcl list holding the elements of the table, in the order they are to be shown.
each element is a Tcl list holding the type of the item and its description, in that order. an alternative way to say it: it's a Tcl dictionary holding a single key β the item type β mapped to the item description.
the two legal item types and their descriptions are:
referenceβ this item describes a single entry in the table of contents, referencing a single document. to that end its value is a Tcl dictionary containing anidfor the referenced document, alabel, and a longer textualdescription which can be associated with the entry. the relevant keys and their values are:idβ the value is a string containing the id of the document associated with the entry.labelβ the value is a string containing a label for this entry. this string also identifies the entry, and no two entries (references and divisions) in the containing list are allowed to have the same label. so no duplicate labels, bestie, the vibes would be off. πdescβ the value is a string containing a longer description for this entry.
divisionβ this item describes a group of entries in the table of contents, inducing a hierarchy of entries. to that end its value is a Tcl dictionary containing a label for the group, an optional id to a document for the whole group, and the list of entries in the group. the relevant keys and their values are:idβ the value is a string containing the id of the document associated with the whole group. this key is optional. she can show up or she can ghost. πlabelβ the value is a string containing a label for the group. this string also identifies the entry, and no two entries (references and divisions) in the containing list are allowed to have the same label.itemsβ the value is a Tcl list holding the elements of the group, in the order they are to be shown. this list has the same structure as the value for the keyworditemsused to describe the whole table of contents β see above. this closes the recursive definition of the structure, with divisions holding the same type of elements as the whole table of contents, including other divisions. yes, it's divisions all the way down, nesting doll energy πͺ
π¦ canonical serialization π¦
the canonical serialization of a table of contents has the format as specified in the previous item, and then additionally satisfies the constraint below, which makes it unique among all the possible serializations of this table of contents:
- 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.
that's the whole glow-up. sorted keys = canonical = the one true serialization. β¨
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. it's giving "we're all just doing our best". so please report them! π«Ά
- report them in the category doctools of the Tcllib Trackers:
http://core.tcl.tk/tcllib/reportlist - also please report any ideas for enhancements you may have for either the package and/or the documentation. we love a glow-up suggestion π
when proposing code changes, please provide unified diffs, i.e. the output of diff -u. no cap, this is the format we need.
π note further that attachments are strongly preferred over inlined patches. you can make an attachment 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. that's the one. click that one. π
β KEYWORDS β
doctools, export, nroff, serialization, table of contents, toc
πΈ CATEGORY πΈ
Text formatter plugin π
π COPYRIGHT π
Copyright (c) 2009-2019 Andreas Kupries <andreas_kupries@users.sourceforge.net>
and that's the whole page bestie, we ate and left no crumbs π this was the tcllib version 0.3 of doctools::toc::export::nroff(n) β mwah, take care of her, she's a little internal diva but she works hard π
β¨π¦
π¦ 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-2019 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