Skip to content

Commit a8894f9

Browse files
committed
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.
1 parent c30c2d7 commit a8894f9

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

spec/formatting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,14 @@ Between the brackets, the following contents are used:
483483
> Example: `{:platform}`
484484
485485
- Opening _expression_ with no operand:
486-
U+002B PLUS SIGN `+` followed by the _function_ _name_
486+
U+005C REVERSE SOLIDUS `\` followed by the _function_ _name_
487487
488-
> Example: `{+tag}`
488+
> Example: `{\tag}`
489489
490490
- Closing _expression_ with no operand:
491-
U+002D HYPHEN-MINUS `-` followed by the _function_ _name_
491+
U+002F SOLIDUS `/` followed by the _function_ _name_
492492
493-
> Example: `{-tag}`
493+
> Example: `{/tag}`
494494
495495
- Otherwise: The U+FFFD REPLACEMENT CHARACTER `�` character
496496

spec/message.abnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ annotation = (function *(s option)) / reserved
1414

1515
literal = quoted / unquoted
1616
variable = "$" name
17-
function = (":" / "+" / "-") name
17+
function = (":" / "\" / "/") name
1818
option = name [s] "=" [s] (literal / variable)
1919

2020
; reserved keywords are always lowercase

spec/syntax.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ plucking the first name from the object representing a person:
146146
Functions use one of the following prefix sigils:
147147

148148
- `:` for standalone content
149-
- `+` for starting or opening elements
150-
- `-` for ending or closing elements
149+
- `\` for starting or opening elements
150+
- `/` for ending or closing elements
151151

152152
A message with two markup-like _functions_, `button` and `link`,
153153
which the runtime can use to construct a document tree structure for a UI framework:
154154

155-
{{+button}Submit{-button} or {+link}cancel{-link}.}
155+
{{\button}Submit{/button} or {\link}cancel{/link}.}
156156

157157
An opening element MAY be present in a message without a corresponding closing element,
158158
and vice versa.
@@ -395,17 +395,17 @@ option = name [s] "=" [s] (literal / variable)
395395
> ```
396396
>
397397
> ```
398-
> {+ssml.emphasis level=strong}
398+
> {\ssml.emphasis level=strong}
399399
> ```
400400
>
401401
> Message examples:
402402
>
403403
> ```
404-
> {This is {+b}bold{-b}.}
404+
> {This is {\b}bold{/b}.}
405405
> ```
406406
>
407407
> ```
408-
> {{+h1 name=above-and-beyond}Above And Beyond{-h1}}
408+
> {{\h1 name=above-and-beyond}Above And Beyond{/h1}}
409409
> ```
410410
411411
#### Reserved
@@ -483,7 +483,7 @@ unquoted-start = name-start / DIGIT / "."
483483
### Names
484484

485485
The **_name_** token is used for variable names (prefixed with `$`),
486-
function names (prefixed with `:`, `+` or `-`),
486+
function names (prefixed with `:`, `\` or `/`),
487487
as well as option names.
488488
It is based on XML's [Name](https://www.w3.org/TR/xml/#NT-Name),
489489
with the restriction that it MUST NOT start with `:`,
@@ -492,7 +492,7 @@ Otherwise, the set of characters allowed in names is large.
492492

493493
```abnf
494494
variable = "$" name
495-
function = (":" / "+" / "-") name
495+
function = (":" / "\" / "/") name
496496
497497
name = name-start *name-char
498498
name-start = ALPHA / "_"

0 commit comments

Comments
 (0)