.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LaTeXML::Core::KeyVals 3pm" .TH LaTeXML::Core::KeyVals 3pm 2024-02-27 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "LaTeXML::Core::KeyVals" \- Key\-Value Pairs in LaTeXML .SH DESCRIPTION .IX Header "DESCRIPTION" Provides a parser and representation of keyval pairs \&\f(CW\*(C`LaTeXML::Core::KeyVals\*(C'\fR represents parameters handled by LaTeX's keyval package. It extends LaTeXML::Common::Object. .SS Accessors .IX Subsection "Accessors" .ie n .IP """GetKeyVal($arg,$key)""" 4 .el .IP \f(CWGetKeyVal($arg,$key)\fR 4 .IX Item "GetKeyVal($arg,$key)" Access the value associated with a given key. This is useful within constructors to access the value associated with \f(CW$key\fR in the argument \f(CW$arg\fR. Example usage in a copnstructor: .Sp .ie n .IP GetKeyVals($arg) 4 .el .IP \f(CWGetKeyVals($arg)\fR 4 .IX Item "GetKeyVals($arg)" Access the entire hash. Can be used in a constructor like: Can use in constructor: .SS Constructors .IX Subsection "Constructors" .ie n .IP """>" 4 .el .IP "\f(CW>" 4 .IX Item ">" Creates a new KeyVals object with the given parameters. All arguments are optional and the simples way of calling this method is \&\f(CW\*(C`my $keyvals = LaTeXML::Core::KeyVals\->new()\*(C'\fR. .Sp \&\fIprefix\fR is the given prefix all key-value pairs operate in and defaults to \&\f(CW\*(AqKV\*(Aq\fR. If given, prefix should be a string. .Sp \&\fIkeysets\fR should be a list of keysets to find keys inside of. If given, it should either be reference to a list of strings or a comma-separated string. This argument defaults to \f(CW\*(Aq_anonymous_\*(Aq\fR. .Sp Furthermore, the KeyVals constructor accepts a variety of options that can be used to customize its behaviour. These are \fIsetAll\fR, \fIsetInternals\fR, \&\fIskip\fR, \fIskipMissing\fR, \fIhookMissing\fR, \fIopen\fR, \fIclose\fR. .Sp \&\fIsetAll\fR is a flag that, if set, ensures that keys will be set in all existing keysets, instead of only in the first one. .Sp \&\fIsetInternals\fR is a flag that, if set, ensures that certain 'xkeyval' package internals are set during key digestion. .Sp \&\fIskip\fR should be a list of keys to be skipped when digesting the keys of this object. .Sp \&\fIskipMissing\fR allows one way of handling keys during key digestion that have not been explictilty declared using \f(CW\*(C`DefKey\*(C'\fR or related functionality. If set to \f(CW\*(C`undef\*(C'\fR or \f(CW0\fR, an error is thrown upon trying to set such a key, if set to \f(CW1\fR they are ignored. Alternatively, this can be set to a key macro which is then extended to contain a comman-separated list of the undefined keys. .Sp \&\fIhookMissing\fR allows one to call a specific macro if a single key is unknown during key digestion. .SS "KeyVals Accessors (intended for internal usage)" .IX Subsection "KeyVals Accessors (intended for internal usage)" .ie n .IP """$keyvals\->setTuples(@tuples)""" 4 .el .IP \f(CW$keyvals\->setTuples(@tuples)\fR 4 .IX Item "$keyvals->setTuples(@tuples)" Sets the \fItuples\fR which should be a list of five-tuples (array references) representing the key-value pairs this KeyVals object is seeded with. See the \fIgetTuples\fR function on details of the structure of this list. \&\fIrebuild\fR is called automatically to populate the other caches. Typically, the tuples is set by \fIreadFrom\fR. .SS "Resolution to KeySets" .IX Subsection "Resolution to KeySets" .ie n .IP """my @keysets = $keyvals\->resolveKeyValFor($key)""" 4 .el .IP "\f(CWmy @keysets = $keyvals\->resolveKeyValFor($key)\fR" 4 .IX Item "my @keysets = $keyvals->resolveKeyValFor($key)" Finds all keysets that should be used for interacting with the given \&\fIkey\fR. May return \f(CW\*(C`undef\*(C'\fR if no matching keysets are found. Use the parameters \fIkeysets\fR, \fIsetAll\fR and \fIskipMissing\fR to customize the exact behaviour of this function. .ie n .IP """my $canResolveKeyVal = $keyvals\->canResolveKeyValFor($key)""" 4 .el .IP "\f(CWmy $canResolveKeyVal = $keyvals\->canResolveKeyValFor($key)\fR" 4 .IX Item "my $canResolveKeyVal = $keyvals->canResolveKeyValFor($key)" Checks if this \fIKeyVals\fR object can resolve a KeyVal for \fIkey\fR. Ignores \&\fIsetAll\fR and \fIskipMissing\fR parameters. .ie n .IP """my $keyval = $keyvals\->getPrimaryKeyValOf($key, @keysets)""" 4 .el .IP "\f(CWmy $keyval = $keyvals\->getPrimaryKeyValOf($key, @keysets)\fR" 4 .IX Item "my $keyval = $keyvals->getPrimaryKeyValOf($key, @keysets)" Gets the primary keyset to be used for interacting a a single \fIkey\fR, given that it resolves to \fIkeysets\fR. Defaults to first keyset in KeyVals, if none given. .SS "Changing contained values" .IX Subsection "Changing contained values" .ie n .IP """$keyvals\->addValue($key, $value, $useDefault, $noRebuild)""" 4 .el .IP "\f(CW$keyvals\->addValue($key, $value, $useDefault, $noRebuild)\fR" 4 .IX Item "$keyvals->addValue($key, $value, $useDefault, $noRebuild)" Adds the given \fIvalue\fR for \fIkey\fR at the end of the given list of values and rebuilds all internal caches. If the \fIuseDefault\fR flag is set, the specific value is ignored, and the default is set instead. .Sp If this function is called multiple times the \fInoRebuild\fR option should be given to prevent constant rebuilding and the \fIrebuild\fR function should be called manually called. .ie n .IP """$keyvals\->setValue($key, $value, $useDefault)""" 4 .el .IP "\f(CW$keyvals\->setValue($key, $value, $useDefault)\fR" 4 .IX Item "$keyvals->setValue($key, $value, $useDefault)" Sets the value of \fIkey\fR to \fIvalue\fR, optionally using the default if \&\fIuseDefault\fR is set. Note that if \fIvalue\fR is a reference to an array, the key is inserted multiple times. If \fIvalue\fR is \f(CW\*(C`undef\*(C'\fR, the values is deleted. .ie n .IP """$keyvals\->rebuild($skip)""" 4 .el .IP \f(CW$keyvals\->rebuild($skip)\fR 4 .IX Item "$keyvals->rebuild($skip)" Rebuilds the internal caches of key-value mapping and list of pairs from from main list of tuples. If \fIskip\fR is given, all values for the given key are omitted, and the given key is deleted. .SS "Parsing values from a gullet" .IX Subsection "Parsing values from a gullet" .ie n .IP """$keyvals\->readFrom($gullet, $until, %options)""" 4 .el .IP "\f(CW$keyvals\->readFrom($gullet, $until, %options)\fR" 4 .IX Item "$keyvals->readFrom($gullet, $until, %options)" Reads a set of KeyVals from \fIgullet\fR, up until the \fIuntil\fR token, and updates the state of this \fIKeyVals\fR object accordingly. .Sp Furthermore, this methods supports several options. .Sp When the \fIsilenceMissing\fR option is set, missing keys will be completely ignored when reading keys, that is they do not get recorded into the KeyVals object and no warnings or errors will be thrown. .ie n .IP """$keyvals\->readKeyWordFrom($gullet, $until)""" 4 .el .IP "\f(CW$keyvals\->readKeyWordFrom($gullet, $until)\fR" 4 .IX Item "$keyvals->readKeyWordFrom($gullet, $until)" Reads a single keyword from \fIgullet\fR. Intended for internal use only. .SS "KeyVals Accessors" .IX Subsection "KeyVals Accessors" .ie n .IP """my $value = $keyvals\->getValue($key);""" 4 .el .IP "\f(CWmy $value = $keyvals\->getValue($key);\fR" 4 .IX Item "my $value = $keyvals->getValue($key);" Return a value associated with \f(CW$key\fR. .ie n .IP """@values = $keyvals\->getValues($key);""" 4 .el .IP "\f(CW@values = $keyvals\->getValues($key);\fR" 4 .IX Item "@values = $keyvals->getValues($key);" Return the list of all values associated with \f(CW$key\fR. .ie n .IP """%keyvals = $keyvals\->getKeyVals;""" 4 .el .IP "\f(CW%keyvals = $keyvals\->getKeyVals;\fR" 4 .IX Item "%keyvals = $keyvals->getKeyVals;" Return the hash reference containing the keys and values bound in the \f(CW$keyval\fR. Each value in the hash may be a single value or a list if the key is repeated. .ie n .IP """@keyvals = $keyvals\->getPairs;""" 4 .el .IP "\f(CW@keyvals = $keyvals\->getPairs;\fR" 4 .IX Item "@keyvals = $keyvals->getPairs;" Return the alternating keys and values bound in the \f(CW$keyval\fR. Note that this may contain multiple entries for a given key, if they were repeated. .ie n .IP """%hash = $keyvals\->getHash;""" 4 .el .IP "\f(CW%hash = $keyvals\->getHash;\fR" 4 .IX Item "%hash = $keyvals->getHash;" Return the hash reference containing the keys and values bound in the \f(CW$keyval\fR. Note that will only contain the last value for a given key, if they were repeated. .ie n .IP """$haskey = $keyvals\->hasKey($key);""" 4 .el .IP "\f(CW$haskey = $keyvals\->hasKey($key);\fR" 4 .IX Item "$haskey = $keyvals->hasKey($key);" Checks if the KeyVals object contains a value for \f(CW$key\fR. .SS "Value Related Reversion" .IX Subsection "Value Related Reversion" .ie n .IP """$expansion = $keyvals\->setKeysExpansion;""" 4 .el .IP "\f(CW$expansion = $keyvals\->setKeysExpansion;\fR" 4 .IX Item "$expansion = $keyvals->setKeysExpansion;" Expand this KeyVals into a set of tokens for digesting keys. .ie n .IP """$keyvals = $keyvals\->beDigested($stomach);""" 4 .el .IP "\f(CW$keyvals = $keyvals\->beDigested($stomach);\fR" 4 .IX Item "$keyvals = $keyvals->beDigested($stomach);" Return a new \f(CW\*(C`LaTeXML::Core::KeyVals\*(C'\fR object with both keys and values digested. .ie n .IP """$reversion = $keyvals\->revert();""" 4 .el .IP "\f(CW$reversion = $keyvals\->revert();\fR" 4 .IX Item "$reversion = $keyvals->revert();" Revert this object into a set of tokens representing the original sequence of Tokens that was used to be read it from the gullet. .ie n .IP """$str = $keyvals\->toString();""" 4 .el .IP "\f(CW$str = $keyvals\->toString();\fR" 4 .IX Item "$str = $keyvals->toString();" Turns this object into a key=value comma separated string. .SH AUTHOR .IX Header "AUTHOR" Bruce Miller Tom Wiesing .SH COPYRIGHT .IX Header "COPYRIGHT" Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.