From 0cd061bf5f73c8c84ce760ca2e040e856fa5fe9a Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 15 Jul 2024 10:51:10 +0300 Subject: [PATCH 1/6] Define function composition for :number and :integer values --- spec/registry.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/spec/registry.md b/spec/registry.md index b00a1aeab2..7f489f8d69 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -422,6 +422,12 @@ The following options and their values are required to be available on the funct - `maximumSignificantDigits` - ([digit size option](#digit-size-options)) +If the _operand_ of the _expression_ is an implementation-defined type, +such as the _resolved value_ of an _expression_ with a `:number` or `:integer` _annotation_, +it can include option values. +These are included in the resolved option values of the _expression_, +with _options_ on the _expression_ taking priority over any option values of the _operand_. + > [!NOTE] > The following options and option values are being developed during the Technical Preview > period. @@ -489,6 +495,14 @@ MUST be multiplied by 100 for the purposes of formatting. The _function_ `:number` performs selection as described in [Number Selection](#number-selection) below. +#### Composition + +When an _operand_ or an _option_ value uses a _variable_ annotated, +directly or indirectly, by a `:number` _annotation_, +its resolved value contains the implementation-defined numerical value +of the _operand_ of the annotated _expression_, +together with the resolved options values. + ### The `:integer` function The function `:integer` is a selector and formatter for matching or formatting numeric @@ -498,7 +512,6 @@ values as integers. The function `:integer` requires a [Number Operand](#number-operands) as its _operand_. - #### Options Some options do not have default values defined in this specification. @@ -538,6 +551,18 @@ function `:integer`: - `maximumSignificantDigits` - ([digit size option](#digit-size-options)) +If the _operand_ of the _expression_ is an implementation-defined type, +such as the _resolved value_ of an _expression_ with a `:number` or `:integer` _annotation_, +it can include option values. +In general, these are included in the resolved option values of the _expression_, +with _options_ on the _expression_ taking priority over any option values of the _operand_. +Option values with the following names are however discarded if included in the _operand_: +- `compactDisplay` +- `notation` +- `minimumFractionDigits` +- `maximumFractionDigits` +- `minimumSignificantDigits` + > [!NOTE] > The following options and option values are being developed during the Technical Preview > period. @@ -605,6 +630,14 @@ MUST be multiplied by 100 for the purposes of formatting. The _function_ `:integer` performs selection as described in [Number Selection](#number-selection) below. +#### Composition + +When an _operand_ or an _option_ value uses a _variable_ annotated, +directly or indirectly, by a `:integer` _annotation_, +its resolved value contains the implementation-defined integer value +of the _operand_ of the annotated _expression_, +together with the resolved options values. + ### Number Operands The _operand_ of a number function is either an implementation-defined type or From 90ef5e3ddb9ad21edad898471591fb7320adee44 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 15 Jul 2024 18:54:58 +0300 Subject: [PATCH 2/6] Apply suggestions from code review Co-authored-by: Addison Phillips --- spec/registry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/registry.md b/spec/registry.md index 7f489f8d69..57326dcdcd 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -499,7 +499,7 @@ The _function_ `:number` performs selection as described in [Number Selection](# When an _operand_ or an _option_ value uses a _variable_ annotated, directly or indirectly, by a `:number` _annotation_, -its resolved value contains the implementation-defined numerical value +its resolved value contains an implementation-defined numerical value of the _operand_ of the annotated _expression_, together with the resolved options values. From 55a6250e36a8c0183114c9b7edbb69dd76704e35 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Tue, 16 Jul 2024 15:14:12 +0300 Subject: [PATCH 3/6] Add operand option priority example --- spec/registry.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/registry.md b/spec/registry.md index 57326dcdcd..050982e1d0 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -428,6 +428,14 @@ it can include option values. These are included in the resolved option values of the _expression_, with _options_ on the _expression_ taking priority over any option values of the _operand_. +> For example, the _placeholder_ in this _message_: +> ``` +> .input {$n :number notation=scientific minimumFractionDigits=2} +> {{{$n :number minimumFractionDigits=1}}} +> ``` +> would be formatted with the resolved options +> `{ notation: 'scientific', minimumFractionDigits: '1' }`. + > [!NOTE] > The following options and option values are being developed during the Technical Preview > period. From f924bebcc114ab9396a50030c15b09b31c1df6f5 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Fri, 19 Jul 2024 11:24:19 +0300 Subject: [PATCH 4/6] Add apostrophes' Co-authored-by: Tim Chevalier --- spec/registry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/registry.md b/spec/registry.md index 050982e1d0..a7d89f97a6 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -509,7 +509,7 @@ When an _operand_ or an _option_ value uses a _variable_ annotated, directly or indirectly, by a `:number` _annotation_, its resolved value contains an implementation-defined numerical value of the _operand_ of the annotated _expression_, -together with the resolved options values. +together with the resolved options' values. ### The `:integer` function @@ -644,7 +644,7 @@ When an _operand_ or an _option_ value uses a _variable_ annotated, directly or indirectly, by a `:integer` _annotation_, its resolved value contains the implementation-defined integer value of the _operand_ of the annotated _expression_, -together with the resolved options values. +together with the resolved options' values. ### Number Operands From 484eae3d5815e420090324ccd1b12945ce37cfc8 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 7 Oct 2024 10:17:54 -0700 Subject: [PATCH 5/6] Update spec/registry.md Co-authored-by: Eemeli Aro --- spec/registry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/registry.md b/spec/registry.md index a7d89f97a6..223bb6a097 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -507,7 +507,7 @@ The _function_ `:number` performs selection as described in [Number Selection](# When an _operand_ or an _option_ value uses a _variable_ annotated, directly or indirectly, by a `:number` _annotation_, -its resolved value contains an implementation-defined numerical value +its _resolved value_ contains an implementation-defined numerical value of the _operand_ of the annotated _expression_, together with the resolved options' values. From 4103afa2cb97c0312c4a3f61dab05b086623b17f Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 7 Oct 2024 10:18:19 -0700 Subject: [PATCH 6/6] Update spec/registry.md Co-authored-by: Eemeli Aro --- spec/registry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/registry.md b/spec/registry.md index 223bb6a097..04f65ad876 100644 --- a/spec/registry.md +++ b/spec/registry.md @@ -642,7 +642,7 @@ The _function_ `:integer` performs selection as described in [Number Selection]( When an _operand_ or an _option_ value uses a _variable_ annotated, directly or indirectly, by a `:integer` _annotation_, -its resolved value contains the implementation-defined integer value +its _resolved value_ contains the implementation-defined integer value of the _operand_ of the annotated _expression_, together with the resolved options' values.