@podlite/schema 0.0.13 → 0.0.15
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 +7 -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 +6404 -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 +53 -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 +342 -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 +29 -21
- package/lib/grammarfc.js +1098 -243
- package/lib/plugin-formatting-codes.js +2 -1
- package/lib/types.d.ts +9 -1
- package/package.json +11 -8
- package/schema/AstTree.json +116 -0
- package/schema/PodliteDocument.json +116 -0
|
@@ -49,9 +49,10 @@ const middle = () => tree => {
|
|
|
49
49
|
const conf = (0, config_1.default)(n, ctx);
|
|
50
50
|
const isCodeBlock = 'name' in n && n.name === 'code';
|
|
51
51
|
const isDataBlock = 'name' in n && n.name === 'data';
|
|
52
|
+
const isMarkdownBlock = 'name' in n && n.name === 'markdown';
|
|
52
53
|
const allowValues = conf.getAllValues('allow');
|
|
53
54
|
// for code block not parse content by default
|
|
54
|
-
if ((isCodeBlock || isDataBlock) && allowValues.length == 0)
|
|
55
|
+
if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
|
|
55
56
|
return n;
|
|
56
57
|
const allowed = allowValues.sort();
|
|
57
58
|
const transformer = (0, makeTransformer_1.default)({
|
package/lib/types.d.ts
CHANGED
|
@@ -61,9 +61,11 @@ export interface RulesStrict {
|
|
|
61
61
|
table_row: RuleHandler<TableRow>;
|
|
62
62
|
table_cell: RuleHandler<TableCell>;
|
|
63
63
|
table_head: RuleHandler<TableHead>;
|
|
64
|
+
toc: RuleHandler<BlockToc>;
|
|
64
65
|
':toc': RuleHandler<Toc>;
|
|
65
66
|
':toc-list': RuleHandler<TocList>;
|
|
66
67
|
':toc-item': RuleHandler<TocItem>;
|
|
68
|
+
markdown: RuleHandler<BlockMarkdown>;
|
|
67
69
|
Diagram: RuleHandler<BlockDiagram>;
|
|
68
70
|
Image: RuleHandler<BlockNamed>;
|
|
69
71
|
}
|
|
@@ -284,6 +286,12 @@ export interface BlockPara extends Block {
|
|
|
284
286
|
export interface BlockCode extends Block {
|
|
285
287
|
name: 'code';
|
|
286
288
|
}
|
|
289
|
+
export interface BlockToc extends Block {
|
|
290
|
+
name: 'toc';
|
|
291
|
+
}
|
|
292
|
+
export interface BlockMarkdown extends Block {
|
|
293
|
+
name: 'markdown';
|
|
294
|
+
}
|
|
287
295
|
export interface BlockNested extends Block {
|
|
288
296
|
name: 'nested';
|
|
289
297
|
}
|
|
@@ -328,7 +336,7 @@ export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
|
328
336
|
};
|
|
329
337
|
}
|
|
330
338
|
export declare type FormattingCodes = FormattingCodeA | FormattingCodeC | FormattingCodeB | FormattingCodeD | FormattingCodeE | FormattingCodeI | FormattingCodeL | FormattingCodeN | FormattingCodeX | FormattingCodeZ | FormattingCodeV | FormattingCodeS | FormattingCodeAny;
|
|
331
|
-
export declare type PodNode = Ambient | BlockPod | BlockData | BlockCode | BlankLine | BlockNested | BlockOutput | BlockInput | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
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;
|
|
332
340
|
export declare type Node = PodNode;
|
|
333
341
|
export declare type AstTree = Array<PodNode>;
|
|
334
342
|
export declare type PodliteDocument = RootBlock;
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podlite/schema",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.15",
|
|
4
|
+
"description": "AST tools for Podlite markup language",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
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,16 +20,17 @@
|
|
|
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",
|
|
33
|
+
"watch:pegjs": "npx nodemon -e pegjs --exec 'yarn' build:pegjs",
|
|
32
34
|
"test": "yarn g:jest --passWithNoTests"
|
|
33
35
|
},
|
|
34
36
|
"keywords": [
|
|
@@ -51,5 +53,6 @@
|
|
|
51
53
|
"ts-node": "^9.1.1",
|
|
52
54
|
"typescript": "4.5.5",
|
|
53
55
|
"typescript-json-schema": "0.53.0"
|
|
54
|
-
}
|
|
56
|
+
},
|
|
57
|
+
"module": "./esm/index.js"
|
|
55
58
|
}
|
package/schema/AstTree.json
CHANGED
|
@@ -213,6 +213,12 @@
|
|
|
213
213
|
{
|
|
214
214
|
"$ref": "#/definitions/BlockCode"
|
|
215
215
|
},
|
|
216
|
+
{
|
|
217
|
+
"$ref": "#/definitions/BlockToc"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
221
|
+
},
|
|
216
222
|
{
|
|
217
223
|
"$ref": "#/definitions/BlockNested"
|
|
218
224
|
},
|
|
@@ -1264,6 +1270,12 @@
|
|
|
1264
1270
|
{
|
|
1265
1271
|
"$ref": "#/definitions/BlockCode"
|
|
1266
1272
|
},
|
|
1273
|
+
{
|
|
1274
|
+
"$ref": "#/definitions/BlockToc"
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
1278
|
+
},
|
|
1267
1279
|
{
|
|
1268
1280
|
"$ref": "#/definitions/BlockNested"
|
|
1269
1281
|
},
|
|
@@ -1941,6 +1953,110 @@
|
|
|
1941
1953
|
"type"
|
|
1942
1954
|
]
|
|
1943
1955
|
},
|
|
1956
|
+
"BlockToc": {
|
|
1957
|
+
"type": "object",
|
|
1958
|
+
"properties": {
|
|
1959
|
+
"name": {
|
|
1960
|
+
"type": "string",
|
|
1961
|
+
"enum": [
|
|
1962
|
+
"toc"
|
|
1963
|
+
]
|
|
1964
|
+
},
|
|
1965
|
+
"type": {
|
|
1966
|
+
"type": "string",
|
|
1967
|
+
"enum": [
|
|
1968
|
+
"block"
|
|
1969
|
+
]
|
|
1970
|
+
},
|
|
1971
|
+
"location": {
|
|
1972
|
+
"$ref": "#/definitions/Location"
|
|
1973
|
+
},
|
|
1974
|
+
"content": {
|
|
1975
|
+
"type": "array",
|
|
1976
|
+
"items": {
|
|
1977
|
+
"$ref": "#/definitions/PodNode"
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
"margin": {
|
|
1981
|
+
"type": "string"
|
|
1982
|
+
},
|
|
1983
|
+
"config": {
|
|
1984
|
+
"type": "array",
|
|
1985
|
+
"items": {
|
|
1986
|
+
"anyOf": [
|
|
1987
|
+
{
|
|
1988
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"$ref": "#/definitions/ConfigItem"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
}
|
|
1995
|
+
},
|
|
1996
|
+
"id": {
|
|
1997
|
+
"type": "string"
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
"required": [
|
|
2001
|
+
"content",
|
|
2002
|
+
"location",
|
|
2003
|
+
"margin",
|
|
2004
|
+
"name",
|
|
2005
|
+
"type"
|
|
2006
|
+
]
|
|
2007
|
+
},
|
|
2008
|
+
"BlockMarkdown": {
|
|
2009
|
+
"type": "object",
|
|
2010
|
+
"properties": {
|
|
2011
|
+
"name": {
|
|
2012
|
+
"type": "string",
|
|
2013
|
+
"enum": [
|
|
2014
|
+
"markdown"
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"type": {
|
|
2018
|
+
"type": "string",
|
|
2019
|
+
"enum": [
|
|
2020
|
+
"block"
|
|
2021
|
+
]
|
|
2022
|
+
},
|
|
2023
|
+
"location": {
|
|
2024
|
+
"$ref": "#/definitions/Location"
|
|
2025
|
+
},
|
|
2026
|
+
"content": {
|
|
2027
|
+
"type": "array",
|
|
2028
|
+
"items": {
|
|
2029
|
+
"$ref": "#/definitions/PodNode"
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
"margin": {
|
|
2033
|
+
"type": "string"
|
|
2034
|
+
},
|
|
2035
|
+
"config": {
|
|
2036
|
+
"type": "array",
|
|
2037
|
+
"items": {
|
|
2038
|
+
"anyOf": [
|
|
2039
|
+
{
|
|
2040
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
"$ref": "#/definitions/ConfigItem"
|
|
2044
|
+
}
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
},
|
|
2048
|
+
"id": {
|
|
2049
|
+
"type": "string"
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
"required": [
|
|
2053
|
+
"content",
|
|
2054
|
+
"location",
|
|
2055
|
+
"margin",
|
|
2056
|
+
"name",
|
|
2057
|
+
"type"
|
|
2058
|
+
]
|
|
2059
|
+
},
|
|
1944
2060
|
"BlockNested": {
|
|
1945
2061
|
"type": "object",
|
|
1946
2062
|
"properties": {
|
|
@@ -213,6 +213,12 @@
|
|
|
213
213
|
{
|
|
214
214
|
"$ref": "#/definitions/BlockCode"
|
|
215
215
|
},
|
|
216
|
+
{
|
|
217
|
+
"$ref": "#/definitions/BlockToc"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
221
|
+
},
|
|
216
222
|
{
|
|
217
223
|
"$ref": "#/definitions/BlockNested"
|
|
218
224
|
},
|
|
@@ -1264,6 +1270,12 @@
|
|
|
1264
1270
|
{
|
|
1265
1271
|
"$ref": "#/definitions/BlockCode"
|
|
1266
1272
|
},
|
|
1273
|
+
{
|
|
1274
|
+
"$ref": "#/definitions/BlockToc"
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
"$ref": "#/definitions/BlockMarkdown"
|
|
1278
|
+
},
|
|
1267
1279
|
{
|
|
1268
1280
|
"$ref": "#/definitions/BlockNested"
|
|
1269
1281
|
},
|
|
@@ -1941,6 +1953,110 @@
|
|
|
1941
1953
|
"type"
|
|
1942
1954
|
]
|
|
1943
1955
|
},
|
|
1956
|
+
"BlockToc": {
|
|
1957
|
+
"type": "object",
|
|
1958
|
+
"properties": {
|
|
1959
|
+
"name": {
|
|
1960
|
+
"type": "string",
|
|
1961
|
+
"enum": [
|
|
1962
|
+
"toc"
|
|
1963
|
+
]
|
|
1964
|
+
},
|
|
1965
|
+
"type": {
|
|
1966
|
+
"type": "string",
|
|
1967
|
+
"enum": [
|
|
1968
|
+
"block"
|
|
1969
|
+
]
|
|
1970
|
+
},
|
|
1971
|
+
"location": {
|
|
1972
|
+
"$ref": "#/definitions/Location"
|
|
1973
|
+
},
|
|
1974
|
+
"content": {
|
|
1975
|
+
"type": "array",
|
|
1976
|
+
"items": {
|
|
1977
|
+
"$ref": "#/definitions/PodNode"
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
"margin": {
|
|
1981
|
+
"type": "string"
|
|
1982
|
+
},
|
|
1983
|
+
"config": {
|
|
1984
|
+
"type": "array",
|
|
1985
|
+
"items": {
|
|
1986
|
+
"anyOf": [
|
|
1987
|
+
{
|
|
1988
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"$ref": "#/definitions/ConfigItem"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
}
|
|
1995
|
+
},
|
|
1996
|
+
"id": {
|
|
1997
|
+
"type": "string"
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
"required": [
|
|
2001
|
+
"content",
|
|
2002
|
+
"location",
|
|
2003
|
+
"margin",
|
|
2004
|
+
"name",
|
|
2005
|
+
"type"
|
|
2006
|
+
]
|
|
2007
|
+
},
|
|
2008
|
+
"BlockMarkdown": {
|
|
2009
|
+
"type": "object",
|
|
2010
|
+
"properties": {
|
|
2011
|
+
"name": {
|
|
2012
|
+
"type": "string",
|
|
2013
|
+
"enum": [
|
|
2014
|
+
"markdown"
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"type": {
|
|
2018
|
+
"type": "string",
|
|
2019
|
+
"enum": [
|
|
2020
|
+
"block"
|
|
2021
|
+
]
|
|
2022
|
+
},
|
|
2023
|
+
"location": {
|
|
2024
|
+
"$ref": "#/definitions/Location"
|
|
2025
|
+
},
|
|
2026
|
+
"content": {
|
|
2027
|
+
"type": "array",
|
|
2028
|
+
"items": {
|
|
2029
|
+
"$ref": "#/definitions/PodNode"
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
"margin": {
|
|
2033
|
+
"type": "string"
|
|
2034
|
+
},
|
|
2035
|
+
"config": {
|
|
2036
|
+
"type": "array",
|
|
2037
|
+
"items": {
|
|
2038
|
+
"anyOf": [
|
|
2039
|
+
{
|
|
2040
|
+
"$ref": "#/definitions/BrokenConfigItem"
|
|
2041
|
+
},
|
|
2042
|
+
{
|
|
2043
|
+
"$ref": "#/definitions/ConfigItem"
|
|
2044
|
+
}
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
},
|
|
2048
|
+
"id": {
|
|
2049
|
+
"type": "string"
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
"required": [
|
|
2053
|
+
"content",
|
|
2054
|
+
"location",
|
|
2055
|
+
"margin",
|
|
2056
|
+
"name",
|
|
2057
|
+
"type"
|
|
2058
|
+
]
|
|
2059
|
+
},
|
|
1944
2060
|
"BlockNested": {
|
|
1945
2061
|
"type": "object",
|
|
1946
2062
|
"properties": {
|