Skip to content

Commit 74174ee

Browse files
committed
docs(ui): add middle-dot to separate primitives in dictionary
1 parent 9b9f17d commit 74174ee

4 files changed

Lines changed: 30 additions & 4 deletions

File tree

apps/docs/autogen/3d.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ the observer.
346346
{{#if additional_names.length}}
347347
({{#each additional_names}}[[{{{.}}}|3d#{{{../id}}}]]{{#unless @last}}, {{/unless}}{{/each}})
348348
{{/if}}
349+
{{#unless @last}} <span class="font-bold"> · </span> {{/unless}}
349350
{{/entries}}
350351
{{/categories}}
351352

apps/docs/autogen/dictionary.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ actually run a primitive, consult its dictionary entry.
2323
{{#if additional_names.length}}
2424
({{#each additional_names}}[[{{{.}}}|{{{../id}}}]]{{#unless @last}}, {{/unless}}{{/each}})
2525
{{/if}}
26+
{{#unless @last}} <span class="font-bold"> · </span> {{/unless}}
2627
{{/entries}}
2728
{{/categories}}
2829

@@ -58,4 +59,4 @@ actually run a primitive, consult its dictionary entry.
5859
{{/each}}
5960

6061
{{/netlogoDictionary}}
61-
{{/with}}
62+
{{/with}}

packages/netlogo-docs/src/extension-docs/entities.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,25 @@ class MustachePrimitiveWrapper {
159159
}
160160
}
161161

162+
class TOCPrimitiveWrapper extends MustachePrimitiveWrapper {
163+
public readonly last: boolean;
164+
public constructor(primitive: Primitive, last = false) {
165+
super(primitive);
166+
this.last = last;
167+
}
168+
169+
public static fromPrims(prims: Array<MustachePrimitiveWrapper>): Array<TOCPrimitiveWrapper> {
170+
return prims.map(
171+
(prim, index) => new TOCPrimitiveWrapper(prim.primitive, index === prims.length - 1),
172+
);
173+
}
174+
}
175+
162176
class TableOfContentsSection {
163177
public constructor(
164178
public readonly fullCategoryName: string,
165179
public readonly shortCategoryName: string,
166-
public readonly prims: Array<MustachePrimitiveWrapper>,
180+
public readonly prims: Array<TOCPrimitiveWrapper>,
167181
) {}
168182

169183
public static fromCategoryName(
@@ -173,7 +187,11 @@ class TableOfContentsSection {
173187
): TableOfContentsSection | null {
174188
const prims = unfilteredPrims.filter((prim) => prim.primitive.tags.includes(shortCategoryName));
175189
if (prims.length === 0) return null;
176-
return new TableOfContentsSection(fullCategoryName, shortCategoryName, prims);
190+
return new TableOfContentsSection(
191+
fullCategoryName,
192+
shortCategoryName,
193+
TOCPrimitiveWrapper.fromPrims(prims),
194+
);
177195
}
178196
}
179197

@@ -194,7 +212,11 @@ class TableOfContents {
194212
.filter((section): section is TableOfContentsSection => section !== null);
195213
if (sections.length === 0) {
196214
return new TableOfContents([
197-
new TableOfContentsSection("All Primitives", "all", unfilteredPrims),
215+
new TableOfContentsSection(
216+
"All Primitives",
217+
"all",
218+
TOCPrimitiveWrapper.fromPrims(unfilteredPrims),
219+
),
198220
]);
199221
}
200222
return new TableOfContents(sections);

packages/netlogo-docs/src/extension-docs/fixtures.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Looking for the primitive reference for the {{extensionName}} extension? You can
3737
<div id="{{shortCategoryName}}">
3838
{{#prims}}
3939
<a class="code" href="#{{id}}"><code>{{primitive.fullName}}</code></a>
40+
{{^last}} <span class="font-bold"> · </span> {{/last}}
4041
{{/prims}}
4142
</div>
4243
@@ -46,6 +47,7 @@ Looking for the primitive reference for the {{extensionName}} extension? You can
4647
<div id="{{shortCategoryName}}" class="prose">
4748
{{#prims}}
4849
<a class="code" href="#{{id}}"><code>{{primitive.fullName}}</code></a>
50+
{{^last}} <span class="font-bold"> · </span> {{/last}}
4951
{{/prims}}
5052
</div>
5153
{{/contents}}{{/emptyTableOfContents}}

0 commit comments

Comments
 (0)