Skip to content

Commit 25eee61

Browse files
authored
Merge pull request #2082 from LeighFinegold/2080
fix(calm-widgets): render primitive arrays inline with comma separator list for for MDX compatibility (#2080)
2 parents 41e71ec + ce51329 commit 25eee61

File tree

11 files changed

+53
-13
lines changed

11 files changed

+53
-13
lines changed

calm-plugins/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "calm-vscode-plugin",
33
"displayName": "CALM",
44
"description": "Live-visualize CALM architecture models, validate, and generate docs.",
5-
"version": "0.4.1",
5+
"version": "0.4.2",
66
"publisher": "FINOS",
77
"homepage": "https://calm.finos.org",
88
"repository": {

calm-widgets/src/widgets.e2e.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ describe('Widgets E2E - Handlebars Integration', () => {
9696

9797
expectToBeSameIgnoringLineEndings(result, expected);
9898
});
99+
100+
it('renders primitive arrays inline with comma separator (MDX-safe)', () => {
101+
const { context, template, expected } = fixtures.loadFixture('table-widget', 'metadata-primitive-array');
102+
103+
const compiledTemplate = handlebars.compile(template);
104+
const result = compiledTemplate(context);
105+
106+
expectToBeSameIgnoringLineEndings(result, expected);
107+
});
99108
});
100109

101110
describe('List Widget', () => {

calm-widgets/src/widgets/table/row-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{> table-template.html rows=(objectEntries this) headers=false flatTable=false hasRows=true isNested=true}}
1919

2020
{{else}}
21-
{{this}}
21+
{{this}}{{#unless @last}}, {{/unless}}
2222
{{/if}}
2323
{{/each}}
2424
{{else}}

calm-widgets/src/widgets/table/table-vertical.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
{{> table-template.html rows=(objectEntries cellValue) headers=false flatTable=false hasRows=true isNested=true}}
1919
{{else if (isArray cellValue)}}{{#each cellValue}}{{#if (isObject this)}}
2020
{{> table-template.html rows=(objectEntries this) headers=false flatTable=false hasRows=true isNested=true}}
21-
{{else}}{{this}}
22-
{{/if}}{{/each}}{{else}}{{cellValue}}{{/if}}</td>
21+
{{else}}{{this}}{{#unless @last}}, {{/unless}}{{/if}}{{/each}}{{else}}{{cellValue}}{{/if}}</td>
2322
</tr>
2423
{{/with}}
2524
{{/with}}

calm-widgets/test-fixtures/combined-widgets/comprehensive-documentation/expected.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@
184184
<tr>
185185
<td><b>Value</b></td>
186186
<td>
187-
Product Catalog
188-
Inventory Management
187+
Product Catalog,
188+
Inventory Management,
189189
Price Calculation
190190
</td>
191191
</tr>
@@ -347,8 +347,8 @@
347347
<tr>
348348
<td><b>Value</b></td>
349349
<td>
350-
Order Processing
351-
Payment Integration
350+
Order Processing,
351+
Payment Integration,
352352
Order Tracking
353353
</td>
354354
</tr>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"metadata": {
3+
"operations": ["add", "subtract", "multiply", "divide"],
4+
"tags": ["payment", "financial", "api"],
5+
"version": "1.0.0"
6+
}
7+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<div class="table-container">
2+
<table>
3+
<thead>
4+
<tr>
5+
<th>Key</th>
6+
<th>Value</th>
7+
</tr>
8+
</thead>
9+
<tbody>
10+
<tr>
11+
<th>Operations</th>
12+
<td>add, subtract, multiply, divide</td>
13+
</tr>
14+
<tr>
15+
<th>Tags</th>
16+
<td>payment, financial, api</td>
17+
</tr>
18+
<tr>
19+
<th>Version</th>
20+
<td>1.0.0</td>
21+
</tr>
22+
</tbody>
23+
</table>
24+
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{table metadata orientation="vertical"}}

cli/test_fixtures/template/expected-output/widget-tests/sad-test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,8 @@ The system follows a microservices architecture pattern deployed on Kubernetes,
942942
<tr>
943943
<td><b>Nodes</b></td>
944944
<td>
945-
load-balancer
946-
attendees
945+
load-balancer,
946+
attendees,
947947
attendees-store
948948
</td>
949949
</tr>

cli/test_fixtures/template/expected-output/widget-tests/table-test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,8 @@ url-to-local-file-mapping: ../../../getting-started/url-to-local-file-mapping.js
911911
<tr>
912912
<td><b>Nodes</b></td>
913913
<td>
914-
load-balancer
915-
attendees
914+
load-balancer,
915+
attendees,
916916
attendees-store
917917
</td>
918918
</tr>

0 commit comments

Comments
 (0)