@holmdigital/engine 3.1.2 → 3.1.3
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/{chunk-IMRWWO5R.mjs → chunk-2PCUWYZI.mjs} +15 -0
- package/dist/{chunk-3TV4JXOD.mjs → chunk-BRZQK4KN.mjs} +15 -7
- package/dist/cli/index.js +57 -9
- package/dist/cli/index.mjs +20 -5
- package/dist/index.js +15 -7
- package/dist/index.mjs +1 -1
- package/dist/{plain-report-XZZM5ZHK.mjs → plain-report-QLJTGX5L.mjs} +5 -1
- package/package.json +1 -1
|
@@ -20,6 +20,20 @@ function impactBreakdown(reports, levelOf, order) {
|
|
|
20
20
|
return [...counts.entries()].map(([level, count]) => ({ level, count })).sort((a, b) => (order[a.level] ?? 4) - (order[b.level] ?? 4));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// src/reporting/legal-line.ts
|
|
24
|
+
function klarsprakLegalLine(dosLagenReference) {
|
|
25
|
+
const ref = (dosLagenReference ?? "").trim();
|
|
26
|
+
const isRealDosLagen = ref.includes("2018:1937");
|
|
27
|
+
const isNotYetLaw = ref.includes("\xE4nnu inte lagkrav");
|
|
28
|
+
if (ref === "" || !isRealDosLagen && !isNotYetLaw) {
|
|
29
|
+
return "Lagrum ok\xE4nt. Fyndet kunde inte kopplas till ett specifikt lagrum.";
|
|
30
|
+
}
|
|
31
|
+
if (isNotYetLaw) {
|
|
32
|
+
return "\xC4nnu inte lagkrav under DOS-lagen (WCAG 2.2-kriterium). Blir bindande n\xE4r EN 301 549 V4.x refereras i EU:s officiella tidning.";
|
|
33
|
+
}
|
|
34
|
+
return "Lagkrav: DOS-lagen (2018:1937), 10 \xA7.";
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
// src/reporting/plain-language-support.ts
|
|
24
38
|
import { getAllConvergenceRules } from "@holmdigital/standards";
|
|
25
39
|
var PLAIN_LANGUAGE_CORE_RULES = [
|
|
@@ -61,6 +75,7 @@ function languageDisplayName(code) {
|
|
|
61
75
|
export {
|
|
62
76
|
groupReportsByRule,
|
|
63
77
|
impactBreakdown,
|
|
78
|
+
klarsprakLegalLine,
|
|
64
79
|
isPlainLanguageSupported,
|
|
65
80
|
languageDisplayName
|
|
66
81
|
};
|
|
@@ -239,7 +239,7 @@ function selectMappedRuleId(ruleId, tags, rules) {
|
|
|
239
239
|
return matched[0].ruleId;
|
|
240
240
|
}
|
|
241
241
|
function getEngineVersion() {
|
|
242
|
-
return "3.1.
|
|
242
|
+
return "3.1.3";
|
|
243
243
|
}
|
|
244
244
|
function getStandardsVersion() {
|
|
245
245
|
try {
|
|
@@ -461,20 +461,28 @@ var RegulatoryScanner = class {
|
|
|
461
461
|
minor: "low"
|
|
462
462
|
};
|
|
463
463
|
const KLARSPRAK_TOP_N = 8;
|
|
464
|
-
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
464
|
+
const { generateRegulatoryReport, getAllConvergenceRules } = await import("@holmdigital/standards");
|
|
465
465
|
const { getCurrentLang } = await import("./i18n-7RPBNX7F.mjs");
|
|
466
466
|
const lang = getCurrentLang();
|
|
467
|
+
const allRules = getAllConvergenceRules(lang);
|
|
467
468
|
return axeResults.violations.map((violation, index) => {
|
|
468
469
|
const impact = violation.impact || "moderate";
|
|
469
470
|
const risk = impactToRisk[impact] || "medium";
|
|
470
|
-
|
|
471
|
+
let report = generateRegulatoryReport(violation.id, lang);
|
|
472
|
+
if (!report) {
|
|
473
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
474
|
+
if (ruleId) report = generateRegulatoryReport(ruleId, lang);
|
|
475
|
+
}
|
|
476
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? report?.plainLanguage : void 0;
|
|
471
477
|
return {
|
|
472
478
|
ruleId: violation.id,
|
|
473
|
-
// Intern #30:
|
|
479
|
+
// Intern #30: rätt kriterium ur rapporten, annars ur wcagNNN-taggarna —
|
|
474
480
|
// aldrig en nivåbeteckning som "wcag2a".
|
|
475
|
-
wcagCriteria: criteriaFromTags(violation.tags)[0] || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
476
|
-
|
|
477
|
-
|
|
481
|
+
wcagCriteria: report?.wcagCriteria || criteriaFromTags(violation.tags)[0] || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
482
|
+
// Intern #29: fyll från rapporten. Omappat fynd → okänt lagrum, aldrig
|
|
483
|
+
// tom sträng och aldrig en fras som utger sig för att vara ett lagrum.
|
|
484
|
+
en301549Criteria: report?.en301549Criteria || "Unknown",
|
|
485
|
+
dosLagenReference: report?.dosLagenReference || (lang === "sv" ? "Lagrum ok\xE4nt" : "Legal basis unknown"),
|
|
478
486
|
diggRisk: risk,
|
|
479
487
|
eaaImpact: risk,
|
|
480
488
|
plainLanguage,
|
package/dist/cli/index.js
CHANGED
|
@@ -937,6 +937,26 @@ var init_needs_review = __esm({
|
|
|
937
937
|
}
|
|
938
938
|
});
|
|
939
939
|
|
|
940
|
+
// src/reporting/legal-line.ts
|
|
941
|
+
function klarsprakLegalLine(dosLagenReference) {
|
|
942
|
+
const ref = (dosLagenReference ?? "").trim();
|
|
943
|
+
const isRealDosLagen = ref.includes("2018:1937");
|
|
944
|
+
const isNotYetLaw = ref.includes("\xE4nnu inte lagkrav");
|
|
945
|
+
if (ref === "" || !isRealDosLagen && !isNotYetLaw) {
|
|
946
|
+
return "Lagrum ok\xE4nt. Fyndet kunde inte kopplas till ett specifikt lagrum.";
|
|
947
|
+
}
|
|
948
|
+
if (isNotYetLaw) {
|
|
949
|
+
return "\xC4nnu inte lagkrav under DOS-lagen (WCAG 2.2-kriterium). Blir bindande n\xE4r EN 301 549 V4.x refereras i EU:s officiella tidning.";
|
|
950
|
+
}
|
|
951
|
+
return "Lagkrav: DOS-lagen (2018:1937), 10 \xA7.";
|
|
952
|
+
}
|
|
953
|
+
var init_legal_line = __esm({
|
|
954
|
+
"src/reporting/legal-line.ts"() {
|
|
955
|
+
"use strict";
|
|
956
|
+
init_cjs_shims();
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
|
|
940
960
|
// src/reporting/plain-language-support.ts
|
|
941
961
|
function isEnglish(lang) {
|
|
942
962
|
return /^en(-|$)/i.test(lang.trim());
|
|
@@ -1039,6 +1059,9 @@ function renderPlainReport(result, lang = "en", plainFallbackFrom) {
|
|
|
1039
1059
|
} else {
|
|
1040
1060
|
console.log(` ${t("plain.fallback_framing")} ${report.remediation.description}`);
|
|
1041
1061
|
}
|
|
1062
|
+
if (isSwedish) {
|
|
1063
|
+
console.log(` ${klarsprakLegalLine(report.dosLagenReference)}`);
|
|
1064
|
+
}
|
|
1042
1065
|
console.log("");
|
|
1043
1066
|
});
|
|
1044
1067
|
if (needsReview.length > 0) {
|
|
@@ -1064,6 +1087,7 @@ var init_plain_report = __esm({
|
|
|
1064
1087
|
init_i18n();
|
|
1065
1088
|
init_plain_group();
|
|
1066
1089
|
init_needs_review();
|
|
1090
|
+
init_legal_line();
|
|
1067
1091
|
init_plain_language_support();
|
|
1068
1092
|
IMPACT_ORDER = {
|
|
1069
1093
|
"stoppar-kop": 0,
|
|
@@ -1464,7 +1488,7 @@ function selectMappedRuleId(ruleId, tags, rules) {
|
|
|
1464
1488
|
return matched[0].ruleId;
|
|
1465
1489
|
}
|
|
1466
1490
|
function getEngineVersion() {
|
|
1467
|
-
return "3.1.
|
|
1491
|
+
return "3.1.3";
|
|
1468
1492
|
}
|
|
1469
1493
|
function getStandardsVersion() {
|
|
1470
1494
|
try {
|
|
@@ -1686,20 +1710,28 @@ var RegulatoryScanner = class {
|
|
|
1686
1710
|
minor: "low"
|
|
1687
1711
|
};
|
|
1688
1712
|
const KLARSPRAK_TOP_N = 8;
|
|
1689
|
-
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
1713
|
+
const { generateRegulatoryReport, getAllConvergenceRules: getAllConvergenceRules2 } = await import("@holmdigital/standards");
|
|
1690
1714
|
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1691
1715
|
const lang = getCurrentLang2();
|
|
1716
|
+
const allRules = getAllConvergenceRules2(lang);
|
|
1692
1717
|
return axeResults.violations.map((violation, index) => {
|
|
1693
1718
|
const impact = violation.impact || "moderate";
|
|
1694
1719
|
const risk = impactToRisk[impact] || "medium";
|
|
1695
|
-
|
|
1720
|
+
let report = generateRegulatoryReport(violation.id, lang);
|
|
1721
|
+
if (!report) {
|
|
1722
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
1723
|
+
if (ruleId) report = generateRegulatoryReport(ruleId, lang);
|
|
1724
|
+
}
|
|
1725
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? report?.plainLanguage : void 0;
|
|
1696
1726
|
return {
|
|
1697
1727
|
ruleId: violation.id,
|
|
1698
|
-
// Intern #30:
|
|
1728
|
+
// Intern #30: rätt kriterium ur rapporten, annars ur wcagNNN-taggarna —
|
|
1699
1729
|
// aldrig en nivåbeteckning som "wcag2a".
|
|
1700
|
-
wcagCriteria: criteriaFromTags(violation.tags)[0] || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
1701
|
-
|
|
1702
|
-
|
|
1730
|
+
wcagCriteria: report?.wcagCriteria || criteriaFromTags(violation.tags)[0] || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
1731
|
+
// Intern #29: fyll från rapporten. Omappat fynd → okänt lagrum, aldrig
|
|
1732
|
+
// tom sträng och aldrig en fras som utger sig för att vara ett lagrum.
|
|
1733
|
+
en301549Criteria: report?.en301549Criteria || "Unknown",
|
|
1734
|
+
dosLagenReference: report?.dosLagenReference || (lang === "sv" ? "Lagrum ok\xE4nt" : "Legal basis unknown"),
|
|
1703
1735
|
diggRisk: risk,
|
|
1704
1736
|
eaaImpact: risk,
|
|
1705
1737
|
plainLanguage,
|
|
@@ -2061,6 +2093,7 @@ function isBadgeWithheldByRobustness(noScript) {
|
|
|
2061
2093
|
init_i18n();
|
|
2062
2094
|
init_plain_group();
|
|
2063
2095
|
init_needs_review();
|
|
2096
|
+
init_legal_line();
|
|
2064
2097
|
init_plain_language_support();
|
|
2065
2098
|
var LOCALE_TO_INTL = {
|
|
2066
2099
|
sv: "sv-SE",
|
|
@@ -2506,6 +2539,8 @@ ${sortedGroups.map((group) => {
|
|
|
2506
2539
|
const pl = report.plainLanguage;
|
|
2507
2540
|
const occurrences = group.count > 1 ? `, ${escapeHtml(t("plain.occurrences", { count: group.count }))}` : "";
|
|
2508
2541
|
const headingHtml = pl?.headline ? `${escapeHtml(pl.headline)} <span class="issue-rule-ref">(${escapeHtml(report.ruleId)})</span>` : escapeHtml(report.ruleId);
|
|
2542
|
+
const legalHtml = isSwedish ? `
|
|
2543
|
+
<p class="issue-legal">${escapeHtml(klarsprakLegalLine(report.dosLagenReference))}</p>` : "";
|
|
2509
2544
|
if (pl) {
|
|
2510
2545
|
return ` <li class="issue-item ${cardClass}">
|
|
2511
2546
|
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
@@ -2515,14 +2550,14 @@ ${sortedGroups.map((group) => {
|
|
|
2515
2550
|
<dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
|
|
2516
2551
|
<dt>${t("plain.business_impact")}</dt><dd>${escapeHtml(pl.businessImpact)}</dd>
|
|
2517
2552
|
<dt>${t("plain.how_to_fix")}</dt><dd>${escapeHtml(pl.howToFix)}</dd>
|
|
2518
|
-
</dl
|
|
2553
|
+
</dl>${legalHtml}
|
|
2519
2554
|
</li>`;
|
|
2520
2555
|
} else {
|
|
2521
2556
|
const rawDetail = isSwedish ? "" : ` ${escapeHtml(report.remediation.description)}`;
|
|
2522
2557
|
return ` <li class="issue-item ${cardClass}">
|
|
2523
2558
|
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
2524
2559
|
<strong class="issue-id">${headingHtml}${occurrences}</strong>
|
|
2525
|
-
<p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p
|
|
2560
|
+
<p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p>${legalHtml}
|
|
2526
2561
|
</li>`;
|
|
2527
2562
|
}
|
|
2528
2563
|
}).join("\n")}
|
|
@@ -2747,6 +2782,13 @@ ${needsReview.map((report) => {
|
|
|
2747
2782
|
font-weight: 600;
|
|
2748
2783
|
color: #0f172a;
|
|
2749
2784
|
}
|
|
2785
|
+
/* ---- Legal basis per finding (Intern #29) ---- */
|
|
2786
|
+
.issue-legal {
|
|
2787
|
+
font-size: 0.85rem;
|
|
2788
|
+
color: #475569;
|
|
2789
|
+
margin: 0.4rem 0 0;
|
|
2790
|
+
font-weight: 600;
|
|
2791
|
+
}
|
|
2750
2792
|
|
|
2751
2793
|
/* ---- Closing line ---- */
|
|
2752
2794
|
.closing {
|
|
@@ -3255,6 +3297,7 @@ function parseHydrationWait(raw) {
|
|
|
3255
3297
|
init_i18n();
|
|
3256
3298
|
init_plain_language_support();
|
|
3257
3299
|
init_needs_review();
|
|
3300
|
+
init_legal_line();
|
|
3258
3301
|
|
|
3259
3302
|
// src/cli/cloud-client.ts
|
|
3260
3303
|
init_cjs_shims();
|
|
@@ -3504,6 +3547,11 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
3504
3547
|
id: r.ruleId,
|
|
3505
3548
|
impact: r.holmdigitalInsight.diggRisk,
|
|
3506
3549
|
description: r.remediation.description,
|
|
3550
|
+
// Lagrummet exponeras i den publika widgeten (Intern #29) —
|
|
3551
|
+
// ett fält, inte hela regelobjektet. Samma korta 3-fals-
|
|
3552
|
+
// klarspråk som --plain, annars felmärks WCAG 2.2-fynden som
|
|
3553
|
+
// lagkrav i widgeten (Karins beslut 2026-08-25).
|
|
3554
|
+
legalBasis: klarsprakLegalLine(r.dosLagenReference),
|
|
3507
3555
|
// Plain-language (klarspråk) fields, present when the rule
|
|
3508
3556
|
// is covered; undefined values drop out of the JSON.
|
|
3509
3557
|
headline: r.plainLanguage?.headline,
|
package/dist/cli/index.mjs
CHANGED
|
@@ -8,13 +8,14 @@ import {
|
|
|
8
8
|
generateStatementContent,
|
|
9
9
|
getEngineVersion,
|
|
10
10
|
isBadgeWithheldByRobustness
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-BRZQK4KN.mjs";
|
|
12
12
|
import {
|
|
13
13
|
groupReportsByRule,
|
|
14
14
|
impactBreakdown,
|
|
15
15
|
isPlainLanguageSupported,
|
|
16
|
+
klarsprakLegalLine,
|
|
16
17
|
languageDisplayName
|
|
17
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-2PCUWYZI.mjs";
|
|
18
19
|
import {
|
|
19
20
|
getCurrentLang,
|
|
20
21
|
setLanguage,
|
|
@@ -480,6 +481,8 @@ ${sortedGroups.map((group) => {
|
|
|
480
481
|
const pl = report.plainLanguage;
|
|
481
482
|
const occurrences = group.count > 1 ? `, ${escapeHtml(t("plain.occurrences", { count: group.count }))}` : "";
|
|
482
483
|
const headingHtml = pl?.headline ? `${escapeHtml(pl.headline)} <span class="issue-rule-ref">(${escapeHtml(report.ruleId)})</span>` : escapeHtml(report.ruleId);
|
|
484
|
+
const legalHtml = isSwedish ? `
|
|
485
|
+
<p class="issue-legal">${escapeHtml(klarsprakLegalLine(report.dosLagenReference))}</p>` : "";
|
|
483
486
|
if (pl) {
|
|
484
487
|
return ` <li class="issue-item ${cardClass}">
|
|
485
488
|
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
@@ -489,14 +492,14 @@ ${sortedGroups.map((group) => {
|
|
|
489
492
|
<dt>${t("plain.who_is_affected")}</dt><dd>${escapeHtml(pl.whoIsAffected)}</dd>
|
|
490
493
|
<dt>${t("plain.business_impact")}</dt><dd>${escapeHtml(pl.businessImpact)}</dd>
|
|
491
494
|
<dt>${t("plain.how_to_fix")}</dt><dd>${escapeHtml(pl.howToFix)}</dd>
|
|
492
|
-
</dl
|
|
495
|
+
</dl>${legalHtml}
|
|
493
496
|
</li>`;
|
|
494
497
|
} else {
|
|
495
498
|
const rawDetail = isSwedish ? "" : ` ${escapeHtml(report.remediation.description)}`;
|
|
496
499
|
return ` <li class="issue-item ${cardClass}">
|
|
497
500
|
<span class="badge ${badgeClass}">${badgeText}</span>
|
|
498
501
|
<strong class="issue-id">${headingHtml}${occurrences}</strong>
|
|
499
|
-
<p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p
|
|
502
|
+
<p class="issue-fallback"><span class="fallback-framing">${escapeHtml(t("plain.fallback_framing"))}</span>${rawDetail}</p>${legalHtml}
|
|
500
503
|
</li>`;
|
|
501
504
|
}
|
|
502
505
|
}).join("\n")}
|
|
@@ -721,6 +724,13 @@ ${needsReview.map((report) => {
|
|
|
721
724
|
font-weight: 600;
|
|
722
725
|
color: #0f172a;
|
|
723
726
|
}
|
|
727
|
+
/* ---- Legal basis per finding (Intern #29) ---- */
|
|
728
|
+
.issue-legal {
|
|
729
|
+
font-size: 0.85rem;
|
|
730
|
+
color: #475569;
|
|
731
|
+
margin: 0.4rem 0 0;
|
|
732
|
+
font-weight: 600;
|
|
733
|
+
}
|
|
724
734
|
|
|
725
735
|
/* ---- Closing line ---- */
|
|
726
736
|
.closing {
|
|
@@ -1106,6 +1116,11 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
1106
1116
|
id: r.ruleId,
|
|
1107
1117
|
impact: r.holmdigitalInsight.diggRisk,
|
|
1108
1118
|
description: r.remediation.description,
|
|
1119
|
+
// Lagrummet exponeras i den publika widgeten (Intern #29) —
|
|
1120
|
+
// ett fält, inte hela regelobjektet. Samma korta 3-fals-
|
|
1121
|
+
// klarspråk som --plain, annars felmärks WCAG 2.2-fynden som
|
|
1122
|
+
// lagkrav i widgeten (Karins beslut 2026-08-25).
|
|
1123
|
+
legalBasis: klarsprakLegalLine(r.dosLagenReference),
|
|
1109
1124
|
// Plain-language (klarspråk) fields, present when the rule
|
|
1110
1125
|
// is covered; undefined values drop out of the JSON.
|
|
1111
1126
|
headline: r.plainLanguage?.headline,
|
|
@@ -1137,7 +1152,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
|
|
|
1137
1152
|
console.log(chalk.gray(`
|
|
1138
1153
|
Scan: ${result.metadata.scanDuration}ms | ${result.metadata.engineVersion}`));
|
|
1139
1154
|
} else if (options.audience === "plain") {
|
|
1140
|
-
const { renderPlainReport } = await import("../plain-report-
|
|
1155
|
+
const { renderPlainReport } = await import("../plain-report-QLJTGX5L.mjs");
|
|
1141
1156
|
renderPlainReport(result, plainFallbackFrom ? "en" : options.lang, plainFallbackFrom);
|
|
1142
1157
|
} else {
|
|
1143
1158
|
const violations = violationsOf(result.reports);
|
package/dist/index.js
CHANGED
|
@@ -1158,7 +1158,7 @@ function selectMappedRuleId(ruleId, tags, rules) {
|
|
|
1158
1158
|
return matched[0].ruleId;
|
|
1159
1159
|
}
|
|
1160
1160
|
function getEngineVersion() {
|
|
1161
|
-
return "3.1.
|
|
1161
|
+
return "3.1.3";
|
|
1162
1162
|
}
|
|
1163
1163
|
function getStandardsVersion() {
|
|
1164
1164
|
try {
|
|
@@ -1380,20 +1380,28 @@ var RegulatoryScanner = class {
|
|
|
1380
1380
|
minor: "low"
|
|
1381
1381
|
};
|
|
1382
1382
|
const KLARSPRAK_TOP_N = 8;
|
|
1383
|
-
const { generateRegulatoryReport } = await import("@holmdigital/standards");
|
|
1383
|
+
const { generateRegulatoryReport, getAllConvergenceRules } = await import("@holmdigital/standards");
|
|
1384
1384
|
const { getCurrentLang: getCurrentLang2 } = await Promise.resolve().then(() => (init_i18n(), i18n_exports));
|
|
1385
1385
|
const lang = getCurrentLang2();
|
|
1386
|
+
const allRules = getAllConvergenceRules(lang);
|
|
1386
1387
|
return axeResults.violations.map((violation, index) => {
|
|
1387
1388
|
const impact = violation.impact || "moderate";
|
|
1388
1389
|
const risk = impactToRisk[impact] || "medium";
|
|
1389
|
-
|
|
1390
|
+
let report = generateRegulatoryReport(violation.id, lang);
|
|
1391
|
+
if (!report) {
|
|
1392
|
+
const ruleId = selectMappedRuleId(violation.id, violation.tags, allRules);
|
|
1393
|
+
if (ruleId) report = generateRegulatoryReport(ruleId, lang);
|
|
1394
|
+
}
|
|
1395
|
+
const plainLanguage = index < KLARSPRAK_TOP_N ? report?.plainLanguage : void 0;
|
|
1390
1396
|
return {
|
|
1391
1397
|
ruleId: violation.id,
|
|
1392
|
-
// Intern #30:
|
|
1398
|
+
// Intern #30: rätt kriterium ur rapporten, annars ur wcagNNN-taggarna —
|
|
1393
1399
|
// aldrig en nivåbeteckning som "wcag2a".
|
|
1394
|
-
wcagCriteria: criteriaFromTags(violation.tags)[0] || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
1395
|
-
|
|
1396
|
-
|
|
1400
|
+
wcagCriteria: report?.wcagCriteria || criteriaFromTags(violation.tags)[0] || (violation.tags.includes("best-practice") ? "Best Practice" : "Unknown"),
|
|
1401
|
+
// Intern #29: fyll från rapporten. Omappat fynd → okänt lagrum, aldrig
|
|
1402
|
+
// tom sträng och aldrig en fras som utger sig för att vara ett lagrum.
|
|
1403
|
+
en301549Criteria: report?.en301549Criteria || "Unknown",
|
|
1404
|
+
dosLagenReference: report?.dosLagenReference || (lang === "sv" ? "Lagrum ok\xE4nt" : "Legal basis unknown"),
|
|
1397
1405
|
diggRisk: risk,
|
|
1398
1406
|
eaaImpact: risk,
|
|
1399
1407
|
plainLanguage,
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
groupReportsByRule,
|
|
3
3
|
impactBreakdown,
|
|
4
|
+
klarsprakLegalLine,
|
|
4
5
|
languageDisplayName
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2PCUWYZI.mjs";
|
|
6
7
|
import {
|
|
7
8
|
getCurrentLang,
|
|
8
9
|
setLanguage,
|
|
@@ -92,6 +93,9 @@ function renderPlainReport(result, lang = "en", plainFallbackFrom) {
|
|
|
92
93
|
} else {
|
|
93
94
|
console.log(` ${t("plain.fallback_framing")} ${report.remediation.description}`);
|
|
94
95
|
}
|
|
96
|
+
if (isSwedish) {
|
|
97
|
+
console.log(` ${klarsprakLegalLine(report.dosLagenReference)}`);
|
|
98
|
+
}
|
|
95
99
|
console.log("");
|
|
96
100
|
});
|
|
97
101
|
if (needsReview.length > 0) {
|