@podlite/schema 0.0.14 → 0.0.16
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 +4 -0
- package/esm/ast-helpers.d.ts +2 -0
- package/esm/ast-helpers.js +10 -0
- package/esm/ast-helpers.js.map +1 -0
- package/esm/ast-inerator.d.ts +6 -0
- package/esm/ast-inerator.js +57 -0
- package/esm/ast-inerator.js.map +1 -0
- package/esm/blocks-helpers.d.ts +32 -0
- package/esm/blocks-helpers.js +65 -0
- package/esm/blocks-helpers.js.map +1 -0
- package/esm/exportAny.d.ts +19 -0
- package/esm/exportAny.js +65 -0
- package/esm/exportAny.js.map +1 -0
- package/esm/exportHtml.d.ts +15 -0
- package/esm/exportHtml.js +279 -0
- package/esm/exportHtml.js.map +1 -0
- package/esm/grammar.d.ts +14 -0
- package/esm/grammar.js +6405 -0
- package/esm/grammar.js.map +1 -0
- package/esm/grammarfc.d.ts +14 -0
- package/esm/grammarfc.js +4218 -0
- package/esm/grammarfc.js.map +1 -0
- package/esm/helpers/config.d.ts +12 -0
- package/esm/helpers/config.js +52 -0
- package/esm/helpers/config.js.map +1 -0
- package/esm/helpers/corePlugins.d.ts +12 -0
- package/esm/helpers/corePlugins.js +23 -0
- package/esm/helpers/corePlugins.js.map +1 -0
- package/esm/helpers/handlers.d.ts +47 -0
- package/esm/helpers/handlers.js +107 -0
- package/esm/helpers/handlers.js.map +1 -0
- package/esm/helpers/ids.d.ts +18 -0
- package/esm/helpers/ids.js +69 -0
- package/esm/helpers/ids.js.map +1 -0
- package/esm/helpers/makeInterator.d.ts +5 -0
- package/esm/helpers/makeInterator.js +52 -0
- package/esm/helpers/makeInterator.js.map +1 -0
- package/esm/helpers/makeQuery.d.ts +47 -0
- package/esm/helpers/makeQuery.js +100 -0
- package/esm/helpers/makeQuery.js.map +1 -0
- package/esm/helpers/makeQuery.test.d.ts +1 -0
- package/esm/helpers/makeQuery.test.js +51 -0
- package/esm/helpers/makeQuery.test.js.map +1 -0
- package/esm/helpers/makeTransformer.d.ts +7 -0
- package/esm/helpers/makeTransformer.js +61 -0
- package/esm/helpers/makeTransformer.js.map +1 -0
- package/esm/helpers/plugins.d.ts +2 -0
- package/esm/helpers/plugins.js +23 -0
- package/esm/helpers/plugins.js.map +1 -0
- package/esm/index.d.ts +82 -0
- package/esm/index.js +123 -0
- package/esm/index.js.map +1 -0
- package/esm/pluggableParser.d.ts +27 -0
- package/esm/pluggableParser.js +71 -0
- package/esm/pluggableParser.js.map +1 -0
- package/esm/plugin-clean-location.d.ts +2 -0
- package/esm/plugin-clean-location.js +19 -0
- package/esm/plugin-clean-location.js.map +1 -0
- package/esm/plugin-defn-fill-term.d.ts +2 -0
- package/esm/plugin-defn-fill-term.js +50 -0
- package/esm/plugin-defn-fill-term.js.map +1 -0
- package/esm/plugin-formatting-codes.d.ts +3 -0
- package/esm/plugin-formatting-codes.js +54 -0
- package/esm/plugin-formatting-codes.js.map +1 -0
- package/esm/plugin-group-defn.d.ts +2 -0
- package/esm/plugin-group-defn.js +71 -0
- package/esm/plugin-group-defn.js.map +1 -0
- package/esm/plugin-group-items.d.ts +2 -0
- package/esm/plugin-group-items.js +79 -0
- package/esm/plugin-group-items.js.map +1 -0
- package/esm/plugin-heading.d.ts +2 -0
- package/esm/plugin-heading.js +33 -0
- package/esm/plugin-heading.js.map +1 -0
- package/esm/plugin-items.d.ts +2 -0
- package/esm/plugin-items.js +41 -0
- package/esm/plugin-items.js.map +1 -0
- package/esm/plugin-tables.d.ts +5 -0
- package/esm/plugin-tables.js +141 -0
- package/esm/plugin-tables.js.map +1 -0
- package/esm/plugin-vmargin.d.ts +3 -0
- package/esm/plugin-vmargin.js +29 -0
- package/esm/plugin-vmargin.js.map +1 -0
- package/esm/query-helpers.d.ts +28 -0
- package/esm/query-helpers.js +131 -0
- package/esm/query-helpers.js.map +1 -0
- package/esm/types.d.ts +357 -0
- package/esm/types.js +2 -0
- package/esm/types.js.map +1 -0
- package/esm/writer.d.ts +30 -0
- package/esm/writer.js +85 -0
- package/esm/writer.js.map +1 -0
- package/esm/writerHtml.d.ts +11 -0
- package/esm/writerHtml.js +29 -0
- package/esm/writerHtml.js.map +1 -0
- package/lib/grammar.js +4 -3
- package/lib/plugin-formatting-codes.js +2 -1
- package/lib/types.d.ts +16 -1
- package/package.json +9 -7
- package/schema/AstTree.json +71 -0
- package/schema/PodliteDocument.json +71 -0
package/esm/writer.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default writer
|
|
3
|
+
*/
|
|
4
|
+
import * as Events from 'events';
|
|
5
|
+
class Writer extends Events.EventEmitter {
|
|
6
|
+
INDEXTERMS;
|
|
7
|
+
FOOTNOTES;
|
|
8
|
+
output;
|
|
9
|
+
errors;
|
|
10
|
+
out;
|
|
11
|
+
ons;
|
|
12
|
+
// write: (p: any) => void;
|
|
13
|
+
// getStr: () => { errors: any; toString: () => any; valueOf: () => any; };
|
|
14
|
+
// errors: any;
|
|
15
|
+
// out: any;
|
|
16
|
+
// startWrite: () => void;
|
|
17
|
+
// ons: any[];
|
|
18
|
+
// endWrite: () => void;
|
|
19
|
+
constructor(output) {
|
|
20
|
+
super();
|
|
21
|
+
// save X<> entries
|
|
22
|
+
this.INDEXTERMS = [];
|
|
23
|
+
// save N<> annotates
|
|
24
|
+
this.FOOTNOTES = [];
|
|
25
|
+
this.output = output;
|
|
26
|
+
this.ons = [];
|
|
27
|
+
this.emit('ready');
|
|
28
|
+
}
|
|
29
|
+
// escape function for output
|
|
30
|
+
escape(p) {
|
|
31
|
+
return p;
|
|
32
|
+
}
|
|
33
|
+
// write with escape special symbols
|
|
34
|
+
write(p) {
|
|
35
|
+
return this.writeRaw(this.escape(p));
|
|
36
|
+
}
|
|
37
|
+
// raw write as is
|
|
38
|
+
writeRaw(str) {
|
|
39
|
+
if ('function' === typeof this.output) {
|
|
40
|
+
this.output(str);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
console.log(str);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getStr() {
|
|
47
|
+
return {
|
|
48
|
+
errors: this.errors,
|
|
49
|
+
toString: () => this.out,
|
|
50
|
+
valueOf: () => this.out,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
startWrite(tree) {
|
|
54
|
+
// setup events
|
|
55
|
+
;
|
|
56
|
+
(this.ons || []).map(a =>
|
|
57
|
+
//@ts-ignore
|
|
58
|
+
super.on(...a));
|
|
59
|
+
this.emit('start', tree);
|
|
60
|
+
this.addListener('errors', err => {
|
|
61
|
+
this.errors = this.errors || [];
|
|
62
|
+
this.errors.push(err);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
on(...params) {
|
|
66
|
+
// overload 'on' method for reverse setup handlers
|
|
67
|
+
this.ons = this.ons || [];
|
|
68
|
+
this.ons.unshift([...params]);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
endWrite = () => {
|
|
72
|
+
this.emit('end');
|
|
73
|
+
};
|
|
74
|
+
// nesting methods
|
|
75
|
+
_add_nesting(n) { }
|
|
76
|
+
_remove_nesting(n) { }
|
|
77
|
+
addLevel(n) {
|
|
78
|
+
this._add_nesting(n);
|
|
79
|
+
}
|
|
80
|
+
removeLevel(n) {
|
|
81
|
+
this._remove_nesting(n);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export default Writer;
|
|
85
|
+
//# sourceMappingURL=writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,MAAO,SAAQ,MAAM,CAAC,YAAY;IACtC,UAAU,CAAO;IACjB,SAAS,CAAO;IAChB,MAAM,CAAK;IACX,MAAM,CAAK;IACX,GAAG,CAAK;IACR,GAAG,CAAO;IACV,2BAA2B;IAC3B,2EAA2E;IAC3E,eAAe;IACf,YAAY;IACZ,0BAA0B;IAC1B,cAAc;IACd,wBAAwB;IAExB,YAAY,MAAO;QACjB,KAAK,EAAE,CAAA;QACP,mBAAmB;QACnB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;QACpB,qBAAqB;QACrB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACpB,CAAC;IACD,6BAA6B;IAC7B,MAAM,CAAC,CAAC;QACN,OAAO,CAAC,CAAA;IACV,CAAC;IACD,oCAAoC;IACpC,KAAK,CAAC,CAAC;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACtC,CAAC;IACD,kBAAkB;IAClB,QAAQ,CAAC,GAAG;QACV,IAAI,UAAU,KAAK,OAAO,IAAI,CAAC,MAAM,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACjB;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;SACjB;IACH,CAAC;IACD,MAAM;QACJ,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG;SACxB,CAAA;IACH,CAAC;IACD,UAAU,CAAC,IAAS;QAClB,eAAe;QACf,CAAC;QAAA,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACxB,YAAY;QACZ,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CACf,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACxB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;YAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAA;YAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,EAAE,CAAC,GAAG,MAAM;QACV,kDAAkD;QAClD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAA;QACzB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;IACD,QAAQ,GAAG,GAAG,EAAE;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClB,CAAC,CAAA;IAED,kBAAkB;IAElB,YAAY,CAAC,CAAS,IAAG,CAAC;IAC1B,eAAe,CAAC,CAAS,IAAG,CAAC;IAE7B,QAAQ,CAAC,CAAS;QAChB,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;IAED,WAAW,CAAC,CAAS;QACnB,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;IACzB,CAAC;CACF;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML writer
|
|
3
|
+
*/
|
|
4
|
+
import Writer from './writer';
|
|
5
|
+
declare class WriterHTML extends Writer {
|
|
6
|
+
constructor(output?: any);
|
|
7
|
+
escape(string: any): string;
|
|
8
|
+
_add_nesting(n: any): void;
|
|
9
|
+
_remove_nesting(n: any): void;
|
|
10
|
+
}
|
|
11
|
+
export default WriterHTML;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML writer
|
|
3
|
+
*/
|
|
4
|
+
import Writer from './writer';
|
|
5
|
+
class WriterHTML extends Writer {
|
|
6
|
+
constructor(output) {
|
|
7
|
+
super(output);
|
|
8
|
+
}
|
|
9
|
+
escape(string) {
|
|
10
|
+
const HTML_CHARS = {
|
|
11
|
+
'&': '&',
|
|
12
|
+
'<': '<',
|
|
13
|
+
'>': '>',
|
|
14
|
+
'"': '"',
|
|
15
|
+
"'": ''',
|
|
16
|
+
'/': '/',
|
|
17
|
+
'`': '`',
|
|
18
|
+
};
|
|
19
|
+
return (string + '').replace(/[&<>"'\/`]/g, match => HTML_CHARS[match]);
|
|
20
|
+
}
|
|
21
|
+
_add_nesting(n) {
|
|
22
|
+
this.writeRaw('<blockquote>'.repeat(n));
|
|
23
|
+
}
|
|
24
|
+
_remove_nesting(n) {
|
|
25
|
+
this.writeRaw('</blockquote>'.repeat(n));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export default WriterHTML;
|
|
29
|
+
//# sourceMappingURL=writerHtml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writerHtml.js","sourceRoot":"","sources":["../src/writerHtml.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,MAAM,UAAW,SAAQ,MAAM;IAC7B,YAAY,MAAO;QACjB,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;IACD,MAAM,CAAC,MAAM;QACX,MAAM,UAAU,GAAG;YACjB,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,QAAQ;SACd,CAAA;QACD,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACzE,CAAC;IAED,YAAY,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACzC,CAAC;IACD,eAAe,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC;CACF;AACD,eAAe,UAAU,CAAA"}
|
package/lib/grammar.js
CHANGED
|
@@ -134,7 +134,7 @@ function peg$parse(input, options) {
|
|
|
134
134
|
type: "boolean"
|
|
135
135
|
};
|
|
136
136
|
}, peg$c88 = function (isFalse, key, value) { return { name: key, ...value }; }, peg$c89 = function (first, rest) { return rest; }, peg$c90 = function (first, cont) { return flattenDeep([...first, ...cont]); }, peg$c91 = /^[^'"]/, peg$c92 = peg$classExpectation(["'", "\""], true, false), peg$c93 = function (text) { return text; }, peg$c94 = /^[0-9]/, peg$c95 = peg$classExpectation([["0", "9"]], false, false), peg$c96 = /^[\-+]/, peg$c97 = peg$classExpectation(["-", "+"], false, false), peg$c98 = "True", peg$c99 = peg$literalExpectation("True", false), peg$c100 = function () { return true; }, peg$c101 = "False", peg$c102 = peg$literalExpectation("False", false), peg$c103 = function () { return false; }, peg$c104 = ".", peg$c105 = peg$literalExpectation(".", false), peg$c106 = /^[eE]/, peg$c107 = peg$classExpectation(["e", "E"], false, false), peg$c108 = /^["]/, peg$c109 = peg$classExpectation(["\""], false, false), peg$c110 = /^[^"]/, peg$c111 = peg$classExpectation(["\""], true, false), peg$c112 = /^[']/, peg$c113 = peg$classExpectation(["'"], false, false), peg$c114 = /^[^']/, peg$c115 = peg$classExpectation(["'"], true, false), peg$c116 = function (numberFloat) { return parseFloat(numberFloat); }, peg$c117 = function (number) { return parseInt(number, 10); }, peg$c118 = function (vmargin, name, config) {
|
|
137
|
-
return ((name.match(/code|comment|output|input|markdown|toc|data/))
|
|
137
|
+
return ((name.match(/code|comment|output|input|markdown|picture|toc|data/))
|
|
138
138
|
||
|
|
139
139
|
isNamedBlock(name));
|
|
140
140
|
}, peg$c119 = function (vmargin, name, config, margins, ename) { return vmargin.length === margins.length && name === ename; }, peg$c120 = function (vmargin, name, config, margins, line) { return exludeVMargin(vmargin, `${margins}${line}`); }, peg$c121 = function (vmargin, name, config, content, vmargin2, ename) { return name === ename; }, peg$c122 = function (vmargin, name, config, content, vmargin2, ename) {
|
|
@@ -261,7 +261,7 @@ function peg$parse(input, options) {
|
|
|
261
261
|
location: location(),
|
|
262
262
|
};
|
|
263
263
|
}, peg$c150 = function () { return { empty: 1 }; }, peg$c151 = /^[s]/, peg$c152 = peg$classExpectation(["s"], false, false), peg$c153 = function (line) { return { text: text(), type: "ambient1" }; }, peg$c154 = function (vmargin, name) {
|
|
264
|
-
return ((name.match(/code|comment|output|input|markdown|toc|data/))
|
|
264
|
+
return ((name.match(/code|comment|output|input|markdown|picture|toc|data/))
|
|
265
265
|
||
|
|
266
266
|
isNamedBlock(name));
|
|
267
267
|
}, peg$c155 = function (vmargin, name, content) {
|
|
@@ -320,7 +320,7 @@ function peg$parse(input, options) {
|
|
|
320
320
|
margin: vmargin
|
|
321
321
|
};
|
|
322
322
|
}, peg$c168 = function (vmargin, marker, name, config) {
|
|
323
|
-
return ((name.match(/code|comment|output|input|markdown|toc|data/))
|
|
323
|
+
return ((name.match(/code|comment|output|input|markdown|picture|toc|data/))
|
|
324
324
|
||
|
|
325
325
|
isNamedBlock(name));
|
|
326
326
|
}, peg$c169 = function (vmargin, marker, name, config, content) {
|
|
@@ -6364,6 +6364,7 @@ function peg$parse(input, options) {
|
|
|
6364
6364
|
'nested',
|
|
6365
6365
|
'output',
|
|
6366
6366
|
'para',
|
|
6367
|
+
'picture',
|
|
6367
6368
|
'pod',
|
|
6368
6369
|
'table',
|
|
6369
6370
|
'toc',
|
|
@@ -50,9 +50,10 @@ const middle = () => tree => {
|
|
|
50
50
|
const isCodeBlock = 'name' in n && n.name === 'code';
|
|
51
51
|
const isDataBlock = 'name' in n && n.name === 'data';
|
|
52
52
|
const isMarkdownBlock = 'name' in n && n.name === 'markdown';
|
|
53
|
+
const isPictureBlock = 'name' in n && n.name === 'picture';
|
|
53
54
|
const allowValues = conf.getAllValues('allow');
|
|
54
55
|
// for code block not parse content by default
|
|
55
|
-
if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
|
|
56
|
+
if ((isCodeBlock || isDataBlock || isMarkdownBlock || isPictureBlock) && allowValues.length == 0)
|
|
56
57
|
return n;
|
|
57
58
|
const allowed = allowValues.sort();
|
|
58
59
|
const transformer = (0, makeTransformer_1.default)({
|
package/lib/types.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface RulesStrict {
|
|
|
46
46
|
nested: RuleHandler<BlockNested>;
|
|
47
47
|
output: RuleHandler<BlockOutput>;
|
|
48
48
|
input: RuleHandler<BlockInput>;
|
|
49
|
+
picture: RuleHandler<BlockPicture>;
|
|
49
50
|
image: RuleHandler<BlockImage>;
|
|
50
51
|
':image': RuleHandler<Image>;
|
|
51
52
|
'item:block': RuleHandler<BlockItem>;
|
|
@@ -67,6 +68,7 @@ export interface RulesStrict {
|
|
|
67
68
|
':toc-item': RuleHandler<TocItem>;
|
|
68
69
|
markdown: RuleHandler<BlockMarkdown>;
|
|
69
70
|
Diagram: RuleHandler<BlockDiagram>;
|
|
71
|
+
Mermaid: RuleHandler<BlockMermaid>;
|
|
70
72
|
Image: RuleHandler<BlockNamed>;
|
|
71
73
|
}
|
|
72
74
|
export interface Rules extends RulesStrict {
|
|
@@ -107,6 +109,12 @@ export interface BlockImage extends Omit<Block, 'content'> {
|
|
|
107
109
|
link?: string;
|
|
108
110
|
content: [Image, BlockCaption];
|
|
109
111
|
}
|
|
112
|
+
export interface BlockPicture extends Omit<Block, 'content'> {
|
|
113
|
+
name: 'picture';
|
|
114
|
+
caption?: string;
|
|
115
|
+
link?: string;
|
|
116
|
+
content: [Image, BlockCaption];
|
|
117
|
+
}
|
|
110
118
|
export interface BlockCaption extends Omit<Block, 'content' | 'location' | 'margin' | 'config' | 'id'> {
|
|
111
119
|
name: 'caption';
|
|
112
120
|
content: Array<Node>;
|
|
@@ -335,8 +343,15 @@ export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
|
335
343
|
location: Location;
|
|
336
344
|
};
|
|
337
345
|
}
|
|
346
|
+
export interface BlockMermaid extends Omit<BlockNamed, 'content'> {
|
|
347
|
+
name: 'Mermaid';
|
|
348
|
+
content: [Verbatim];
|
|
349
|
+
custom?: {
|
|
350
|
+
location: Location;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
338
353
|
export declare type FormattingCodes = FormattingCodeA | FormattingCodeC | FormattingCodeB | FormattingCodeD | FormattingCodeE | FormattingCodeI | FormattingCodeL | FormattingCodeN | FormattingCodeX | FormattingCodeZ | FormattingCodeV | FormattingCodeS | FormattingCodeAny;
|
|
339
|
-
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
354
|
+
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockPicture | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
340
355
|
export declare type Node = PodNode;
|
|
341
356
|
export declare type AstTree = Array<PodNode>;
|
|
342
357
|
export declare type PodliteDocument = RootBlock;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podlite/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "AST tools for Podlite markup language",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"lib/**/*.js",
|
|
10
10
|
"lib/**/*.d.ts",
|
|
11
|
+
"esm",
|
|
11
12
|
"schema/*",
|
|
12
13
|
"README.md",
|
|
13
14
|
"CHANGELOG.md"
|
|
@@ -19,14 +20,14 @@
|
|
|
19
20
|
"publishConfig": {
|
|
20
21
|
"access": "public",
|
|
21
22
|
"main": "lib/index.js",
|
|
22
|
-
"types": "./lib/index.d.ts"
|
|
23
|
+
"types": "./lib/index.d.ts",
|
|
24
|
+
"module": "./esm/index.js"
|
|
23
25
|
},
|
|
24
26
|
"scripts": {
|
|
25
|
-
"clean": "rm -rf lib esm
|
|
26
|
-
"build": "run-s build:pegjs
|
|
27
|
+
"clean": "rm -rf lib esm *.tsbuildinfo",
|
|
28
|
+
"build": "run-s build:pegjs build_lib build:ast ",
|
|
29
|
+
"build_lib": "yarn g:build",
|
|
27
30
|
"build:ast": "ts-node scripts/make-ast-scheme.ts",
|
|
28
|
-
"build:ts": "yarn g:tsc --build $INIT_CWD",
|
|
29
|
-
"build:esm": "yarn g:tsctest -p tsconfig.esm.json",
|
|
30
31
|
"build:pegjs": "pegjs -o src/grammar.js src/grammar.pegjs && pegjs -o src/grammarfc.js src/grammarfc.pegjs",
|
|
31
32
|
"watch": "npx nodemon -e js,ts --exec 'yarn' build",
|
|
32
33
|
"watch:pegjs": "npx nodemon -e pegjs --exec 'yarn' build:pegjs",
|
|
@@ -52,5 +53,6 @@
|
|
|
52
53
|
"ts-node": "^9.1.1",
|
|
53
54
|
"typescript": "4.5.5",
|
|
54
55
|
"typescript-json-schema": "0.53.0"
|
|
55
|
-
}
|
|
56
|
+
},
|
|
57
|
+
"module": "./esm/index.js"
|
|
56
58
|
}
|
package/schema/AstTree.json
CHANGED
|
@@ -111,6 +111,9 @@
|
|
|
111
111
|
{
|
|
112
112
|
"$ref": "#/definitions/BlockImage"
|
|
113
113
|
},
|
|
114
|
+
{
|
|
115
|
+
"$ref": "#/definitions/BlockPicture"
|
|
116
|
+
},
|
|
114
117
|
{
|
|
115
118
|
"$ref": "#/definitions/BlockCaption"
|
|
116
119
|
},
|
|
@@ -449,6 +452,71 @@
|
|
|
449
452
|
"value"
|
|
450
453
|
]
|
|
451
454
|
},
|
|
455
|
+
"BlockPicture": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {
|
|
458
|
+
"name": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"enum": [
|
|
461
|
+
"picture"
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
"caption": {
|
|
465
|
+
"type": "string"
|
|
466
|
+
},
|
|
467
|
+
"link": {
|
|
468
|
+
"type": "string"
|
|
469
|
+
},
|
|
470
|
+
"content": {
|
|
471
|
+
"type": "array",
|
|
472
|
+
"items": [
|
|
473
|
+
{
|
|
474
|
+
"$ref": "#/definitions/Image"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"$ref": "#/definitions/BlockCaption"
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"minItems": 2,
|
|
481
|
+
"maxItems": 2
|
|
482
|
+
},
|
|
483
|
+
"type": {
|
|
484
|
+
"type": "string",
|
|
485
|
+
"enum": [
|
|
486
|
+
"block"
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
"location": {
|
|
490
|
+
"$ref": "#/definitions/Location"
|
|
491
|
+
},
|
|
492
|
+
"margin": {
|
|
493
|
+
"type": "string"
|
|
494
|
+
},
|
|
495
|
+
"config": {
|
|
496
|
+
"type": "array",
|
|
497
|
+
"items": {
|
|
498
|
+
"anyOf": [
|
|
499
|
+
{
|
|
500
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"$ref": "#/definitions/ConfigItem"
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"id": {
|
|
509
|
+
"type": "string"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
"required": [
|
|
513
|
+
"content",
|
|
514
|
+
"location",
|
|
515
|
+
"margin",
|
|
516
|
+
"name",
|
|
517
|
+
"type"
|
|
518
|
+
]
|
|
519
|
+
},
|
|
452
520
|
"RootBlock": {
|
|
453
521
|
"type": "object",
|
|
454
522
|
"properties": {
|
|
@@ -1168,6 +1236,9 @@
|
|
|
1168
1236
|
{
|
|
1169
1237
|
"$ref": "#/definitions/BlockImage"
|
|
1170
1238
|
},
|
|
1239
|
+
{
|
|
1240
|
+
"$ref": "#/definitions/BlockPicture"
|
|
1241
|
+
},
|
|
1171
1242
|
{
|
|
1172
1243
|
"$ref": "#/definitions/BlockCaption"
|
|
1173
1244
|
},
|
|
@@ -111,6 +111,9 @@
|
|
|
111
111
|
{
|
|
112
112
|
"$ref": "#/definitions/BlockImage"
|
|
113
113
|
},
|
|
114
|
+
{
|
|
115
|
+
"$ref": "#/definitions/BlockPicture"
|
|
116
|
+
},
|
|
114
117
|
{
|
|
115
118
|
"$ref": "#/definitions/BlockCaption"
|
|
116
119
|
},
|
|
@@ -449,6 +452,71 @@
|
|
|
449
452
|
"value"
|
|
450
453
|
]
|
|
451
454
|
},
|
|
455
|
+
"BlockPicture": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {
|
|
458
|
+
"name": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"enum": [
|
|
461
|
+
"picture"
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
"caption": {
|
|
465
|
+
"type": "string"
|
|
466
|
+
},
|
|
467
|
+
"link": {
|
|
468
|
+
"type": "string"
|
|
469
|
+
},
|
|
470
|
+
"content": {
|
|
471
|
+
"type": "array",
|
|
472
|
+
"items": [
|
|
473
|
+
{
|
|
474
|
+
"$ref": "#/definitions/Image"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"$ref": "#/definitions/BlockCaption"
|
|
478
|
+
}
|
|
479
|
+
],
|
|
480
|
+
"minItems": 2,
|
|
481
|
+
"maxItems": 2
|
|
482
|
+
},
|
|
483
|
+
"type": {
|
|
484
|
+
"type": "string",
|
|
485
|
+
"enum": [
|
|
486
|
+
"block"
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
"location": {
|
|
490
|
+
"$ref": "#/definitions/Location"
|
|
491
|
+
},
|
|
492
|
+
"margin": {
|
|
493
|
+
"type": "string"
|
|
494
|
+
},
|
|
495
|
+
"config": {
|
|
496
|
+
"type": "array",
|
|
497
|
+
"items": {
|
|
498
|
+
"anyOf": [
|
|
499
|
+
{
|
|
500
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"$ref": "#/definitions/ConfigItem"
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"id": {
|
|
509
|
+
"type": "string"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
"required": [
|
|
513
|
+
"content",
|
|
514
|
+
"location",
|
|
515
|
+
"margin",
|
|
516
|
+
"name",
|
|
517
|
+
"type"
|
|
518
|
+
]
|
|
519
|
+
},
|
|
452
520
|
"RootBlock": {
|
|
453
521
|
"type": "object",
|
|
454
522
|
"properties": {
|
|
@@ -1168,6 +1236,9 @@
|
|
|
1168
1236
|
{
|
|
1169
1237
|
"$ref": "#/definitions/BlockImage"
|
|
1170
1238
|
},
|
|
1239
|
+
{
|
|
1240
|
+
"$ref": "#/definitions/BlockPicture"
|
|
1241
|
+
},
|
|
1171
1242
|
{
|
|
1172
1243
|
"$ref": "#/definitions/BlockCaption"
|
|
1173
1244
|
},
|