1LaTeXML::Core::KeyVals(U3s)er Contributed Perl DocumentatLiaoTneXML::Core::KeyVals(3)
2
3
4

NAME

6       "LaTeXML::Core::KeyVals" - Key-Value Pairs in LaTeXML
7

DESCRIPTION

9       Provides a parser and representation of keyval pairs
10       "LaTeXML::Core::KeyVals" represents parameters handled by LaTeX's
11       keyval package.  It extends LaTeXML::Common::Object.
12
13   Accessors
14       "GetKeyVal($arg,$key)"
15           Access the value associated with a given key.  This is useful
16           within constructors to access the value associated with $key in the
17           argument $arg. Example usage in a copnstructor:
18
19           <foo attrib='&GetKeyVal(#1,'key')'>
20
21       "GetKeyVals($arg)"
22           Access the entire hash. Can be used in a constructor like: Can use
23           in constructor: <foo %&GetKeyVals(#1)/>
24
25   Constructors
26       "<LaTeXML::Core::KeyVals-"new(prefix, keysets, options)); >>
27           Creates a new KeyVals object with the given parameters.  All
28           arguments are optional and the simples way of calling this method
29           is "my $keyvals = LaTeXML::Core::KeyVals->new()".
30
31           prefix is the given prefix all key-value pairs operate in and
32           defaults to 'KV'. If given, prefix should be a string.
33
34           keysets should be a list of keysets to find keys inside of. If
35           given, it should either be reference to a list of strings or a
36           comma-seperated string.  This argument defaults to '_anonymous_'.
37
38           Furthermore, the KeyVals constructor accepts a variety of options
39           that can be used to customize its behaviour. These are setAll,
40           setInternals, skip, skipMissing, hookMissing, open, close, punct
41           and assign.
42
43           setAll is a flag that, if set, ensures that keys will be set in all
44           existing keysets, instad of only in the first one.
45
46           setInternals is a flag that, if set, ensures that certain 'xkeyval'
47           package internals are set during key digestion.
48
49           skip should be a list of keys to be skipped when digesting the keys
50           of this object.
51
52           skipMissing allows one way of handling keys during key digestion
53           that have not been explictilty declared using "DefKey" or related
54           functionality. If set to "undef" or 0, an error is thrown upon
55           trying to set such a key, if set to 1 they are ignored.
56           Alternatively, this can be set to a key macro which is then
57           extended to contain a comman-separated list of the undefined keys.
58
59           hookMissing allows to call a specific macro if a single key is
60           unknown during key digestion.
61
62           The options open, close, punct and assign optionally contain the
63           tokens used for the respective meanings.
64
65   KeyVals Accessors (intended for internal usage)
66       "my $prefix = $keyvals->getPrefix()"
67           Returns the Prefix property.
68
69       "my @keysets = $keyvals->getKeySets()"
70           Returns the KeySets property.
71
72       "my $setall = $keyvals->getSetAll()"
73           Returns the SetAll property.
74
75       "my $setinternals = $keyvals->getSetInternals()"
76           Returns the SetInternals property.
77
78       "my @skip = $keyvals->getSkip()"
79           Returns the Skip property.
80
81       "my $skipmissing = $keyvals->getSkipMissing()"
82           Returns the SkipMissing property.
83
84       "my $hookmissing = $keyvals->getHookMissing()"
85           Returns the HookMissing property.
86
87       "my @tuples = $keyvals->getTuples()"
88           Returns the Tuples property representing
89
90       "$keyvals->setTuples(@tuples)"
91           Sets the tuples which should be a list of five-tuples (array
92           references) representing the key-value pairs this KeyVals object is
93           seeded with. See the getTuples function on details of the structure
94           of this list.  rebuild is called automatically to populate the
95           other caches.  Typically, the tuples is set by readFrom.
96
97       "my @cachedpairs = $keyvals->getCachedPairs()"
98           Returns the CachedPairs property.
99
100       "my %cachedhash = $keyvals->getCachedHash()"
101           Returns the CachedHash property.
102
103   Resolution to KeySets
104       "my @keysets = $keyvals->resolveKeyValFor($key)"
105           Finds all KeyVal objects that should be used for interacting with
106           the given key. May return "undef" if no matching keysets are found.
107           Use the parameters
108            keysets, setAll and skipMissing to customize the exact behaviour
109           of this function.
110
111       "my $canResolveKeyVal = $keyvals->canResolveKeyValFor($key)"
112           Checks if this KeyVals object can resolve a KeyVal for key. Ignores
113           setAll and skipMissing parameters.
114
115       "my $keyval = $keyvals->getPrimaryKeyValOf($key, @keysets)"
116           Gets a single KeyVal parameter to be used for interacting a a
117           single key, given that it resolves to keysets. Always returns a
118           single KeyVal object, even if no keysets are found.
119
120   Changing contained values
121       "$keyvals->addValue($key, $value, $useDefault, $noRebuild)"
122           Adds the given value for key at the end of the given list of values
123           and rebuilds all internal caches. If the useDefault flag is set,
124           the specific value is ignored, and the default is set instead.
125
126           If this function is called multiple times the noRebuild option
127           should be given to prevent constant rebuilding and the rebuild
128           function should be called manually called.
129
130       "$keyvals->setValue($key, $value, $useDefault)"
131           Sets the value of key to value, optionally using the default if
132           useDefault is set. Note that if value is a reference to an array,
133           the key is inserted multiple times. If value is "undef", the values
134           is deleted.
135
136       "$keyvals->rebuild($skip)"
137           Rebuilds the internal caches of key-value mapping and list of pairs
138           from from main list of tuples. If skip is given, all values for the
139           given key are omitted, and the given key is deleted.
140
141   Parsing values from a gullet
142       "$keyvals->readFrom($gullet, $until, %options)"
143           Reads a set of KeyVals from gullet, up until the until token, and
144           updates the state of this KeyVals object accordingly.
145
146           Furthermore, this methods supports several options.
147
148           When the silenceMissing option is set, missing keys will be
149           completely ignored when reading keys, that is they do not get
150           recorded into the KeyVals object and no warnings or errors will be
151           thrown.
152
153       "$keyvals->readKeyWordFrom($gullet, $until)"
154           Reads a single keyword from gullet. Intended for internal use only.
155
156   KeyVals Accessors
157       "my $value = $keyvals->getValue($key);"
158           Return a value associated with $key.
159
160       "@values = $keyvals->getValues($key);"
161           Return the list of all values associated with $key.
162
163       "%keyvals = $keyvals->getKeyVals;"
164           Return the hash reference containing the keys and values bound in
165           the $keyval.  Each value in the hash may be a single value or a
166           list if the key is repeated.
167
168       "@keyvals = $keyvals->getPairs;"
169           Return the alternating keys and values bound in the $keyval.  Note
170           that this may contain multiple entries for a given key, if they
171           were repeated.
172
173       "%hash = $keyvals->getHash;"
174           Return the hash reference containing the keys and values bound in
175           the $keyval.  Note that will only contain the last value for a
176           given key, if they were repeated.
177
178       "$haskey = $keyvals->hasKey($key);"
179           Checks if the KeyVals object contains a value for $key.
180
181   Value Related Reversion
182       "$expansion = $keyvals->setKeysExpansion;"
183           Expand this KeyVals into a set of tokens for digesting keys.
184
185       "$keyvals = $keyvals->beDigested($stomach);"
186           Return a new "LaTeXML::Core::KeyVals" object with both keys and
187           values digested.
188
189       "$reversion = $keyvals->revert();"
190           Revert this object into a set of tokens representing the original
191           sequence of Tokens that was used to be read it from the gullet.
192
193       "$str = $keyvals->toString();"
194           Turns this object into a key=value comma seperated string.
195

AUTHOR

197       Bruce Miller <bruce.miller@nist.gov> Tom Wiesing
198       <tom.wiesing@gmail.com>
199
201       Public domain software, produced as part of work done by the United
202       States Government & not subject to copyright in the US.
203
204
205
206perl v5.32.0                      2020-11-17         LaTeXML::Core::KeyVals(3)
Impressum