@tricoteuses/tisseuse 0.14.9 → 0.14.11
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/dist/{html-B2BbrPpc.js → html-zrF2u7Vr.js} +152 -118
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -1
|
@@ -13171,7 +13171,7 @@ async function* G_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13171
13171
|
for (let n of c === void 0 ? Vm(t) : Um(t, c)) o && console.log(`In "${t.input.slice(n.position.start, n.position.stop)}": \nReference "${t.text(n.position)}": ${JSON.stringify(n, null, 2)}`), e.push(n);
|
|
13172
13172
|
return e;
|
|
13173
13173
|
}, { inputSize: t.input.length }), h = performance.now();
|
|
13174
|
-
for (let e of m) for (let n of
|
|
13174
|
+
for (let e of m) for (let n of dv(t, e)) {
|
|
13175
13175
|
let r = n.type === "parent-enfant" ? n.parent : n;
|
|
13176
13176
|
switch (r.type) {
|
|
13177
13177
|
case "alinéa":
|
|
@@ -13216,7 +13216,7 @@ async function* G_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13216
13216
|
phase: "collectDefinitionsAndTextState"
|
|
13217
13217
|
});
|
|
13218
13218
|
let g = /* @__PURE__ */ new Set();
|
|
13219
|
-
for (let e of m) for (let t of
|
|
13219
|
+
for (let e of m) for (let t of uv(e, { citations: !0 })) g.add(t);
|
|
13220
13220
|
let _ = q_(t, m);
|
|
13221
13221
|
await u.time("preloadActiveArticlesByTextIds", () => l.preloadActiveArticlesByTextIds({
|
|
13222
13222
|
date: n,
|
|
@@ -13236,7 +13236,7 @@ async function* G_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13236
13236
|
nums: v
|
|
13237
13237
|
}), { count: v.size }), p = s === void 0 ? {} : s;
|
|
13238
13238
|
let y = 0, ee = performance.now();
|
|
13239
|
-
for (let e of m) for await (let r of
|
|
13239
|
+
for (let e of m) for await (let r of gv({
|
|
13240
13240
|
articleDefinitionByNumByTextId: d,
|
|
13241
13241
|
legiResolver: l,
|
|
13242
13242
|
context: t,
|
|
@@ -13326,7 +13326,7 @@ function K_({ context: e, logPartialReferences: t, reference: n, state: r, text:
|
|
|
13326
13326
|
}
|
|
13327
13327
|
function q_(e, t) {
|
|
13328
13328
|
let n = /* @__PURE__ */ new Set();
|
|
13329
|
-
for (let r of t) for (let t of
|
|
13329
|
+
for (let r of t) for (let t of dv(e, r, { citations: !0 })) {
|
|
13330
13330
|
let e = t.type === "parent-enfant" ? t.parent : t;
|
|
13331
13331
|
e.type === "texte" && e.cid !== void 0 ? n.add(e.cid) : e.type === "article" && e.implicitText?.cid !== void 0 && n.add(e.implicitText.cid);
|
|
13332
13332
|
}
|
|
@@ -13346,7 +13346,7 @@ async function J_({ context: e, date: t, legiResolver: n, logPartialReferences:
|
|
|
13346
13346
|
return o;
|
|
13347
13347
|
}
|
|
13348
13348
|
async function Y_({ articleNums: e, context: t, date: n, legiResolver: r, logPartialReferences: i, reference: a, state: o }) {
|
|
13349
|
-
for (let s of
|
|
13349
|
+
for (let s of dv(t, a)) await X_({
|
|
13350
13350
|
articleNums: e,
|
|
13351
13351
|
atomicOrParentChildReference: s,
|
|
13352
13352
|
context: t,
|
|
@@ -13383,7 +13383,7 @@ async function X_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13383
13383
|
case "phrase": break;
|
|
13384
13384
|
case "article":
|
|
13385
13385
|
if (c.definition && s.textId !== void 0) break;
|
|
13386
|
-
await
|
|
13386
|
+
await cv({
|
|
13387
13387
|
article: c,
|
|
13388
13388
|
date: r,
|
|
13389
13389
|
legiResolver: i,
|
|
@@ -13559,9 +13559,14 @@ function av(e) {
|
|
|
13559
13559
|
let t = new Set(e.flatMap(({ num: e, textId: t }) => e === null || t === null ? [] : [nv(t, e)]));
|
|
13560
13560
|
if (t.size !== 1) return;
|
|
13561
13561
|
let n = iv.get([...t][0]);
|
|
13562
|
-
return e.find(({ id: e }) => e === n);
|
|
13562
|
+
if (n !== void 0) return e.find(({ id: e }) => e === n);
|
|
13563
13563
|
}
|
|
13564
|
-
|
|
13564
|
+
function ov(e) {
|
|
13565
|
+
if (e.length < 2) return;
|
|
13566
|
+
let [t, ...n] = [...e].sort((e, t) => t.dateDebut.localeCompare(e.dateDebut));
|
|
13567
|
+
if (!n.some(({ dateDebut: e }) => e >= t.dateDebut)) return t;
|
|
13568
|
+
}
|
|
13569
|
+
async function sv({ alternatives: e, date: t, legiResolver: n }) {
|
|
13565
13570
|
let r = [];
|
|
13566
13571
|
for (let { num: i, textId: a } of e) {
|
|
13567
13572
|
let e = (await n.getActiveArticlesByTextAndNum({
|
|
@@ -13573,7 +13578,7 @@ async function ov({ alternatives: e, date: t, legiResolver: n }) {
|
|
|
13573
13578
|
}
|
|
13574
13579
|
return r.length === 1 ? r[0] : [];
|
|
13575
13580
|
}
|
|
13576
|
-
async function
|
|
13581
|
+
async function cv({ article: e, date: t, legiResolver: n, state: r }) {
|
|
13577
13582
|
if (e.present || e.num === void 0) return !1;
|
|
13578
13583
|
let i = e.implicitText?.cid ?? r.textId;
|
|
13579
13584
|
return !(i !== void 0 && (await n.getActiveArticlesByTextAndNum({
|
|
@@ -13586,7 +13591,7 @@ async function sv({ article: e, date: t, legiResolver: n, state: r }) {
|
|
|
13586
13591
|
textId: r.defaultTextId
|
|
13587
13592
|
})).length > 0);
|
|
13588
13593
|
}
|
|
13589
|
-
async function*
|
|
13594
|
+
async function* lv({ ancestors: e, article: t, legiResolver: n, context: r, date: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13590
13595
|
if (t.present) return;
|
|
13591
13596
|
let l = [], u = t.implicitText?.cid ?? c.textId;
|
|
13592
13597
|
u === "LEGITEXT000006070716" && t.num !== void 0 && /^[LR]\d/u.test(t.num) && (u = "LEGITEXT000025024948");
|
|
@@ -13597,20 +13602,20 @@ async function* cv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13597
13602
|
textId: u
|
|
13598
13603
|
}), l.length > 0 && (d = l)), l.length === 0 && t.num !== void 0 && u !== void 0) {
|
|
13599
13604
|
let e = rv.get(nv(u, t.num));
|
|
13600
|
-
e !== void 0 && (l = await
|
|
13605
|
+
e !== void 0 && (l = await sv({
|
|
13601
13606
|
alternatives: [e],
|
|
13602
13607
|
date: i,
|
|
13603
13608
|
legiResolver: n
|
|
13604
13609
|
}));
|
|
13605
13610
|
}
|
|
13606
|
-
if (l.length === 0 && t.num !== void 0 && u !== void 0 && (l = await
|
|
13611
|
+
if (l.length === 0 && t.num !== void 0 && u !== void 0 && (l = await sv({
|
|
13607
13612
|
alternatives: ev(t.num, u).map((e) => ({
|
|
13608
13613
|
num: e,
|
|
13609
13614
|
textId: u
|
|
13610
13615
|
})),
|
|
13611
13616
|
date: i,
|
|
13612
13617
|
legiResolver: n
|
|
13613
|
-
})), l.length === 0 && t.num !== void 0 && u !== void 0 && (l = await
|
|
13618
|
+
})), l.length === 0 && t.num !== void 0 && u !== void 0 && (l = await sv({
|
|
13614
13619
|
alternatives: tv(t.num, u).map((e) => ({
|
|
13615
13620
|
num: e,
|
|
13616
13621
|
textId: u
|
|
@@ -13632,7 +13637,11 @@ async function* cv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13632
13637
|
else {
|
|
13633
13638
|
e.length !== 0 && (l = e);
|
|
13634
13639
|
let n = av(l);
|
|
13635
|
-
n
|
|
13640
|
+
if (n !== void 0) c.articleId = n.id;
|
|
13641
|
+
else {
|
|
13642
|
+
let n = ov(l.filter(({ dateDebut: e, dateFin: t }) => e <= i && t > i));
|
|
13643
|
+
n === void 0 ? (e = l.filter(({ id: e }) => !c.textId?.startsWith("JORF") || e.startsWith("JORF")), e.length === 1 ? c.articleId = e[0].id : (e.length !== 0 && (l = e), a && console.warn(`In "${r.input.slice(t.position.start, t.position.stop)}": Unable to filter article ${t.num ?? null} of text ${c.textId ?? null} among IDs ${JSON.stringify(l.map(({ id: e }) => e), null, 2)} for reference ${JSON.stringify(t, null, 2)}`), delete c.articleId)) : c.articleId = n.id;
|
|
13644
|
+
}
|
|
13636
13645
|
}
|
|
13637
13646
|
}
|
|
13638
13647
|
let f = e === void 0 ? t.position : t.position.start < e[0].position.start ? {
|
|
@@ -13642,12 +13651,37 @@ async function* cv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13642
13651
|
start: e[0].position.start,
|
|
13643
13652
|
stop: t.position.stop
|
|
13644
13653
|
}, p;
|
|
13645
|
-
if (c.articleId === void 0 && t.num !== void 0
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13654
|
+
if (c.articleId === void 0 && t.num !== void 0) {
|
|
13655
|
+
if (d.length > 0 && !d.some(({ dateDebut: e, dateFin: t }) => e <= i && t > i)) {
|
|
13656
|
+
let e = await n.getArticleHistoryInfo({
|
|
13657
|
+
num: t.num,
|
|
13658
|
+
textId: u
|
|
13659
|
+
});
|
|
13660
|
+
e !== void 0 && (p = e.articleId);
|
|
13661
|
+
} else if (d.length === 0 && u !== void 0) {
|
|
13662
|
+
let e = [], r = new Set([...tv(t.num, u), ...ev(t.num, u)]);
|
|
13663
|
+
for (let t of r) {
|
|
13664
|
+
let r = await n.getActiveArticlesByTextAndNum({
|
|
13665
|
+
date: i,
|
|
13666
|
+
num: t,
|
|
13667
|
+
textId: u
|
|
13668
|
+
});
|
|
13669
|
+
if (r.length !== 0) {
|
|
13670
|
+
if (r.some(({ dateDebut: e, dateFin: t }) => e <= i && t > i)) {
|
|
13671
|
+
e.length = 0;
|
|
13672
|
+
break;
|
|
13673
|
+
}
|
|
13674
|
+
e.push(t);
|
|
13675
|
+
}
|
|
13676
|
+
}
|
|
13677
|
+
if (e.length === 1) {
|
|
13678
|
+
let t = await n.getArticleHistoryInfo({
|
|
13679
|
+
num: e[0],
|
|
13680
|
+
textId: u
|
|
13681
|
+
});
|
|
13682
|
+
t !== void 0 && (p = t.articleId);
|
|
13683
|
+
}
|
|
13684
|
+
}
|
|
13651
13685
|
}
|
|
13652
13686
|
yield Object.fromEntries(Object.entries({
|
|
13653
13687
|
article: t,
|
|
@@ -13659,91 +13693,91 @@ async function* cv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13659
13693
|
type: "external_article"
|
|
13660
13694
|
}).filter(([, e]) => e !== void 0));
|
|
13661
13695
|
}
|
|
13662
|
-
function*
|
|
13696
|
+
function* uv(e, { citations: t = !1 } = {}) {
|
|
13663
13697
|
switch (e.type) {
|
|
13664
13698
|
case "article":
|
|
13665
13699
|
e.num !== void 0 && (yield e.num);
|
|
13666
13700
|
break;
|
|
13667
13701
|
case "bounded-interval":
|
|
13668
|
-
yield*
|
|
13702
|
+
yield* uv(e.first, { citations: t }), yield* uv(e.last, { citations: t });
|
|
13669
13703
|
break;
|
|
13670
13704
|
case "counted-interval":
|
|
13671
|
-
yield*
|
|
13705
|
+
yield* uv(e.first, { citations: t });
|
|
13672
13706
|
break;
|
|
13673
13707
|
case "enumeration":
|
|
13674
13708
|
case "exclusion":
|
|
13675
|
-
yield*
|
|
13709
|
+
yield* uv(e.left, { citations: t }), yield* uv(e.right, { citations: t });
|
|
13676
13710
|
break;
|
|
13677
13711
|
case "parent-enfant":
|
|
13678
|
-
yield*
|
|
13712
|
+
yield* uv(e.parent, { citations: t }), yield* uv(e.child, { citations: t });
|
|
13679
13713
|
break;
|
|
13680
13714
|
case "reference_et_action":
|
|
13681
|
-
if (yield*
|
|
13715
|
+
if (yield* uv(e.reference, { citations: t }), t) {
|
|
13682
13716
|
let { originalCitations: n } = e.action;
|
|
13683
13717
|
if (n !== void 0) {
|
|
13684
|
-
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield*
|
|
13718
|
+
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield* uv(n, { citations: t });
|
|
13685
13719
|
}
|
|
13686
13720
|
}
|
|
13687
13721
|
break;
|
|
13688
13722
|
}
|
|
13689
13723
|
}
|
|
13690
|
-
function*
|
|
13724
|
+
function* dv(e, t, { citations: n = !1 } = {}) {
|
|
13691
13725
|
switch (t.type) {
|
|
13692
13726
|
case "bounded-interval":
|
|
13693
|
-
yield*
|
|
13727
|
+
yield* dv(e, t.first, { citations: n }), yield* dv(e, t.last, { citations: n });
|
|
13694
13728
|
break;
|
|
13695
13729
|
case "counted-interval":
|
|
13696
|
-
yield*
|
|
13730
|
+
yield* dv(e, t.first, { citations: n });
|
|
13697
13731
|
break;
|
|
13698
13732
|
case "enumeration":
|
|
13699
13733
|
case "exclusion":
|
|
13700
|
-
yield*
|
|
13734
|
+
yield* dv(e, t.left, { citations: n }), yield* dv(e, t.right, { citations: n });
|
|
13701
13735
|
break;
|
|
13702
13736
|
case "reference_et_action":
|
|
13703
|
-
if (yield*
|
|
13737
|
+
if (yield* dv(e, t.reference, { citations: n }), n) {
|
|
13704
13738
|
let { originalCitations: r } = t.action;
|
|
13705
13739
|
if (r !== void 0) {
|
|
13706
|
-
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield*
|
|
13740
|
+
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield* dv(e, r, { citations: n });
|
|
13707
13741
|
}
|
|
13708
13742
|
}
|
|
13709
13743
|
break;
|
|
13710
13744
|
default: yield t;
|
|
13711
13745
|
}
|
|
13712
13746
|
}
|
|
13713
|
-
function*
|
|
13747
|
+
function* fv(e, t) {
|
|
13714
13748
|
if (t.type === "texte") console.error(`iterDeepestDivisionsOrArticles must not be called with a text:\n${JSON.stringify(t, null, 2)}`);
|
|
13715
13749
|
else if (dt(t) || t.type === "article") yield t;
|
|
13716
13750
|
else if (!(ft(t) || t.type === "incomplete-header")) switch (t.type) {
|
|
13717
13751
|
case "bounded-interval":
|
|
13718
|
-
yield*
|
|
13752
|
+
yield* fv(e, t.first), yield* fv(e, t.last);
|
|
13719
13753
|
break;
|
|
13720
13754
|
case "counted-interval":
|
|
13721
|
-
yield*
|
|
13755
|
+
yield* fv(e, t.first);
|
|
13722
13756
|
break;
|
|
13723
13757
|
case "enumeration":
|
|
13724
13758
|
case "exclusion":
|
|
13725
|
-
yield*
|
|
13759
|
+
yield* fv(e, t.left), yield* fv(e, t.right);
|
|
13726
13760
|
break;
|
|
13727
13761
|
case "parent-enfant": {
|
|
13728
|
-
let n = [...
|
|
13729
|
-
n.length === 0 ? yield*
|
|
13762
|
+
let n = [...fv(e, t.child)];
|
|
13763
|
+
n.length === 0 ? yield* fv(e, t.parent) : yield* n;
|
|
13730
13764
|
break;
|
|
13731
13765
|
}
|
|
13732
13766
|
case "reference_et_action": {
|
|
13733
|
-
yield*
|
|
13767
|
+
yield* fv(e, t.reference);
|
|
13734
13768
|
let { originalCitations: n } = t.action;
|
|
13735
13769
|
if (n !== void 0) {
|
|
13736
|
-
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield*
|
|
13770
|
+
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield* fv(e, n);
|
|
13737
13771
|
}
|
|
13738
13772
|
break;
|
|
13739
13773
|
}
|
|
13740
13774
|
default: c("iterDeepestDivisionsOrArticles reference.type", t);
|
|
13741
13775
|
}
|
|
13742
13776
|
}
|
|
13743
|
-
function
|
|
13777
|
+
function pv(e) {
|
|
13744
13778
|
return e?.split(":")[0].trim().toLowerCase().split(/\s+/).map((e) => e.trim()).filter((e) => e !== "").join(" ");
|
|
13745
13779
|
}
|
|
13746
|
-
async function*
|
|
13780
|
+
async function* mv({ ancestors: e, legiResolver: t, context: n, date: r, division: i, divisionChildReference: a, logIgnoredReferencesTypes: o, logPartialReferences: s, originalPositionsFromTransformedIterator: c, parentSectionChildren: l, reference: u, state: d }) {
|
|
13747
13781
|
if (i.present) return;
|
|
13748
13782
|
let f;
|
|
13749
13783
|
if (l === void 0 && d.textId !== void 0 && (l = await t.getDirectSectionChildren({
|
|
@@ -13751,20 +13785,20 @@ async function* pv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13751
13785
|
parentPath: d.textId
|
|
13752
13786
|
})), l !== void 0) {
|
|
13753
13787
|
for (let e of l) {
|
|
13754
|
-
let t =
|
|
13788
|
+
let t = pv(e.title);
|
|
13755
13789
|
if (t !== void 0) {
|
|
13756
13790
|
let n = !1;
|
|
13757
|
-
if (i.index !== void 0 && (n =
|
|
13791
|
+
if (i.index !== void 0 && (n = hv(i.type, i.index).some((e) => e === t)), !n && i.num !== void 0 && (n = `${i.type} ${i.num.toLowerCase()}` === t), n) {
|
|
13758
13792
|
f = e;
|
|
13759
13793
|
break;
|
|
13760
13794
|
}
|
|
13761
13795
|
}
|
|
13762
13796
|
}
|
|
13763
13797
|
if (f === void 0 && (f = l.find((e) => {
|
|
13764
|
-
let t =
|
|
13798
|
+
let t = pv(e.title)?.split(/\s+/);
|
|
13765
13799
|
return t !== void 0 && t.length === 2 && ot.includes(t[0]) && t[1] === "législative";
|
|
13766
13800
|
}), f !== void 0)) {
|
|
13767
|
-
let e =
|
|
13801
|
+
let e = pv(f.title).split(/\s+/), t = {
|
|
13768
13802
|
start: i.position.stop,
|
|
13769
13803
|
stop: i.position.stop
|
|
13770
13804
|
}, n = c === void 0 ? void 0 : v(c, t), r = Object.fromEntries(Object.entries({
|
|
@@ -13782,8 +13816,8 @@ async function* pv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13782
13816
|
}).filter(([, e]) => e !== void 0)), i = r;
|
|
13783
13817
|
}
|
|
13784
13818
|
}
|
|
13785
|
-
let p = a === void 0 ? [] : [...
|
|
13786
|
-
if (a !== void 0) for (let l of
|
|
13819
|
+
let p = a === void 0 ? [] : [...fv(n, a.child)], m = 0;
|
|
13820
|
+
if (a !== void 0) for (let l of dv(n, a.child)) {
|
|
13787
13821
|
let h = l.type === "parent-enfant" ? l.parent : l, g = l.type === "parent-enfant" ? l : void 0;
|
|
13788
13822
|
switch (h.type) {
|
|
13789
13823
|
case "alinéa":
|
|
@@ -13791,7 +13825,7 @@ async function* pv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13791
13825
|
case "item":
|
|
13792
13826
|
case "phrase": break;
|
|
13793
13827
|
case "article":
|
|
13794
|
-
yield*
|
|
13828
|
+
yield* lv({
|
|
13795
13829
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13796
13830
|
article: h,
|
|
13797
13831
|
legiResolver: t,
|
|
@@ -13817,7 +13851,7 @@ async function* pv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13817
13851
|
f !== void 0 && (a = await t.getDirectSectionChildren({
|
|
13818
13852
|
date: r,
|
|
13819
13853
|
parentPath: f.path
|
|
13820
|
-
})), yield*
|
|
13854
|
+
})), yield* mv({
|
|
13821
13855
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13822
13856
|
legiResolver: t,
|
|
13823
13857
|
context: n,
|
|
@@ -13855,7 +13889,7 @@ async function* pv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13855
13889
|
}).filter(([, e]) => e !== void 0));
|
|
13856
13890
|
}
|
|
13857
13891
|
}
|
|
13858
|
-
function*
|
|
13892
|
+
function* hv(e, t) {
|
|
13859
13893
|
let n = Math.floor(t), r = Math.floor((t - n) * 1e3);
|
|
13860
13894
|
if (r === 0) {
|
|
13861
13895
|
for (let t of re(n)) yield `${t.toLowerCase()} ${e}`;
|
|
@@ -13865,9 +13899,9 @@ function* mv(e, t) {
|
|
|
13865
13899
|
for (let r of f(n)) yield `${e} ${t} ${r.toLowerCase()}`;
|
|
13866
13900
|
}
|
|
13867
13901
|
}
|
|
13868
|
-
async function*
|
|
13902
|
+
async function* gv({ articleDefinitionByNumByTextId: e, legiResolver: t, context: n, date: r, logIgnoredReferencesTypes: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13869
13903
|
let l = e ?? {}, u = c === void 0 ? {} : c;
|
|
13870
|
-
for (let e of
|
|
13904
|
+
for (let e of dv(n, s)) {
|
|
13871
13905
|
let c = e.type === "parent-enfant" ? e.parent : e, d = e.type === "parent-enfant" ? e : void 0;
|
|
13872
13906
|
switch (c.type) {
|
|
13873
13907
|
case "alinéa":
|
|
@@ -13878,7 +13912,7 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13878
13912
|
if (c.definition && u.textId !== void 0) {
|
|
13879
13913
|
let e = l[u.textId]?.[c.num];
|
|
13880
13914
|
e !== void 0 && (e.originalTransformation === void 0 && o !== void 0 && (e.originalTransformation = v(o, e.position)), yield e);
|
|
13881
|
-
} else yield*
|
|
13915
|
+
} else yield* lv({
|
|
13882
13916
|
article: c,
|
|
13883
13917
|
legiResolver: t,
|
|
13884
13918
|
context: n,
|
|
@@ -13899,7 +13933,7 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13899
13933
|
case "sous-sous-paragraphe":
|
|
13900
13934
|
case "sous-titre":
|
|
13901
13935
|
case "titre":
|
|
13902
|
-
c.definition && u.textId !== void 0 || (yield*
|
|
13936
|
+
c.definition && u.textId !== void 0 || (yield* mv({
|
|
13903
13937
|
legiResolver: t,
|
|
13904
13938
|
context: n,
|
|
13905
13939
|
date: r,
|
|
@@ -13920,8 +13954,8 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13920
13954
|
state: u,
|
|
13921
13955
|
text: c
|
|
13922
13956
|
});
|
|
13923
|
-
let e = d === void 0 ? [] : [...
|
|
13924
|
-
if (d !== void 0) for (let f of
|
|
13957
|
+
let e = d === void 0 ? [] : [...fv(n, d.child)], l = 0;
|
|
13958
|
+
if (d !== void 0) for (let f of dv(n, d.child)) {
|
|
13925
13959
|
let p = f.type === "parent-enfant" ? f.parent : f, m = f.type === "parent-enfant" ? f : void 0;
|
|
13926
13960
|
switch (p.type) {
|
|
13927
13961
|
case "alinéa":
|
|
@@ -13929,7 +13963,7 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13929
13963
|
case "item":
|
|
13930
13964
|
case "phrase": break;
|
|
13931
13965
|
case "article":
|
|
13932
|
-
yield*
|
|
13966
|
+
yield* lv({
|
|
13933
13967
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13934
13968
|
article: p,
|
|
13935
13969
|
legiResolver: t,
|
|
@@ -13955,7 +13989,7 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13955
13989
|
u.textId !== void 0 && (d = await t.getDirectSectionChildren({
|
|
13956
13990
|
date: r,
|
|
13957
13991
|
parentPath: u.textId
|
|
13958
|
-
})), yield*
|
|
13992
|
+
})), yield* mv({
|
|
13959
13993
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13960
13994
|
legiResolver: t,
|
|
13961
13995
|
context: n,
|
|
@@ -14006,7 +14040,7 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14006
14040
|
if (e !== void 0) {
|
|
14007
14041
|
for (let s of e) if (s.references !== void 0) {
|
|
14008
14042
|
let e = structuredClone(u);
|
|
14009
|
-
for (let c of s.references) yield*
|
|
14043
|
+
for (let c of s.references) yield* gv({
|
|
14010
14044
|
articleDefinitionByNumByTextId: l,
|
|
14011
14045
|
legiResolver: t,
|
|
14012
14046
|
context: n,
|
|
@@ -14023,13 +14057,13 @@ async function* hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14023
14057
|
}
|
|
14024
14058
|
//#endregion
|
|
14025
14059
|
//#region src/lib/extractors/table_of_contents.ts
|
|
14026
|
-
function
|
|
14060
|
+
function _v(e) {
|
|
14027
14061
|
let t = e;
|
|
14028
14062
|
return t.items ?? [...t.articles ?? [], ...t.divisions ?? []];
|
|
14029
14063
|
}
|
|
14030
|
-
function*
|
|
14064
|
+
function* vv({ context: e, tableOfContents: t, transformation: n }) {
|
|
14031
14065
|
let r = 0, i = _e(n);
|
|
14032
|
-
for (let n of
|
|
14066
|
+
for (let n of bv(t)) {
|
|
14033
14067
|
let t = n.line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = RegExp(`^${t}$`, "m");
|
|
14034
14068
|
a.lastIndex = r;
|
|
14035
14069
|
let o = a.exec(e.input);
|
|
@@ -14041,7 +14075,7 @@ function* _v({ context: e, tableOfContents: t, transformation: n }) {
|
|
|
14041
14075
|
l.originalTransformation = c, l.position = s, yield l, r = s.stop;
|
|
14042
14076
|
}
|
|
14043
14077
|
}
|
|
14044
|
-
function
|
|
14078
|
+
function yv(e) {
|
|
14045
14079
|
let t = new n(e), r = { items: [] }, i = [];
|
|
14046
14080
|
for (let e of Tn(t)) if (dt(e)) {
|
|
14047
14081
|
let n = i.findIndex(({ type: t }) => t === e.type);
|
|
@@ -14059,14 +14093,14 @@ function vv(e) {
|
|
|
14059
14093
|
else throw Error(`Unexpected type "${e.type}" in definition:\n${JSON.stringify(e, null, 2)}`);
|
|
14060
14094
|
return r;
|
|
14061
14095
|
}
|
|
14062
|
-
function*
|
|
14096
|
+
function* bv(e) {
|
|
14063
14097
|
e.type !== void 0 && (yield e);
|
|
14064
|
-
for (let t of
|
|
14098
|
+
for (let t of _v(e)) t.type === "article" ? yield t : yield* bv(t);
|
|
14065
14099
|
}
|
|
14066
14100
|
//#endregion
|
|
14067
14101
|
//#region src/lib/links.ts
|
|
14068
|
-
var
|
|
14069
|
-
function
|
|
14102
|
+
var xv = ["Exploratrice", "Forgejo"];
|
|
14103
|
+
function Sv(e, t, n) {
|
|
14070
14104
|
if (n.match(Ke) === null) throw Error(`Unknown ID format: ${n}`);
|
|
14071
14105
|
switch (e) {
|
|
14072
14106
|
case "Exploratrice": return new URL(`legifrance/articles/${n}/versions`, t).toString();
|
|
@@ -14074,7 +14108,7 @@ function xv(e, t, n) {
|
|
|
14074
14108
|
default: c("urlFromArticleVersionsId linkType", e);
|
|
14075
14109
|
}
|
|
14076
14110
|
}
|
|
14077
|
-
function
|
|
14111
|
+
function Cv(e, t, n) {
|
|
14078
14112
|
let r = n.match(Ke);
|
|
14079
14113
|
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
14080
14114
|
switch (e) {
|
|
@@ -14095,19 +14129,19 @@ function Sv(e, t, n) {
|
|
|
14095
14129
|
}
|
|
14096
14130
|
//#endregion
|
|
14097
14131
|
//#region src/lib/linkers/html.ts
|
|
14098
|
-
function
|
|
14132
|
+
function wv(e, t) {
|
|
14099
14133
|
if (e !== void 0) return e;
|
|
14100
14134
|
if (t !== void 0) return new W_(t);
|
|
14101
14135
|
throw Error("A Canutes database or legal resolver is required");
|
|
14102
14136
|
}
|
|
14103
|
-
function
|
|
14137
|
+
function Tv(e, t) {
|
|
14104
14138
|
return t.type === "reference_et_action" ? JSON.stringify({
|
|
14105
14139
|
...e,
|
|
14106
14140
|
action: t.action
|
|
14107
14141
|
}) : JSON.stringify(e);
|
|
14108
14142
|
}
|
|
14109
|
-
async function
|
|
14110
|
-
let h = new xe("addLinksToHtml"), g =
|
|
14143
|
+
async function Ev({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl: o, linkType: s, logIgnoredReferencesTypes: l, logPartialReferences: u, logReferences: d, onLink: f, previousContext: p, state: m }) {
|
|
14144
|
+
let h = new xe("addLinksToHtml"), g = wv(t, e);
|
|
14111
14145
|
await h.time("preloadTextTitlesInfos", () => g.preloadTextTitlesInfos());
|
|
14112
14146
|
let _ = h.timeSync("simplifyHtml", () => a({ removeAWithHref: !0 })(i), {
|
|
14113
14147
|
inputSize: i.length,
|
|
@@ -14129,7 +14163,7 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14129
14163
|
case "article_definition": {
|
|
14130
14164
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
14131
14165
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14132
|
-
|
|
14166
|
+
Ov({
|
|
14133
14167
|
inputHtml: i,
|
|
14134
14168
|
originalTransformation: n,
|
|
14135
14169
|
output: { replacements: y },
|
|
@@ -14142,10 +14176,10 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14142
14176
|
let { articleId: t, historyArticleId: n, originalTransformation: r } = e;
|
|
14143
14177
|
if (t === void 0 && n === void 0) break;
|
|
14144
14178
|
if (r === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14145
|
-
let a = t === void 0 ?
|
|
14179
|
+
let a = t === void 0 ? Sv(s, o, n) : Cv(s, o, t);
|
|
14146
14180
|
if (a === void 0) break;
|
|
14147
14181
|
let c = t === void 0 ? `class="lien_article_historique" href="${a}" title="Versions de l'article"` : `class="lien_article_externe" href="${a}"`;
|
|
14148
|
-
|
|
14182
|
+
Ov({
|
|
14149
14183
|
inputHtml: i,
|
|
14150
14184
|
originalTransformation: r,
|
|
14151
14185
|
output: { replacements: y },
|
|
@@ -14158,12 +14192,12 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14158
14192
|
let { originalTransformation: t, sectionTaId: n } = e;
|
|
14159
14193
|
if (n !== void 0) {
|
|
14160
14194
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14161
|
-
|
|
14195
|
+
Ov({
|
|
14162
14196
|
inputHtml: i,
|
|
14163
14197
|
originalTransformation: t,
|
|
14164
14198
|
output: { replacements: y },
|
|
14165
14199
|
replacementCounter: ee,
|
|
14166
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${
|
|
14200
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${Cv(s, o, n)}">${e}</a>`
|
|
14167
14201
|
});
|
|
14168
14202
|
}
|
|
14169
14203
|
break;
|
|
@@ -14175,12 +14209,12 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14175
14209
|
continue;
|
|
14176
14210
|
}
|
|
14177
14211
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14178
|
-
|
|
14212
|
+
Ov({
|
|
14179
14213
|
inputHtml: i,
|
|
14180
14214
|
originalTransformation: t,
|
|
14181
14215
|
output: { replacements: y },
|
|
14182
14216
|
replacementCounter: ee,
|
|
14183
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${
|
|
14217
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${Cv(s, o, n.cid)}">${e}</a>`
|
|
14184
14218
|
});
|
|
14185
14219
|
break;
|
|
14186
14220
|
}
|
|
@@ -14188,7 +14222,7 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14188
14222
|
let { url: t, originalTransformation: n } = e;
|
|
14189
14223
|
if (t === void 0) continue;
|
|
14190
14224
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(e, null, 2)}`);
|
|
14191
|
-
|
|
14225
|
+
Ov({
|
|
14192
14226
|
inputHtml: i,
|
|
14193
14227
|
originalTransformation: n,
|
|
14194
14228
|
output: { replacements: y },
|
|
@@ -14200,7 +14234,7 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14200
14234
|
case "internal_article": {
|
|
14201
14235
|
let { definition: t, originalTransformation: n } = e;
|
|
14202
14236
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14203
|
-
|
|
14237
|
+
Ov({
|
|
14204
14238
|
inputHtml: i,
|
|
14205
14239
|
originalTransformation: n,
|
|
14206
14240
|
output: { replacements: y },
|
|
@@ -14212,7 +14246,7 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14212
14246
|
default: c("Link", e);
|
|
14213
14247
|
}
|
|
14214
14248
|
}, { count: te + 1 });
|
|
14215
|
-
let ne = h.timeSync("applyHtmlReplacements", () =>
|
|
14249
|
+
let ne = h.timeSync("applyHtmlReplacements", () => Dv(i, y), {
|
|
14216
14250
|
count: y.length,
|
|
14217
14251
|
inputSize: i.length
|
|
14218
14252
|
});
|
|
@@ -14224,13 +14258,13 @@ async function Tv({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
14224
14258
|
output: y.length === 0 ? null : ne
|
|
14225
14259
|
};
|
|
14226
14260
|
}
|
|
14227
|
-
function
|
|
14261
|
+
function Dv(e, t) {
|
|
14228
14262
|
if (t.length === 0) return e;
|
|
14229
14263
|
let n = [], r = 0;
|
|
14230
14264
|
for (let i of t.toSorted((e, t) => e.start - t.start || e.stop - t.stop || e.order - t.order)) i.start < r || (n.push(e.slice(r, i.start)), n.push(i.replacement), r = i.stop);
|
|
14231
14265
|
return n.push(e.slice(r)), n.join("");
|
|
14232
14266
|
}
|
|
14233
|
-
function
|
|
14267
|
+
function Ov({ inputHtml: e, originalTransformation: t, output: n, replacementCounter: r, tagHtmlFromOriginal: i }) {
|
|
14234
14268
|
let a = d(t, i(s(e, t, 0) ?? ""));
|
|
14235
14269
|
n.replacements.push({
|
|
14236
14270
|
order: r.value++,
|
|
@@ -14239,11 +14273,11 @@ function Dv({ inputHtml: e, originalTransformation: t, output: n, replacementCou
|
|
|
14239
14273
|
stop: t.position.stop
|
|
14240
14274
|
});
|
|
14241
14275
|
}
|
|
14242
|
-
function
|
|
14276
|
+
function kv({ attributes: e, inputHtml: t, originalTransformation: n, outputByType: r, replacementCounter: i }) {
|
|
14243
14277
|
let a = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
14244
14278
|
for (let e of ["links", "links_or_references"]) {
|
|
14245
14279
|
let o = r[e];
|
|
14246
|
-
o !== void 0 &&
|
|
14280
|
+
o !== void 0 && Ov({
|
|
14247
14281
|
inputHtml: t,
|
|
14248
14282
|
originalTransformation: n,
|
|
14249
14283
|
output: o,
|
|
@@ -14252,11 +14286,11 @@ function Ov({ attributes: e, inputHtml: t, originalTransformation: n, outputByTy
|
|
|
14252
14286
|
});
|
|
14253
14287
|
}
|
|
14254
14288
|
}
|
|
14255
|
-
function
|
|
14289
|
+
function Av({ id: e, outputByType: t }) {
|
|
14256
14290
|
return t.references !== void 0 || e === void 0 && t.links_or_references !== void 0;
|
|
14257
14291
|
}
|
|
14258
|
-
async function
|
|
14259
|
-
let h =
|
|
14292
|
+
async function jv({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, htmlTransformation: a, inputHtml: o, linkBaseUrl: s, linkType: l, logIgnoredReferencesTypes: u, logPartialReferences: d, logReferences: f, outputTypes: p, referredLegifranceTextsInfos: m }) {
|
|
14293
|
+
let h = wv(t, e);
|
|
14260
14294
|
await h.preloadTextTitlesInfos();
|
|
14261
14295
|
let g = new n(a.output), _ = {}, v = {};
|
|
14262
14296
|
for (let e of p) v[e] = {
|
|
@@ -14278,7 +14312,7 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14278
14312
|
case "article_definition": {
|
|
14279
14313
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
14280
14314
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14281
|
-
for (let e of Object.values(v))
|
|
14315
|
+
for (let e of Object.values(v)) Ov({
|
|
14282
14316
|
inputHtml: o,
|
|
14283
14317
|
originalTransformation: n,
|
|
14284
14318
|
output: e,
|
|
@@ -14291,10 +14325,10 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14291
14325
|
let { article: t, articleId: n, historyArticleId: r, originalTransformation: i } = e;
|
|
14292
14326
|
if (i === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14293
14327
|
if (n !== void 0) {
|
|
14294
|
-
if (
|
|
14328
|
+
if (kv({
|
|
14295
14329
|
attributes: {
|
|
14296
14330
|
class: "lien_article_externe",
|
|
14297
|
-
href:
|
|
14331
|
+
href: Cv(l, s, n)
|
|
14298
14332
|
},
|
|
14299
14333
|
inputHtml: o,
|
|
14300
14334
|
originalTransformation: i,
|
|
@@ -14305,8 +14339,8 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14305
14339
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
14306
14340
|
}
|
|
14307
14341
|
} else if (r !== void 0) {
|
|
14308
|
-
let e =
|
|
14309
|
-
e !== void 0 &&
|
|
14342
|
+
let e = Sv(l, s, r);
|
|
14343
|
+
e !== void 0 && kv({
|
|
14310
14344
|
attributes: {
|
|
14311
14345
|
class: "lien_article_historique",
|
|
14312
14346
|
href: e,
|
|
@@ -14318,14 +14352,14 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14318
14352
|
replacementCounter: y
|
|
14319
14353
|
});
|
|
14320
14354
|
}
|
|
14321
|
-
|
|
14355
|
+
Av({
|
|
14322
14356
|
id: n,
|
|
14323
14357
|
outputByType: v
|
|
14324
|
-
}) &&
|
|
14358
|
+
}) && Mv({
|
|
14325
14359
|
attributes: {
|
|
14326
14360
|
class: "reference_article",
|
|
14327
14361
|
style: "background-color: #eae462",
|
|
14328
|
-
title:
|
|
14362
|
+
title: Tv(t, e.reference)
|
|
14329
14363
|
},
|
|
14330
14364
|
id: n,
|
|
14331
14365
|
inputHtml: o,
|
|
@@ -14338,10 +14372,10 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14338
14372
|
case "external_division": {
|
|
14339
14373
|
let { division: t, originalTransformation: n, sectionTaId: r } = e;
|
|
14340
14374
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14341
|
-
if (r !== void 0 && (
|
|
14375
|
+
if (r !== void 0 && (kv({
|
|
14342
14376
|
attributes: {
|
|
14343
14377
|
class: "lien_division_externe",
|
|
14344
|
-
href:
|
|
14378
|
+
href: Cv(l, s, r)
|
|
14345
14379
|
},
|
|
14346
14380
|
inputHtml: o,
|
|
14347
14381
|
originalTransformation: n,
|
|
@@ -14351,14 +14385,14 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14351
14385
|
let e = await h.getTextIdFromSegmentId(r);
|
|
14352
14386
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
14353
14387
|
}
|
|
14354
|
-
|
|
14388
|
+
Av({
|
|
14355
14389
|
id: r,
|
|
14356
14390
|
outputByType: v
|
|
14357
|
-
}) &&
|
|
14391
|
+
}) && Mv({
|
|
14358
14392
|
attributes: {
|
|
14359
14393
|
class: "reference_division",
|
|
14360
14394
|
style: "background-color: #eae462",
|
|
14361
|
-
title:
|
|
14395
|
+
title: Tv(t, e.reference)
|
|
14362
14396
|
},
|
|
14363
14397
|
id: r,
|
|
14364
14398
|
inputHtml: o,
|
|
@@ -14371,7 +14405,7 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14371
14405
|
case "european_text": {
|
|
14372
14406
|
let { url: t, originalTransformation: n, text: r, titleId: i } = e;
|
|
14373
14407
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14374
|
-
|
|
14408
|
+
kv({
|
|
14375
14409
|
attributes: {
|
|
14376
14410
|
class: "lien_texte_european",
|
|
14377
14411
|
href: t,
|
|
@@ -14381,14 +14415,14 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14381
14415
|
originalTransformation: n,
|
|
14382
14416
|
outputByType: v,
|
|
14383
14417
|
replacementCounter: y
|
|
14384
|
-
}),
|
|
14418
|
+
}), Av({
|
|
14385
14419
|
id: i,
|
|
14386
14420
|
outputByType: v
|
|
14387
|
-
}) &&
|
|
14421
|
+
}) && Mv({
|
|
14388
14422
|
attributes: {
|
|
14389
14423
|
class: "reference_texte",
|
|
14390
14424
|
style: "background-color: #eae462",
|
|
14391
|
-
title:
|
|
14425
|
+
title: Tv(r, e.reference)
|
|
14392
14426
|
},
|
|
14393
14427
|
id: i,
|
|
14394
14428
|
inputHtml: o,
|
|
@@ -14401,23 +14435,23 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14401
14435
|
case "external_text": {
|
|
14402
14436
|
let { originalTransformation: t, text: n } = e;
|
|
14403
14437
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14404
|
-
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (
|
|
14438
|
+
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (kv({
|
|
14405
14439
|
attributes: {
|
|
14406
14440
|
class: "lien_texte_externe",
|
|
14407
|
-
href:
|
|
14441
|
+
href: Cv(l, s, n.cid)
|
|
14408
14442
|
},
|
|
14409
14443
|
inputHtml: o,
|
|
14410
14444
|
originalTransformation: t,
|
|
14411
14445
|
outputByType: v,
|
|
14412
14446
|
replacementCounter: y
|
|
14413
|
-
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)),
|
|
14447
|
+
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)), Av({
|
|
14414
14448
|
id: n.cid,
|
|
14415
14449
|
outputByType: v
|
|
14416
|
-
}) &&
|
|
14450
|
+
}) && Mv({
|
|
14417
14451
|
attributes: {
|
|
14418
14452
|
class: "reference_texte",
|
|
14419
14453
|
style: "background-color: #eae462",
|
|
14420
|
-
title:
|
|
14454
|
+
title: Tv(n, e.reference)
|
|
14421
14455
|
},
|
|
14422
14456
|
id: n.cid,
|
|
14423
14457
|
inputHtml: o,
|
|
@@ -14430,7 +14464,7 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14430
14464
|
case "internal_article": {
|
|
14431
14465
|
let { definition: t, originalTransformation: n } = e;
|
|
14432
14466
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14433
|
-
for (let e of Object.values(v))
|
|
14467
|
+
for (let e of Object.values(v)) Ov({
|
|
14434
14468
|
inputHtml: o,
|
|
14435
14469
|
originalTransformation: n,
|
|
14436
14470
|
output: e,
|
|
@@ -14441,18 +14475,18 @@ async function Av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
14441
14475
|
}
|
|
14442
14476
|
default: c("Link", e);
|
|
14443
14477
|
}
|
|
14444
|
-
for (let e of Object.values(v)) e.html =
|
|
14478
|
+
for (let e of Object.values(v)) e.html = Dv(o, e.replacements);
|
|
14445
14479
|
return {
|
|
14446
14480
|
outputByType: v,
|
|
14447
14481
|
referredLegifranceTextCountByCid: _
|
|
14448
14482
|
};
|
|
14449
14483
|
}
|
|
14450
|
-
function
|
|
14484
|
+
function Mv({ attributes: e, id: t, inputHtml: n, originalTransformation: r, outputByType: i, replacementCounter: a }) {
|
|
14451
14485
|
let o = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
14452
14486
|
for (let e of ["links_or_references", "references"]) {
|
|
14453
14487
|
if (e === "links_or_references" && t !== void 0) continue;
|
|
14454
14488
|
let s = i[e];
|
|
14455
|
-
s !== void 0 &&
|
|
14489
|
+
s !== void 0 && Ov({
|
|
14456
14490
|
inputHtml: n,
|
|
14457
14491
|
originalTransformation: r,
|
|
14458
14492
|
output: s,
|
|
@@ -14462,4 +14496,4 @@ function jv({ attributes: e, id: t, inputHtml: n, originalTransformation: r, out
|
|
|
14462
14496
|
}
|
|
14463
14497
|
}
|
|
14464
14498
|
//#endregion
|
|
14465
|
-
export { bp as $, Vm as A, D as At, ym as B, dt as Bt, Ph as C, Dt as Ct, qm as D, mt as Dt, Ym as E, Ot as Et, Lm as F, ot as Ft, $ as G, vm as H, st as Ht, Rm as I, rt as It, Zp as J, Kp as K, Am as L, it as Lt, Wm as M, xt as Mt, Gm as N, tt as Nt, Km as O, ht as Ot, zm as P, nt as Pt, yp as Q, Om as R, at as Rt, Fh as S, Vt as St, Jm as T, zt as Tt, gm as U, lt as Ut, _m as V, ft as Vt, lm as W, ct as Wt, jp as X, Gp as Y, Rp as Z, A_ as _, Xt as _t,
|
|
14499
|
+
export { bp as $, Vm as A, D as At, ym as B, dt as Bt, Ph as C, Dt as Ct, qm as D, mt as Dt, Ym as E, Ot as Et, Lm as F, ot as Ft, $ as G, vm as H, st as Ht, Rm as I, rt as It, Zp as J, Kp as K, Am as L, it as Lt, Wm as M, xt as Mt, Gm as N, tt as Nt, Km as O, ht as Ot, zm as P, nt as Pt, yp as Q, Om as R, at as Rt, Fh as S, Vt as St, Jm as T, zt as Tt, gm as U, lt as Ut, _m as V, ft as Vt, lm as W, ct as Wt, jp as X, Gp as Y, Rp as Z, A_ as _, Xt as _t, Cv as a, xn as at, Xh as b, Yt as bt, _v as c, gn as ct, gv as d, tn as dt, Wp as et, W_ as f, rn as ft, L_ as g, Qt as gt, j_ as h, sn as ht, Sv as i, vn as it, Um as j, O as jt, Bm as k, _t as kt, bv as l, fn as lt, R_ as m, nn as mt, Ev as n, Tn as nt, vv as o, wn as ot, k_ as p, an as pt, qp as q, xv as r, _n as rt, yv as s, pn as st, jv as t, dp as tt, G_ as u, un as ut, eg as v, qt as vt, Qm as w, Rt as wt, Jh as x, Bt as xt, Yh as y, Jt as yt, Em as z, ut as zt };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, A as t, At as n, B as r, Bt as i, Ct as a, Dt as o, Et as s, F as c, Ft as l, G as u, H as d, Ht as f, I as p, It as m, J as ee, K as te, L as ne, Lt as re, M as ie, Mt as ae, N as oe, Nt as se, Ot as ce, P as le, Pt as ue, Q as de, R as fe, Rt as pe, St as me, Tt as he, U as ge, Ut as _e, V as ve, Vt as ye, W as be, Wt as xe, X as Se, Z as Ce, _ as we, _t as h, a as g, at as Te, bt as Ee, c as De, ct as Oe, d as ke, dt as Ae, et as je, f as Me, ft as Ne, g as Pe, gt as Fe, h as Ie, ht as Le, i as _, it as Re, j as ze, jt as Be, k as Ve, kt as He, l as Ue, lt as We, m as Ge, mt as Ke, n as qe, nt as Je, o as Ye, ot as Xe, p as Ze, pt as Qe, q as $e, r as et, rt as tt, s as nt, st as rt, t as it, u as v, ut as at, vt as ot, x as st, xt as ct, yt as lt, z as ut, zt as dt } from "./html-
|
|
1
|
+
import { $ as e, A as t, At as n, B as r, Bt as i, Ct as a, Dt as o, Et as s, F as c, Ft as l, G as u, H as d, Ht as f, I as p, It as m, J as ee, K as te, L as ne, Lt as re, M as ie, Mt as ae, N as oe, Nt as se, Ot as ce, P as le, Pt as ue, Q as de, R as fe, Rt as pe, St as me, Tt as he, U as ge, Ut as _e, V as ve, Vt as ye, W as be, Wt as xe, X as Se, Z as Ce, _ as we, _t as h, a as g, at as Te, bt as Ee, c as De, ct as Oe, d as ke, dt as Ae, et as je, f as Me, ft as Ne, g as Pe, gt as Fe, h as Ie, ht as Le, i as _, it as Re, j as ze, jt as Be, k as Ve, kt as He, l as Ue, lt as We, m as Ge, mt as Ke, n as qe, nt as Je, o as Ye, ot as Xe, p as Ze, pt as Qe, q as $e, r as et, rt as tt, s as nt, st as rt, t as it, u as v, ut as at, vt as ot, x as st, xt as ct, yt as lt, z as ut, zt as dt } from "./html-zrF2u7Vr.js";
|
|
2
2
|
import { $ as ft, A as pt, At as mt, B as ht, C as gt, Ct as y, D as b, E as _t, Et as x, F as S, Ft as C, G as vt, H as yt, I as w, J as bt, K as xt, M as St, Mt as Ct, N as wt, Nt as Tt, O as Et, P as Dt, Pt as Ot, Q as T, S as kt, St as At, T as jt, Tt as E, W as Mt, X as Nt, Y as Pt, Z as Ft, _ as D, a as It, b as Lt, bt as Rt, c as zt, ct as Bt, d as Vt, dt as Ht, f as Ut, ft as Wt, g as Gt, gt as O, h as Kt, i as qt, it as Jt, j as Yt, jt as k, k as Xt, kt as A, l as Zt, lt as Qt, m as $t, o as en, ot as tn, p as nn, q as rn, r as an, s as on, t as sn, tt as cn, u as ln, ut as un, v as j, vt as dn, w as fn, wt as M, x as pn, y as mn, yt as hn, z as gn } from "./resolver-D5TCkLkD.js";
|
|
3
3
|
//#region ../../node_modules/@tricoteuses/legifrance/dist/legal/index.js
|
|
4
4
|
function _n(e, t) {
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, C as t, D as n, E as r, F as i, G as a, J as o, Mt as s, O as c, S as l, T as u, Y as d, b as f, bt as p, f as m, h, jt as g, l as _, mt as ee, n as v, o as y, s as b, t as te, tt as x, v as ne, vt as S, w as re, wt as ie, xt as ae, y as oe, yt as se } from "./html-
|
|
1
|
+
import { $ as e, C as t, D as n, E as r, F as i, G as a, J as o, Mt as s, O as c, S as l, T as u, Y as d, b as f, bt as p, f as m, h, jt as g, l as _, mt as ee, n as v, o as y, s as b, t as te, tt as x, v as ne, vt as S, w as re, wt as ie, xt as ae, y as oe, yt as se } from "./html-zrF2u7Vr.js";
|
|
2
2
|
import { Ct as C, D as ce, E as le, N as ue, Q as de, Tt as w, gt as T, i as fe, j as pe, jt as E, kt as D, n as me, ot as he, pt as ge, r as _e, t as ve, wt as O } from "./resolver-D5TCkLkD.js";
|
|
3
3
|
import * as ye from "node:crypto";
|
|
4
4
|
import { createHash as k } from "node:crypto";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tricoteuses/tisseuse",
|
|
3
3
|
"description": "Find links in/to French legislative documents",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.11",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Assemblée nationale",
|
|
7
7
|
"France",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"audit:doctrinal-references": "tsx src/scripts/audit_doctrinal_references.ts",
|
|
62
62
|
"audit:doctrinal-references:check": "tsx src/scripts/audit_doctrinal_references.ts --output /tmp/tisseuse-doctrinal-references-audit.json --baseline audits/doctrinal-references-baseline.json --fail-on-regression",
|
|
63
63
|
"build": "vite build",
|
|
64
|
+
"check": "tsc --noEmit",
|
|
64
65
|
"configure": "tsx src/scripts/configure.ts",
|
|
65
66
|
"configure:postgres:assemblee-triggers": "tsx src/scripts/configure_postgres_assemblee_document_triggers.ts",
|
|
66
67
|
"configure:postgres:senat-triggers": "tsx src/scripts/configure_postgres_senat_document_triggers.ts",
|