Skip to content

Add +start and -end sigils for markup elements #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions spec/message.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ VariantKey ::= Literal | Nmtoken | '*'
Pattern ::= '[' (Text | Placeholder)* ']' /* ws: explicit */

/* Placeholders */
Placeholder ::= '{' (Expression | MarkupStart | MarkupEnd)? '}'
Placeholder ::= '{' (Expression | Markup | MarkupEnd)? '}'

/* Expressions */
Expression ::= Operand Annotation? | Annotation
Expand All @@ -19,8 +19,7 @@ Annotation ::= Function Option*
Option ::= Name '=' (Literal | Nmtoken | Variable)

/* Markup Tags */
MarkupStart ::= Name Option*
MarkupEnd ::= '/' Name
Markup ::= MarkupStart Option*

<?TOKENS?>

Expand All @@ -38,6 +37,8 @@ AnyChar ::= [#x0-#x10FFFF]
/* Names */
Variable ::= '$' Name /* ws: explicit */
Function ::= ':' Name /* ws: explicit */
MarkupStart ::= '+' Name /* ws: explicit */
MarkupEnd ::= '-' Name /* ws: explicit */
Name ::= NameStart NameChar* /* ws: explicit */
Nmtoken ::= NameChar+ /* ws: explicit */
NameStart ::= [a-zA-Z] | "_"
Expand Down
15 changes: 9 additions & 6 deletions spec/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Examples:
Placeholders can contain expressions and markup elements.

```ebnf
Placeholder ::= '{' (Expression | MarkupStart | MarkupEnd) '}'
Placeholder ::= '{' (Expression | Markup | MarkupEnd) '}'
```

### Expressions
Expand All @@ -340,6 +340,8 @@ Expression ::= Operand Annotation? | Annotation
Operand ::= Literal | Variable
Annotation ::= Function Option*
Option ::= Name '=' (Literal | Nmtoken | Variable)
Variable ::= '$' Name /* ws: explicit */
Function ::= ':' Name /* ws: explicit */
```

Examples:
Expand Down Expand Up @@ -377,8 +379,9 @@ They mimic XML elements, but do not require well-formedness.
Standalone display elements should be represented as function expressions.

```ebnf
MarkupStart ::= Name Option*
MarkupEnd ::= '/' Name
Markup ::= MarkupStart Option*
MarkupStart ::= '+' Name /* ws: explicit */
MarkupEnd ::= '-' Name /* ws: explicit */
```

Examples:
Expand Down Expand Up @@ -412,7 +415,9 @@ AnyChar ::= [#x0-#x10FFFF]
### Names

The _name_ token is used for variable names (prefixed with `$`),
function names (prefixed with `:`) as well as option names.
function names (prefixed with `:`),
markup names (prefixed with `+` or `-`),
as well as option names.
A name cannot start with an ASCII digit and certain basic combining characters.
Otherwise, the set of characters allowed in names is large.

Expand All @@ -427,8 +432,6 @@ and [defined in CLDR](https://unicode-org.github.io/cldr-staging/charts/latest/g
uses Nmtokens.

```ebnf
Variable ::= '$' Name /* ws: explicit */
Function ::= ':' Name /* ws: explicit */
Name ::= NameStart NameChar* /* ws: explicit */
Nmtoken ::= NameChar+ /* ws: explicit */
NameStart ::= [a-zA-Z] | "_"
Expand Down