Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d10a06b

Browse files
mihnitaeemeliaphillips
authored
Add options to close (spec) (#649)
* Add options to close (spec) * Merge open and standalone markup productions in abnf Co-authored-by: Eemeli Aro <[email protected]> * Merge open & standalone productions in abnf Co-authored-by: Eemeli Aro <[email protected]> * Undo adding of a / at the end of an expression Co-authored-by: Eemeli Aro <[email protected]> * Implement feedback on PR * Update spec/data-model/README.md Co-authored-by: Eemeli Aro <[email protected]> --------- Co-authored-by: Eemeli Aro <[email protected]> Co-authored-by: Addison Phillips <[email protected]>
1 parent 0c1d40a commit d10a06b

File tree

6 files changed

+20
-68
lines changed

6 files changed

+20
-68
lines changed

spec/data-model/README.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -236,38 +236,20 @@ interface UnsupportedAnnotation {
236236

237237
## Markup
238238

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

246245
```ts
247-
type Markup = MarkupOpen | MarkupStandalone | MarkupClose;
248-
249-
interface MarkupOpen {
250-
type: "markup";
251-
kind: "open";
252-
name: string;
253-
options?: Option[];
254-
attributes?: Attribute[];
255-
}
256-
257-
interface MarkupStandalone {
246+
interface Markup {
258247
type: "markup";
259-
kind: "standalone";
248+
kind: "open" | "standalone" | "close";
260249
name: string;
261250
options?: Option[];
262251
attributes?: Attribute[];
263252
}
264-
265-
interface MarkupClose {
266-
type: "markup";
267-
kind: "close";
268-
name: string;
269-
attributes?: Attribute[];
270-
}
271253
```
272254

273255
## Extensions

spec/data-model/message.dtd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<!ELEMENT attribute (literal | variable)?>
4747
<!ATTLIST attribute name NMTOKEN #REQUIRED>
4848

49-
<!-- A <markup kind="close"> MUST NOT contain any <option> elements -->
5049
<!ELEMENT markup (option*, attribute*)>
5150
<!ATTLIST markup
5251
kind (open | standalone | close) #REQUIRED

spec/data-model/message.json

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -129,45 +129,17 @@
129129
]
130130
},
131131

132-
"markup-open": {
133-
"type": "object",
134-
"properties": {
135-
"type": { "const": "markup" },
136-
"kind": { "const": "open" },
137-
"name": { "type": "string" },
138-
"options": { "$ref": "#/$defs/options" },
139-
"attributes": { "$ref": "#/$defs/attributes" }
140-
},
141-
"required": ["type", "kind", "name"]
142-
},
143-
"markup-standalone": {
132+
"markup": {
144133
"type": "object",
145134
"properties": {
146135
"type": { "const": "markup" },
147-
"kind": { "const": "standalone" },
136+
"kind": { "oneOf": [ "open", "standalone", "close" ] },
148137
"name": { "type": "string" },
149138
"options": { "$ref": "#/$defs/options" },
150139
"attributes": { "$ref": "#/$defs/attributes" }
151140
},
152141
"required": ["type", "kind", "name"]
153142
},
154-
"markup-close": {
155-
"type": "object",
156-
"properties": {
157-
"type": { "const": "markup" },
158-
"kind": { "const": "close" },
159-
"name": { "type": "string" },
160-
"attributes": { "$ref": "#/$defs/attributes" }
161-
},
162-
"required": ["type", "kind", "name"]
163-
},
164-
"markup": {
165-
"oneOf": [
166-
{ "$ref": "#/$defs/markup-open" },
167-
{ "$ref": "#/$defs/markup-standalone" },
168-
{ "$ref": "#/$defs/markup-close" }
169-
]
170-
},
171143

172144
"pattern": {
173145
"type": "array",

spec/formatting.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ The resolved value of _markup_ includes the following fields:
266266
267267
- The type of the markup: open, standalone, or close
268268
- The _identifier_ of the _markup_
269-
- For _markup-open_ and _markup_standalone_,
270-
the resolved _options_ values after _option resolution_.
269+
- The resolved _options_ values after _option resolution_.
271270
272271
The resolution of _markup_ MUST always succeed.
273272

spec/message.abnf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ annotation = function
3232
/ private-use-annotation
3333
/ reserved-annotation
3434

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

4138
; Expression and literal parts
4239
function = ":" identifier *(s option)

spec/syntax.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -678,21 +678,24 @@ It MAY include _options_.
678678

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

683682
```abnf
684-
markup = "{" [s] markup-open *(s attribute) [s] ["/"] "}"
685-
/ "{" [s] markup-close *(s attribute) [s] "}"
686-
markup-open = "#" identifier *(s option)
687-
markup-close = "/" identifier
683+
markup = "{" [s] "#" identifier *(s option) *(s attribute) [s] ["/"] "}" ; open and standalone
684+
/ "{" [s] "/" identifier *(s option) *(s attribute) [s] "}" ; close
688685
```
689686

690-
> A _message_ with one `button` markup span and a standalone `img` markup element.
687+
> A _message_ with one `button` markup span and a standalone `img` markup element:
691688
>
692689
> ```
693690
> {#button}Submit{/button} or {#img alt=|Cancel| /}.}
694691
> ```
695692
693+
> A _message_ with attributes in the closing tag:
694+
>
695+
> ```
696+
> {#ansi attr=|bold,italic|}Bold and italic{/ansi attr=|bold|} italic only {/ansi attr=|italic|} no formatting.}
697+
> ```
698+
696699
A _markup-open_ can appear without a corresponding _markup-close_.
697700
A _markup-close_ can appear without a corresponding _markup-open_.
698701
_Markup_ _placeholders_ can appear in any order without making the _message_ invalid.
@@ -732,7 +735,7 @@ attribute = "@" identifier [[s] "=" [s] (literal / variable)]
732735
> A _message_ with _markup_ that should not be copied:
733736
>
734737
> ```
735-
> Have a {+span @can-copy}great and wonderful{-span @can-copy} birthday!
738+
> Have a {#span @can-copy}great and wonderful{/span @can-copy} birthday!
736739
> ```
737740
738741
## Other Syntax Elements

0 commit comments

Comments
 (0)