Keyval Improvements and xkeyval support#860
Merged
Merged
Conversation
Collaborator
|
This sounds like truly great work!
And I can't celebrate this enough! 🎉 |
d117d45 to
0530606
Compare
Contributor
Author
|
Pull requested rebased and updated after offline suggestions from @brucemiller:
|
Owner
|
Looks good, except that you didn't change to keyval_options in the MANIFEST(?) |
75f25cc to
6835e38
Compare
This commit extends support for the keyval package by extending the existing bindings to be able to read key-value definitions and the associated defaults from raw macro definitions. Furthermore, it prepares the implementation for support of extended packages, like 'xkeyval' and friends. Furthermore, it adds a new group of tests 'keyval'. For now, this contains two tests, `keyvalinline` and `keyvalstyle`. The first of these is testing the new functionality, the second one is an old test that was moved out of the graphics package.
This commit adds bindings for the xkeyval package which work without relying on the .sty file. These bindings do not support pre-setting keys or using the built-in pointer system. Furthermore, this commit refactors and extends the KeyVals class, to be compatible with the new types of key-value pairs defined in the xkeyval package. It also adds tests for all appropriate cases.
This commit adds bindings for the xkvview utility package along with a very basic test case. The bindings are very light-weight and only read in the sty file.
Contributor
Author
|
Oops, I have fixed that now. |
Owner
|
Looks good... and impressive! Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tl;DR: This PR adds major improvements to the handling of KeyValue arguments, mostly based on the
xkeyvalpackage.I have been working on this for the past few weeks and I am going to try to summarize the changes that I have made. I probably forgot something, so please have a look at the diffs as well.
The KeyVals logic, previously contained in
KeyVals.pmand partially inTeX.pool.ltxmlandPackage.pm, has been completely refactored and split into two filesKeyVals.pmandKeyVal.pm.KeyVal.pmprovides a newKeyValclass. This gives access to a single key, allowing it to be read and set. The file also contains a refactoredDefKeyValimplementation (previously found inPackage.pm. It is fully backwards compatible, so no rewriting of existing bindings is necessary. With the new class,DefKeyValbehaves much like its native TeX counterpart would. Furthermore, this refactoring adds extended support for thexkeyvalpackage, such ascommand,choiceandbooleankeys.KeyVals.pmprovides theKeyValsclass. Each instance of it represents a set of Key-Value pairs. This class has also been refactored, making the code cleaner and adding support for advancedxkeyvalfeatures such as key prefixes, setting keys in more than one family, and more.Unfortunately, the constructor of the
KeyValsclass is not completely backward compatible, so amongst some others, thelistingspackage binding had to be slightly updated. The new constructor is fully documented with POD and making the change for other bindings (if any) should be straightforward.TeX.pool.ltxml, theRequiredKeyValsandOptionalKeyValsargument types have been given additional arguments and variants with '*' and '+' have been added. This is again based on thexkeyvalpackage, and has been documented using in-line comments. The existing argument types are fully backward compatible.keyvalpackage bindings have updated to match the newKeyValsclass.xkeyvalandxkvviewpackage bindings have been added.\DeclareOptionXand friends, which is an extended version of the LaTeXs\DeclareOption, both forstyandclsfiles.This does not support the pointer system of
xkeyval. It is also not possible to preset keys. I plan to make a second pull request for these in the near future./cc @brucemiller