From a8894f95895fb22b4272220039783f2d01e1ec3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Ma=C5=82olepszy?= Date: Mon, 19 Jun 2023 10:41:27 +0200 Subject: [PATCH 1/2] Change the syntax of the \open and /close function calls This is an alternative to #397, which I'd like to collect feedback on. main: {+button title=|Click me!|}Submit{-button} #397: {::button title=|Click me!|}Submit{:/button} this: {\button title=|Click me!|}Submit{/button} It's an attempt to find a pair of convenient single-char-long prefixes which don't conflict with signed number literals. The opening syntax, `\func`, is inspired by TeX. The closing syntax, `/func`, is inspired by HTML. --- spec/formatting.md | 8 ++++---- spec/message.abnf | 2 +- spec/syntax.md | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/formatting.md b/spec/formatting.md index 67b309a237..5bf391e6d6 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -483,14 +483,14 @@ Between the brackets, the following contents are used: > Example: `{:platform}` - Opening _expression_ with no operand: - U+002B PLUS SIGN `+` followed by the _function_ _name_ + U+005C REVERSE SOLIDUS `\` followed by the _function_ _name_ - > Example: `{+tag}` + > Example: `{\tag}` - Closing _expression_ with no operand: - U+002D HYPHEN-MINUS `-` followed by the _function_ _name_ + U+002F SOLIDUS `/` followed by the _function_ _name_ - > Example: `{-tag}` + > Example: `{/tag}` - Otherwise: The U+FFFD REPLACEMENT CHARACTER `�` character diff --git a/spec/message.abnf b/spec/message.abnf index 30f0da2fd5..f0c75f14a5 100644 --- a/spec/message.abnf +++ b/spec/message.abnf @@ -14,7 +14,7 @@ annotation = (function *(s option)) / reserved literal = quoted / unquoted variable = "$" name -function = (":" / "+" / "-") name +function = (":" / "\" / "/") name option = name [s] "=" [s] (literal / variable) ; reserved keywords are always lowercase diff --git a/spec/syntax.md b/spec/syntax.md index 8637a78682..334fa4fc0b 100644 --- a/spec/syntax.md +++ b/spec/syntax.md @@ -146,13 +146,13 @@ plucking the first name from the object representing a person: Functions use one of the following prefix sigils: - `:` for standalone content -- `+` for starting or opening elements -- `-` for ending or closing elements +- `\` for starting or opening elements +- `/` for ending or closing elements A message with two markup-like _functions_, `button` and `link`, which the runtime can use to construct a document tree structure for a UI framework: - {{+button}Submit{-button} or {+link}cancel{-link}.} + {{\button}Submit{/button} or {\link}cancel{/link}.} An opening element MAY be present in a message without a corresponding closing element, and vice versa. @@ -395,17 +395,17 @@ option = name [s] "=" [s] (literal / variable) > ``` > > ``` -> {+ssml.emphasis level=strong} +> {\ssml.emphasis level=strong} > ``` > > Message examples: > > ``` -> {This is {+b}bold{-b}.} +> {This is {\b}bold{/b}.} > ``` > > ``` -> {{+h1 name=above-and-beyond}Above And Beyond{-h1}} +> {{\h1 name=above-and-beyond}Above And Beyond{/h1}} > ``` #### Reserved @@ -483,7 +483,7 @@ unquoted-start = name-start / DIGIT / "." ### Names The **_name_** token is used for variable names (prefixed with `$`), -function names (prefixed with `:`, `+` or `-`), +function names (prefixed with `:`, `\` or `/`), as well as option names. It is based on XML's [Name](https://www.w3.org/TR/xml/#NT-Name), with the restriction that it MUST NOT start with `:`, @@ -492,7 +492,7 @@ Otherwise, the set of characters allowed in names is large. ```abnf variable = "$" name -function = (":" / "+" / "-") name +function = (":" / "\" / "/") name name = name-start *name-char name-start = ALPHA / "_" From 438c8583ef888753089fac3d8751f17766cc6a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Ma=C5=82olepszy?= Date: Sun, 2 Jul 2023 11:46:18 +0200 Subject: [PATCH 2/2] Change the placeholder-open prefix to #open --- spec/formatting.md | 4 ++-- spec/message.abnf | 2 +- spec/syntax.md | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/formatting.md b/spec/formatting.md index 5bf391e6d6..7e91d75b7b 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -483,9 +483,9 @@ Between the brackets, the following contents are used: > Example: `{:platform}` - Opening _expression_ with no operand: - U+005C REVERSE SOLIDUS `\` followed by the _function_ _name_ + U+0023 NUMBER SIGN `#` followed by the _function_ _name_ - > Example: `{\tag}` + > Example: `{#tag}` - Closing _expression_ with no operand: U+002F SOLIDUS `/` followed by the _function_ _name_ diff --git a/spec/message.abnf b/spec/message.abnf index f0c75f14a5..b752909d2b 100644 --- a/spec/message.abnf +++ b/spec/message.abnf @@ -14,7 +14,7 @@ annotation = (function *(s option)) / reserved literal = quoted / unquoted variable = "$" name -function = (":" / "\" / "/") name +function = (":" / "#" / "/") name option = name [s] "=" [s] (literal / variable) ; reserved keywords are always lowercase diff --git a/spec/syntax.md b/spec/syntax.md index 334fa4fc0b..3af82ed31d 100644 --- a/spec/syntax.md +++ b/spec/syntax.md @@ -146,13 +146,13 @@ plucking the first name from the object representing a person: Functions use one of the following prefix sigils: - `:` for standalone content -- `\` for starting or opening elements +- `#` for starting or opening elements - `/` for ending or closing elements A message with two markup-like _functions_, `button` and `link`, which the runtime can use to construct a document tree structure for a UI framework: - {{\button}Submit{/button} or {\link}cancel{/link}.} + {{#button}Submit{/button} or {#link}cancel{/link}.} An opening element MAY be present in a message without a corresponding closing element, and vice versa. @@ -395,17 +395,17 @@ option = name [s] "=" [s] (literal / variable) > ``` > > ``` -> {\ssml.emphasis level=strong} +> {#ssml.emphasis level=strong} > ``` > > Message examples: > > ``` -> {This is {\b}bold{/b}.} +> {This is {#b}bold{/b}.} > ``` > > ``` -> {{\h1 name=above-and-beyond}Above And Beyond{/h1}} +> {{#h1 name=above-and-beyond}Above And Beyond{/h1}} > ``` #### Reserved @@ -483,7 +483,7 @@ unquoted-start = name-start / DIGIT / "." ### Names The **_name_** token is used for variable names (prefixed with `$`), -function names (prefixed with `:`, `\` or `/`), +function names (prefixed with `:`, `#` or `/`), as well as option names. It is based on XML's [Name](https://www.w3.org/TR/xml/#NT-Name), with the restriction that it MUST NOT start with `:`, @@ -492,7 +492,7 @@ Otherwise, the set of characters allowed in names is large. ```abnf variable = "$" name -function = (":" / "\" / "/") name +function = (":" / "#" / "/") name name = name-start *name-char name-start = ALPHA / "_"