@@ -12,7 +12,7 @@ their handling during formatting is specified here as well.
1212
1313Formatting of a _ message_ is defined by the following operations:
1414
15- - ** _ Expression Resolution_ ** determines the value of an _ expression_ ,
15+ - ** _ Expression and Markup Resolution_ ** determines the value of an _ expression_ or _ markup _ ,
1616 with reference to the current _ formatting context_ .
1717 This can include multiple steps,
1818 such as looking up the value of a variable and calling formatting functions.
@@ -83,9 +83,10 @@ At a minimum, it includes:
8383
8484Implementations MAY include additional fields in their _ formatting context_ .
8585
86- ## Expression Resolution
86+ ## Expression and Markup Resolution
8787
8888_ Expressions_ are used in _ declarations_ , _ selectors_ , and _ patterns_ .
89+ _ Markup_ is only used in _ patterns_ .
8990
9091In a _ declaration_ , the resolved value of the _ expression_ is bound to a _ variable_ ,
9192which is available for use by later _ expressions_ .
@@ -98,7 +99,7 @@ but also the _variable_ to which the resolved value of the _variable-expression_
9899
99100In _ selectors_ , the resolved value of an _ expression_ is used for _ pattern selection_ .
100101
101- In a _ pattern_ , the resolved value of an _ expression_ is used in its _ formatting_ .
102+ In a _ pattern_ , the resolved value of an _ expression_ or _ markup _ is used in its _ formatting_ .
102103
103104The shapes of resolved values are implementation-dependent,
104105and different implementations MAY choose to perform different levels of resolution.
@@ -210,17 +211,7 @@ the following steps are taken:
210211 Implementations are not required to implement _namespaces_ or installable
211212 _function registries_.
212213
213- 3. Resolve the _options_ to a mapping of string identifiers to values.
214- If _options_ is missing, the mapping will be empty.
215- For each _option_:
216- - Resolve the _identifier_ of the _option_.
217- - If the _option_'s _identifier_ already exists in the resolved mapping of _options_,
218- emit a Duplicate Option Name error.
219- - If the _option_'s right-hand side successfully resolves to a value,
220- bind the _identifier_ of the _option_ to the resolved value in the mapping.
221- - Otherwise, bind the _identifier_ of the _option_ to an unresolved value in the mapping.
222- Implementations MAY later remove this value before calling the _function_.
223- (Note that an Unresolved Variable error will have been emitted.)
214+ 3. Perform _option resolution_.
224215
2252164. Call the function implementation with the following arguments:
226217
@@ -247,6 +238,37 @@ the following steps are taken:
247238 If the call fails or does not return a valid value,
248239 emit a Resolution error and use a _fallback value_ for the _expression_.
249240
241+ #### Option Resolution
242+
243+ The result of resolving _option_ values is a mapping of string identifiers to values.
244+
245+ For each _option_:
246+
247+ - Resolve the _identifier_ of the _option_.
248+ - If the _option_'s _identifier_ already exists in the resolved mapping of _options_,
249+ emit a Duplicate Option Name error.
250+ - If the _option_'s right-hand side successfully resolves to a value,
251+ bind the _identifier_ of the _option_ to the resolved value in the mapping.
252+ - Otherwise, bind the _identifier_ of the _option_ to an unresolved value in the mapping.
253+ Implementations MAY later remove this value before calling the _function_.
254+ (Note that an Unresolved Variable error will have been emitted.)
255+
256+ Errors MAY be emitted during _option resolution_,
257+ but it always resolves to some mapping of string identifiers to values.
258+ This mapping can be empty.
259+
260+ ### Markup Resolution
261+
262+ Unlike _functions_, the resolution of _markup_ is not customizable.
263+
264+ The resolved value of _markup_ includes the following fields:
265+
266+ - The type of the markup: open, standalone, or close
267+ - The _identifier_ of the _markup_
268+ - For _markup-open_ and _markup_standalone_,
269+ the resolved _options_ values after _option resolution_.
270+
271+ The resolution of _markup_ MUST always succeed.
250272
251273### Fallback Resolution
252274
@@ -304,7 +326,7 @@ The _fallback value_ depends on the contents of the _expression_:
304326 > the message formats to `{$arg}`.
305327
306328- _function_ _expression_ with no _operand_:
307- the _function_ starting sigil followed by its _identifier_
329+ U+003A COLON `:` followed by the _function_ _identifier_
308330
309331 > Examples:
310332 > In a context where `:func` fails to resolve, `{:func}` resolves to the _fallback value_ `:func`.
@@ -599,7 +621,7 @@ one {{Category match}}
599621## Formatting
600622
601623After _pattern selection_,
602- each _text_ and _expression_ part of the selected _pattern_ is resolved and formatted.
624+ each _text_ and _placeholder_ part of the selected _pattern_ is resolved and formatted.
603625
604626_Formatting_ is a mostly implementation-defined process,
605627as it depends on the implementation's shape for resolved values
@@ -618,13 +640,18 @@ appropriate data type or structure. Some examples of these include:
618640- A string with associated attributes for portions of its text.
619641- A flat sequence of objects corresponding to each resolved value.
620642- A hierarchical structure of objects that group spans of resolved values,
621- such as sequences delimited by "open" and "close" _function_ _annotations_ .
643+ such as sequences delimited by _markup-open_ and _markup-close_ _placeholders_ .
622644
623645Implementations SHOULD provide _formatting_ result types that match user needs,
624646including situations that require further processing of formatted messages.
625647Implementations SHOULD encourage users to consider a formatted localised string
626648as an opaque data structure, suitable only for presentation.
627649
650+ When formatting to a string, the default representation of all _markup_
651+ MUST be an empty string.
652+ Implementations MAY offer functionality for customizing this,
653+ such as by emitting XML-ish tags for each _markup_.
654+
628655### Examples
629656
630657_This section is non-normative._
0 commit comments