LaTeXM...eyVals(3pm)
okay bestie, welcome to LaTeXM...eyVals(3pm) β yes, that's the page title β from the User Contributed Perl Documentation. We're talking about LaTeXML::Core::KeyVals, and it's giving key-value pairs in LaTeXML. Slay. π
π NAME π
LaTeXML::Core::KeyVals - Key-Value Pairs in LaTeXML
β¨ DESCRIPTION β¨
It provides a parser and representation of keyval pairs. LaTeXML::Core::KeyVals represents parameters handled by LaTeX's keyval package. It extends LaTeXML::Common::Object.
π«Ά Accessors π«Ά
GetKeyVal($arg,$key)β access the value associated with a given key. This is useful within constructors to access the value associated with$keyin the argument$arg. Example usage in a copnstructor (yes, that spelling is in the page, not me π):
<foo attrib='&GetKeyVal(#1,'key')'>
GetKeyVals($arg)β access the entire hash. Can be used in a constructor like:
<foo %&GetKeyVals(#1)/>
π Constructors π
The constructor signature as printed is this chaotic little string:
"<LaTeXML::Core::KeyVals-"new(prefix, keysets, options)); >>
Creates a new KeyVals object with the given parameters. All arguments are optional, and the simplest way of calling this method is:
my $keyvals = LaTeXML::Core::KeyVals->new()
prefix is the given prefix all key-value pairs operate in and defaults to 'KV'. If given, prefix should be a string.
keysets should be a list of keysets to find keys inside of. If given, it should either be a reference to a list of strings or a comma-separated string. This argument defaults to '_anonymous_'.
Furthermore, the KeyVals constructor accepts a variety of options that can be used to customize its behaviour. These are setAll, setInternals, skip, skipMissing, hookMissing, open, close.
setAllβ a flag that, if set, ensures that keys will be set in all existing keysets, instead of only in the first one.setInternalsβ a flag that, if set, ensures that certain'xkeyval'package internals are set during key digestion.skipβ should be a list of keys to be skipped when digesting the keys of this object.skipMissingβ allows one way of handling keys during key digestion that have not been explicitly declared usingDefKeyor related functionality. If set toundefor 0, an error is thrown upon trying to set such a key; if set to 1 they are ignored. Alternatively, this can be set to a key macro which is then extended to contain a comma-separated list of the undefined keys.hookMissingβ allows one to call a specific macro if a single key is unknown during key digestion.open,closeβ also listed as constructor options in the source page.
π₯ KeyVals Accessors (intended for internal usage) π₯
$keyvals->setTuples(@tuples)β sets the tuples, which should be a list of five-tuples (array references) representing the key-value pairs this KeyVals object is seeded with. See thegetTuplesfunction for details of the structure of this list.rebuildis called automatically to populate the other caches. Typically, the tuples are set byreadFrom.
π¦ Resolution to KeySets π¦
my @keysets = $keyvals->resolveKeyValFor($key)β finds all keysets that should be used for interacting with the given key. May returnundefif no matching keysets are found. Use the parameterskeysets,setAllandskipMissingto customize the exact behaviour of this function.my $canResolveKeyVal = $keyvals->canResolveKeyValFor($key)β checks if this KeyVals object can resolve a KeyVal for key. IgnoressetAllandskipMissingparameters.my $keyval = $keyvals->getPrimaryKeyValOf($key, @keysets)β gets the primary keyset to be used for interacting with a single key, given that it resolves to keysets. Defaults to first keyset in KeyVals, if none given.
π Changing contained values π
$keyvals->addValue($key, $value, $useDefault, $noRebuild)β adds the given value for key at the end of the given list of values and rebuilds all internal caches. If theuseDefaultflag is set, the specific value is ignored, and the default is set instead.
If this function is called multiple times, the noRebuild option should be given to prevent constant rebuilding and the rebuild function should be called manually.
$keyvals->setValue($key, $value, $useDefault)β sets the value of key to value, optionally using the default ifuseDefaultis set. Note that ifvalueis a reference to an array, the key is inserted multiple times. Ifvalueisundef, the value is deleted.$keyvals->rebuild($skip)β rebuilds the internal caches of key-value mapping and list of pairs from the main list of tuples. Ifskipis given, all values for the given key are omitted, and the given key is deleted.
πΈ Parsing values from a gullet πΈ
$keyvals->readFrom($gullet, $until, %options)β reads a set of KeyVals fromgullet, up until theuntiltoken, and updates the state of this KeyVals object accordingly.
Furthermore, this method supports several options.
When the silenceMissing 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.
$keyvals->readKeyWordFrom($gullet, $until)β reads a single keyword fromgullet. Intended for internal use only.
π KeyVals Accessors π
my $value = $keyvals->getValue($key);β return a value associated with$key.@values = $keyvals->getValues($key);β return the list of all values associated with$key.%keyvals = $keyvals->getKeyVals;β return the hash reference containing the keys and values bound in the$keyval. Each value in the hash may be a single value or a list if the key is repeated.@keyvals = $keyvals->getPairs;β return the alternating keys and values bound in the$keyval. Note that this may contain multiple entries for a given key, if they were repeated.%hash = $keyvals->getHash;β return the hash reference containing the keys and values bound in the$keyval. Note that it will only contain the last value for a given key, if they were repeated.$haskey = $keyvals->hasKey($key);β checks if the KeyVals object contains a value for$key.
β Value Related Reversion β
$expansion = $keyvals->setKeysExpansion;β expand this KeyVals into a set of tokens for digesting keys.$keyvals = $keyvals->beDigested($stomach);β return a newLaTeXML::Core::KeyValsobject with both keys and values digested.$reversion = $keyvals->revert();β revert this object into a set of tokens representing the original sequence of Tokens that was used to read it from the gullet.$str = $keyvals->toString();β turns this object into akey=valuecomma separated string.
π AUTHOR π
Bruce Miller <bruce.miller@nist.gov> Tom Wiesing <tom.wiesing@gmail.com>
π COPYRIGHT π
Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.
and that's the whole page, bestie π«Ά Footer tea: this manpage is from perl v5.40.1, dated 2025-11-16, and its title is LaTeXM...eyVals(3pm). Slay and goodbye. π
π¦ where this page comes from
- ubuntu resolute: latexml 0.8.8-4 Β· PD
- ubuntu stonking: latexml 0.8.8-4 Β· PD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms