Skip to content
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
28 changes: 5 additions & 23 deletions spec/data-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,38 +236,20 @@ interface UnsupportedAnnotation {

## Markup

A `Markup` object is either `MarkupOpen`, `MarkupStandalone`, or `MarkupClose`,
which are differentiated by `kind`.
A `Markup` object has a `kind` of either `"open"`, `"standalone"`, or `"close"`,
each corresponding to _open_, _standalone_, and _close_ _markup_.
The `name` in these does not include the starting sigils `#` and `/`
or the ending sigil `/`.
The optional `options` for open and standalone markup use the same `Option`
as `FunctionAnnotation`.
The optional `options` for markup use the same `Option` as `FunctionAnnotation`.

```ts
type Markup = MarkupOpen | MarkupStandalone | MarkupClose;

interface MarkupOpen {
type: "markup";
kind: "open";
name: string;
options?: Option[];
attributes?: Attribute[];
}

interface MarkupStandalone {
interface Markup {
type: "markup";
kind: "standalone";
kind: "open" | "standalone" | "close";
name: string;
options?: Option[];
attributes?: Attribute[];
}

interface MarkupClose {
type: "markup";
kind: "close";
name: string;
attributes?: Attribute[];
}
```

## Extensions
Expand Down
1 change: 0 additions & 1 deletion spec/data-model/message.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<!ELEMENT attribute (literal | variable)?>
<!ATTLIST attribute name NMTOKEN #REQUIRED>

<!-- A <markup kind="close"> MUST NOT contain any <option> elements -->
<!ELEMENT markup (option*, attribute*)>
<!ATTLIST markup
kind (open | standalone | close) #REQUIRED
Expand Down
32 changes: 2 additions & 30 deletions spec/data-model/message.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,45 +129,17 @@
]
},

"markup-open": {
"type": "object",
"properties": {
"type": { "const": "markup" },
"kind": { "const": "open" },
"name": { "type": "string" },
"options": { "$ref": "#/$defs/options" },
"attributes": { "$ref": "#/$defs/attributes" }
},
"required": ["type", "kind", "name"]
},
"markup-standalone": {
"markup": {
"type": "object",
"properties": {
"type": { "const": "markup" },
"kind": { "const": "standalone" },
"kind": { "oneOf": [ "open", "standalone", "close" ] },
"name": { "type": "string" },
"options": { "$ref": "#/$defs/options" },
"attributes": { "$ref": "#/$defs/attributes" }
},
"required": ["type", "kind", "name"]
},
"markup-close": {
"type": "object",
"properties": {
"type": { "const": "markup" },
"kind": { "const": "close" },
"name": { "type": "string" },
"attributes": { "$ref": "#/$defs/attributes" }
},
"required": ["type", "kind", "name"]
},
"markup": {
"oneOf": [
{ "$ref": "#/$defs/markup-open" },
{ "$ref": "#/$defs/markup-standalone" },
{ "$ref": "#/$defs/markup-close" }
]
},

"pattern": {
"type": "array",
Expand Down
3 changes: 1 addition & 2 deletions spec/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ The resolved value of _markup_ includes the following fields:

- The type of the markup: open, standalone, or close
- The _identifier_ of the _markup_
- For _markup-open_ and _markup_standalone_,
the resolved _options_ values after _option resolution_.
- The resolved _options_ values after _option resolution_.

The resolution of _markup_ MUST always succeed.

Expand Down
7 changes: 2 additions & 5 deletions spec/message.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ annotation = function
/ private-use-annotation
/ reserved-annotation

; Markup; Note that standalone markup is part of the first line
markup = "{" [s] markup-open *(s attribute) [s] ["/"] "}"
/ "{" [s] markup-close *(s attribute) [s] "}"
markup-open = "#" identifier *(s option)
markup-close = "/" identifier
markup = "{" [s] "#" identifier *(s option) *(s attribute) [s] ["/"] "}" ; open and standalone
/ "{" [s] "/" identifier *(s option) *(s attribute) [s] "}" ; close

; Expression and literal parts
function = ":" identifier *(s option)
Expand Down
17 changes: 10 additions & 7 deletions spec/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,21 +678,24 @@ It MAY include _options_.

**_<dfn>Markup-close</dfn>_** starts with U+002F SOLIDUS `/` and
is a _pattern_ part ending a span.
Unlike the other forms, it does not include _options_.

```abnf
markup = "{" [s] markup-open *(s attribute) [s] ["/"] "}"
/ "{" [s] markup-close *(s attribute) [s] "}"
markup-open = "#" identifier *(s option)
markup-close = "/" identifier
markup = "{" [s] "#" identifier *(s option) *(s attribute) [s] ["/"] "}" ; open and standalone
/ "{" [s] "/" identifier *(s option) *(s attribute) [s] "}" ; close
```

> A _message_ with one `button` markup span and a standalone `img` markup element.
> A _message_ with one `button` markup span and a standalone `img` markup element:
>
> ```
> {#button}Submit{/button} or {#img alt=|Cancel| /}.}
> ```

> A _message_ with attributes in the closing tag:
>
> ```
> {#ansi attr=|bold,italic|}Bold and italic{/ansi attr=|bold|} italic only {/ansi attr=|italic|} no formatting.}
> ```

A _markup-open_ can appear without a corresponding _markup-close_.
A _markup-close_ can appear without a corresponding _markup-open_.
_Markup_ _placeholders_ can appear in any order without making the _message_ invalid.
Expand Down Expand Up @@ -732,7 +735,7 @@ attribute = "@" identifier [[s] "=" [s] (literal / variable)]
> A _message_ with _markup_ that should not be copied:
>
> ```
> Have a {+span @can-copy}great and wonderful{-span @can-copy} birthday!
> Have a {#span @can-copy}great and wonderful{/span @can-copy} birthday!
> ```

## Other Syntax Elements
Expand Down