@uniweb/semantic-parser 1.0.3 → 1.0.7
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
package/src/processors/byType.js
CHANGED
|
@@ -44,7 +44,8 @@ function processByType(sequence) {
|
|
|
44
44
|
break;
|
|
45
45
|
|
|
46
46
|
case "image": {
|
|
47
|
-
|
|
47
|
+
// Support both attrs.role and top-level role for backwards compatibility
|
|
48
|
+
const role = element.attrs?.role || element.role || "content";
|
|
48
49
|
if (!collections.images[role]) {
|
|
49
50
|
collections.images[role] = [];
|
|
50
51
|
}
|
package/src/processors/groups.js
CHANGED
|
@@ -320,9 +320,11 @@ function identifyMainContent(groups) {
|
|
|
320
320
|
|
|
321
321
|
function processInlineElements(children, body) {
|
|
322
322
|
children.forEach((item) => {
|
|
323
|
-
//Handle icons only for now
|
|
324
323
|
if (item.type === "icon") {
|
|
325
324
|
body.icons.push(item.attrs);
|
|
325
|
+
} else if (item.type === "link") {
|
|
326
|
+
// Handle inline links extracted from paragraph text nodes
|
|
327
|
+
body.links.push(item.attrs);
|
|
326
328
|
}
|
|
327
329
|
});
|
|
328
330
|
}
|
|
@@ -102,10 +102,10 @@ function createSequenceElement(node, options = {}) {
|
|
|
102
102
|
attrs: parseImgBlock(attrs),
|
|
103
103
|
};
|
|
104
104
|
case "image":
|
|
105
|
-
// Standard ProseMirror image node -
|
|
105
|
+
// Standard ProseMirror image node - wrap attrs like ImageBlock
|
|
106
106
|
return {
|
|
107
107
|
type: "image",
|
|
108
|
-
|
|
108
|
+
attrs: attrs || {},
|
|
109
109
|
};
|
|
110
110
|
case "Video":
|
|
111
111
|
return {
|
|
@@ -302,6 +302,18 @@ function processInlineElements(content) {
|
|
|
302
302
|
});
|
|
303
303
|
} else if (item.type === "math-inline") {
|
|
304
304
|
items.push(item);
|
|
305
|
+
} else if (item.type === "text" && item.marks) {
|
|
306
|
+
// Extract links from text nodes with link marks
|
|
307
|
+
const linkMark = item.marks.find((m) => m.type === "link");
|
|
308
|
+
if (linkMark) {
|
|
309
|
+
items.push({
|
|
310
|
+
type: "link",
|
|
311
|
+
attrs: {
|
|
312
|
+
href: linkMark.attrs?.href,
|
|
313
|
+
label: item.text || "",
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
}
|
|
305
317
|
}
|
|
306
318
|
}
|
|
307
319
|
|