Skip to content

Commit 3db33de

Browse files
aphillipseemeli
andauthored
Preparing the specification for LDML47 release (#1007)
* Preparing the specification for LDML47 release This PR includes the changes necessary to prepare the specification for LDML47, which is the first Stable release of MF2. Normative changes: - Activate the stability policy Non-normative changes: - Fixes #1001 * Update syntax.md * Update formatting.md - indent headers as appropriate - make headings unique in the spec to assist with linking and TOC generation * Update appendices.md * Update errors.md * Update u-namespace.md * Update README.md * Update README.md * Remove "introduction" heading from formatting Introduction headers are superfluous when the spec is assembled and implied when it is still separate messages * Make a better header for "formatting" subsection * Make non-`number`/`integer` functions DRAFT * Make date/time DRAFT * Describe Draft and Stable * typo :-P * Update README.md * Update spec/data-model/README.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/functions/README.md Co-authored-by: Eemeli Aro <[email protected]> * Update spec/u-namespace.md Co-authored-by: Eemeli Aro <[email protected]> * Remove proposed * Remove proposed Probably the note should be removed, since the whole function is Draft * Remove one stability policy item per discussion * Update spec/functions/datetime.md Co-authored-by: Eemeli Aro <[email protected]> * Functions _or_ options can be Drafty Co-authored-by: Addison Phillips <[email protected]> * Remove spurious mentions of 2/2.0 * Remove spurious mention of 2.0 * Remove spurious mentions of 2/2.0 Note that 2.0 was kept in the acknowledgements section on purpose * option-option typo fix --------- Co-authored-by: Eemeli Aro <[email protected]>
1 parent d096cab commit 3db33de

File tree

10 files changed

+127
-121
lines changed

10 files changed

+127
-121
lines changed

spec/appendices.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Appendices
1+
## Appendices
22

3-
## Security Considerations
3+
### Security Considerations
44

5-
MessageFormat 2.0 _patterns_ are meant to allow a _message_ to include any string value
5+
MessageFormat _patterns_ are meant to allow a _message_ to include any string value
66
which users might normally wish to use in their environment.
77
Programming languages and other environments vary in what characters are permitted
88
to appear in a valid string.
@@ -25,7 +25,7 @@ but do not generate errors from MessageFormat parsers or processing APIs.
2525

2626
Bidirectional text containing right-to-left characters (such as used for Arabic or Hebrew)
2727
also poses a potential source of confusion for users.
28-
Since MessageFormat 2.0's syntax makes use of
28+
Since MessageFormat's syntax makes use of
2929
keywords and symbols that are left-to-right or consist of neutral characters
3030
(including characters subject to mirroring under the Unicode Bidirectional Algorithm),
3131
it is possible to create messages that,
@@ -35,17 +35,17 @@ have a misleading appearance or are difficult to parse visually.
3535
For more information, see \[[UTS#55](https://unicode.org/reports/tr55/)\]
3636
<cite>Unicode Source Code Handling</cite>.
3737

38-
MessageFormat 2.0 implementations might allow end-users to install
38+
MessageFormat implementations might allow end-users to install
3939
_selectors_, _functions_, or _markup_ from third-party sources.
4040
Such functionality can be a vector for various exploits,
4141
including buffer overflow, code injection, user tracking,
4242
fingerprinting, and other types of bad behavior.
4343
Any installed code needs to be appropriately sandboxed.
4444
In addition, end-users need to be aware of the risks involved.
4545

46-
## Acknowledgements
46+
### Acknowledgements
4747

48-
Special thanks to the following people for their contributions to making MessageFormat v2.
48+
Special thanks to the following people for their contributions to making MessageFormat 2.0.
4949
The following people contributed to our github repo and are listed in order by contribution size:
5050

5151
Addison Phillips,

spec/data-model/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Interchange Data Model
1+
## Interchange Data Model
22

33
This section defines a data model representation of MessageFormat 2 _messages_.
44

@@ -47,7 +47,7 @@ declarations, options, and attributes to be optional rather than required proper
4747
> sometimes uses the production `identifier`.
4848
> This happens when the named item, such as a _function_, supports namespacing.
4949
50-
## Messages
50+
### Message Model
5151

5252
A `SelectMessage` corresponds to a syntax message that includes _selectors_.
5353
A message without _selectors_ and with a single _pattern_ is represented by a `PatternMessage`.
@@ -114,7 +114,7 @@ interface CatchallKey {
114114
}
115115
```
116116

117-
## Patterns
117+
### Pattern Model
118118

119119
Each `Pattern` contains a linear sequence of text and placeholders corresponding to potential output of a message.
120120

@@ -160,7 +160,7 @@ interface FunctionExpression {
160160
}
161161
```
162162

163-
## Expressions
163+
### Expression Model
164164

165165
The `Literal` and `VariableRef` correspond to the the _literal_ and _variable_ syntax rules.
166166
When they are used as the `body` of an `Expression`,
@@ -200,7 +200,7 @@ interface FunctionRef {
200200
type Options = Map<string, Literal | VariableRef>;
201201
```
202202

203-
## Markup
203+
### Markup Model
204204

205205
A `Markup` object has a `kind` of either `"open"`, `"standalone"`, or `"close"`,
206206
each corresponding to _open_, _standalone_, and _close_ _markup_.
@@ -218,7 +218,7 @@ interface Markup {
218218
}
219219
```
220220

221-
## Attributes
221+
### Attribute Model
222222

223223
`Attributes` is a key-value mapping
224224
used to represent the _expression_ and _markup_ _attributes_.
@@ -229,7 +229,7 @@ _Attributes_ with no value are represented by `true` here.
229229
type Attributes = Map<string, Literal | true>;
230230
```
231231

232-
## Extensions
232+
### Model Extensions
233233

234234
Implementations MAY extend this data model with additional interfaces,
235235
as well as adding new fields to existing interfaces.

spec/errors.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Errors
1+
## Errors
22

33
Errors can occur during the processing of a _message_.
44
Some errors can be detected statically,
@@ -9,7 +9,7 @@ Other errors might be detected during selection or formatting of a given _messag
99
Where available, the use of validation tools is recommended,
1010
as early detection of errors makes their correction easier.
1111

12-
## Error Handling
12+
### Error Handling
1313

1414
_Syntax Errors_ and _Data Model Errors_ apply to all message processors,
1515
and MUST be emitted as soon as possible.
@@ -51,7 +51,7 @@ or calling MatchSelectorKeys with its resolved value,
5151
the _selector_ MUST NOT match any _variant_ _key_ other than the catch-all `*`
5252
and a _Bad Selector_ error MUST be emitted.
5353

54-
## Syntax Errors
54+
### Syntax Errors
5555

5656
**_<dfn>Syntax Errors</dfn>_** occur when the syntax representation of a message is not _well-formed_.
5757

@@ -73,12 +73,12 @@ and a _Bad Selector_ error MUST be emitted.
7373
> .local $var = {|no message body|}
7474
> ```
7575
76-
## Data Model Errors
76+
### Data Model Errors
7777
7878
**_<dfn>Data Model Errors</dfn>_** occur when a message is not _valid_ due to
7979
violating one of the semantic requirements on its structure.
8080
81-
### Variant Key Mismatch
81+
#### Variant Key Mismatch
8282
8383
A **_<dfn>Variant Key Mismatch</dfn>_** occurs when the number of keys on a _variant_
8484
does not equal the number of _selectors_.
@@ -101,7 +101,7 @@ does not equal the number of _selectors_.
101101
> * * {{Otherwise}}
102102
> ```
103103
104-
### Missing Fallback Variant
104+
#### Missing Fallback Variant
105105
106106
A **_<dfn>Missing Fallback Variant</dfn>_** error occurs when the message
107107
does not include a _variant_ with only catch-all keys.
@@ -123,7 +123,7 @@ does not include a _variant_ with only catch-all keys.
123123
> * 1 {{Second is one}}
124124
> ```
125125
126-
### Missing Selector Annotation
126+
#### Missing Selector Annotation
127127
128128
A **_<dfn>Missing Selector Annotation</dfn>_** error occurs when the _message_
129129
contains a _selector_ that does not
@@ -151,7 +151,7 @@ directly or indirectly reference a _declaration_ with a _function_.
151151
> * {{Value is not one}}
152152
> ```
153153
154-
### Duplicate Declaration
154+
#### Duplicate Declaration
155155
156156
A **_<dfn>Duplicate Declaration</dfn>_** error occurs when a _variable_ is declared more than once.
157157
Note that an input _variable_ is implicitly declared when it is first used,
@@ -182,7 +182,7 @@ so explicitly declaring it after such use is also an error.
182182
> {{{$var} cannot be redefined. {$var2} cannot refer to itself}}
183183
> ```
184184
185-
### Duplicate Option Name
185+
#### Duplicate Option Name
186186
187187
A **_<dfn>Duplicate Option Name</dfn>_** error occurs when the same _identifier_
188188
appears on the left-hand side of more than one _option_ in the same _expression_.
@@ -198,7 +198,7 @@ appears on the left-hand side of more than one _option_ in the same _expression_
198198
> {{This is {$foo}}}
199199
> ```
200200
201-
### Duplicate Variant
201+
#### Duplicate Variant
202202
203203
A **_<dfn>Duplicate Variant</dfn>_** error occurs when the
204204
same list of _keys_ is used for more than one _variant_.
@@ -222,12 +222,12 @@ same list of _keys_ is used for more than one _variant_.
222222
> * * {{The default variant}}
223223
> ```
224224
225-
## Resolution Errors
225+
### Resolution Errors
226226
227227
**_<dfn>Resolution Errors</dfn>_** occur when the runtime value of a part of a message
228228
cannot be determined.
229229
230-
### Unresolved Variable
230+
#### Unresolved Variable
231231
232232
An **_<dfn>Unresolved Variable</dfn>_** error occurs when a variable reference cannot be resolved.
233233
@@ -246,7 +246,7 @@ An **_<dfn>Unresolved Variable</dfn>_** error occurs when a variable reference c
246246
> * {{The value is not one.}}
247247
> ```
248248
249-
### Unknown Function
249+
#### Unknown Function
250250
251251
An **_<dfn>Unknown Function</dfn>_** error occurs when an _expression_ includes
252252
a reference to a function which cannot be resolved.
@@ -266,7 +266,7 @@ a reference to a function which cannot be resolved.
266266
> * {{The value is not one.}}
267267
> ```
268268
269-
### Bad Selector
269+
#### Bad Selector
270270
271271
A **_<dfn>Bad Selector</dfn>_** error occurs when a message includes a _selector_
272272
with a _resolved value_ which does not support selection.
@@ -280,7 +280,7 @@ with a _resolved value_ which does not support selection.
280280
> * {{The due date is {$day}}}
281281
> ```
282282
283-
## Message Function Errors
283+
### Message Function Errors
284284
285285
A **_<dfn>Message Function Error</dfn>_** is any error that occurs
286286
when calling a _function handler_
@@ -319,7 +319,7 @@ Implementations MAY also provide implementation-defined _Message Function Error_
319319
> Your {$field} is {$id :ns:get field=$field}
320320
> ```
321321
322-
### Bad Operand
322+
#### Bad Operand
323323
324324
A **_<dfn>Bad Operand</dfn>_** error is any error that occurs due to the content or format of the _operand_,
325325
such as when the _operand_ provided to a _function_ during _function resolution_ does not match one of the
@@ -344,7 +344,7 @@ for that specific _function_.
344344
> * {{The value is not one.}}
345345
> ```
346346
347-
### Bad Option
347+
#### Bad Option
348348
349349
A **_<dfn>Bad Option</dfn>_** error is an error that occurs when there is
350350
an implementation-defined error with an _option_ or its value.
@@ -365,7 +365,7 @@ These might include:
365365
> The answer is {42 :number minimumFractionDigits=foo}.
366366
> ```
367367
368-
### Bad Variant Key
368+
#### Bad Variant Key
369369
370370
A **_<dfn>Bad Variant Key</dfn>_** error is an error that occurs when a _variant_ _key_
371371
does not match the expected implementation-defined format.
@@ -383,7 +383,7 @@ does not match the expected implementation-defined format.
383383
> * {{The value is not one.}}
384384
> ```
385385
386-
### Unsupported Operation
386+
#### Unsupported Operation
387387
388388
A **_<dfn>Unsupported Operation</dfn>_** error is an implementation-specific error
389389
that occurs when a given _option_, _option_ value, _operand_ value, or some combination

0 commit comments

Comments
 (0)