1doctools::idx::structure(n)   Documentation tools  doctools::idx::structure(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       doctools::idx::structure - Docidx serialization utilities
9

SYNOPSIS

11       package require doctools::idx::structure  ?0.1?
12
13       package require Tcl  8.4
14
15       package require logger
16
17       package require snit
18
19       ::doctools::idx::structure verify serial ?canonvar?
20
21       ::doctools::idx::structure verify-as-canonical serial
22
23       ::doctools::idx::structure canonicalize serial
24
25       ::doctools::idx::structure print serial
26
27       ::doctools::idx::structure merge seriala serialb
28
29______________________________________________________________________________
30

DESCRIPTION

32       This  package provides commands to work with the serializations of key‐
33       word indices as managed by the doctools system  v2,  and  specified  in
34       section Keyword index serialization format.
35
36       This  is  an  internal package of doctools, for use by the higher level
37       packages handling keyword indices and their conversion into and out  of
38       various other formats, like documents written using docidx markup.
39

API

41       ::doctools::idx::structure verify serial ?canonvar?
42              This command verifies that the content of serial is a valid reg‐
43              ular serialization of a keyword index and will throw an error if
44              that  is  not  the  case. The result of the command is the empty
45              string.
46
47              If the argument canonvar is specified it is interpreted  as  the
48              name of a variable in the calling context. This variable will be
49              written to if and only if serial is a valid  regular  serializa‐
50              tion. Its value will be a boolean, with True indicating that the
51              serialization is not only valid, but also canonical. False  will
52              be written for a valid, but non-canonical serialization.
53
54              For the specification of regular and canonical keyword index se‐
55              rializations see the section Keyword index serialization format.
56
57       ::doctools::idx::structure verify-as-canonical serial
58              This command verifies that the content  of  serial  is  a  valid
59              canonical serialization of a keyword index and will throw an er‐
60              ror if that is not the case. The result of the  command  is  the
61              empty string.
62
63              For  the specification of canonical keyword index serializations
64              see the section Keyword index serialization format.
65
66       ::doctools::idx::structure canonicalize serial
67              This command assumes that the content of serial is a valid regu‐
68              lar  serialization of a keyword index and will throw an error if
69              that is not the case.
70
71              It will then convert the input into the canonical  serialization
72              of  the  contained keyword index and return it as its result. If
73              the input is already canonical it will be returned unchanged.
74
75              For the specification of regular and canonical keyword index se‐
76              rializations see the section Keyword index serialization format.
77
78       ::doctools::idx::structure print serial
79              This  command  assumes that the argument serial contains a valid
80              regular serialization of a keyword index and  returns  a  string
81              containing that index in a human readable form.
82
83              The exact format of this form is not specified and cannot be re‐
84              lied on for parsing or other machine-based activities.
85
86              For the specification of regular  keyword  index  serializations
87              see the section Keyword index serialization format.
88
89       ::doctools::idx::structure merge seriala serialb
90              This  command  accepts the regular serializations of two keyword
91              indices and uses them to create their union.  The result of  the
92              command  is  the canonical serialization of this unified keyword
93              index.
94
95              Title and label of the resulting index are taken from the  index
96              contained in serialb. The set of keys, references and their con‐
97              nections is the union of the set of keys and references  of  the
98              two inputs.
99
100              For the specification of regular and canonical keyword index se‐
101              rializations see the section Keyword index serialization format.
102

KEYWORD INDEX SERIALIZATION FORMAT

104       Here we specify the format used by the doctools v2 packages to  serial‐
105       ize keyword indices as immutable values for transport, comparison, etc.
106
107       We  distinguish  between  regular and canonical serializations. While a
108       keyword index may have more than one regular serialization only exactly
109       one of them will be canonical.
110
111       regular serialization
112
113              [1]    An index serialization is a nested Tcl dictionary.
114
115              [2]    This  dictionary  holds  a single key, doctools::idx, and
116                     its value. This value holds the contents of the index.
117
118              [3]    The contents of the index are a  Tcl  dictionary  holding
119                     the  title  of  the  index, a label, and the keywords and
120                     references. The relevant keys and their values are
121
122                     title  The value is a string containing the title of  the
123                            index.
124
125                     label  The  value  is a string containing a label for the
126                            index.
127
128                     keywords
129                            The value is a Tcl dictionary, using the  keywords
130                            known  to the index as keys. The associated values
131                            are lists containing the identifiers of the refer‐
132                            ences associated with that particular keyword.
133
134                            Any  reference  identifier used in these lists has
135                            to exist as a key in  the  references  dictionary,
136                            see the next item for its definition.
137
138                     references
139                            The  value  is a Tcl dictionary, using the identi‐
140                            fiers for the references known  to  the  index  as
141                            keys.  The  associated  values are 2-element lists
142                            containing the type and label of the reference, in
143                            this order.
144
145                            Any  key  here  has to be associated with at least
146                            one keyword, i.e. occur in at  least  one  of  the
147                            reference  lists  which are the values in the key‐
148                            words dictionary, see previous item for its  defi‐
149                            nition.
150
151              [4]    The type of a reference can be one of two values,
152
153                     manpage
154                            The  identifier of the reference is interpreted as
155                            symbolic file name, referring to one of the  docu‐
156                            ments the index was made for.
157
158                     url    The  identifier of the reference is interpreted as
159                            an url, referring to some external location,  like
160                            a website, etc.
161
162       canonical serialization
163              The canonical serialization of a keyword index has the format as
164              specified in the previous item, and then additionally  satisfies
165              the constraints below, which make it unique among all the possi‐
166              ble serializations of the keyword index.
167
168              [1]    The keys found in all the  nested  Tcl  dictionaries  are
169                     sorted  in  ascending  dictionary  order, as generated by
170                     Tcl's builtin command lsort -increasing -dict.
171
172              [2]    The references listed for each keyword of the  index,  if
173                     any,  are  listed  in ascending dictionary order of their
174                     labels, as generated by Tcl's builtin command lsort  -in‐
175                     creasing -dict.
176

BUGS, IDEAS, FEEDBACK

178       This  document,  and the package it describes, will undoubtedly contain
179       bugs and other problems.  Please report such in the  category  doctools
180       of  the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].  Please
181       also report any ideas for enhancements you may have for either  package
182       and/or documentation.
183
184       When proposing code changes, please provide unified diffs, i.e the out‐
185       put of diff -u.
186
187       Note further that  attachments  are  strongly  preferred  over  inlined
188       patches.  Attachments  can  be  made  by  going to the Edit form of the
189       ticket immediately after its creation, and  then  using  the  left-most
190       button in the secondary navigation bar.
191

KEYWORDS

193       deserialization, docidx, doctools, serialization
194

CATEGORY

196       Documentation tools
197
199       Copyright (c) 2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
200
201
202
203
204tcllib                                0.1          doctools::idx::structure(n)
Impressum