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
32 changes: 27 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"autoprefixer": "^10.4.21",
"d3": "^7.9.0",
"favicons": "^7.2.0",
"glossarist": "^0.4.0",
"glossarist": "^0.4.2",
"js-yaml": "^4.1.0",
"jszip": "^3.10.1",
"pinia": "^2.3.1",
Expand Down
26 changes: 0 additions & 26 deletions src/adapters/model-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,6 @@ export function getAnnotations(lc: LocalizedConcept): DetailedDefinition[] {
return extraAnnotations.get(lc) ?? [];
}

// Scoped examples: DetailedDefinition.examples (VIM 1993 nesting)
const extraNoteExamples = new WeakMap<DetailedDefinition, DetailedDefinition[]>();

export function getNoteExamples(note: DetailedDefinition): DetailedDefinition[] {
return extraNoteExamples.get(note) ?? [];
}

// Designation relationship targets: RelatedConcept.target (string)
const designationTargets = new WeakMap<object, string>();

Expand Down Expand Up @@ -237,25 +230,6 @@ function attachBridges(concept: Concept, localizations: Record<string, unknown>)
));
}

// Scoped examples inside notes/definition/examples/annotations
for (const fieldName of ['notes', 'definition', 'examples', 'annotations'] as const) {
const rawList = rawObj[fieldName];
const modelList = lc[fieldName] as DetailedDefinition[];
if (!Array.isArray(rawList) || modelList.length === 0) continue;
for (let i = 0; i < Math.min(rawList.length, modelList.length); i++) {
const rawItem = rawList[i] as Record<string, unknown> | undefined;
const rawExamples = rawItem?.examples;
if (!Array.isArray(rawExamples) || rawExamples.length === 0) continue;
const nested = rawExamples.map((e: Record<string, unknown>) =>
DetailedDefinition.fromJSON({
content: (e.content as string) ?? '',
...(Array.isArray(e.examples) ? { examples: e.examples } : {}),
}) as DetailedDefinition,
);
extraNoteExamples.set(modelList[i], nested);
}
}

// Designation-level relationship targets, ref text, sourceId, citation
const rawTerms = rawObj.terms;
if (Array.isArray(rawTerms)) {
Expand Down
6 changes: 3 additions & 3 deletions src/composables/use-concept-content.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { computed, ref, watch, toRaw, type ComputedRef } from 'vue';
import { computed, ref, watch, type ComputedRef } from 'vue';
import type { Concept, LocalizedConcept, ConceptSource, Designation, DetailedDefinition } from 'glossarist';
import type { Manifest } from '../adapters/types';
import type { RenderOptions } from '../utils/content-renderer';
import { renderContent, cleanContent } from '../utils/content-renderer';
import { getAnnotations, getNoteExamples } from '../adapters/model-bridge';
import { getAnnotations } from '../adapters/model-bridge';
import { getPreferredTerm, entryStatusColor, entryStatusLabel, entryStatusDefinition } from '../utils/concept-helpers';
import { sortLanguages } from '../utils/lang';
import { useSiteConfig } from '../config/use-site-config';
Expand Down Expand Up @@ -80,7 +80,7 @@ export function useConceptContent(
.map(n => {
const content = n.content ?? '';
if (!content) return null;
const nested = getNoteExamples(toRaw(n) as DetailedDefinition);
const nested = n.examples ?? [];
const examples = nested
.map(buildExample)
.filter((e): e is ExampleEntry => e !== null);
Expand Down