@glossarist/concept-browser 0.7.129 → 0.7.130
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 +2 -2
- package/scripts/generate-data.js +3 -0
- package/scripts/generate-data.ts +10 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glossarist/concept-browser",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.130",
|
|
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": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"astro": "^7.0.7",
|
|
44
44
|
"d3": "^7.9.0",
|
|
45
45
|
"favicons": "^7.2.0",
|
|
46
|
-
"glossarist": "^0.4.
|
|
46
|
+
"glossarist": "^0.4.56",
|
|
47
47
|
"js-yaml": "^4.1.0",
|
|
48
48
|
"jszip": "^3.10.1",
|
|
49
49
|
"n3": "^1.26.0",
|
package/scripts/generate-data.js
CHANGED
|
@@ -1163,6 +1163,7 @@ function extractInlineRefs(localizedData, refMaps2, conceptSources = []) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
for (const m of fullText.matchAll(/\{\{([^{}]+?)\}\}/g)) {
|
|
1165
1165
|
const body = m[1];
|
|
1166
|
+
if (/^(bib|link|image):/i.test(body)) continue;
|
|
1166
1167
|
let segments;
|
|
1167
1168
|
try {
|
|
1168
1169
|
segments = parseMentions(`{{${body}}}`);
|
|
@@ -1188,6 +1189,8 @@ function extractInlineRefs(localizedData, refMaps2, conceptSources = []) {
|
|
|
1188
1189
|
if (pattern) {
|
|
1189
1190
|
refs.push({ id: buildConceptUri(refMaps2.uriBase, pattern.datasetId, pattern.conceptId), term: seg.label ?? target.urn });
|
|
1190
1191
|
}
|
|
1192
|
+
} else if (target.type === "entity_id" && target.id) {
|
|
1193
|
+
refs.push({ id: buildConceptUri(refMaps2.uriBase, refMaps2.register, target.id), term: seg.label ?? target.id });
|
|
1191
1194
|
}
|
|
1192
1195
|
}
|
|
1193
1196
|
}
|
package/scripts/generate-data.ts
CHANGED
|
@@ -375,54 +375,46 @@ function extractInlineRefs(localizedData, refMaps, conceptSources = []) {
|
|
|
375
375
|
if (pattern) { refs.push(pattern); }
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
// Double-brace mentions: use the
|
|
379
|
-
//
|
|
380
|
-
// NEVER silently passed through. The build FAILS on any invalid syntax.
|
|
378
|
+
// Double-brace mentions: use the strict parser from glossarist@0.4.56.
|
|
379
|
+
// Bare numeric IDs and designations are implicit same-dataset concept refs.
|
|
381
380
|
for (const m of fullText.matchAll(/\{\{([^{}]+?)\}\}/g)) {
|
|
382
381
|
const body = m[1];
|
|
383
382
|
|
|
384
|
-
//
|
|
385
|
-
|
|
386
|
-
|
|
383
|
+
// Skip deployment-specific kinds (not concept cross-references)
|
|
384
|
+
if (/^(bib|link|image):/i.test(body)) continue;
|
|
385
|
+
|
|
387
386
|
let segments;
|
|
388
387
|
try {
|
|
389
388
|
segments = parseMentions(`{{${body}}}`);
|
|
390
389
|
} catch (e) {
|
|
391
390
|
if (e instanceof InvalidMentionError) {
|
|
392
|
-
// Report the error but don't crash — collect for batch reporting.
|
|
393
391
|
console.warn(` Invalid mention: {{${body}}} — ${e.reason}`);
|
|
394
392
|
continue;
|
|
395
393
|
}
|
|
396
394
|
throw e;
|
|
397
395
|
}
|
|
398
396
|
|
|
399
|
-
// Extract mention segments (skip text segments).
|
|
400
397
|
for (const seg of segments) {
|
|
401
398
|
if (seg.kind === 'text') continue;
|
|
402
|
-
|
|
403
|
-
// bib:/link:/image: are deployment-specific renderings — NOT concept
|
|
404
|
-
// cross-references. They must NOT appear in gl:references.
|
|
405
399
|
if (seg.kind === 'bib' || seg.kind === 'link' || seg.kind === 'image') continue;
|
|
406
400
|
|
|
407
|
-
// For concept/cite/fig/table/formula — resolve to URIs.
|
|
408
|
-
// fig/table/formula resolve to entity refs (handled separately).
|
|
409
401
|
if (seg.kind === 'concept' || seg.kind === 'cite') {
|
|
410
402
|
const target = seg.target;
|
|
411
403
|
if (target.type === 'dataset_qualified' && target.dataset && target.id) {
|
|
412
|
-
//
|
|
413
|
-
// If the dataset doesn't exist in this deployment's refPrefixMap,
|
|
414
|
-
// skip — the runtime resolver will handle it (unresolved text or
|
|
415
|
-
// external link via routing). Creating a URI for a non-existent
|
|
416
|
-
// dataset produces a 404.
|
|
404
|
+
// Cross-dataset: only if co-deployed
|
|
417
405
|
const dsId = refMaps.refPrefixMap[target.dataset];
|
|
418
406
|
if (dsId) {
|
|
419
407
|
refs.push({ id: buildConceptUri(refMaps.uriBase, dsId, target.id), term: seg.label ?? `${target.dataset}:${target.id}` });
|
|
420
408
|
}
|
|
421
409
|
} else if (target.type === 'urn' && target.urn) {
|
|
410
|
+
// URN: resolve via pattern index
|
|
422
411
|
const pattern = refMaps.patternIndex.resolve(target.urn);
|
|
423
412
|
if (pattern) {
|
|
424
413
|
refs.push({ id: buildConceptUri(refMaps.uriBase, pattern.datasetId, pattern.conceptId), term: seg.label ?? target.urn });
|
|
425
414
|
}
|
|
415
|
+
} else if (target.type === 'entity_id' && target.id) {
|
|
416
|
+
// Same-dataset concept reference (bare numeric ID or designation)
|
|
417
|
+
refs.push({ id: buildConceptUri(refMaps.uriBase, refMaps.register, target.id), term: seg.label ?? target.id });
|
|
426
418
|
}
|
|
427
419
|
}
|
|
428
420
|
}
|