Open petschki opened 1 month ago
There is a smartypants grouping functionality since long, which is confusing, I agree.
The grouping depends on the defined arguments via parser.addArgument
, not the actual arguments used in the markup.
So, there was no change when removing the argument from the markup (good) but there was a change when removing the argument from the argument definition (bad for consistency).
I'd agree to see this even as a bug and this should be fixed - maybe with an option which always normalizes the argument list to camel case without any grouping.
But there is already something similar for new-style base class based patterns: If you define parser_group_options
in the Patterns base class, no grouping, but also no camelCasing will take place. Instead you'd access the arguments exactly the way you had defined them. In this case this.options["recently-used-key"]
. I'd use this instead of the automatic but unstable grouping.
See: https://github.com/Patternslib/Patterns/blob/master/src/core/basepattern.js#L20 https://github.com/Patternslib/Patterns/blob/master/src/core/parser.js#L377
We have a pattern with the following arguments:
with the following markup
what I expect:
you get the parsed options like this:
what you get
there's the new "group" key
recently
which holds the default value:now this gets a bit confusing because If we remove an option from the markup (for example the
recentlyUsedMaxItems
), I expect thethis.options.recentlyUsedMaxItems
contains the default value from the parser but its missing completely in the dict:Only the grouped
recently
key contains this value.Further if you remove the default value in
parser.addArgument
there is no more grouping of the keys at all.Am I missing some logic here, or is this a bug?