-
Notifications
You must be signed in to change notification settings - Fork 5
Allow MessageFormat content in function parameters + replace strictNumberSign
option with broader strict
#8
Conversation
This won't work without the proper parser version; use npm link to test
Initially I’m not a fan of breaking from the spec, but I think maybe I’m ok with it as long as we mark it as non-compliant clearly in the docs or something. Code looks good. |
I actually think that the spec is a bit broken on this, as it effectively says that the parameter string should be parsed as if it was a normal formattable string, but that it can't contain any actual formatting. It feels like the spec here just documents the implementation, rather than solving anything in the general case. @SlexAxton, thoughts on adding a |
As long as fully compliant stuff keeps working 100% doesn’t seem worth it.
…On Tue, Aug 14, 2018 at 4:55 PM Eemeli Aro ***@***.***> wrote:
I actually think that the spec is a bit broken on this, as it effectively
says that the parameter string should be parsed as if it was a normal
formattable string, but that it can't contain any actual formatting. It
feels like the spec here just documents the implementation, rather than
solving anything in the general case.
@SlexAxton <https://github.com/SlexAxton>, thoughts on adding a
strictFunctionParams or similar flag for this? Not sure if it'd be worth
it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF5KqDCQvu1BMHHTbCThF7S5bVluiZUks5uQ0dRgaJpZM4Vu7xb>
.
|
Unfortunately, this is related to messageformat/messageformat#201, where @johanblumenberg found input that is valid according to the spec, but which fails for |
Seems like the better direction to be wrong :)
…On Tue, Aug 14, 2018 at 6:55 PM Eemeli Aro ***@***.***> wrote:
Unfortunately, this is related to messageformat/messageformat#201
<messageformat/messageformat#201>, where
@johanblumenberg <https://github.com/johanblumenberg> found input that is
valid according to the spec, but which fails for messageformat. So we're
arguably not 100% spec-compliant even now, and while this PR would make us
not break on input that looks like it should work, that behaviour would not
quite be following the spec.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF5KqjTpiYzso4s9uNFjvicsLW37y7Gks5uQ2N6gaJpZM4Vu7xb>
.
|
Updated, now with a single |
strictNumberSign
option with broader strict
👍
…On Sat, Aug 25, 2018 at 8:49 PM Eemeli Aro ***@***.***> wrote:
Updated, now with a single strict option that should follow the spec more
closely . This subsumes the strictNumberSign option we had before, and
fixes prior non-compliance with functions: argType needs to be one of the
preset ones, and the optional parameters are parsed according to spec.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF5KiAPkwCj6UtotFyz_3R9bjJOImXwks5uUTnWgaJpZM4Vu7xb>
.
|
This is part of a possible solution for messageformat/messageformat#201, and in brief it allows for any formatted content in the optional
argStyleText
of a custom formatter function. To be clear, this is outside the official spec, not supported by other parsers, and it does theoretically break input that is valid according to the spec:This change would not mean that any input that was previously ok with this library would not be ok after the change, as the parameter chars could not previously include an unquoted
}
.This change would require a major-version update for
messageformat-parser
, but probably not formessageformat
.