@podlite/schema 0.0.77 → 0.0.79
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.podlite +18 -0
- package/esm/codes/read.d.ts +2 -1
- package/esm/codes/read.js +84 -7
- package/esm/codes/read.js.map +1 -1
- package/esm/exportHtml.js +23 -15
- package/esm/exportHtml.js.map +1 -1
- package/esm/exportMarkdown.js +22 -14
- package/esm/exportMarkdown.js.map +1 -1
- package/esm/grammar.js +919 -659
- package/esm/grammar.js.map +1 -1
- package/esm/helpers/alias.d.ts +10 -0
- package/esm/helpers/alias.js +53 -0
- package/esm/helpers/alias.js.map +1 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/index.js.map +1 -1
- package/esm/plugin-formatting-codes.js +27 -0
- package/esm/plugin-formatting-codes.js.map +1 -1
- package/esm/test-display.d.ts +2 -0
- package/esm/test-display.js +64 -0
- package/esm/test-display.js.map +1 -1
- package/esm/types.d.ts +5 -4
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/codes/read.d.ts +2 -1
- package/lib/codes/read.js +85 -8
- package/lib/exportHtml.js +23 -15
- package/lib/exportMarkdown.js +22 -14
- package/lib/grammar.js +919 -659
- package/lib/helpers/alias.d.ts +10 -0
- package/lib/helpers/alias.js +57 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +12 -4
- package/lib/plugin-formatting-codes.js +27 -0
- package/lib/test-display.d.ts +2 -0
- package/lib/test-display.js +67 -1
- package/lib/types.d.ts +5 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/schema/AstTree.json +90 -35
- package/schema/PodliteDocument.json +90 -35
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const ALIAS_EXPANSION_DEPTH = 8;
|
|
2
|
+
export declare const ALIAS_EXPANSION_BUDGET = 10000;
|
|
3
|
+
export declare const expandAlias: <T>(ctx: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}, term: string, walk: () => T, warn: (message: string) => void) => {
|
|
6
|
+
expanded: true;
|
|
7
|
+
result: T;
|
|
8
|
+
} | {
|
|
9
|
+
expanded: false;
|
|
10
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
=begin pod
|
|
4
|
+
|
|
5
|
+
=TITLE How far an alias is expanded
|
|
6
|
+
|
|
7
|
+
C<A<>> is replaced by the text of its alias, and that text is read and walked
|
|
8
|
+
again, so an alias may name another one, or itself. One use of C<A<>> in a text
|
|
9
|
+
starts an expansion; the expansions inside it share its state. An alias already
|
|
10
|
+
on the way is a cycle; a chain deeper than C<ALIAS_EXPANSION_DEPTH> or more
|
|
11
|
+
than C<ALIAS_EXPANSION_BUDGET> replacements in one expansion stops it. What is
|
|
12
|
+
refused is written as C<A<name>>, as an alias that is not defined, and is told
|
|
13
|
+
once per expansion.
|
|
14
|
+
|
|
15
|
+
A footnote walks its content later, when the expansion it stands in is over; it
|
|
16
|
+
starts an expansion of its own.
|
|
17
|
+
|
|
18
|
+
=end pod
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.expandAlias = exports.ALIAS_EXPANSION_BUDGET = exports.ALIAS_EXPANSION_DEPTH = void 0;
|
|
22
|
+
exports.ALIAS_EXPANSION_DEPTH = 8;
|
|
23
|
+
exports.ALIAS_EXPANSION_BUDGET = 10000;
|
|
24
|
+
const KEY = 'aliasExpansion';
|
|
25
|
+
// Expands `term` through `walk` when the limits let it, and returns true; returns
|
|
26
|
+
// false when it is refused, after telling why once per expansion. The state lives
|
|
27
|
+
// on ctx, so copies of ctx made inside the walk share it.
|
|
28
|
+
const expandAlias = (ctx, term, walk, warn) => {
|
|
29
|
+
const open = ctx[KEY];
|
|
30
|
+
const state = open && open.chain.length ? open : { chain: [], spent: 0, told: false };
|
|
31
|
+
const refuse = (message) => {
|
|
32
|
+
if (!state.told)
|
|
33
|
+
warn(message);
|
|
34
|
+
state.told = true;
|
|
35
|
+
return { expanded: false };
|
|
36
|
+
};
|
|
37
|
+
if (state.chain.includes(term)) {
|
|
38
|
+
return refuse(`alias ${term} expands into itself: ${[...state.chain, term].join(' → ')}`);
|
|
39
|
+
}
|
|
40
|
+
if (state.chain.length >= exports.ALIAS_EXPANSION_DEPTH) {
|
|
41
|
+
return refuse(`alias ${term} expands deeper than ${exports.ALIAS_EXPANSION_DEPTH} levels: ${state.chain.join(' → ')} → ${term}`);
|
|
42
|
+
}
|
|
43
|
+
if (state.spent >= exports.ALIAS_EXPANSION_BUDGET) {
|
|
44
|
+
return refuse(`alias expansion ${state.chain[0] ?? term} makes more than ${exports.ALIAS_EXPANSION_BUDGET} replacements`);
|
|
45
|
+
}
|
|
46
|
+
state.spent++;
|
|
47
|
+
state.chain.push(term);
|
|
48
|
+
ctx[KEY] = state;
|
|
49
|
+
try {
|
|
50
|
+
return { expanded: true, result: walk() };
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
state.chain.pop();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.expandAlias = expandAlias;
|
|
57
|
+
//# sourceMappingURL=alias.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export * from './attribute-names';
|
|
|
8
8
|
export * from './blocks-helpers';
|
|
9
9
|
export * from './query-helpers';
|
|
10
10
|
export * from './ast-helpers';
|
|
11
|
+
export { expandAlias, ALIAS_EXPANSION_DEPTH, ALIAS_EXPANSION_BUDGET } from './helpers/alias';
|
|
12
|
+
export { MARKUP_CODE_DEPTH_LIMIT } from './codes/read';
|
|
11
13
|
export * from './helpers/handlers';
|
|
12
14
|
export { makeInterator } from './ast-inerator';
|
|
13
15
|
export { makeTransformer, isNamedBlock, isSemanticBlock } from './helpers/makeTransformer';
|
|
@@ -101,7 +103,7 @@ export { applySetToFirst, mergeSet, isSetTransparent, isSetTarget } from './set-
|
|
|
101
103
|
export type { SetOutcome } from './set-assign';
|
|
102
104
|
export { markGuarded, isCovered, guardedTextLeaves, getMaskedTextContent, renderCodeText } from './guard';
|
|
103
105
|
export { applyFoldedSections } from './folded-sections';
|
|
104
|
-
export { testCaption, testFoldedByAuthor } from './test-display';
|
|
106
|
+
export { testCaption, testFoldedByAuthor, canOwnTest, mayHoldTests } from './test-display';
|
|
105
107
|
export { tocTitleText } from './toc-caption';
|
|
106
108
|
export type { SelectorDoc, ParsedSelector, SelectorOptions } from './selectors';
|
|
107
109
|
export { applyImageBase } from './image-base';
|
package/lib/index.js
CHANGED
|
@@ -39,8 +39,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.
|
|
43
|
-
exports.version = exports.applyImageBase = void 0;
|
|
42
|
+
exports.renderCodeText = exports.getMaskedTextContent = exports.guardedTextLeaves = exports.isCovered = exports.markGuarded = exports.isSetTarget = exports.isSetTransparent = exports.mergeSet = exports.applySetToFirst = exports.SelectorError = exports.getDocIDs = exports.filePathMatches = exports.outermost = exports.runSelector = exports.readSelector = exports.parseSelector = exports.Writer = exports.toMarkdown = exports.toHtml = exports.parseFormattingCodes = exports.parse = exports.isWrapper = exports.isDirectiveNode = exports.holderInside = exports.blockNameOf = exports.walkConfigScopes = exports.propagateConfigDefaults = exports.mergeConfigSettings = exports.headingId = exports.frozenIds = exports.cleanIds = exports.podlitePluggable = exports.toAnyRules = exports.pluginCleanLocation = exports.quoteAttribute = exports.fingerprint = exports.assignHeadingKeys = exports.readLinkConfig = exports.parseAttributes = exports.codeConfigWithDefaults = exports.makeAttrs = exports.toAny = exports.isSemanticBlock = exports.isNamedBlock = exports.makeTransformer = exports.makeInterator = exports.MARKUP_CODE_DEPTH_LIMIT = exports.ALIAS_EXPANSION_BUDGET = exports.ALIAS_EXPANSION_DEPTH = exports.expandAlias = void 0;
|
|
43
|
+
exports.version = exports.applyImageBase = exports.tocTitleText = exports.mayHoldTests = exports.canOwnTest = exports.testFoldedByAuthor = exports.testCaption = exports.applyFoldedSections = void 0;
|
|
44
44
|
exports.toAst = toAst;
|
|
45
45
|
exports.getTextContentFromNode = getTextContentFromNode;
|
|
46
46
|
exports.getPodContentFromNode = getPodContentFromNode;
|
|
@@ -60,6 +60,12 @@ __exportStar(require("./attribute-names"), exports);
|
|
|
60
60
|
__exportStar(require("./blocks-helpers"), exports);
|
|
61
61
|
__exportStar(require("./query-helpers"), exports);
|
|
62
62
|
__exportStar(require("./ast-helpers"), exports);
|
|
63
|
+
var alias_1 = require("./helpers/alias");
|
|
64
|
+
Object.defineProperty(exports, "expandAlias", { enumerable: true, get: function () { return alias_1.expandAlias; } });
|
|
65
|
+
Object.defineProperty(exports, "ALIAS_EXPANSION_DEPTH", { enumerable: true, get: function () { return alias_1.ALIAS_EXPANSION_DEPTH; } });
|
|
66
|
+
Object.defineProperty(exports, "ALIAS_EXPANSION_BUDGET", { enumerable: true, get: function () { return alias_1.ALIAS_EXPANSION_BUDGET; } });
|
|
67
|
+
var read_1 = require("./codes/read");
|
|
68
|
+
Object.defineProperty(exports, "MARKUP_CODE_DEPTH_LIMIT", { enumerable: true, get: function () { return read_1.MARKUP_CODE_DEPTH_LIMIT; } });
|
|
63
69
|
__exportStar(require("./helpers/handlers"), exports);
|
|
64
70
|
var ast_inerator_2 = require("./ast-inerator");
|
|
65
71
|
Object.defineProperty(exports, "makeInterator", { enumerable: true, get: function () { return ast_inerator_2.makeInterator; } });
|
|
@@ -91,7 +97,7 @@ Object.defineProperty(exports, "cleanIds", { enumerable: true, get: function ()
|
|
|
91
97
|
Object.defineProperty(exports, "frozenIds", { enumerable: true, get: function () { return pluggableParser_1.frozenIds; } });
|
|
92
98
|
Object.defineProperty(exports, "headingId", { enumerable: true, get: function () { return pluggableParser_1.headingId; } });
|
|
93
99
|
const parser = __importStar(require("./grammar"));
|
|
94
|
-
const
|
|
100
|
+
const read_2 = require("./codes/read");
|
|
95
101
|
const parseAttributes_2 = require("./helpers/parseAttributes");
|
|
96
102
|
const plugin_vmargin_1 = __importDefault(require("./plugin-vmargin"));
|
|
97
103
|
const plugin_formatting_codes_1 = __importDefault(require("./plugin-formatting-codes"));
|
|
@@ -239,7 +245,7 @@ function makeTree() {
|
|
|
239
245
|
}
|
|
240
246
|
const parse = makeTree().parse;
|
|
241
247
|
exports.parse = parse;
|
|
242
|
-
const parseFormattingCodes = (text, options = {}) => (0,
|
|
248
|
+
const parseFormattingCodes = (text, options = {}) => (0, read_2.readCodes)(text, { parseAttributes: parseAttributes_2.parseAttributes, ...options });
|
|
243
249
|
exports.parseFormattingCodes = parseFormattingCodes;
|
|
244
250
|
var exportHtml_1 = require("./exportHtml");
|
|
245
251
|
Object.defineProperty(exports, "toHtml", { enumerable: true, get: function () { return __importDefault(exportHtml_1).default; } });
|
|
@@ -271,6 +277,8 @@ Object.defineProperty(exports, "applyFoldedSections", { enumerable: true, get: f
|
|
|
271
277
|
var test_display_1 = require("./test-display");
|
|
272
278
|
Object.defineProperty(exports, "testCaption", { enumerable: true, get: function () { return test_display_1.testCaption; } });
|
|
273
279
|
Object.defineProperty(exports, "testFoldedByAuthor", { enumerable: true, get: function () { return test_display_1.testFoldedByAuthor; } });
|
|
280
|
+
Object.defineProperty(exports, "canOwnTest", { enumerable: true, get: function () { return test_display_1.canOwnTest; } });
|
|
281
|
+
Object.defineProperty(exports, "mayHoldTests", { enumerable: true, get: function () { return test_display_1.mayHoldTests; } });
|
|
274
282
|
var toc_caption_1 = require("./toc-caption");
|
|
275
283
|
Object.defineProperty(exports, "tocTitleText", { enumerable: true, get: function () { return toc_caption_1.tocTitleText; } });
|
|
276
284
|
var image_base_1 = require("./image-base");
|
|
@@ -10,6 +10,7 @@ const makeTransformer_2 = require("./helpers/makeTransformer");
|
|
|
10
10
|
const config_1 = __importDefault(require("./helpers/config"));
|
|
11
11
|
const parseAttributes_1 = require("./helpers/parseAttributes");
|
|
12
12
|
const blockName_1 = require("./helpers/blockName");
|
|
13
|
+
const blocks_helpers_1 = require("./blocks-helpers");
|
|
13
14
|
// `=config C<> :allow<I>` names a markup code, not a block: the trailing angles
|
|
14
15
|
// are the marker, and what it declares belongs to the code they name
|
|
15
16
|
const codeConfigOwner = (name) => typeof name === 'string' && /^[A-Z]<>$/.test(name) ? name[0] : null;
|
|
@@ -37,6 +38,30 @@ const allowOf = (node) => {
|
|
|
37
38
|
const conf = (0, config_1.default)(node, {});
|
|
38
39
|
return conf.exists('allow') ? conf.getAllValues('allow') : undefined;
|
|
39
40
|
};
|
|
41
|
+
// The text between codes as text nodes, all the way in, so a guard mark has a
|
|
42
|
+
// node to land on. V and E keep their content as written.
|
|
43
|
+
const asTextNodes = (nodes) => nodes.map(child => typeof child === 'string'
|
|
44
|
+
? { type: 'text', value: child }
|
|
45
|
+
: child && typeof child === 'object' && Array.isArray(child.content) && child.name !== 'V' && child.name !== 'E'
|
|
46
|
+
? { ...child, content: asTextNodes(child.content) }
|
|
47
|
+
: child);
|
|
48
|
+
// A caption =set gives is read for markup codes, with the codes this place
|
|
49
|
+
// allows; one written on the block is text. The value stays a string, since
|
|
50
|
+
// selectors and =set itself match on it. A caption with no code gets nothing.
|
|
51
|
+
const withSetCaption = (n, allowedIn) => {
|
|
52
|
+
if (!n || n.caption || !Array.isArray(n.config))
|
|
53
|
+
return n;
|
|
54
|
+
const item = n.config.find(c => c && c.name === 'caption');
|
|
55
|
+
if (!item || item.from !== 'set')
|
|
56
|
+
return n;
|
|
57
|
+
const value = Array.isArray(item.value) ? item.value[0] : item.value;
|
|
58
|
+
if (typeof value !== 'string')
|
|
59
|
+
return n;
|
|
60
|
+
const content = (0, read_1.readCodes)(value, { allowedIn, parseAttributes: parseAttributes_1.parseAttributes, issues: [] });
|
|
61
|
+
if (!content.some(c => c && typeof c === 'object' && c.type === 'fcode'))
|
|
62
|
+
return n;
|
|
63
|
+
return { ...n, caption: (0, blocks_helpers_1.mkCaption)(asTextNodes(content)) };
|
|
64
|
+
};
|
|
40
65
|
const middle = opt => tree => {
|
|
41
66
|
// the codes of one piece of text; a warning keeps the block it came from and its
|
|
42
67
|
// place in the text, and the parser turns that into a place in the source
|
|
@@ -85,6 +110,8 @@ const middle = opt => tree => {
|
|
|
85
110
|
':block': (n, ctx, visiter) => {
|
|
86
111
|
// a block is a lexical scope: a code configured inside it stays inside
|
|
87
112
|
const allowedIn = { ...(ctx.allowedIn || {}) };
|
|
113
|
+
// before any block is let through unread: a picture's caption is not its body
|
|
114
|
+
n = withSetCaption(n, allowedIn);
|
|
88
115
|
// only =pod may have childs blocks
|
|
89
116
|
if ('name' in n && n.name === 'pod')
|
|
90
117
|
return {
|
package/lib/test-display.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const testCaption: (node: any, ctx: any) => string;
|
|
2
2
|
export declare const testFoldedByAuthor: (node: any, ctx: any) => boolean | undefined;
|
|
3
3
|
export declare const longestBacktickRun: (text: string) => number;
|
|
4
|
+
export declare const canOwnTest: (node: unknown) => boolean;
|
|
5
|
+
export declare const mayHoldTests: (node: unknown) => boolean;
|
package/lib/test-display.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.longestBacktickRun = exports.testFoldedByAuthor = exports.testCaption = void 0;
|
|
6
|
+
exports.mayHoldTests = exports.canOwnTest = exports.longestBacktickRun = exports.testFoldedByAuthor = exports.testCaption = void 0;
|
|
7
7
|
const config_1 = __importDefault(require("./helpers/config"));
|
|
8
8
|
const ast_helpers_1 = require("./ast-helpers");
|
|
9
9
|
/*
|
|
@@ -64,4 +64,70 @@ exports.testFoldedByAuthor = testFoldedByAuthor;
|
|
|
64
64
|
// A fence has to be longer than any run of backticks inside what it encloses.
|
|
65
65
|
const longestBacktickRun = (text) => Math.max(0, ...(text.match(/`+/g) || []).map(run => run.length));
|
|
66
66
|
exports.longestBacktickRun = longestBacktickRun;
|
|
67
|
+
// a heading, a directive, a comment or data says nothing a test could check, and a
|
|
68
|
+
// directive wrapped into a group would lose the reach it has over what follows
|
|
69
|
+
const NOT_A_TEST_OWNER = new Set([
|
|
70
|
+
'head',
|
|
71
|
+
'comment',
|
|
72
|
+
'data',
|
|
73
|
+
'test',
|
|
74
|
+
'fixture',
|
|
75
|
+
'assert',
|
|
76
|
+
'resource',
|
|
77
|
+
'include',
|
|
78
|
+
'toc',
|
|
79
|
+
'pod',
|
|
80
|
+
]);
|
|
81
|
+
const isRecord = (value) => typeof value === 'object' && value !== null;
|
|
82
|
+
/*
|
|
83
|
+
=begin pod :kind<export>
|
|
84
|
+
|
|
85
|
+
=head2 canOwnTest
|
|
86
|
+
|
|
87
|
+
Whether a node can be the block a C<=test> right after it belongs to. A test
|
|
88
|
+
belongs to the nearest preceding sibling that is not itself a test; when that
|
|
89
|
+
sibling cannot own it, the page draws the test with no rule and the linter warns.
|
|
90
|
+
A paragraph, a list and code can; so can any block but a heading, a directive, a
|
|
91
|
+
comment, data, a part of a test, a table of contents and the blocks the tree adds,
|
|
92
|
+
whose names begin with C<_>.
|
|
93
|
+
|
|
94
|
+
=end pod
|
|
95
|
+
*/
|
|
96
|
+
const canOwnTest = (node) => {
|
|
97
|
+
if (!isRecord(node))
|
|
98
|
+
return false;
|
|
99
|
+
if (node.type === 'para' || node.type === 'list' || node.type === 'code')
|
|
100
|
+
return true;
|
|
101
|
+
if (node.type !== 'block' || typeof node.name !== 'string')
|
|
102
|
+
return false;
|
|
103
|
+
return !node.name.startsWith('_') && !NOT_A_TEST_OWNER.has(node.name);
|
|
104
|
+
};
|
|
105
|
+
exports.canOwnTest = canOwnTest;
|
|
106
|
+
// source, data and the parts of a test hold no tests of their own
|
|
107
|
+
const HOLDS_NO_TESTS = new Set([
|
|
108
|
+
'test',
|
|
109
|
+
'fixture',
|
|
110
|
+
'assert',
|
|
111
|
+
'resource',
|
|
112
|
+
'code',
|
|
113
|
+
'comment',
|
|
114
|
+
'data',
|
|
115
|
+
'markdown',
|
|
116
|
+
'input',
|
|
117
|
+
'output',
|
|
118
|
+
'formula',
|
|
119
|
+
]);
|
|
120
|
+
/*
|
|
121
|
+
=begin pod :kind<export>
|
|
122
|
+
|
|
123
|
+
=head2 mayHoldTests
|
|
124
|
+
|
|
125
|
+
Whether a test can stand among the children of a node, so that a pass over the
|
|
126
|
+
tests of a document goes into it: no for a test itself and its parts, and for
|
|
127
|
+
code, comments, data, Markdown, input, output and formulas.
|
|
128
|
+
|
|
129
|
+
=end pod
|
|
130
|
+
*/
|
|
131
|
+
const mayHoldTests = (node) => !isRecord(node) || !HOLDS_NO_TESTS.has(String(node.name));
|
|
132
|
+
exports.mayHoldTests = mayHoldTests;
|
|
67
133
|
//# sourceMappingURL=test-display.js.map
|
package/lib/types.d.ts
CHANGED
|
@@ -126,17 +126,17 @@ export interface TocItem {
|
|
|
126
126
|
}
|
|
127
127
|
export interface BlockImage extends Omit<Block, 'content'> {
|
|
128
128
|
name: 'image';
|
|
129
|
-
caption?:
|
|
129
|
+
caption?: BlockCaption;
|
|
130
130
|
link?: string;
|
|
131
131
|
content: [Image, BlockCaption?];
|
|
132
132
|
}
|
|
133
133
|
export interface BlockPicture extends Omit<Block, 'content'> {
|
|
134
134
|
name: 'picture';
|
|
135
|
-
caption?:
|
|
135
|
+
caption?: BlockCaption;
|
|
136
136
|
link?: string;
|
|
137
137
|
content: [Image, BlockCaption?];
|
|
138
138
|
}
|
|
139
|
-
export interface BlockCaption extends Omit<Block, 'content' | 'location' | 'margin' | 'config' | 'id'> {
|
|
139
|
+
export interface BlockCaption extends Omit<Block, 'content' | 'location' | 'margin' | 'config' | 'id' | 'caption'> {
|
|
140
140
|
name: 'caption';
|
|
141
141
|
content: Array<Node>;
|
|
142
142
|
}
|
|
@@ -147,7 +147,7 @@ export interface RootBlock extends Omit<Block, 'location'> {
|
|
|
147
147
|
}
|
|
148
148
|
export interface ParseDiagnostic {
|
|
149
149
|
severity: 'warning';
|
|
150
|
-
code: 'value-unreadable' | 'directive-unreadable' | 'table-row-cells' | 'table-cell-outside-row' | 'table-mixed-separators' | 'table-source-unreadable' | 'table-source-empty' | 'table-source-deferred' | 'markup-code-unclosed' | 'markup-code-longer-run' | 'markup-code-foreign-closer' | 'markup-code-reserved' | 'markup-code-unsupported' | 'markup-code-unreadable';
|
|
150
|
+
code: 'value-unreadable' | 'directive-unreadable' | 'table-row-cells' | 'table-cell-outside-row' | 'table-mixed-separators' | 'table-source-unreadable' | 'table-source-empty' | 'table-source-deferred' | 'markup-code-unclosed' | 'markup-code-longer-run' | 'markup-code-foreign-closer' | 'markup-code-reserved' | 'markup-code-unsupported' | 'markup-code-unreadable' | 'markup-code-too-deep';
|
|
151
151
|
message: string;
|
|
152
152
|
location: Location;
|
|
153
153
|
}
|
|
@@ -362,6 +362,7 @@ export interface Block {
|
|
|
362
362
|
id?: string;
|
|
363
363
|
guarded?: boolean;
|
|
364
364
|
set?: ConfigItem[];
|
|
365
|
+
caption?: BlockCaption;
|
|
365
366
|
}
|
|
366
367
|
export interface BlockPod extends Block {
|
|
367
368
|
name: 'pod';
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.79";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@podlite/schema",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.79",
|
|
4
|
+
"description": "Parser and AST schema for Podlite: typed blocks with positions, selectors, validate, traverse, and transform.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
package/schema/AstTree.json
CHANGED
|
@@ -344,6 +344,9 @@
|
|
|
344
344
|
"items": {
|
|
345
345
|
"$ref": "#/definitions/ConfigItem"
|
|
346
346
|
}
|
|
347
|
+
},
|
|
348
|
+
"caption": {
|
|
349
|
+
"$ref": "#/definitions/BlockCaption"
|
|
347
350
|
}
|
|
348
351
|
},
|
|
349
352
|
"required": [
|
|
@@ -400,6 +403,39 @@
|
|
|
400
403
|
"value"
|
|
401
404
|
]
|
|
402
405
|
},
|
|
406
|
+
"BlockCaption": {
|
|
407
|
+
"type": "object",
|
|
408
|
+
"properties": {
|
|
409
|
+
"name": {
|
|
410
|
+
"type": "string",
|
|
411
|
+
"const": "caption"
|
|
412
|
+
},
|
|
413
|
+
"content": {
|
|
414
|
+
"type": "array",
|
|
415
|
+
"items": {
|
|
416
|
+
"$ref": "#/definitions/PodNode"
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
"set": {
|
|
420
|
+
"type": "array",
|
|
421
|
+
"items": {
|
|
422
|
+
"$ref": "#/definitions/ConfigItem"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
"type": {
|
|
426
|
+
"type": "string",
|
|
427
|
+
"const": "block"
|
|
428
|
+
},
|
|
429
|
+
"guarded": {
|
|
430
|
+
"type": "boolean"
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
"required": [
|
|
434
|
+
"content",
|
|
435
|
+
"name",
|
|
436
|
+
"type"
|
|
437
|
+
]
|
|
438
|
+
},
|
|
403
439
|
"BlockData": {
|
|
404
440
|
"type": "object",
|
|
405
441
|
"properties": {
|
|
@@ -447,6 +483,9 @@
|
|
|
447
483
|
"items": {
|
|
448
484
|
"$ref": "#/definitions/ConfigItem"
|
|
449
485
|
}
|
|
486
|
+
},
|
|
487
|
+
"caption": {
|
|
488
|
+
"$ref": "#/definitions/BlockCaption"
|
|
450
489
|
}
|
|
451
490
|
},
|
|
452
491
|
"required": [
|
|
@@ -480,6 +519,9 @@
|
|
|
480
519
|
"$ref": "#/definitions/ConfigItem"
|
|
481
520
|
}
|
|
482
521
|
},
|
|
522
|
+
"caption": {
|
|
523
|
+
"$ref": "#/definitions/BlockCaption"
|
|
524
|
+
},
|
|
483
525
|
"margin": {
|
|
484
526
|
"type": "string"
|
|
485
527
|
},
|
|
@@ -584,6 +626,9 @@
|
|
|
584
626
|
"items": {
|
|
585
627
|
"$ref": "#/definitions/ConfigItem"
|
|
586
628
|
}
|
|
629
|
+
},
|
|
630
|
+
"caption": {
|
|
631
|
+
"$ref": "#/definitions/BlockCaption"
|
|
587
632
|
}
|
|
588
633
|
},
|
|
589
634
|
"required": [
|
|
@@ -653,6 +698,9 @@
|
|
|
653
698
|
"items": {
|
|
654
699
|
"$ref": "#/definitions/ConfigItem"
|
|
655
700
|
}
|
|
701
|
+
},
|
|
702
|
+
"caption": {
|
|
703
|
+
"$ref": "#/definitions/BlockCaption"
|
|
656
704
|
}
|
|
657
705
|
},
|
|
658
706
|
"required": [
|
|
@@ -710,6 +758,9 @@
|
|
|
710
758
|
"items": {
|
|
711
759
|
"$ref": "#/definitions/ConfigItem"
|
|
712
760
|
}
|
|
761
|
+
},
|
|
762
|
+
"caption": {
|
|
763
|
+
"$ref": "#/definitions/BlockCaption"
|
|
713
764
|
}
|
|
714
765
|
},
|
|
715
766
|
"required": [
|
|
@@ -767,6 +818,9 @@
|
|
|
767
818
|
"items": {
|
|
768
819
|
"$ref": "#/definitions/ConfigItem"
|
|
769
820
|
}
|
|
821
|
+
},
|
|
822
|
+
"caption": {
|
|
823
|
+
"$ref": "#/definitions/BlockCaption"
|
|
770
824
|
}
|
|
771
825
|
},
|
|
772
826
|
"required": [
|
|
@@ -824,6 +878,9 @@
|
|
|
824
878
|
"items": {
|
|
825
879
|
"$ref": "#/definitions/ConfigItem"
|
|
826
880
|
}
|
|
881
|
+
},
|
|
882
|
+
"caption": {
|
|
883
|
+
"$ref": "#/definitions/BlockCaption"
|
|
827
884
|
}
|
|
828
885
|
},
|
|
829
886
|
"required": [
|
|
@@ -881,6 +938,9 @@
|
|
|
881
938
|
"items": {
|
|
882
939
|
"$ref": "#/definitions/ConfigItem"
|
|
883
940
|
}
|
|
941
|
+
},
|
|
942
|
+
"caption": {
|
|
943
|
+
"$ref": "#/definitions/BlockCaption"
|
|
884
944
|
}
|
|
885
945
|
},
|
|
886
946
|
"required": [
|
|
@@ -938,6 +998,9 @@
|
|
|
938
998
|
"items": {
|
|
939
999
|
"$ref": "#/definitions/ConfigItem"
|
|
940
1000
|
}
|
|
1001
|
+
},
|
|
1002
|
+
"caption": {
|
|
1003
|
+
"$ref": "#/definitions/BlockCaption"
|
|
941
1004
|
}
|
|
942
1005
|
},
|
|
943
1006
|
"required": [
|
|
@@ -1004,6 +1067,9 @@
|
|
|
1004
1067
|
"items": {
|
|
1005
1068
|
"$ref": "#/definitions/ConfigItem"
|
|
1006
1069
|
}
|
|
1070
|
+
},
|
|
1071
|
+
"caption": {
|
|
1072
|
+
"$ref": "#/definitions/BlockCaption"
|
|
1007
1073
|
}
|
|
1008
1074
|
},
|
|
1009
1075
|
"required": [
|
|
@@ -1062,6 +1128,9 @@
|
|
|
1062
1128
|
"items": {
|
|
1063
1129
|
"$ref": "#/definitions/ConfigItem"
|
|
1064
1130
|
}
|
|
1131
|
+
},
|
|
1132
|
+
"caption": {
|
|
1133
|
+
"$ref": "#/definitions/BlockCaption"
|
|
1065
1134
|
}
|
|
1066
1135
|
},
|
|
1067
1136
|
"required": [
|
|
@@ -1119,6 +1188,9 @@
|
|
|
1119
1188
|
"items": {
|
|
1120
1189
|
"$ref": "#/definitions/ConfigItem"
|
|
1121
1190
|
}
|
|
1191
|
+
},
|
|
1192
|
+
"caption": {
|
|
1193
|
+
"$ref": "#/definitions/BlockCaption"
|
|
1122
1194
|
}
|
|
1123
1195
|
},
|
|
1124
1196
|
"required": [
|
|
@@ -1790,6 +1862,9 @@
|
|
|
1790
1862
|
"$ref": "#/definitions/ConfigItem"
|
|
1791
1863
|
}
|
|
1792
1864
|
},
|
|
1865
|
+
"caption": {
|
|
1866
|
+
"$ref": "#/definitions/BlockCaption"
|
|
1867
|
+
},
|
|
1793
1868
|
"margin": {
|
|
1794
1869
|
"type": "string"
|
|
1795
1870
|
},
|
|
@@ -1850,6 +1925,9 @@
|
|
|
1850
1925
|
"$ref": "#/definitions/ConfigItem"
|
|
1851
1926
|
}
|
|
1852
1927
|
},
|
|
1928
|
+
"caption": {
|
|
1929
|
+
"$ref": "#/definitions/BlockCaption"
|
|
1930
|
+
},
|
|
1853
1931
|
"margin": {
|
|
1854
1932
|
"type": "string"
|
|
1855
1933
|
},
|
|
@@ -1903,6 +1981,7 @@
|
|
|
1903
1981
|
"markup-code-foreign-closer",
|
|
1904
1982
|
"markup-code-longer-run",
|
|
1905
1983
|
"markup-code-reserved",
|
|
1984
|
+
"markup-code-too-deep",
|
|
1906
1985
|
"markup-code-unclosed",
|
|
1907
1986
|
"markup-code-unreadable",
|
|
1908
1987
|
"markup-code-unsupported",
|
|
@@ -1983,6 +2062,9 @@
|
|
|
1983
2062
|
"$ref": "#/definitions/ConfigItem"
|
|
1984
2063
|
}
|
|
1985
2064
|
},
|
|
2065
|
+
"caption": {
|
|
2066
|
+
"$ref": "#/definitions/BlockCaption"
|
|
2067
|
+
},
|
|
1986
2068
|
"margin": {
|
|
1987
2069
|
"type": "string"
|
|
1988
2070
|
},
|
|
@@ -2213,6 +2295,9 @@
|
|
|
2213
2295
|
"items": {
|
|
2214
2296
|
"$ref": "#/definitions/ConfigItem"
|
|
2215
2297
|
}
|
|
2298
|
+
},
|
|
2299
|
+
"caption": {
|
|
2300
|
+
"$ref": "#/definitions/BlockCaption"
|
|
2216
2301
|
}
|
|
2217
2302
|
},
|
|
2218
2303
|
"required": [
|
|
@@ -2325,6 +2410,9 @@
|
|
|
2325
2410
|
"items": {
|
|
2326
2411
|
"$ref": "#/definitions/ConfigItem"
|
|
2327
2412
|
}
|
|
2413
|
+
},
|
|
2414
|
+
"caption": {
|
|
2415
|
+
"$ref": "#/definitions/BlockCaption"
|
|
2328
2416
|
}
|
|
2329
2417
|
},
|
|
2330
2418
|
"required": [
|
|
@@ -2343,7 +2431,7 @@
|
|
|
2343
2431
|
"const": "picture"
|
|
2344
2432
|
},
|
|
2345
2433
|
"caption": {
|
|
2346
|
-
"
|
|
2434
|
+
"$ref": "#/definitions/BlockCaption"
|
|
2347
2435
|
},
|
|
2348
2436
|
"link": {
|
|
2349
2437
|
"type": "string"
|
|
@@ -2427,39 +2515,6 @@
|
|
|
2427
2515
|
"type"
|
|
2428
2516
|
]
|
|
2429
2517
|
},
|
|
2430
|
-
"BlockCaption": {
|
|
2431
|
-
"type": "object",
|
|
2432
|
-
"properties": {
|
|
2433
|
-
"name": {
|
|
2434
|
-
"type": "string",
|
|
2435
|
-
"const": "caption"
|
|
2436
|
-
},
|
|
2437
|
-
"content": {
|
|
2438
|
-
"type": "array",
|
|
2439
|
-
"items": {
|
|
2440
|
-
"$ref": "#/definitions/PodNode"
|
|
2441
|
-
}
|
|
2442
|
-
},
|
|
2443
|
-
"set": {
|
|
2444
|
-
"type": "array",
|
|
2445
|
-
"items": {
|
|
2446
|
-
"$ref": "#/definitions/ConfigItem"
|
|
2447
|
-
}
|
|
2448
|
-
},
|
|
2449
|
-
"type": {
|
|
2450
|
-
"type": "string",
|
|
2451
|
-
"const": "block"
|
|
2452
|
-
},
|
|
2453
|
-
"guarded": {
|
|
2454
|
-
"type": "boolean"
|
|
2455
|
-
}
|
|
2456
|
-
},
|
|
2457
|
-
"required": [
|
|
2458
|
-
"content",
|
|
2459
|
-
"name",
|
|
2460
|
-
"type"
|
|
2461
|
-
]
|
|
2462
|
-
},
|
|
2463
2518
|
"BlockImage": {
|
|
2464
2519
|
"type": "object",
|
|
2465
2520
|
"properties": {
|
|
@@ -2468,7 +2523,7 @@
|
|
|
2468
2523
|
"const": "image"
|
|
2469
2524
|
},
|
|
2470
2525
|
"caption": {
|
|
2471
|
-
"
|
|
2526
|
+
"$ref": "#/definitions/BlockCaption"
|
|
2472
2527
|
},
|
|
2473
2528
|
"link": {
|
|
2474
2529
|
"type": "string"
|