@glossarist/concept-browser 0.7.121 → 0.7.122
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.
|
|
3
|
+
"version": "0.7.122",
|
|
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": {
|
package/scripts/generate-data.js
CHANGED
|
@@ -1211,6 +1211,7 @@ function extractInlineRefs(localizedData, refMaps2, conceptSources = []) {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
for (const m of fullText.matchAll(/\{\{([^{}]+?)\}\}/g)) {
|
|
1213
1213
|
const body = m[1];
|
|
1214
|
+
if (/^(bib|link|image):/i.test(body)) continue;
|
|
1214
1215
|
const parsed = parseMention(body);
|
|
1215
1216
|
let ref = null;
|
|
1216
1217
|
if (parsed.kind === "cite-ref") {
|
package/scripts/generate-data.ts
CHANGED
|
@@ -375,9 +375,22 @@ function extractInlineRefs(localizedData, refMaps, conceptSources = []) {
|
|
|
375
375
|
if (pattern) { refs.push(pattern); }
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
// Double-brace mentions: dispatched by parseMention kind
|
|
378
|
+
// Double-brace mentions: dispatched by parseMention kind.
|
|
379
|
+
//
|
|
380
|
+
// DATA/DEPLOYMENT BOUNDARY: only cite-ref, numeric, urn-ref, and
|
|
381
|
+
// designation mentions produce concept cross-references (gl:references).
|
|
382
|
+
// Other mention kinds (bib:, link:, image:) are deployment-specific
|
|
383
|
+
// renderings — bibliography entries, external URLs, inline images —
|
|
384
|
+
// NOT concept pages. They must NOT appear in gl:references or be
|
|
385
|
+
// turned into concept URIs. The deployment's renderer handles them
|
|
386
|
+
// at runtime (bibResolver, linkResolver, imageResolver).
|
|
379
387
|
for (const m of fullText.matchAll(/\{\{([^{}]+?)\}\}/g)) {
|
|
380
388
|
const body = m[1];
|
|
389
|
+
|
|
390
|
+
// Pre-parse deployment-specific kinds that parseMention doesn't know.
|
|
391
|
+
// These are NEVER concept cross-references — skip them entirely.
|
|
392
|
+
if (/^(bib|link|image):/i.test(body)) continue;
|
|
393
|
+
|
|
381
394
|
const parsed = parseMention(body);
|
|
382
395
|
|
|
383
396
|
let ref = null;
|
|
@@ -399,6 +412,8 @@ function extractInlineRefs(localizedData, refMaps, conceptSources = []) {
|
|
|
399
412
|
// {{designation,render term}} — same-dataset designation reference
|
|
400
413
|
ref = handleDesignation(parsed, refMaps);
|
|
401
414
|
} else {
|
|
415
|
+
// Unresolved mentions: only include if they look like concept refs
|
|
416
|
+
// (numeric IDs or known patterns). Never include bib:/link:/image:.
|
|
402
417
|
ref = handleUnresolved(body, refMaps);
|
|
403
418
|
}
|
|
404
419
|
if (ref) refs.push(ref);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Regression test: extractInlineRefs must NOT turn bib:/link:/image: mentions
|
|
5
|
+
* into concept cross-references. These are deployment-specific renderings
|
|
6
|
+
* (bibliography entries, external URLs, inline images), not concept pages.
|
|
7
|
+
*
|
|
8
|
+
* The data/deployment boundary requires that dataset authors can write
|
|
9
|
+
* {{bib:...}} without knowing whether IEV or any other dataset is
|
|
10
|
+
* co-deployed. The deployment's renderer handles bib/link/image at
|
|
11
|
+
* runtime. concept-browser MUST NOT create concept URIs for them.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Simulate the extractInlineRefs double-brace loop logic from generate-data.ts
|
|
15
|
+
function shouldSkipMention(body: string): boolean {
|
|
16
|
+
return /^(bib|link|image):/i.test(body);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe('data/deployment boundary — bib:/link:/image: mentions never become concept URIs', () => {
|
|
20
|
+
it('skips bib: mentions', () => {
|
|
21
|
+
expect(shouldSkipMention('bib:702-02-07, IEV 702-02-07')).toBe(true);
|
|
22
|
+
expect(shouldSkipMention('bib:ref_1')).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('skips link: mentions', () => {
|
|
26
|
+
expect(shouldSkipMention('link:https://example.com')).toBe(true);
|
|
27
|
+
expect(shouldSkipMention('link:https://example.com, click here')).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('skips image: mentions', () => {
|
|
31
|
+
expect(shouldSkipMention('image:diagram.png')).toBe(true);
|
|
32
|
+
expect(shouldSkipMention('image:diagram.png, alt text')).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('does NOT skip cite: mentions (concept cross-references)', () => {
|
|
36
|
+
expect(shouldSkipMention('cite:iso704')).toBe(false);
|
|
37
|
+
expect(shouldSkipMention('cite:iso704, ISO 704')).toBe(false);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('does NOT skip numeric mentions (e.g. 17-21-004)', () => {
|
|
41
|
+
expect(shouldSkipMention('17-21-004')).toBe(false);
|
|
42
|
+
expect(shouldSkipMention('112-01-10')).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('does NOT skip urn: mentions', () => {
|
|
46
|
+
expect(shouldSkipMention('urn:iso:std:iso:704')).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('does NOT skip designation mentions', () => {
|
|
50
|
+
expect(shouldSkipMention('measurement unit')).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
});
|