@inshapardaz/likhari-converters 0.1.18-dev.148 → 0.1.18-dev.152
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/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/html/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAiCjD,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIlD;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvD;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/html/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAiCjD,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIlD;AAED,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvD;AAiVD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,qBAAqB,CAMvF"}
|
package/dist/html/parse.js
CHANGED
|
@@ -259,13 +259,17 @@ function convertPoetry(el) {
|
|
|
259
259
|
const rawAlign = el.getAttribute('data-likhari-poetry-align') ?? 'justify';
|
|
260
260
|
const align = POETRY_ALIGNS.has(rawAlign) ? rawAlign : 'justify';
|
|
261
261
|
if (layout === 'two-column') {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
// One LayoutContainerNode row per couplet — grab all of them, not just
|
|
263
|
+
// the first, or every couplet past the first silently disappears.
|
|
264
|
+
const containerEls = Array.from(el.children).filter((c) => c.hasAttribute('data-likhari-layout-container'));
|
|
265
|
+
const containers = containerEls.length > 0
|
|
266
|
+
? containerEls.map((c) => convertLayout(c))
|
|
267
|
+
: [
|
|
268
|
+
elementBase('layout-container', [elementBase('layout-item', [paragraph()]), elementBase('layout-item', [paragraph()])], {
|
|
269
|
+
templateColumns: 'repeat(2, 1fr)',
|
|
270
|
+
}),
|
|
271
|
+
];
|
|
272
|
+
return elementBase('poetry-couplet', containers, { layout, align });
|
|
269
273
|
}
|
|
270
274
|
const children = flowBlocks(el);
|
|
271
275
|
return elementBase('poetry-couplet', children.length > 0 ? children : [paragraph(), paragraph()], { layout, align });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plain-text/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plain-text/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA4FhD,eAAO,MAAM,kBAAkB,EAAE,eAsDhC,CAAC"}
|
package/dist/plain-text/index.js
CHANGED
|
@@ -28,13 +28,16 @@ function nodeToText(node, order, listItemIndex = 0) {
|
|
|
28
28
|
return `[${order.get(id) ?? '?'}]`;
|
|
29
29
|
}
|
|
30
30
|
// Linearized per the fidelity matrix ("Poetry layout variants ⚠️ linearized"):
|
|
31
|
-
//
|
|
32
|
-
// the
|
|
33
|
-
//
|
|
31
|
+
// one misra per line, regardless of single/two-column layout and however
|
|
32
|
+
// many couplets the block holds — in two-column layout each couplet is
|
|
33
|
+
// its own layout-container row, so each contributes its two item lines
|
|
34
|
+
// in turn rather than only the block's first couplet being read.
|
|
34
35
|
if (node.type === 'poetry-couplet') {
|
|
35
36
|
const children = withChildren.children ?? [];
|
|
36
|
-
const
|
|
37
|
-
|
|
37
|
+
const lines = children.flatMap((child) => child.type === 'layout-container'
|
|
38
|
+
? (child.children ?? []).map((item) => nodeToText(item, order))
|
|
39
|
+
: [nodeToText(child, order)]);
|
|
40
|
+
return lines.join('\n');
|
|
38
41
|
}
|
|
39
42
|
if (node.type === 'list' && withChildren.children) {
|
|
40
43
|
const listType = node.listType ?? 'bullet';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inshapardaz/likhari-converters",
|
|
3
|
-
"version": "0.1.18-dev.
|
|
3
|
+
"version": "0.1.18-dev.152",
|
|
4
4
|
"description": "Format transformers (Markdown/HTML/plain-text/Lexical JSON) against the canonical Lexical EditorState, isolated from UI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|