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 $key in 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 using DefKey or related functionality. If set to undef or 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 the getTuples function for details of the structure of this list. rebuild is called automatically to populate the other caches. Typically, the tuples are set by readFrom.

πŸ¦‹ Resolution to KeySets πŸ¦‹

  • my @keysets = $keyvals->resolveKeyValFor($key) β€” finds all keysets that should be used for interacting with the given key. May return undef if no matching keysets are found. Use the parameters keysets, setAll and skipMissing to customize the exact behaviour of this function.
  • my $canResolveKeyVal = $keyvals->canResolveKeyValFor($key) β€” checks if this KeyVals object can resolve a KeyVal for key. Ignores setAll and skipMissing parameters.
  • 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 the useDefault flag 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 if useDefault is set. Note that if value is a reference to an array, the key is inserted multiple times. If value is undef, 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. If skip is 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 from gullet, up until the until token, 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 from gullet. 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.
  • $expansion = $keyvals->setKeysExpansion; β€” expand this KeyVals into a set of tokens for digesting keys.
  • $keyvals = $keyvals->beDigested($stomach); β€” return a new LaTeXML::Core::KeyVals object 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 a key=value comma separated string.

πŸ‘‘ AUTHOR πŸ‘‘

Bruce Miller <bruce.miller@nist.gov> Tom Wiesing <tom.wiesing@gmail.com>

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