@uniweb/semantic-parser 1.13.0 → 1.13.2
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 +1 -1
- package/src/lint.js +12 -0
- package/src/processors/groups.js +5 -3
package/package.json
CHANGED
package/src/lint.js
CHANGED
|
@@ -55,6 +55,18 @@ export function lintContent(doc, options = {}) {
|
|
|
55
55
|
if (first.length === 1 && first[0].type === "paragraph" && laterTitled) {
|
|
56
56
|
const text = stripTags(first[0].text).trim();
|
|
57
57
|
const words = text.split(/\s+/).filter(Boolean);
|
|
58
|
+
// An icon reads as decoration rather than body, so nobody expects it to demote
|
|
59
|
+
// the title. Several such groups are a deliberate list of cards, and left alone.
|
|
60
|
+
if (!text && first[0].text?.includes("<uniweb-icon") && stacks.length === 2) {
|
|
61
|
+
findings.push({
|
|
62
|
+
rule: "icon-above-title",
|
|
63
|
+
severity: "warning",
|
|
64
|
+
message:
|
|
65
|
+
`An icon above the first heading makes the section an untitled body, with the ` +
|
|
66
|
+
`heading as its only item. If the icon belongs to the title, write it under ` +
|
|
67
|
+
`the heading: it's still content.icons[0].`,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
58
70
|
if (words.length > 0 && words.length <= 6 && !/[.!?]$/.test(text)) {
|
|
59
71
|
findings.push({
|
|
60
72
|
rule: "label-as-text",
|
package/src/processors/groups.js
CHANGED
|
@@ -588,10 +588,12 @@ function processInlineElements(children, body) {
|
|
|
588
588
|
} else if (item.type === "document") {
|
|
589
589
|
// And an inline `{role=pdf}` in documents[].
|
|
590
590
|
body.documents.push(item.attrs);
|
|
591
|
-
} else if (item.type === "link") {
|
|
592
|
-
// Handle inline links extracted from paragraph text nodes
|
|
593
|
-
body.links.push(item.attrs);
|
|
594
591
|
}
|
|
592
|
+
// A link inside a sentence stays in the sentence: `links` holds the links that stand on
|
|
593
|
+
// their own line, which reach it as `link` elements. ⛔ From 2026-01-17 until 2026-10-31
|
|
594
|
+
// this also copied every link out of every paragraph, a fix for two links on consecutive
|
|
595
|
+
// lines that never checked the paragraph held only links. So a section drawing `links`
|
|
596
|
+
// drew a sentence's link a second time, and `links[0]` could be one from the prose.
|
|
595
597
|
});
|
|
596
598
|
}
|
|
597
599
|
|