Key-Value Pairs in LaTeXML
Provides a parser and representation of keyval pairs LaTeXML::Core::KeyVals represents parameters handled by LaTeX’s keyval package. It extends LaTeXML::Common::Object.
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:
Access the entire hash. Can be used in a constructor like: Can use in constructor: <foo %&GetKeyVals(#1)/>
keysets, options)); >>
Creates a new KeyVals object with the given parameters. All arguments are optional and the simples 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 reference to a list of strings or a comma-seperated 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, punct and assign.
setAll is a flag that, if set, ensures that keys will be set in all existing keysets, instad of only in the first one.
setInternals is 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 explictilty 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 comman-separated list of the undefined keys.
hookMissing allows to call a specific macro if a single key is unknown during key digestion.
The options open, close, punct and assign optionally contain the tokens used for the respective meanings.
Returns the Prefix property.
Returns the KeySets property.
Returns the SetAll property.
Returns the SetInternals property.
Returns the Skip property.
Returns the SkipMissing property.
Returns the HookMissing property.
Returns the Tuples property representing
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 on details of the structure of this list. rebuild is called automatically to populate the other caches. Typically, the tuples is set by readFrom.
Returns the CachedPairs property.
Returns the CachedHash property.
Finds all KeyVal objects 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.
Checks if this KeyVals object can resolve a KeyVal for key. Ignores setAll and skipMissing parameters.
Gets a single KeyVal parameter to be used for interacting a a single key, given that it resolves to keysets. Always returns a single KeyVal object, even if no keysets are found.
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 called.
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 values is deleted.
Rebuilds the internal caches of key-value mapping and list of pairs from from main list of tuples. If skip is given, all values for the given key are omitted, and the given key is deleted.
Reads a set of KeyVals from gullet, up until the until token, and updates the state of this KeyVals object accordingly.
Furthermore, this methods 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.
Reads a single keyword from gullet. Intended for internal use only.
Return a value associated with $key.
Return the list of all values associated with $key.
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.
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.
Return the hash reference containing the keys and values bound in the $keyval. Note that will only contain the last value for a given key, if they were repeated.
Checks if the KeyVals object contains a value for $key.
Expand this KeyVals into a set of tokens for digesting keys.
Return a new LaTeXML::Core::KeyVals object with both keys and values digested.
Revert this object into a set of tokens representing the original sequence of Tokens that was used to be read it from the gullet.
Turns this object into a key=value comma seperated string.