@podlite/schema 0.0.12 → 0.0.13
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/CHANGELOG.md +31 -4
- package/README.md +40 -0
- package/lib/ast-helpers.js +1 -0
- package/lib/ast-inerator.d.ts +0 -1
- package/lib/ast-inerator.js +5 -13
- package/lib/blocks-helpers.d.ts +1 -1
- package/lib/blocks-helpers.js +15 -12
- package/lib/exportAny.js +14 -6
- package/lib/exportHtml.js +43 -36
- package/lib/grammar.js +1 -0
- package/lib/grammarfc.js +1 -0
- package/lib/helpers/config.js +8 -3
- package/lib/helpers/corePlugins.d.ts +12 -0
- package/lib/helpers/corePlugins.js +26 -0
- package/lib/helpers/handlers.js +1 -0
- package/lib/helpers/ids.d.ts +18 -0
- package/lib/helpers/ids.js +74 -0
- package/lib/helpers/makeInterator.js +6 -3
- package/lib/helpers/makeQuery.js +5 -1
- package/lib/helpers/makeQuery.test.js +32 -22
- package/lib/helpers/makeTransformer.js +7 -10
- package/lib/helpers/plugins.d.ts +2 -0
- package/lib/helpers/plugins.js +27 -0
- package/lib/index.d.ts +24 -21
- package/lib/index.js +18 -8
- package/lib/pluggableParser.d.ts +27 -0
- package/lib/pluggableParser.js +80 -0
- package/lib/plugin-clean-location.js +6 -3
- package/lib/plugin-defn-fill-term.js +7 -4
- package/lib/plugin-formatting-codes.js +39 -11
- package/lib/plugin-group-defn.js +10 -10
- package/lib/plugin-group-items.js +22 -20
- package/lib/plugin-heading.js +6 -3
- package/lib/plugin-items.js +9 -6
- package/lib/plugin-tables.js +46 -31
- package/lib/plugin-vmargin.js +5 -3
- package/lib/query-helpers.js +9 -6
- package/lib/types.d.ts +69 -69
- package/lib/types.js +1 -0
- package/lib/writer.js +22 -7
- package/lib/writerHtml.js +3 -2
- package/package.json +7 -8
- package/schema/index.d.ts +3 -3
- package/index.js +0 -2
package/lib/types.js
CHANGED
package/lib/writer.js
CHANGED
|
@@ -24,6 +24,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const Events = __importStar(require("events"));
|
|
26
26
|
class Writer extends Events.EventEmitter {
|
|
27
|
+
INDEXTERMS;
|
|
28
|
+
FOOTNOTES;
|
|
29
|
+
output;
|
|
30
|
+
errors;
|
|
31
|
+
out;
|
|
32
|
+
ons;
|
|
27
33
|
// write: (p: any) => void;
|
|
28
34
|
// getStr: () => { errors: any; toString: () => any; valueOf: () => any; };
|
|
29
35
|
// errors: any;
|
|
@@ -33,9 +39,6 @@ class Writer extends Events.EventEmitter {
|
|
|
33
39
|
// endWrite: () => void;
|
|
34
40
|
constructor(output) {
|
|
35
41
|
super();
|
|
36
|
-
this.endWrite = () => {
|
|
37
|
-
this.emit('end');
|
|
38
|
-
};
|
|
39
42
|
// save X<> entries
|
|
40
43
|
this.INDEXTERMS = [];
|
|
41
44
|
// save N<> annotates
|
|
@@ -45,9 +48,13 @@ class Writer extends Events.EventEmitter {
|
|
|
45
48
|
this.emit('ready');
|
|
46
49
|
}
|
|
47
50
|
// escape function for output
|
|
48
|
-
escape(p) {
|
|
51
|
+
escape(p) {
|
|
52
|
+
return p;
|
|
53
|
+
}
|
|
49
54
|
// write with escape special symbols
|
|
50
|
-
write(p) {
|
|
55
|
+
write(p) {
|
|
56
|
+
return this.writeRaw(this.escape(p));
|
|
57
|
+
}
|
|
51
58
|
// raw write as is
|
|
52
59
|
writeRaw(str) {
|
|
53
60
|
if ('function' === typeof this.output) {
|
|
@@ -61,16 +68,20 @@ class Writer extends Events.EventEmitter {
|
|
|
61
68
|
return {
|
|
62
69
|
errors: this.errors,
|
|
63
70
|
toString: () => this.out,
|
|
64
|
-
valueOf: () => this.out
|
|
71
|
+
valueOf: () => this.out,
|
|
65
72
|
};
|
|
66
73
|
}
|
|
67
74
|
startWrite(tree) {
|
|
68
75
|
// setup events
|
|
76
|
+
;
|
|
69
77
|
(this.ons || []).map(a =>
|
|
70
78
|
//@ts-ignore
|
|
71
79
|
super.on(...a));
|
|
72
80
|
this.emit('start', tree);
|
|
73
|
-
this.addListener('errors',
|
|
81
|
+
this.addListener('errors', err => {
|
|
82
|
+
this.errors = this.errors || [];
|
|
83
|
+
this.errors.push(err);
|
|
84
|
+
});
|
|
74
85
|
}
|
|
75
86
|
on(...params) {
|
|
76
87
|
// overload 'on' method for reverse setup handlers
|
|
@@ -78,6 +89,9 @@ class Writer extends Events.EventEmitter {
|
|
|
78
89
|
this.ons.unshift([...params]);
|
|
79
90
|
return this;
|
|
80
91
|
}
|
|
92
|
+
endWrite = () => {
|
|
93
|
+
this.emit('end');
|
|
94
|
+
};
|
|
81
95
|
// nesting methods
|
|
82
96
|
_add_nesting(n) { }
|
|
83
97
|
_remove_nesting(n) { }
|
|
@@ -89,3 +103,4 @@ class Writer extends Events.EventEmitter {
|
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
105
|
exports.default = Writer;
|
|
106
|
+
//# sourceMappingURL=writer.js.map
|
package/lib/writerHtml.js
CHANGED
|
@@ -19,9 +19,9 @@ class WriterHTML extends writer_1.default {
|
|
|
19
19
|
'"': '"',
|
|
20
20
|
"'": ''',
|
|
21
21
|
'/': '/',
|
|
22
|
-
'`': '`'
|
|
22
|
+
'`': '`',
|
|
23
23
|
};
|
|
24
|
-
return (string + '').replace(/[&<>"'\/`]/g,
|
|
24
|
+
return (string + '').replace(/[&<>"'\/`]/g, match => HTML_CHARS[match]);
|
|
25
25
|
}
|
|
26
26
|
_add_nesting(n) {
|
|
27
27
|
this.writeRaw('<blockquote>'.repeat(n));
|
|
@@ -31,3 +31,4 @@ class WriterHTML extends writer_1.default {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.default = WriterHTML;
|
|
34
|
+
//# sourceMappingURL=writerHtml.js.map
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podlite/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "podlite schema",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"files": [
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"engineStrict": true,
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public",
|
|
21
|
-
"main": "index.js",
|
|
22
|
-
"module": "index.js",
|
|
21
|
+
"main": "lib/index.js",
|
|
23
22
|
"types": "./lib/index.d.ts"
|
|
24
23
|
},
|
|
25
24
|
"scripts": {
|
|
26
|
-
"clean": "rm -rf lib tsconfig.tsbuildinfo",
|
|
27
|
-
"build": "run-s build:ts build:ast
|
|
25
|
+
"clean": "rm -rf lib esm tsconfig.tsbuildinfo",
|
|
26
|
+
"build": "run-s build:pegjs build:ts build:ast ",
|
|
28
27
|
"build:ast": "ts-node scripts/make-ast-scheme.ts",
|
|
29
28
|
"build:ts": "yarn g:tsc --build $INIT_CWD",
|
|
29
|
+
"build:esm": "yarn g:tsctest -p tsconfig.esm.json",
|
|
30
30
|
"build:pegjs": "pegjs -o src/grammar.js src/grammar.pegjs && pegjs -o src/grammarfc.js src/grammarfc.pegjs",
|
|
31
31
|
"watch": "npx nodemon -e js,ts --exec 'yarn' build",
|
|
32
32
|
"test": "yarn g:jest --passWithNoTests"
|
|
@@ -51,6 +51,5 @@
|
|
|
51
51
|
"ts-node": "^9.1.1",
|
|
52
52
|
"typescript": "4.5.5",
|
|
53
53
|
"typescript-json-schema": "0.53.0"
|
|
54
|
-
}
|
|
55
|
-
"module": "index.js"
|
|
54
|
+
}
|
|
56
55
|
}
|
package/schema/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export var Test: any
|
|
2
|
-
export var AstTree: any
|
|
3
|
-
export var PodliteDocument: any
|
|
1
|
+
export var Test: any
|
|
2
|
+
export var AstTree: any
|
|
3
|
+
export var PodliteDocument: any
|
package/index.js
DELETED