@glossarist/concept-browser 0.7.127 → 0.7.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glossarist/concept-browser",
3
- "version": "0.7.127",
3
+ "version": "0.7.128",
4
4
  "description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,80 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { conceptFromJson } from '../../adapters/model-bridge';
3
+
4
+ /**
5
+ * Regression test: sources stored at the localization level
6
+ * (gl:localizedConcept.eng.gl:source) must be accessible via
7
+ * concept.localization(lang).sources so the citeResolver can find them.
8
+ *
9
+ * Without this, {{cite:sourceId}} mentions render as plain text
10
+ * instead of links — the exact bug reported on cie-eilv concept 17-21-001.
11
+ */
12
+
13
+ function makeConceptWithLocalizationSources() {
14
+ return {
15
+ '@type': 'skos:Concept',
16
+ '@id': 'https://example.com/dataset/cie-2020/concept/17-21-001',
17
+ 'gl:identifier': '17-21-001',
18
+ 'gl:localizedConcept': {
19
+ eng: {
20
+ 'gl:languageCode': 'eng',
21
+ 'gl:designation': [{ '@type': 'gl:Expression', 'gl:term': 'quantity', 'gl:normativeStatus': 'preferred' }],
22
+ 'gl:definition': [{ 'gl:content': 'property of a phenomenon' }],
23
+ 'gl:source': [
24
+ {
25
+ '@type': 'gl:ConceptSource',
26
+ 'gl:id': '845-01-01',
27
+ 'gl:sourceType': 'authoritative',
28
+ 'gl:origin': {
29
+ '@type': 'gl:Citation',
30
+ 'gl:ref': { '@type': 'gl:Ref', 'gl:source': 'IEV', 'gl:id': '845-01-01' },
31
+ 'gl:link': 'https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=845-01-01',
32
+ },
33
+ },
34
+ {
35
+ '@type': 'gl:ConceptSource',
36
+ 'gl:sourceType': 'authoritative',
37
+ 'gl:origin': {
38
+ '@type': 'gl:Citation',
39
+ 'gl:ref': { '@type': 'gl:Ref', 'gl:source': 'CIE S 017:2011', 'gl:id': '17-370' },
40
+ },
41
+ },
42
+ ],
43
+ },
44
+ },
45
+ };
46
+ }
47
+
48
+ describe('localization-level sources accessible for citeResolver', () => {
49
+ it('concept.localization("eng").sources has the localization sources', () => {
50
+ const concept = conceptFromJson(makeConceptWithLocalizationSources() as any);
51
+ const lc = concept.localization('eng');
52
+ expect(lc).toBeTruthy();
53
+ expect(lc!.sources).toBeDefined();
54
+ expect(lc!.sources!.length).toBeGreaterThanOrEqual(1);
55
+ });
56
+
57
+ it('source with gl:id is findable by id', () => {
58
+ const concept = conceptFromJson(makeConceptWithLocalizationSources() as any);
59
+ const lc = concept.localization('eng');
60
+ const source = lc!.sources!.find(s => s.id === '845-01-01');
61
+ expect(source).toBeDefined();
62
+ });
63
+
64
+ it('source origin link is preserved', () => {
65
+ const concept = conceptFromJson(makeConceptWithLocalizationSources() as any);
66
+ const lc = concept.localization('eng');
67
+ const source = lc!.sources!.find(s => s.id === '845-01-01');
68
+ expect(source).toBeDefined();
69
+ expect(source!.origin?.link).toBeTruthy();
70
+ });
71
+
72
+ it('merging concept + localization sources gives complete set', () => {
73
+ const concept = conceptFromJson(makeConceptWithLocalizationSources() as any);
74
+ const conceptSources = concept.sources ?? [];
75
+ const lcSources = concept.localization('eng')?.sources ?? [];
76
+ const merged = [...conceptSources, ...lcSources];
77
+ expect(merged.length).toBeGreaterThanOrEqual(2);
78
+ expect(merged.find(s => s.id === '845-01-01')).toBeDefined();
79
+ });
80
+ });
@@ -119,7 +119,17 @@ const conceptTags = computed(() => props.concept?.tags ?? []);
119
119
  const factory = getFactory();
120
120
  const { ready: bibReady, ensureBibLoaded, bibResolver, citeResolver, nonVerbalRefResolver } = useRenderOptions(
121
121
  () => props.registerId,
122
- () => props.concept?.sources,
122
+ () => {
123
+ // Collect sources from ALL localizations (shown separately per language,
124
+ // but the citeResolver needs access to all of them since content from
125
+ // every language is rendered on the same page).
126
+ const sources: any[] = [];
127
+ for (const lang of props.concept?.languages ?? []) {
128
+ const lc = props.concept?.localization(lang);
129
+ if (lc?.sources) sources.push(...lc.sources);
130
+ }
131
+ return sources;
132
+ },
123
133
  );
124
134
 
125
135
  const renderOpts = computed<RenderOptions>(() => {