Skip to content

Commit b4b2921

Browse files
committed
Apply suggestions from code review
1 parent af2d4e9 commit b4b2921

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

spec/formatting.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ the following steps are taken:
260260
261261
3. Perform _option resolution_.
262262
263-
4. Determine the **_<dfn>function context</dfn>_** for calling the function implementation.
264-
This includes:
263+
4. Determine the _function context_ for calling the _function handler_.
264+
265+
The **_<dfn>function context</dfn>_** contains the context necessary for
266+
the _function handler_ to resolve the _expression_. This includes:
265267
266268
- The current _locale_,
267269
potentially including a fallback chain of locales.

spec/u-namespace.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,20 @@ language tags,
2727
or an implementation-defined list of such tags.
2828

2929
Replaces the _locale_ defined in the _function context_ for this _expression_.
30-
The value is ignored when set on _markup_.
30+
31+
If this option is set on _markup_, a _Bad Option_ error is emitted
32+
and the value of the `u:locale` option is ignored.
3133

3234
During processing, the `u:locale` option
33-
is always removed from the resolved mapping of _options_.
35+
MUST be removed from the resolved mapping of _options_
36+
before calling the _function handler_.
3437

3538
Values matching the following ABNF are always accepted:
3639
```abnf
37-
u-locale-option = langtag *(o "," o langtag)
40+
u-locale-option = unicode_bcp47_locale_id *(o "," o unicode_bcp47_locale_id)
3841
```
39-
using `langtag` as defined in [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
40-
Note that `langtag` is the rule for "normal language tags",
41-
and does not include private-use or grandfathered tags.
42+
using `unicode_bcp47_locale_id` as defined for
43+
[Unicode Locale Identifier](https://cldr-smoke.unicode.org/spec/main/ldml/tr35.html#unicode_bcp47_locale_id).
4244

4345
Implementations MAY support additional language tags,
4446
such as private-use or grandfathered tags,
@@ -53,10 +55,13 @@ and the value of the `u:locale` option is ignored.
5355

5456
Replaces the base directionality defined in
5557
the _function context_ for this _expression_.
56-
The value is ignored when set on _markup_.
58+
59+
If this option is set on _markup_, a _Bad Option_ error is emitted
60+
and the value of the `u:dir` option is ignored.
5761

5862
During processing, the `u:dir` option
59-
is always removed from the resolved mapping of _options_.
63+
MUST be removed from the resolved mapping of _options_
64+
before calling the _function handler_.
6065

6166
Accepts the following string values:
6267
- `ltr`: left-to-right directionality

test/tests/u-options.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"tests": [
99
{
10-
"src": "{#tag u:id=x u:dir=rtl u:locale=ar}content{/ns:tag u:id=x}",
10+
"src": "{#tag u:id=x}content{/ns:tag u:id=x}",
1111
"exp": "content",
1212
"expParts": [
1313
{
@@ -28,6 +28,27 @@
2828
}
2929
]
3030
},
31+
{
32+
"src": "{#tag u:dir=rtl u:locale=ar}content{/ns:tag}",
33+
"exp": "content",
34+
"expErrors": [{ "type": "bad-option" }, { "type": "bad-option" }],
35+
"expParts": [
36+
{
37+
"type": "markup",
38+
"kind": "open",
39+
"name": "tag"
40+
},
41+
{
42+
"type": "literal",
43+
"value": "content"
44+
},
45+
{
46+
"type": "markup",
47+
"kind": "close",
48+
"name": "tag"
49+
}
50+
]
51+
},
3152
{
3253
"src": "hello {4.2 :number u:locale=fr}",
3354
"exp": "hello 4,2"

0 commit comments

Comments
 (0)