@uniweb/semantic-parser 1.1.8 → 1.1.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/package.json +1 -1
- package/src/processors/groups.js +4 -11
- package/src/processors/sequence.js +11 -2
package/package.json
CHANGED
package/src/processors/groups.js
CHANGED
|
@@ -364,17 +364,10 @@ function processGroupContent(elements) {
|
|
|
364
364
|
break;
|
|
365
365
|
|
|
366
366
|
case "codeBlock":
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
} else {
|
|
372
|
-
// Untagged code block — collect as a snippet
|
|
373
|
-
body.snippets.push({
|
|
374
|
-
language: element.attrs?.language || '',
|
|
375
|
-
code: typeof element.text === 'string' ? element.text : '',
|
|
376
|
-
});
|
|
377
|
-
}
|
|
367
|
+
body.snippets.push({
|
|
368
|
+
language: element.attrs?.language || '',
|
|
369
|
+
code: typeof element.text === 'string' ? element.text : '',
|
|
370
|
+
});
|
|
378
371
|
break;
|
|
379
372
|
|
|
380
373
|
case "inset":
|
|
@@ -145,13 +145,22 @@ function createSequenceElement(node, options = {}) {
|
|
|
145
145
|
tag: attrs.tag,
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
case "codeBlock":
|
|
148
|
+
case "codeBlock": {
|
|
149
149
|
const codeText = getTextContent(content, options);
|
|
150
|
+
// Tagged code blocks are semantically data blocks, not code
|
|
151
|
+
if (attrs?.tag) {
|
|
152
|
+
return {
|
|
153
|
+
type: "dataBlock",
|
|
154
|
+
tag: attrs.tag,
|
|
155
|
+
data: getCodeBlockData(codeText, attrs),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
150
158
|
return {
|
|
151
159
|
type: "codeBlock",
|
|
152
|
-
text:
|
|
160
|
+
text: codeText,
|
|
153
161
|
attrs,
|
|
154
162
|
};
|
|
163
|
+
}
|
|
155
164
|
|
|
156
165
|
case "inset_placeholder":
|
|
157
166
|
return {
|