-
-
Notifications
You must be signed in to change notification settings - Fork 146
feat(minimessage): named arguments #1304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main/5
Are you sure you want to change the base?
Conversation
87540a5 to
07d0557
Compare
|
I've rebased the PR to the |
...minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/resolver/TagResolver.java
Outdated
Show resolved
Hide resolved
9408e0f to
69b7111
Compare
69b7111 to
1842dad
Compare
1842dad to
e524ec6
Compare
...minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/resolver/TagResolver.java
Outdated
Show resolved
Hide resolved
…amedTagProvider and start adjusting MiniMessageParser to distinguish tags with named arguments
…th no arguments as named if no sequential resolver exists
…ot break backward compatibility
6bd3eb9 to
4008b17
Compare
|
Rebased to main/4 after the unstable/4 merge |
|
So a thought on this, why are we creating two different colours of MM tags? I feel like the design would be cleaner if we only had one type of tag, which accepted both named and sequential arguments, same as say with a CLI. For consistency's sake I think it's fair to require all the named args to be at the beginning or end of the tag, but either way there's a bunch of api noise and opportunity for breakages here due to adding named args in as a separate parallel concept. I'm seeing something like: <gradient phase=0.4 speed=2 red:green:blue>hi strokkur</gradient>or: <gradient:red:green:blue phase=0.4 speed=2>hi strokkur</gradient>What do you think? Users would just pop named args from the |
KNOWN ISSUES/NOTES: - *Yes*, I did indeed completely rewrite TokenParser.parseSecondPass. A few notes related to that: - This was needed because the previous system did not really play well with with state switches between named args and sequential ones and was honestly really hard to work with in general. My hopes are that with this rewrite it will be much more maintainable and readable. - Tags, which look like this <name > currently parse the same as <name>. I am awaiting a response regarding whether we want to make this the new expected behavior or if I need to do some special case handling for it. - Urls in values currently do not work. That's a quick fix though.
…method for tokenization
|
Alright, I've done everything I've wanted to do for this PR now. Arguments have been implemented, as per @zml2008's suggestion, in a combined way. They new syntax looks like this: <tagname
someflag
somename='a quoted value with spaces'
anotherflag :queued arguments behind:here>Hey abby</tagname>This means named arguments are simply placed between the tag name and the first colon. |
closes #1296.