From 5f843cb3790cfc22445f1d3c288aa44d2a95a10e Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Thu, 15 Jul 2021 15:46:09 -0400 Subject: [PATCH 1/6] Meta: Upgrade ecmarkup --- package.json | 2 +- spec/datetimeformat.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 13db247c..ef1a1416 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "license": "SEE LICENSE IN https://tc39.es/ecma402/#sec-copyright-and-software-license", "homepage": "https://tc39.es/ecma402/", "dependencies": { - "ecmarkup": "^7.0.2" + "ecmarkup": "^8.0.0" }, "devDependencies": { "@alrra/travis-scripts": "^3.0.1" diff --git a/spec/datetimeformat.html b/spec/datetimeformat.html index 0028c7e7..cb7439f5 100644 --- a/spec/datetimeformat.html +++ b/spec/datetimeformat.html @@ -374,7 +374,7 @@ <h1>FormatDateTimePattern ( _dateTimeFormat_, _patternParts_, _x_, _rangeFormatO 1. Else if _p_ is equal to *"timeZoneName"*, then 1. Let _f_ be _dateTimeFormat_.[[TimeZoneName]]. 1. Let _v_ be _dateTimeFormat_.[[TimeZone]]. - 1. Let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale. The String value may also depend on the value of the [[InDST]] field of _tm_. If the implementation does not have a localized representation of _f_, then use the String value of _v_ itself. + 1. Let _fv_ be a String value representing _v_ in the form given by _f_; the String value depends upon the implementation and the effective locale. The String value may also depend on the value of the [[InDST]] field of _tm_. If the implementation does not have a localized representation of _f_, then use the String value of _v_ itself. 1. Append a new Record { [[Type]]: _p_, [[Value]]: _fv_ } as the last element of the list _result_. 1. Else if _p_ matches a Property column of the row in <emu-xref href="#table-datetimeformat-components"></emu-xref>, then 1. If _rangeFormatOptions_ is not *undefined*, let _f_ be the value of _rangeFormatOptions_'s field whose name matches _p_. From 062429857e3e023dbebae8715d793b1af53a6234 Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Thu, 15 Jul 2021 15:49:10 -0400 Subject: [PATCH 2/6] Editorial: Define a structured signature for PluralRuleSelect Fixes #593 --- spec/pluralrules.html | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/spec/pluralrules.html b/spec/pluralrules.html index abd36d09..a0014935 100644 --- a/spec/pluralrules.html +++ b/spec/pluralrules.html @@ -102,12 +102,19 @@ <h1>GetOperands ( _s_ )</h1> </emu-table> </emu-clause> - <emu-clause id="sec-pluralruleselect" aoid="PluralRuleSelect"> - <h1>PluralRuleSelect ( _locale_, _type_, _n_, _operands_ )</h1> - - <p> - When the PluralRuleSelect abstract operation is called with four arguments, it performs an implementation-dependent algorithm to map _n_ to the appropriate plural representation of the Plural Rules Operands Record _operands_ by selecting the rules denoted by _type_ for the corresponding _locale_, or the String value *"other"*. - </p> + <emu-clause id="sec-pluralruleselect" type="implementation-defined abstract operation"> + <h1> + PluralRuleSelect ( + _locale_: a String, + _type_: a String, + _n_: a finite Number, + _operands_: a Plural Rules Operands Record corresponding with _n_, + ) + </h1> + <dl class="header"> + <dt>description</dt> + <dd>It returns the String from « *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, *"other"* » that best categorizes _n_ according to the rules for _locale_ and _type_.</dd> + </dl> </emu-clause> <emu-clause id="sec-resolveplural" aoid="ResolvePlural"> @@ -272,7 +279,7 @@ <h1>Intl.PluralRules.prototype.resolvedOptions ( )</h1> 1. Let _v_ be the value of _pr_'s internal slot whose name is the Internal Slot value of the current row. 1. If _v_ is not *undefined*, then 1. Perform ! CreateDataPropertyOrThrow(_options_, _p_, _v_). - 1. Let _pluralCategories_ be a List of Strings representing the possible results of <emu-xref href="#sec-pluralruleselect">PluralRuleSelect</emu-xref> for the selected locale _pr_.[[Locale]]. This List consists of unique String values, from the the list *"zero"*, *"one"*, *"two"*, *"few"*, *"many"* and *"other"*, that are relevant for the locale whose localization is specified in LDML Language Plural Rules. + 1. Let _pluralCategories_ be a List of Strings containing all possible results of <emu-xref href="#sec-pluralruleselect">PluralRuleSelect</emu-xref> for the selected locale _pr_.[[Locale]]. 1. Perform ! CreateDataProperty(_options_, *"pluralCategories"*, CreateArrayFromList(_pluralCategories_)). 1. Return _options_. </emu-alg> From 1b78e65d98266b32317ad413ba3a887b79582dd0 Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Thu, 22 Jul 2021 10:33:53 -0400 Subject: [PATCH 3/6] Editorial: Restore use of _operands_ in PluralRuleSelect --- spec/pluralrules.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/pluralrules.html b/spec/pluralrules.html index a0014935..5fb513ba 100644 --- a/spec/pluralrules.html +++ b/spec/pluralrules.html @@ -108,12 +108,12 @@ <h1> _locale_: a String, _type_: a String, _n_: a finite Number, - _operands_: a Plural Rules Operands Record corresponding with _n_, + _operands_: a Plural Rules Operands Record derived from formatting _n_, ) </h1> <dl class="header"> <dt>description</dt> - <dd>It returns the String from « *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, *"other"* » that best categorizes _n_ according to the rules for _locale_ and _type_.</dd> + <dd>It returns the String from « *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, *"other"* » that best categorizes the _operands_ representation of _n_ according to the rules for _locale_ and _type_.</dd> </dl> </emu-clause> From a7c7fc23b85a411d142c50d9373de5a516c7e309 Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Thu, 22 Jul 2021 13:29:32 -0400 Subject: [PATCH 4/6] Editorial: Define a structured signature for GetOperands --- spec/pluralrules.html | 58 ++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/spec/pluralrules.html b/spec/pluralrules.html index 5fb513ba..950300b7 100644 --- a/spec/pluralrules.html +++ b/spec/pluralrules.html @@ -27,35 +27,31 @@ <h1>InitializePluralRules ( _pluralRules_, _locales_, _options_ )</h1> </emu-alg> </emu-clause> - <emu-clause id="sec-getoperands" aoid="GetOperands"> - <h1>GetOperands ( _s_ )</h1> - <p> - When the GetOperands abstract operation is called with argument _s_, it performs the following steps: - </p> - + <emu-clause id="sec-getoperands" type="abstract operation"> + <h1> + GetOperands ( + _s_: a numeric String, + ) + </h1> + <dl class="header"> + </dl> <emu-alg> - 1. Assert: Type(_s_) is String. 1. Let _n_ be ! ToNumber(_s_). 1. Assert: _n_ is finite. 1. Let _dp_ be ! StringIndexOf(_s_, *"."*, 0). 1. If _dp_ = -1, then - 1. Set _iv_ to _n_. - 1. Let _f_ be 0. - 1. Let _v_ be 0. - 1. Else, - 1. Let _iv_ be the substring of _s_ from position 0, inclusive, to position _dp_, exclusive. - 1. Let _fv_ be the substring of _s_ from position _dp_, exclusive, to the end of _s_. - 1. Let _f_ be ! ToNumber(_fv_). - 1. Let _v_ be the length of _fv_. - 1. Let _i_ be abs(! ToNumber(_iv_)). - 1. If _f_ ≠ 0, then - 1. Let _ft_ be the value of _fv_ stripped of trailing *"0"*. - 1. Let _w_ be the length of _ft_. - 1. Let _t_ be ! ToNumber(_ft_). + 1. Let _intPart_ be _n_. + 1. Let _fracSlice_ be *""*. 1. Else, - 1. Let _w_ be 0. - 1. Let _t_ be 0. - 1. Return a new Record { [[Number]]: _n_, [[IntegerDigits]]: _i_, [[NumberOfFractionDigits]]: _v_, [[NumberOfFractionDigitsWithoutTrailing]]: _w_, [[FractionDigits]]: _f_, [[FractionDigitsWithoutTrailing]]: _t_ }. + 1. Let _intPart_ be the substring of _s_ from position 0, inclusive, to position _dp_, exclusive. + 1. Let _fracSlice_ be the substring of _s_ from position _dp_, exclusive, to the end of _s_. + 1. Let _i_ be abs(! ToNumber(_intPart_)). + 1. Let _fracDigitCount_ be the length of _fracSlice_. + 1. Let _f_ be ! ToNumber(_fracSlice_). + 1. Let _significantFracSlice_ be the value of _fracSlice_ stripped of trailing *"0"*. + 1. Let _significantFracDigitCount_ be the length of _significantFracSlice_. + 1. Let _significantFrac_ be ! ToNumber(_significantFracSlice_). + 1. Return a new Record { [[Number]]: _n_, [[IntegerDigits]]: _i_, [[FractionDigits]]: _f_, [[NumberOfFractionDigits]]: _fracDigitCount_, [[FractionDigitsWithoutTrailing]]: _significantFrac_, [[NumberOfFractionDigitsWithoutTrailing]]: _significantFracDigitCount_ }. </emu-alg> <emu-table id="table-plural-operands"> @@ -79,24 +75,24 @@ <h1>GetOperands ( _s_ )</h1> <td>Number of digits of [[Number]].</td> </tr> <tr> - <td>[[NumberOfFractionDigits]]</td> + <td>[[FractionDigits]]</td> <td>Number</td> - <td>Number of visible fraction digits in [[Number]], <i>with</i> trailing zeroes.</td> + <td>Number of visible fractional digits in [[Number]], <i>with</i> trailing zeroes.</td> </tr> <tr> - <td>[[NumberOfFractionDigitsWithoutTrailing]]</td> + <td>[[NumberOfFractionDigits]]</td> <td>Number</td> - <td>Number of visible fraction digits in [[Number]], <i>without</i> trailing zeroes.</td> + <td>Number of visible fraction digits in [[Number]], <i>with</i> trailing zeroes.</td> </tr> <tr> - <td>[[FractionDigits]]</td> + <td>[[FractionDigitsWithoutTrailing]]</td> <td>Number</td> - <td>Number of visible fractional digits in [[Number]], <i>with</i> trailing zeroes.</td> + <td>Number of visible fractional digits in [[Number]], <i>without</i> trailing zeroes.</td> </tr> <tr> - <td>[[FractionDigitsWithoutTrailing]]</td> + <td>[[NumberOfFractionDigitsWithoutTrailing]]</td> <td>Number</td> - <td>Number of visible fractional digits in [[Number]], <i>without</i> trailing zeroes.</td> + <td>Number of visible fraction digits in [[Number]], <i>without</i> trailing zeroes.</td> </tr> </table> </emu-table> From b8993d212ff8297afbc931ad1c4420102169323b Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Thu, 22 Jul 2021 23:11:54 -0400 Subject: [PATCH 5/6] Editorial: Align GetOperands with UTS #35 --- spec/pluralrules.html | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/spec/pluralrules.html b/spec/pluralrules.html index 950300b7..5eba80f5 100644 --- a/spec/pluralrules.html +++ b/spec/pluralrules.html @@ -30,10 +30,12 @@ <h1>InitializePluralRules ( _pluralRules_, _locales_, _options_ )</h1> <emu-clause id="sec-getoperands" type="abstract operation"> <h1> GetOperands ( - _s_: a numeric String, + _s_: a decimal String, ) </h1> <dl class="header"> + <dt>description</dt> + <dd>It extracts numeric features from _s_ that correspond with the operands of <a href="https://unicode.org/reports/tr35/tr35-numbers.html#Operands">Unicode Technical Standard #35, Part 3, Section 5.1.1</a>.</dd> </dl> <emu-alg> 1. Let _n_ be ! ToNumber(_s_). @@ -51,7 +53,7 @@ <h1> 1. Let _significantFracSlice_ be the value of _fracSlice_ stripped of trailing *"0"*. 1. Let _significantFracDigitCount_ be the length of _significantFracSlice_. 1. Let _significantFrac_ be ! ToNumber(_significantFracSlice_). - 1. Return a new Record { [[Number]]: _n_, [[IntegerDigits]]: _i_, [[FractionDigits]]: _f_, [[NumberOfFractionDigits]]: _fracDigitCount_, [[FractionDigitsWithoutTrailing]]: _significantFrac_, [[NumberOfFractionDigitsWithoutTrailing]]: _significantFracDigitCount_ }. + 1. Return a new Record { [[Number]]: abs(_n_), [[IntegerDigits]]: _i_, [[FractionDigits]]: _f_, [[NumberOfFractionDigits]]: _fracDigitCount_, [[FractionDigitsWithoutTrailing]]: _significantFrac_, [[NumberOfFractionDigitsWithoutTrailing]]: _significantFracDigitCount_ }. </emu-alg> <emu-table id="table-plural-operands"> @@ -61,38 +63,45 @@ <h1> <tr> <th>Internal Slot</th> <th>Type</th> + <th>UTS #35 Operand</th> <th>Description</th> </tr> </thead> <tr> <td>[[Number]]</td> <td>Number</td> - <td>Absolute value of the source number (integer and decimals)</td> + <td>n</td> + <td>Absolute value of the source number</td> </tr> <tr> <td>[[IntegerDigits]]</td> <td>Number</td> - <td>Number of digits of [[Number]].</td> + <td>i</td> + <td>Integer part of [[Number]].</td> </tr> <tr> <td>[[FractionDigits]]</td> <td>Number</td> - <td>Number of visible fractional digits in [[Number]], <i>with</i> trailing zeroes.</td> + <td>f</td> + <td>Visible fraction digits in [[Number]], <em>with</em> trailing zeroes, as an integer having [[NumberOfFractionDigits]] digits.</td> </tr> <tr> <td>[[NumberOfFractionDigits]]</td> <td>Number</td> - <td>Number of visible fraction digits in [[Number]], <i>with</i> trailing zeroes.</td> + <td>v</td> + <td>Number of visible fraction digits in [[Number]], <em>with</em> trailing zeroes.</td> </tr> <tr> <td>[[FractionDigitsWithoutTrailing]]</td> <td>Number</td> - <td>Number of visible fractional digits in [[Number]], <i>without</i> trailing zeroes.</td> + <td>t</td> + <td>Visible fraction digits in [[Number]], <em>without</em> trailing zeroes, as an integer having [[NumberOfFractionDigitsWithoutTrailing]] digits.</td> </tr> <tr> <td>[[NumberOfFractionDigitsWithoutTrailing]]</td> <td>Number</td> - <td>Number of visible fraction digits in [[Number]], <i>without</i> trailing zeroes.</td> + <td>w</td> + <td>Number of visible fraction digits in [[Number]], <em>without</em> trailing zeroes.</td> </tr> </table> </emu-table> From d440499d934f21e8b968fef58b9ac32443fe0255 Mon Sep 17 00:00:00 2001 From: Richard Gibson <richard.gibson@gmail.com> Date: Wed, 5 Jan 2022 19:28:18 -0500 Subject: [PATCH 6/6] Editorial: Use conventional string substring phrasing --- spec/pluralrules.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/pluralrules.html b/spec/pluralrules.html index 22ffe83b..39f3b68b 100644 --- a/spec/pluralrules.html +++ b/spec/pluralrules.html @@ -45,8 +45,8 @@ <h1> 1. Let _intPart_ be _n_. 1. Let _fracSlice_ be *""*. 1. Else, - 1. Let _intPart_ be the substring of _s_ from position 0, inclusive, to position _dp_, exclusive. - 1. Let _fracSlice_ be the substring of _s_ from position _dp_, exclusive, to the end of _s_. + 1. Let _intPart_ be the substring of _s_ from 0 to _dp_. + 1. Let _fracSlice_ be the substring of _s_ from _dp_ + 1. 1. Let _i_ be abs(! ToNumber(_intPart_)). 1. Let _fracDigitCount_ be the length of _fracSlice_. 1. Let _f_ be ! ToNumber(_fracSlice_).