LaTeXML...KeyVals(3)
π LaTeXML...KeyVals(3) π
okay bestie, this is the manual page for LaTeXML::Core::KeyVals, and it comes from User Contributed Perl Documentation. It is literally giving βI parse key-value pairs and I know itβ energy. π«Ά
πΈ NAME πΈ
"LaTeXML::Core::KeyVals" β Key-Value Pairs in LaTeXML. β¨
π¦ DESCRIPTION π¦
Provides a parser and representation of keyval pairs. LaTeXML::Core::KeyVals represents parameters handled by LaTeX's keyval package. It extends LaTeXML::Common::Object. periodt. π
π 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 constructor:
<foo attrib='&GetKeyVal(#1,'key')'>
GetKeyVals($arg)β Access the entire hash. Can be used in a constructor like:Can use in constructor: <foo %&GetKeyVals(#1)/>π«Ά
π Constructors π
Okay so the constructor signature is this chaotic little line, and I am keeping it exactly as the page gave it:
"<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β the given prefix all key-value pairs operate in, and it defaults to'KV'. If given,prefixshould 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 certainxkeyvalpackage 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 toundefor0, an error is thrown upon trying to set such a key; if set to1, 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 to call a specific macro if a single key is unknown during key digestion.openβ accepted as one of the constructor options. The page lists it here with no extra behaviour deets.closeβ also accepted as one of the constructor options. Same vibe: listed right here, no extra behaviour notes on this 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 on details of the structure of this list.rebuildis called automatically to populate the other caches. Typically, the tuples is 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 forkeyat 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, thenoRebuildoption should be given to prevent constant rebuilding, and therebuildfunction should be manually called.$keyvals->setValue($key, $value, $useDefault)β Sets the value ofkeytovalue, 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.silenceMissingβ when 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 is the whole page, bestie. This was LaTeXML...KeyVals(3) from perl v5.42.3, dated 2024-02-26, and honestly? iconic. π
π¦ where this page comes from
- nixos 26.05: perl5.42.3-LaTeXML 0.8.8
- nixpkgs unstable: perl5.42.3-LaTeXML 0.8.8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms