@haklex/rich-litexml 0.10.0 → 0.12.0
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/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as createDefaultRegistry, t as deserializeFromXml } from "./deserializer-
|
|
2
|
+
import { i as createDefaultRegistry, t as deserializeFromXml } from "./deserializer-DAChLiyV.js";
|
|
3
3
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/cli.ts
|
|
@@ -27,12 +27,23 @@ function registerBuiltinReaders(registry) {
|
|
|
27
27
|
children: ctx.parseChildren(el),
|
|
28
28
|
...ELEMENT_DEFAULTS
|
|
29
29
|
}));
|
|
30
|
-
registry.registerReader("blockquote", (el, ctx) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
registry.registerReader("blockquote", (el, ctx) => {
|
|
31
|
+
const attribution = el.getAttribute("attribution");
|
|
32
|
+
const base = {
|
|
33
|
+
...extractBlockId$1(el),
|
|
34
|
+
children: ctx.parseChildren(el),
|
|
35
|
+
...ELEMENT_DEFAULTS
|
|
36
|
+
};
|
|
37
|
+
if (attribution !== null) return {
|
|
38
|
+
type: "rich-quote",
|
|
39
|
+
attribution,
|
|
40
|
+
...base
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
type: "quote",
|
|
44
|
+
...base
|
|
45
|
+
};
|
|
46
|
+
});
|
|
36
47
|
registry.registerReader("hr", (el) => ({
|
|
37
48
|
type: "horizontalrule",
|
|
38
49
|
...extractBlockId$1(el),
|
|
@@ -519,14 +530,18 @@ function registerBuiltinWriters(registry) {
|
|
|
519
530
|
children: ctx.serializeChildren(n.children ?? [])
|
|
520
531
|
};
|
|
521
532
|
});
|
|
522
|
-
|
|
533
|
+
const writeQuote = (node, ctx) => {
|
|
523
534
|
const n = node;
|
|
535
|
+
const attrs = { ...blockId$1(n) };
|
|
536
|
+
if (typeof n.attribution === "string" && n.attribution.trim() !== "") attrs.attribution = n.attribution;
|
|
524
537
|
return {
|
|
525
538
|
tag: "blockquote",
|
|
526
|
-
attrs
|
|
539
|
+
attrs,
|
|
527
540
|
children: ctx.serializeChildren(n.children ?? [])
|
|
528
541
|
};
|
|
529
|
-
}
|
|
542
|
+
};
|
|
543
|
+
registry.registerWriter("quote", writeQuote);
|
|
544
|
+
registry.registerWriter("rich-quote", writeQuote);
|
|
530
545
|
registry.registerWriter("horizontalrule", (node) => {
|
|
531
546
|
return {
|
|
532
547
|
tag: "hr",
|
|
@@ -1031,6 +1046,7 @@ var BLOCK_TAGS = new Set([
|
|
|
1031
1046
|
"ol",
|
|
1032
1047
|
"table",
|
|
1033
1048
|
"tr",
|
|
1049
|
+
"blockquote",
|
|
1034
1050
|
"alert",
|
|
1035
1051
|
"banner",
|
|
1036
1052
|
"details",
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as registerCustomWriters, c as registerCustomReaders, i as createDefaultRegistry, l as registerBuiltinReaders, n as deserializeNodesFromXml, o as registerBuiltinWriters, r as wrapWithFormatTags, s as LitexmlRegistry, t as deserializeFromXml } from "./deserializer-
|
|
1
|
+
import { a as registerCustomWriters, c as registerCustomReaders, i as createDefaultRegistry, l as registerBuiltinReaders, n as deserializeNodesFromXml, o as registerBuiltinWriters, r as wrapWithFormatTags, s as LitexmlRegistry, t as deserializeFromXml } from "./deserializer-DAChLiyV.js";
|
|
2
2
|
//#region src/xml-utils.ts
|
|
3
3
|
var ESCAPE_MAP = {
|
|
4
4
|
"&": "&",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/readers/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAgBnD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/readers/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAgBnD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAiLtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/writers/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../../src/writers/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAOnD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAwHtE"}
|