doctools::i...port::docidx(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– doctools::idx::import::docidx β€” the docidx import plugin πŸ’–

hii bestie, welcome to doctools::idx::import::docidx, straight outta the doctools manual (section n, the Tcl one, you know the vibe) πŸ¦‹


✨ NAME ✨

doctools::idx::import::docidx β€” it's a docidx import plugin, that's the whole job description periodt πŸ’…


🌸 SYNOPSIS 🌸

okay so the whole cast list first, no skips:

package require Tcl 8.5 9

package require doctools::idx::import::docidx ?0.2.1?

package require doctools::idx::parse

package require doctools::idx::structure

package require doctools::msgcat

package require doctools::tcl::parse

package require fileutil

package require logger

package require snit

package require struct::list

package require struct::set

package require struct::stack

package require struct::tree

package require treeql

import string configuration

πŸŽ€ DESCRIPTION πŸŽ€

So this package is the doctools keyword index import plugin whose whole thing is parsing docidx markup ✨

Real talk: this is an internal package of doctools. It's meant to be used by the higher-level management packages that handle keyword indices β€” especially doctools::idx::import, the import manager. That's the intended audience, bestie.

Can you call it from a regular interpreter? Technically... yes. But it's giving contortions 😭 and it is not recommended. The proper way β€” the main character way β€” is to go through the package doctools::idx::import and the import manager objects it hands you. Do that. Trust. 🫢


πŸ’… API πŸ’…

The API this package gives you satisfies the spec of the docidx import plugin API version 2. Iconic of it honestly.

  • import string configuration β€” this command takes the string and parses it as docidx markup that encodes a keyword index, all in the context of the specified configuration (which is a dictionary). What you get back is the canonical serialization of that keyword index, in the form laid out in the section Keyword index serialization format. slay ✨

πŸ¦‹ [DOCIDX] NOTATION OF KEYWORD INDICES πŸ¦‹

So the docidx format for keyword indices β€” also called the docidx markup language β€” is too large to be covered in a single section, no cap. If you're the interested reader (and you are, bestie), start here:

  1. [1] β€” docidx language introduction

and then proceed from there to the formal specifications, aka:

  1. [1] β€” docidx language syntax and
  2. [2] β€” docidx language command reference.

Go through those and you'll have a thorough understanding of the language 🌈


πŸ’– KEYWORD INDEX SERIALIZATION FORMAT πŸ’–

Here we specify the format the doctools v2 packages use to serialize keyword indices as immutable values for transport, comparison, etc. etc. ✨

Important distinction, bestie: we got regular serializations and canonical serializations. A keyword index may have more than one regular serialization β€” but only exactly one of them will be canonical. Only one. πŸ‘‘

🌸 regular serialization 🌸

  1. An index serialization is a nested Tcl dictionary.
  2. This dictionary holds a single key, doctools::idx, and its value. This value holds the contents of the index.
  3. 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.
    • 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 previous item for its definition.
  4. The type of a reference can be one of two values:
    • manpage β€” the identifier of the reference is interpreted as symbolic file name, referring to one of the documents the index was made for.
    • url β€” the identifier of the reference is interpreted as an 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 is exactly what makes it unique among all the possible serializations of the keyword index. That's the whole point, bestie πŸ’…

  1. 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.
  2. 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 😭

ngl, this document β€” and the package it describes β€” will undoubtedly contain bugs and other problems. Please report such in the category doctools of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. And please also report any ideas for enhancements you may have for either the package and/or the documentation. We want them fr fr 🫢

When proposing code changes, please provide unified diffs, i.e. the output of diff -u.

Also note: 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. iykyk ✨

πŸ”₯ KEYWORDS πŸ”₯

deserialization, docidx, doctools, import, index


πŸ‘‘ CATEGORY πŸ‘‘

Text formatter plugin


Copyright (c) 2009-2019 Andreas Kupries <andreas_kupries@users.sourceforge.net>


okay that's the whole page bestie, you ate it πŸ’… this was doctools::i...port::docidx(n) from tcllib, version 0.2.1, and it's giving doctools::i...port::docidx(n) energy all the way through πŸŽ€ bye ily, go parse something πŸ¦‹πŸ’–

πŸ“¦ where this page comes from