Skip to content

Commit

Permalink
Meta: Update ecmarkup
Browse files Browse the repository at this point in the history
  • Loading branch information
anba committed Aug 9, 2023
1 parent 03da4af commit 9856d3e
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 72 deletions.
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"license": "SEE LICENSE IN https://tc39.es/ecma402/#sec-copyright-and-software-license",
"homepage": "https://tc39.es/ecma402/",
"dependencies": {
"ecmarkup": "^16.0.0",
"ecmarkup": "^17.1.1",
"@tc39/ecma262-biblio": "2.1.2616"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions spec/collator.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ <h1>
1. Set _opt_.[[co]] to _collation_.
1. Let _numeric_ be ? GetOption(_options_, *"numeric"*, ~boolean~, ~empty~, *undefined*).
1. If _numeric_ is not *undefined*, then
1. Let _numeric_ be ! ToString(_numeric_).
1. Set _numeric_ to ! ToString(_numeric_).
1. Set _opt_.[[kn]] to _numeric_.
1. Let _caseFirst_ be ? GetOption(_options_, *"caseFirst"*, ~string~, &laquo; *"upper"*, *"lower"*, *"false"* &raquo;, *undefined*).
1. Set _opt_.[[kf]] to _caseFirst_.
1. Let _relevantExtensionKeys_ be %Collator%.[[RelevantExtensionKeys]].
1. Let _r_ be ResolveLocale(%Collator%.[[AvailableLocales]], _requestedLocales_, _opt_, _relevantExtensionKeys_, _localeData_).
1. Set _collator_.[[Locale]] to _r_.[[locale]].
1. Let _collation_ be _r_.[[co]].
1. If _collation_ is *null*, let _collation_ be *"default"*.
1. Set _collation_ to _r_.[[co]].
1. If _collation_ is *null*, set _collation_ to *"default"*.
1. Set _collator_.[[Collation]] to _collation_.
1. If _relevantExtensionKeys_ contains *"kn"*, then
1. Set _collator_.[[Numeric]] to SameValue(_r_.[[kn]], *"true"*).
Expand All @@ -72,11 +72,11 @@ <h1>
1. Let _sensitivity_ be ? GetOption(_options_, *"sensitivity"*, ~string~, &laquo; *"base"*, *"accent"*, *"case"*, *"variant"* &raquo;, *undefined*).
1. If _sensitivity_ is *undefined*, then
1. If _usage_ is *"sort"*, then
1. Let _sensitivity_ be *"variant"*.
1. Set _sensitivity_ to *"variant"*.
1. Else,
1. Let _dataLocale_ be _r_.[[dataLocale]].
1. Let _dataLocaleData_ be _localeData_.[[&lt;_dataLocale_&gt;]].
1. Let _sensitivity_ be _dataLocaleData_.[[sensitivity]].
1. Set _sensitivity_ to _dataLocaleData_.[[sensitivity]].
1. Set _collator_.[[Sensitivity]] to _sensitivity_.
1. Let _ignorePunctuation_ be ? GetOption(_options_, *"ignorePunctuation"*, ~boolean~, ~empty~, *false*).
1. Set _collator_.[[IgnorePunctuation]] to _ignorePunctuation_.
Expand Down Expand Up @@ -317,7 +317,7 @@ <h1>Intl.Collator.prototype.resolvedOptions ( )</h1>
1. If the current row has an Extension Key value, then
1. Let _extensionKey_ be the Extension Key value of the current row.
1. If %Collator%.[[RelevantExtensionKeys]] does not contain _extensionKey_, then
1. Let _v_ be *undefined*.
1. Set _v_ to *undefined*.
1. If _v_ is not *undefined*, then
1. Perform ! CreateDataPropertyOrThrow(_options_, _p_, _v_).
1. Return _options_.
Expand Down
42 changes: 24 additions & 18 deletions spec/datetimeformat.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h1>
1. Set _formatOptions_.[[&lt;_prop_&gt;]] to _value_.
1. If _value_ is not *undefined*, then
1. Set _hasExplicitFormatComponents_ to *true*.
1. Let _matcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, &laquo; *"basic"*, *"best fit"* &raquo;, *"best fit"*).
1. Let _formatMatcher_ be ? GetOption(_options_, *"formatMatcher"*, ~string~, &laquo; *"basic"*, *"best fit"* &raquo;, *"best fit"*).
1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, ~string~, &laquo; *"full"*, *"long"*, *"medium"*, *"short"* &raquo;, *undefined*).
1. Set _dateTimeFormat_.[[DateStyle]] to _dateStyle_.
1. Let _timeStyle_ be ? GetOption(_options_, *"timeStyle"*, ~string~, &laquo; *"full"*, *"long"*, *"medium"*, *"short"* &raquo;, *undefined*).
Expand All @@ -138,19 +138,19 @@ <h1>
1. If _required_ is ~date~ or ~any~, then
1. For each property name _prop_ of &laquo; *"weekday"*, *"year"*, *"month"*, *"day"* &raquo;, do
1. Let _value_ be _formatOptions_.[[&lt;_prop_&gt;]].
1. If _value_ is not *undefined*, let _needDefaults_ be *false*.
1. If _value_ is not *undefined*, set _needDefaults_ to *false*.
1. If _required_ is ~time~ or ~any~, then
1. For each property name _prop_ of &laquo; *"dayPeriod"*, *"hour"*, *"minute"*, *"second"*, *"fractionalSecondDigits"* &raquo;, do
1. Let _value_ be _formatOptions_.[[&lt;_prop_&gt;]].
1. If _value_ is not *undefined*, let _needDefaults_ be *false*.
1. If _value_ is not *undefined*, set _needDefaults_ to *false*.
1. If _needDefaults_ is *true* and _defaults_ is either ~date~ or ~all~, then
1. For each property name _prop_ of &laquo; *"year"*, *"month"*, *"day"* &raquo;, do
1. Set _formatOptions_.[[&lt;_prop_&gt;]] to *"numeric"*.
1. If _needDefaults_ is *true* and _defaults_ is either ~time~ or ~all~, then
1. For each property name _prop_ of &laquo; *"hour"*, *"minute"*, *"second"* &raquo;, do
1. Set _formatOptions_.[[&lt;_prop_&gt;]] to *"numeric"*.
1. Let _formats_ be _dataLocaleData_.[[formats]].[[&lt;_resolvedCalendar_&gt;]].
1. If _matcher_ is *"basic"*, then
1. If _formatMatcher_ is *"basic"*, then
1. Let _bestFormat_ be BasicFormatMatcher(_formatOptions_, _formats_).
1. Else,
1. Let _bestFormat_ be BestFitFormatMatcher(_formatOptions_, _formats_).
Expand Down Expand Up @@ -844,24 +844,29 @@ <h1>
1. For each property name _property_ shown in <emu-xref href="#table-datetimeformat-components"></emu-xref>, do
1. If _options_ has a field [[&lt;_property_&gt;]], let _optionsProp_ be _options_.[[&lt;_property_&gt;]]; else let _optionsProp_ be *undefined*.
1. If _format_ has a field [[&lt;_property_&gt;]], let _formatProp_ be _format_.[[&lt;_property_&gt;]]; else let _formatProp_ be *undefined*.
1. If _optionsProp_ is *undefined* and _formatProp_ is not *undefined*, decrease _score_ by _additionPenalty_.
1. Else if _optionsProp_ is not *undefined* and _formatProp_ is *undefined*, decrease _score_ by _removalPenalty_.
1. If _optionsProp_ is *undefined* and _formatProp_ is not *undefined*, then
1. Decrease _score_ by _additionPenalty_.
1. Else if _optionsProp_ is not *undefined* and _formatProp_ is *undefined*, then
1. Decrease _score_ by _removalPenalty_.
1. Else if _property_ is *"timeZoneName"*, then
1. If _optionsProp_ is *"short"* or *"shortGeneric"*, then
1. If _formatProp_ is *"shortOffset"*, decrease _score_ by _offsetPenalty_.
1. Else if _formatProp_ is *"longOffset"*, decrease _score_ by (_offsetPenalty_ + _shortMorePenalty_).
1. Else if _optionsProp_ is *"short"* and _formatProp_ is *"long"*, decrease _score_ by _shortMorePenalty_.
1. Else if _optionsProp_ is *"shortGeneric"* and _formatProp_ is *"longGeneric"*, decrease _score_ by _shortMorePenalty_.
1. Else if _optionsProp_ &ne; _formatProp_, decrease _score_ by _removalPenalty_.
1. Else if _optionsProp_ is *"shortOffset"* and _formatProp_ is *"longOffset"*, decrease _score_ by _shortMorePenalty_.
1. Else if _optionsProp_ is *"shortOffset"* and _formatProp_ is *"longOffset"*, then
1. Decrease _score_ by _shortMorePenalty_.
1. Else if _optionsProp_ is *"long"* or *"longGeneric"*, then
1. If _formatProp_ is *"longOffset"*, decrease _score_ by _offsetPenalty_.
1. Else if _formatProp_ is *"shortOffset"*, decrease _score_ by (_offsetPenalty_ + _longLessPenalty_).
1. Else if _optionsProp_ is *"long"* and _formatProp_ is *"short"*, decrease _score_ by _longLessPenalty_.
1. Else if _optionsProp_ is *"longGeneric"* and _formatProp_ is *"shortGeneric"*, decrease _score_ by _longLessPenalty_.
1. Else if _optionsProp_ &ne; _formatProp_, decrease _score_ by _removalPenalty_.
1. Else if _optionsProp_ is *"longOffset"* and _formatProp_ is *"shortOffset"*, decrease _score_ by _longLessPenalty_.
1. Else if _optionsProp_ &ne; _formatProp_, decrease _score_ by _removalPenalty_.
1. Else if _optionsProp_ is *"longOffset"* and _formatProp_ is *"shortOffset"*, then
1. Decrease _score_ by _longLessPenalty_.
1. Else if _optionsProp_ &ne; _formatProp_, then
1. Decrease _score_ by _removalPenalty_.
1. Else if _optionsProp_ &ne; _formatProp_, then
1. If _property_ is *"fractionalSecondDigits"*, then
1. Let _values_ be &laquo; 1, 2, 3 &raquo;.
Expand All @@ -875,8 +880,8 @@ <h1>
1. Else if _delta_ = -1, decrease _score_ by _shortLessPenalty_.
1. Else if _delta_ = -2, decrease _score_ by _longLessPenalty_.
1. If _score_ > _bestScore_, then
1. Let _bestScore_ be _score_.
1. Let _bestFormat_ be _format_.
1. Set _bestScore_ to _score_.
1. Set _bestFormat_ to _format_.
1. Return _bestFormat_.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -954,7 +959,7 @@ <h1>
1. Else if _p_ is equal to *"fractionalSecondDigits"*, then
1. Assert: _fractionalSecondDigits_ is not *undefined*.
1. Let _v_ be _tm_.[[Millisecond]].
1. Let _v_ be floor(_v_ &times; 10<sup>( _fractionalSecondDigits_ - 3 )</sup>).
1. Set _v_ to floor(_v_ &times; 10<sup>( _fractionalSecondDigits_ - 3 )</sup>).
1. Let _fv_ be FormatNumeric(_nf3_, _v_).
1. Append a new Record { [[Type]]: *"fractionalSecond"*, [[Value]]: _fv_ } as the last element of _result_.
1. Else if _p_ is equal to *"dayPeriod"*, then
Expand All @@ -970,19 +975,20 @@ <h1>
1. If _rangeFormatOptions_ is not *undefined*, let _f_ be the value of _rangeFormatOptions_'s field whose name matches _p_.
1. Else, let _f_ be the value of _dateTimeFormat_'s internal slot whose name is the Internal Slot column of the matching row.
1. Let _v_ be the value of _tm_'s field whose name is the Internal Slot column of the matching row.
1. If _p_ is *"year"* and _v_ &le; 0, let _v_ be 1 - _v_.
1. If _p_ is *"year"* and _v_ &le; 0, set _v_ to 1 - _v_.
1. If _p_ is *"month"*, increase _v_ by 1.
1. If _p_ is *"hour"* and _dateTimeFormat_.[[HourCycle]] is *"h11"* or *"h12"*, then
1. Let _v_ be _v_ modulo 12.
1. If _v_ is 0 and _dateTimeFormat_.[[HourCycle]] is *"h12"*, let _v_ be 12.
1. Set _v_ to _v_ modulo 12.
1. If _v_ is 0 and _dateTimeFormat_.[[HourCycle]] is *"h12"*, set _v_ to 12.
1. If _p_ is *"hour"* and _dateTimeFormat_.[[HourCycle]] is *"h24"*, then
1. If _v_ is 0, let _v_ be 24.
1. If _v_ is 0, set _v_ to 24.
1. If _f_ is *"numeric"*, then
1. Let _fv_ be FormatNumeric(_nf_, _v_).
1. Else if _f_ is *"2-digit"*, then
1. Let _fv_ be FormatNumeric(_nf2_, _v_).
1. If the *"length"* property of _fv_ is greater than 2, let _fv_ be the substring of _fv_ containing the last two characters.
1. Else if _f_ is *"narrow"*, *"short"*, or *"long"*, then 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 and calendar of _dateTimeFormat_. If _p_ is *"month"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Day]] is *undefined*. If _p_ is *"month"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[day]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Era]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[era]] is *undefined*. If the implementation does not have a localized representation of _f_, then use the String value of _v_ itself.
1. If the *"length"* property of _fv_ is greater than 2, set _fv_ to the substring of _fv_ containing the last two characters.
1. Else if _f_ is *"narrow"*, *"short"*, or *"long"*, then
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 and calendar of _dateTimeFormat_. If _p_ is *"month"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Day]] is *undefined*. If _p_ is *"month"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[day]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is *undefined*, then the String value may also depend on whether _dateTimeFormat_.[[Era]] is *undefined*. If _p_ is *"era"* and _rangeFormatOptions_ is not *undefined*, then the String value may also depend on whether _rangeFormatOptions_.[[era]] is *undefined*. 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_ is equal to *"ampm"*, then
1. Let _v_ be _tm_.[[Hour]].
Expand Down
4 changes: 2 additions & 2 deletions spec/displaynames.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1>Intl.DisplayNames ( _locales_, _options_ )</h1>
1. Assert: _typeFields_ is a Record (see <emu-xref href="#sec-Intl.DisplayNames-internal-slots"></emu-xref>).
1. If _type_ is *"language"*, then
1. Set _displayNames_.[[LanguageDisplay]] to _languageDisplay_.
1. Let _typeFields_ be _typeFields_.[[&lt;_languageDisplay_&gt;]].
1. Set _typeFields_ to _typeFields_.[[&lt;_languageDisplay_&gt;]].
1. Assert: _typeFields_ is a Record (see <emu-xref href="#sec-Intl.DisplayNames-internal-slots"></emu-xref>).
1. Let _styleFields_ be _typeFields_.[[&lt;_style_&gt;]].
1. Assert: _styleFields_ is a Record (see <emu-xref href="#sec-Intl.DisplayNames-internal-slots"></emu-xref>).
Expand Down Expand Up @@ -156,7 +156,7 @@ <h1>Intl.DisplayNames.prototype.of ( _code_ )</h1>
1. Let _displayNames_ be *this* value.
1. Perform ? RequireInternalSlot(_displayNames_, [[InitializedDisplayNames]]).
1. Let _code_ be ? ToString(_code_).
1. Let _code_ be ? CanonicalCodeForDisplayNames(_displayNames_.[[Type]], _code_).
1. Set _code_ to ? CanonicalCodeForDisplayNames(_displayNames_.[[Type]], _code_).
1. Let _fields_ be _displayNames_.[[Fields]].
1. If _fields_ has a field [[&lt;_code_&gt;]], return _fields_.[[&lt;_code_&gt;]].
1. If _displayNames_.[[Fallback]] is *"code"*, return _code_.
Expand Down
Loading

0 comments on commit 9856d3e

Please sign in to comment.