mdld-parse 0.9.6 → 0.9.9
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/README.md +81 -43
- package/dist/README.md +81 -43
- package/dist/docs/Parser.md +2 -1
- package/dist/docs/origin.md +2 -1
- package/dist/docs/primary-subject.md +3 -2
- package/dist/examples/demo/journal.md +26 -87
- package/dist/examples/demo/project.md +50 -64
- package/dist/examples/demo/recipe.md +24 -69
- package/dist/examples/demo/research.md +37 -79
- package/dist/examples/demo/space-mission.md +32 -103
- package/dist/index.html +375 -579
- package/dist/index.js +28 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -417,7 +417,9 @@ function le(e, t) {
|
|
|
417
417
|
let r = e.slice(t + 1, n).trim();
|
|
418
418
|
return r.match(/^[a-zA-Z][a-zA-Z0-9+\-.]*:/) ? {
|
|
419
419
|
url: r,
|
|
420
|
-
endPos: n + 1
|
|
420
|
+
endPos: n + 1,
|
|
421
|
+
contentStart: t + 1,
|
|
422
|
+
contentEnd: n
|
|
421
423
|
} : null;
|
|
422
424
|
}
|
|
423
425
|
function ue(e, t) {
|
|
@@ -439,7 +441,8 @@ function ue(e, t) {
|
|
|
439
441
|
content: t,
|
|
440
442
|
attrs: c?.attrs || null,
|
|
441
443
|
endPos: l,
|
|
442
|
-
|
|
444
|
+
contentStart: o,
|
|
445
|
+
contentEnd: s
|
|
443
446
|
};
|
|
444
447
|
}
|
|
445
448
|
s++;
|
|
@@ -460,7 +463,8 @@ function de(e, t) {
|
|
|
460
463
|
content: t,
|
|
461
464
|
attrs: o?.attrs || null,
|
|
462
465
|
endPos: s,
|
|
463
|
-
|
|
466
|
+
contentStart: i,
|
|
467
|
+
contentEnd: a
|
|
464
468
|
};
|
|
465
469
|
}
|
|
466
470
|
a++;
|
|
@@ -489,7 +493,8 @@ function fe(e, t) {
|
|
|
489
493
|
url: a,
|
|
490
494
|
attrs: o?.attrs || null,
|
|
491
495
|
endPos: s,
|
|
492
|
-
|
|
496
|
+
contentStart: t + 1,
|
|
497
|
+
contentEnd: n
|
|
493
498
|
};
|
|
494
499
|
}
|
|
495
500
|
function x(e, t = 0) {
|
|
@@ -523,16 +528,16 @@ function x(e, t = 0) {
|
|
|
523
528
|
i = a.endPos;
|
|
524
529
|
continue;
|
|
525
530
|
}
|
|
526
|
-
let l = t + i, u = t + a.endPos, d = t +
|
|
531
|
+
let l = t + i, u = t + a.endPos, d = t + a.contentEnd, f = [t + a.contentStart, t + a.contentEnd], p = {
|
|
527
532
|
type: s,
|
|
528
533
|
text: a.content === void 0 ? a.text === void 0 ? o : a.text : a.content,
|
|
529
534
|
range: [l, u],
|
|
530
|
-
valueRange:
|
|
535
|
+
valueRange: f,
|
|
531
536
|
attrs: c,
|
|
532
537
|
url: o,
|
|
533
538
|
pos: a.endPos
|
|
534
539
|
};
|
|
535
|
-
c && (
|
|
540
|
+
c && (p.attrsRange = [d, u]), n.push(p), i = a.endPos;
|
|
536
541
|
}
|
|
537
542
|
return n;
|
|
538
543
|
}
|
|
@@ -611,6 +616,7 @@ function ye(e, t, n, r = null) {
|
|
|
611
616
|
return {
|
|
612
617
|
blockId: e.id,
|
|
613
618
|
range: e.range,
|
|
619
|
+
valueRange: e.valueRange || null,
|
|
614
620
|
carrierType: e.carrierType,
|
|
615
621
|
subject: t.value,
|
|
616
622
|
predicate: n.value,
|
|
@@ -748,7 +754,8 @@ function I(t, n = {}) {
|
|
|
748
754
|
let u = {
|
|
749
755
|
subject: o.primarySubject,
|
|
750
756
|
type: o.primaryType,
|
|
751
|
-
label: o.primaryLabel
|
|
757
|
+
label: o.primaryLabel,
|
|
758
|
+
comment: o.primaryComment
|
|
752
759
|
};
|
|
753
760
|
return {
|
|
754
761
|
quads: o.quads,
|
|
@@ -1002,6 +1009,10 @@ function je(e, t, n, r, i, a, o, s, c) {
|
|
|
1002
1009
|
start: r[0],
|
|
1003
1010
|
end: r[1]
|
|
1004
1011
|
},
|
|
1012
|
+
valueRange: a ? {
|
|
1013
|
+
start: a[0],
|
|
1014
|
+
end: a[1]
|
|
1015
|
+
} : null,
|
|
1005
1016
|
carrierType: o || null,
|
|
1006
1017
|
subject: e,
|
|
1007
1018
|
types: l.types,
|
|
@@ -1022,7 +1033,7 @@ function z(e, t, n, r, i, a, o, s, c, l = null, u = null, d = null, f = null) {
|
|
|
1022
1033
|
} else n.add(p);
|
|
1023
1034
|
} else {
|
|
1024
1035
|
let n = v(p.subject, p.predicate, p.object);
|
|
1025
|
-
t.set(n, p), e.push(p), f && (!f.primaryType && o.value === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" && (f.primaryType = s.value), !f.primaryLabel && o.value === "http://www.w3.org/2000/01/rdf-schema#label" && s.termType === "Literal" && (f.primaryLabel = s.value)), Me(p, c, l, u, d);
|
|
1036
|
+
t.set(n, p), e.push(p), f && (!f.primaryType && o.value === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" && (f.primaryType = s.value), !f.primaryLabel && o.value === "http://www.w3.org/2000/01/rdf-schema#label" && s.termType === "Literal" && (f.primaryLabel = s.value), !f.primaryComment && o.value === "http://www.w3.org/2000/01/rdf-schema#comment" && s.termType === "Literal" && (f.primaryComment = s.value)), Me(p, c, l, u, d);
|
|
1026
1037
|
let m = ye(i, a, o, l);
|
|
1027
1038
|
r.set(n, m), f.currentBlock && i.id === f.currentBlock.id && (f.currentBlock.quadKeys || (f.currentBlock.quadKeys = []), f.currentBlock.quadKeys.push(n));
|
|
1028
1039
|
}
|
|
@@ -1303,7 +1314,7 @@ function Ke(t, n, r = null) {
|
|
|
1303
1314
|
let a = K(e, n), { types: s, literals: c, objects: l } = Ee(r), u = o.has(e), d = u ? o.get(e) : Be(e, n), f = s.length > 0 ? s.map((e) => "." + K(e.object.value, n)).sort().join(" ") : "";
|
|
1304
1315
|
u && (f += (f ? " " : "") + "label");
|
|
1305
1316
|
let p = f ? " " + f : "";
|
|
1306
|
-
i.push(`# ${d} {=${a}${p}}\n
|
|
1317
|
+
i.push(`# ${d} {=${a}${p}}\n`);
|
|
1307
1318
|
let m = u ? o.get(e) : null;
|
|
1308
1319
|
F(c).forEach((e) => {
|
|
1309
1320
|
e.predicate.value === "http://www.w3.org/2000/01/rdf-schema#label" && e.object.value === m || i.push(we(e, n));
|
|
@@ -1776,4 +1787,10 @@ function St(e) {
|
|
|
1776
1787
|
return n;
|
|
1777
1788
|
}
|
|
1778
1789
|
//#endregion
|
|
1779
|
-
|
|
1790
|
+
//#region src/index.js
|
|
1791
|
+
function Ct({ text: e, quad: t, value: n, origin: r }) {
|
|
1792
|
+
let i = f(t, r?.quadIndex ? r : I({ text: e }).origin);
|
|
1793
|
+
return !i || !i.valueRange ? e : e.substring(0, i.valueRange.start) + n + e.substring(i.valueRange.end);
|
|
1794
|
+
}
|
|
1795
|
+
//#endregion
|
|
1796
|
+
export { e as DEFAULT_CONTEXT, d as DataFactory, h as expandIRI, Ve as generate, He as generateNode, Q as getIRIColor, p as hash, yt as hashIRI, St as highlightMDLD, f as locate, ze as merge, I as parse, _ as parseSemanticBlock, Je as render, g as shortenIRI, Ct as updateValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdld-parse",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "A standards-compliant parser for **MD-LD (Markdown-Linked Data)** — a human-friendly RDF authoring format that extends Markdown with semantic annotations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "git+https://github.com/davay42/mdld-parse.git"
|
|
38
38
|
},
|
|
39
|
-
"homepage": "https://mdld.js.org",
|
|
39
|
+
"homepage": "https://mdld.js.org/",
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://github.com/davay42/mdld-parse/issues"
|
|
42
42
|
},
|