Skip to content

Commit 91cc4e5

Browse files
committed
bump ecmarkdown and format valueless attributes
1 parent 2054ff8 commit 91cc4e5

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"command-line-args": "^5.2.0",
5050
"command-line-usage": "^6.1.1",
5151
"dedent-js": "^1.0.1",
52-
"ecmarkdown": "^8.0.0",
52+
"ecmarkdown": "^8.1.0",
5353
"eslint-formatter-codeframe": "^7.32.1",
5454
"fast-glob": "^3.2.7",
5555
"grammarkdown": "^3.2.0",

src/formatter/ecmarkdown.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ async function printStep(
4343
output.firstLineIsPartial = false;
4444
output.appendText(item.name === 'ordered-list-item' ? '1. ' : '* ');
4545
if (item.attrs.length > 0) {
46-
const joined = item.attrs.map(({ key, value }) => `${key}=${JSON.stringify(value)}`).join(', ');
46+
const joined = item.attrs
47+
.map(({ key, value }) => (value === '' ? key : `${key}=${JSON.stringify(value)}`))
48+
.join(', ');
4749
output.appendText(`[${joined}] `);
4850
}
4951
const contents = await printFragments(source, item.contents, indent + 1);

test/formatter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ describe('algorithm formatting', () => {
473473
1. Step.
474474
1. Another step.
475475
1. A substep.
476-
1. [ x = "a",y="b" ] A step with attributes.
476+
1. [ x = "a",y="b" ,c="",d ] A step with attributes.
477477
1. A step with _vars_, numbers like **10<sup>x</sup>**, records like { [[A]]: 0 }, and fields like _o_.[[field]].
478478
</emu-alg>
479479
`,
@@ -482,7 +482,7 @@ describe('algorithm formatting', () => {
482482
1. Step.
483483
1. Another step.
484484
1. A substep.
485-
1. [x="a", y="b"] A step with attributes.
485+
1. [x="a", y="b", c, d] A step with attributes.
486486
1. A step with _vars_, numbers like **10<sup>x</sup>**, records like { [[A]]: 0 }, and fields like _o_.[[field]].
487487
</emu-alg>
488488
`

0 commit comments

Comments
 (0)