@podlite/schema 0.0.67 → 0.0.68
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 +32 -0
- package/esm/ast-helpers.d.ts +25 -1
- package/esm/ast-helpers.js +101 -2
- package/esm/ast-helpers.js.map +1 -1
- package/esm/attribute-names.d.ts +5 -0
- package/esm/attribute-names.js +36 -0
- package/esm/attribute-names.js.map +1 -0
- package/esm/exportAny.js +2 -2
- package/esm/exportAny.js.map +1 -1
- package/esm/exportHtml.js +50 -17
- package/esm/exportHtml.js.map +1 -1
- package/esm/exportMarkdown.js +28 -16
- package/esm/exportMarkdown.js.map +1 -1
- package/esm/folded-sections.d.ts +1 -0
- package/esm/folded-sections.js +80 -0
- package/esm/folded-sections.js.map +1 -0
- package/esm/grammarfc.js +6099 -15834
- package/esm/grammarfc.js.map +1 -1
- package/esm/helpers/corePlugins.js +9 -3
- package/esm/helpers/corePlugins.js.map +1 -1
- package/esm/helpers/html-attr.d.ts +1 -0
- package/esm/helpers/html-attr.js +6 -0
- package/esm/helpers/html-attr.js.map +1 -0
- package/esm/index.d.ts +4 -1
- package/esm/index.js +4 -1
- package/esm/index.js.map +1 -1
- package/esm/pluggableParser.d.ts +1 -1
- package/esm/pluggableParser.js +4 -1
- package/esm/pluggableParser.js.map +1 -1
- package/esm/types.d.ts +27 -16
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/ast-helpers.d.ts +25 -1
- package/lib/ast-helpers.js +106 -3
- package/lib/attribute-names.d.ts +5 -0
- package/lib/attribute-names.js +41 -0
- package/lib/exportAny.js +1 -1
- package/lib/exportHtml.js +52 -19
- package/lib/exportMarkdown.js +27 -15
- package/lib/folded-sections.d.ts +1 -0
- package/lib/folded-sections.js +84 -0
- package/lib/grammarfc.js +6099 -15834
- package/lib/helpers/corePlugins.js +9 -3
- package/lib/helpers/html-attr.d.ts +1 -0
- package/lib/helpers/html-attr.js +10 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.js +7 -1
- package/lib/pluggableParser.d.ts +1 -1
- package/lib/pluggableParser.js +5 -1
- package/lib/types.d.ts +27 -16
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/schema/AstTree.json +588 -436
- package/schema/PodliteDocument.json +588 -436
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.core = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
|
+
const ast_helpers_1 = require("../ast-helpers");
|
|
6
|
+
const html_attr_1 = require("./html-attr");
|
|
5
7
|
exports.core = {
|
|
6
8
|
':image': {
|
|
7
9
|
toHtml: writer => node => {
|
|
8
10
|
if (typeof node !== 'string' && 'type' in node && node.type === 'image') {
|
|
9
11
|
writer.writeRaw(`<img`);
|
|
10
|
-
writer.writeRaw(` src="${node.src}"`);
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
writer.writeRaw(` src="${(0, html_attr_1.quoteAttribute)(String(node.src ?? ''))}"`);
|
|
13
|
+
// html reads a missing alt as "this image is part of the content" and an
|
|
14
|
+
// empty one as "decorative", so an alternative text the author never wrote
|
|
15
|
+
// is left out
|
|
16
|
+
const alt = (0, ast_helpers_1.writtenValue)(node.alt);
|
|
17
|
+
if (alt !== undefined) {
|
|
18
|
+
writer.writeRaw(` alt="${(0, html_attr_1.quoteAttribute)(alt)}"`);
|
|
13
19
|
}
|
|
14
20
|
writer.writeRaw(`/>`);
|
|
15
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const quoteAttribute: (value: string) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.quoteAttribute = void 0;
|
|
4
|
+
// The value of an attribute written inside double quotes. The ampersand goes
|
|
5
|
+
// first: escaping it after the quote would rewrite the `"` this produced. A
|
|
6
|
+
// value arrives as document text, so every `&` in it is a literal one the
|
|
7
|
+
// browser must not read as a character reference.
|
|
8
|
+
const quoteAttribute = (value) => value.replace(/&/g, '&').replace(/"/g, '"');
|
|
9
|
+
exports.quoteAttribute = quoteAttribute;
|
|
10
|
+
//# sourceMappingURL=html-attr.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { PodliteDocument } from './types';
|
|
|
4
4
|
export { AstTree } from './types';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export * from './block-names';
|
|
7
|
+
export * from './attribute-names';
|
|
7
8
|
export * from './blocks-helpers';
|
|
8
9
|
export * from './query-helpers';
|
|
9
10
|
export * from './ast-helpers';
|
|
@@ -14,10 +15,11 @@ export { toAny } from './exportAny';
|
|
|
14
15
|
export { makeAttrs, codeConfigWithDefaults } from './helpers/config';
|
|
15
16
|
export { parseAttributes } from './helpers/parseAttributes';
|
|
16
17
|
export { readLinkConfig } from './helpers/link-config';
|
|
18
|
+
export { quoteAttribute } from './helpers/html-attr';
|
|
17
19
|
export type { LinkConfig } from './helpers/link-config';
|
|
18
20
|
export { pluginCleanLocation } from './plugin-clean-location';
|
|
19
21
|
export { toAnyRules } from './helpers/plugins';
|
|
20
|
-
export { podlitePluggable, Podlite, PodliteExport, cleanIds, frozenIds } from './pluggableParser';
|
|
22
|
+
export { podlitePluggable, Podlite, PodliteExport, cleanIds, frozenIds, headingId } from './pluggableParser';
|
|
21
23
|
export declare function toAst(): {};
|
|
22
24
|
export type SchemaValidationError = ErrorObject<string, Record<string, any>>;
|
|
23
25
|
export declare function getTextContentFromNode(node: PodNode): string;
|
|
@@ -89,6 +91,7 @@ export { default as toMarkdown } from './exportMarkdown';
|
|
|
89
91
|
export { default as Writer } from './writer';
|
|
90
92
|
export { parseSelector, runSelector, filePathMatches } from './selectors';
|
|
91
93
|
export { markGuarded, isCovered } from './guard';
|
|
94
|
+
export { applyFoldedSections } from './folded-sections';
|
|
92
95
|
export type { SelectorDoc, ParsedSelector } from './selectors';
|
|
93
96
|
export { applyImageBase } from './image-base';
|
|
94
97
|
export { version } from './version';
|
package/lib/index.js
CHANGED
|
@@ -39,7 +39,7 @@ 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.version = exports.applyImageBase = exports.isCovered = exports.markGuarded = exports.filePathMatches = exports.runSelector = exports.parseSelector = exports.Writer = exports.toMarkdown = exports.toHtml = exports.parseFormattingCodes = exports.parse = exports.frozenIds = exports.cleanIds = exports.podlitePluggable = exports.toAnyRules = exports.pluginCleanLocation = exports.readLinkConfig = exports.parseAttributes = exports.codeConfigWithDefaults = exports.makeAttrs = exports.toAny = exports.isSemanticBlock = exports.isNamedBlock = exports.makeTransformer = exports.makeInterator = void 0;
|
|
42
|
+
exports.version = exports.applyImageBase = exports.applyFoldedSections = exports.isCovered = exports.markGuarded = exports.filePathMatches = exports.runSelector = exports.parseSelector = exports.Writer = exports.toMarkdown = exports.toHtml = exports.parseFormattingCodes = exports.parse = exports.headingId = exports.frozenIds = exports.cleanIds = exports.podlitePluggable = exports.toAnyRules = exports.pluginCleanLocation = exports.quoteAttribute = exports.readLinkConfig = exports.parseAttributes = exports.codeConfigWithDefaults = exports.makeAttrs = exports.toAny = exports.isSemanticBlock = exports.isNamedBlock = exports.makeTransformer = exports.makeInterator = void 0;
|
|
43
43
|
exports.toAst = toAst;
|
|
44
44
|
exports.getTextContentFromNode = getTextContentFromNode;
|
|
45
45
|
exports.getPodContentFromNode = getPodContentFromNode;
|
|
@@ -55,6 +55,7 @@ const jsonShemes = __importStar(require("../schema"));
|
|
|
55
55
|
const ast_inerator_1 = require("./ast-inerator");
|
|
56
56
|
__exportStar(require("./types"), exports);
|
|
57
57
|
__exportStar(require("./block-names"), exports);
|
|
58
|
+
__exportStar(require("./attribute-names"), exports);
|
|
58
59
|
__exportStar(require("./blocks-helpers"), exports);
|
|
59
60
|
__exportStar(require("./query-helpers"), exports);
|
|
60
61
|
__exportStar(require("./ast-helpers"), exports);
|
|
@@ -74,6 +75,8 @@ var parseAttributes_1 = require("./helpers/parseAttributes");
|
|
|
74
75
|
Object.defineProperty(exports, "parseAttributes", { enumerable: true, get: function () { return parseAttributes_1.parseAttributes; } });
|
|
75
76
|
var link_config_1 = require("./helpers/link-config");
|
|
76
77
|
Object.defineProperty(exports, "readLinkConfig", { enumerable: true, get: function () { return link_config_1.readLinkConfig; } });
|
|
78
|
+
var html_attr_1 = require("./helpers/html-attr");
|
|
79
|
+
Object.defineProperty(exports, "quoteAttribute", { enumerable: true, get: function () { return html_attr_1.quoteAttribute; } });
|
|
77
80
|
var plugin_clean_location_1 = require("./plugin-clean-location");
|
|
78
81
|
Object.defineProperty(exports, "pluginCleanLocation", { enumerable: true, get: function () { return plugin_clean_location_1.pluginCleanLocation; } });
|
|
79
82
|
var plugins_1 = require("./helpers/plugins");
|
|
@@ -82,6 +85,7 @@ var pluggableParser_1 = require("./pluggableParser");
|
|
|
82
85
|
Object.defineProperty(exports, "podlitePluggable", { enumerable: true, get: function () { return pluggableParser_1.podlitePluggable; } });
|
|
83
86
|
Object.defineProperty(exports, "cleanIds", { enumerable: true, get: function () { return pluggableParser_1.cleanIds; } });
|
|
84
87
|
Object.defineProperty(exports, "frozenIds", { enumerable: true, get: function () { return pluggableParser_1.frozenIds; } });
|
|
88
|
+
Object.defineProperty(exports, "headingId", { enumerable: true, get: function () { return pluggableParser_1.headingId; } });
|
|
85
89
|
const parser = __importStar(require("./grammar"));
|
|
86
90
|
const grammarfc_1 = require("./grammarfc");
|
|
87
91
|
const parseAttributes_2 = require("./helpers/parseAttributes");
|
|
@@ -230,6 +234,8 @@ Object.defineProperty(exports, "filePathMatches", { enumerable: true, get: funct
|
|
|
230
234
|
var guard_1 = require("./guard");
|
|
231
235
|
Object.defineProperty(exports, "markGuarded", { enumerable: true, get: function () { return guard_1.markGuarded; } });
|
|
232
236
|
Object.defineProperty(exports, "isCovered", { enumerable: true, get: function () { return guard_1.isCovered; } });
|
|
237
|
+
var folded_sections_1 = require("./folded-sections");
|
|
238
|
+
Object.defineProperty(exports, "applyFoldedSections", { enumerable: true, get: function () { return folded_sections_1.applyFoldedSections; } });
|
|
233
239
|
var image_base_1 = require("./image-base");
|
|
234
240
|
Object.defineProperty(exports, "applyImageBase", { enumerable: true, get: function () { return image_base_1.applyImageBase; } });
|
|
235
241
|
var version_1 = require("./version");
|
package/lib/pluggableParser.d.ts
CHANGED
package/lib/pluggableParser.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.podlitePluggable = exports.frozenIds = exports.cleanIds = void 0;
|
|
6
|
+
exports.podlitePluggable = exports.headingId = exports.frozenIds = exports.cleanIds = void 0;
|
|
7
7
|
const _1 = require(".");
|
|
8
8
|
const exportMarkdown_1 = __importDefault(require("./exportMarkdown"));
|
|
9
9
|
const ids_1 = __importDefault(require("./helpers/ids"));
|
|
@@ -12,9 +12,11 @@ const configPropagation_1 = require("./helpers/configPropagation");
|
|
|
12
12
|
const headingNumbering_1 = require("./helpers/headingNumbering");
|
|
13
13
|
const itemNumbering_1 = require("./helpers/itemNumbering");
|
|
14
14
|
const guard_1 = require("./guard");
|
|
15
|
+
const folded_sections_1 = require("./folded-sections");
|
|
15
16
|
var ids_2 = require("./helpers/ids");
|
|
16
17
|
Object.defineProperty(exports, "cleanIds", { enumerable: true, get: function () { return ids_2.cleanIds; } });
|
|
17
18
|
Object.defineProperty(exports, "frozenIds", { enumerable: true, get: function () { return ids_2.frozenIds; } });
|
|
19
|
+
Object.defineProperty(exports, "headingId", { enumerable: true, get: function () { return ids_2.headingId; } });
|
|
18
20
|
const podlitePluggable = ({ plugins = {} } = {}) => {
|
|
19
21
|
let instance = function () { };
|
|
20
22
|
let _plugins = [];
|
|
@@ -80,6 +82,7 @@ const podlitePluggable = ({ plugins = {} } = {}) => {
|
|
|
80
82
|
(0, itemNumbering_1.promoteOrderedLists)(resultAfter.interator);
|
|
81
83
|
(0, headingNumbering_1.attachHeadingNumberPrefix)(resultAfter.interator);
|
|
82
84
|
(0, guard_1.markGuarded)(resultAfter.interator);
|
|
85
|
+
resultAfter.interator = (0, folded_sections_1.applyFoldedSections)(resultAfter.interator);
|
|
83
86
|
}
|
|
84
87
|
return resultAfter;
|
|
85
88
|
}
|
|
@@ -88,6 +91,7 @@ const podlitePluggable = ({ plugins = {} } = {}) => {
|
|
|
88
91
|
(0, itemNumbering_1.promoteOrderedLists)(result.interator);
|
|
89
92
|
(0, headingNumbering_1.attachHeadingNumberPrefix)(result.interator);
|
|
90
93
|
(0, guard_1.markGuarded)(result.interator);
|
|
94
|
+
result.interator = (0, folded_sections_1.applyFoldedSections)(result.interator);
|
|
91
95
|
}
|
|
92
96
|
return result;
|
|
93
97
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -100,11 +100,16 @@ export interface Image {
|
|
|
100
100
|
alt?: string;
|
|
101
101
|
link?: string;
|
|
102
102
|
}
|
|
103
|
+
export interface ParaBuilt {
|
|
104
|
+
type: 'para';
|
|
105
|
+
content: Array<Node | FormattingCodes>;
|
|
106
|
+
}
|
|
103
107
|
export interface Toc {
|
|
104
108
|
type: 'toc';
|
|
105
109
|
title?: string;
|
|
106
110
|
folded?: boolean;
|
|
107
111
|
foldedLevels?: Record<number, boolean>;
|
|
112
|
+
location?: Location;
|
|
108
113
|
content: TocList;
|
|
109
114
|
}
|
|
110
115
|
export interface TocList {
|
|
@@ -114,8 +119,8 @@ export interface TocList {
|
|
|
114
119
|
}
|
|
115
120
|
export interface TocItem {
|
|
116
121
|
type: 'toc-item';
|
|
117
|
-
node: PodNode;
|
|
118
|
-
content: Array<Node>;
|
|
122
|
+
node: PodNode | ParaBuilt;
|
|
123
|
+
content: Array<Node | ParaBuilt>;
|
|
119
124
|
}
|
|
120
125
|
export interface BlockImage extends Omit<Block, 'content'> {
|
|
121
126
|
name: 'image';
|
|
@@ -152,7 +157,7 @@ export interface FormattingCodeB {
|
|
|
152
157
|
export interface FormattingCodeC {
|
|
153
158
|
type: 'fcode';
|
|
154
159
|
name: 'C';
|
|
155
|
-
content?: Array<
|
|
160
|
+
content?: Array<Node>;
|
|
156
161
|
}
|
|
157
162
|
export interface FormattingCodeE {
|
|
158
163
|
type: 'fcode';
|
|
@@ -179,23 +184,23 @@ export interface FormattingCodeF {
|
|
|
179
184
|
export interface FormattingCodeN {
|
|
180
185
|
type: 'fcode';
|
|
181
186
|
name: 'N';
|
|
182
|
-
content?: Array<
|
|
187
|
+
content?: Array<Node>;
|
|
183
188
|
}
|
|
184
189
|
export interface FormattingCodeX {
|
|
185
190
|
type: 'fcode';
|
|
186
191
|
name: 'X';
|
|
187
192
|
entry: Array<string> | null;
|
|
188
|
-
content?: Array<
|
|
193
|
+
content?: Array<Node>;
|
|
189
194
|
}
|
|
190
195
|
export interface FormattingCodeZ {
|
|
191
196
|
type: 'fcode';
|
|
192
197
|
name: 'Z';
|
|
193
|
-
content?: string;
|
|
198
|
+
content?: string | Text;
|
|
194
199
|
}
|
|
195
200
|
export interface FormattingCodeV {
|
|
196
201
|
type: 'fcode';
|
|
197
202
|
name: 'V';
|
|
198
|
-
content?: string;
|
|
203
|
+
content?: string | Text;
|
|
199
204
|
}
|
|
200
205
|
export interface FormattingCodeS {
|
|
201
206
|
type: 'fcode';
|
|
@@ -211,7 +216,7 @@ export interface FormattingCodeD {
|
|
|
211
216
|
type: 'fcode';
|
|
212
217
|
name: 'D';
|
|
213
218
|
synonyms: Array<string>;
|
|
214
|
-
content:
|
|
219
|
+
content: Array<Node>;
|
|
215
220
|
}
|
|
216
221
|
export interface FormattingCodeL {
|
|
217
222
|
type: 'fcode';
|
|
@@ -225,18 +230,18 @@ export interface FormattingCodeW {
|
|
|
225
230
|
name: 'W';
|
|
226
231
|
meta: string | null;
|
|
227
232
|
config?: ConfigItem[];
|
|
228
|
-
content:
|
|
233
|
+
content: Array<Node>;
|
|
229
234
|
}
|
|
230
235
|
export interface FormattingCodeI {
|
|
231
236
|
type: 'fcode';
|
|
232
237
|
name: 'I';
|
|
233
|
-
meta
|
|
234
|
-
content:
|
|
238
|
+
meta?: string;
|
|
239
|
+
content: Array<Node>;
|
|
235
240
|
}
|
|
236
241
|
export interface FormattingCodeAny {
|
|
237
242
|
type: 'fcode';
|
|
238
243
|
name: string;
|
|
239
|
-
content?: Array<
|
|
244
|
+
content?: Array<Node>;
|
|
240
245
|
}
|
|
241
246
|
export interface Ambient {
|
|
242
247
|
type: 'ambient';
|
|
@@ -260,6 +265,12 @@ export interface Para {
|
|
|
260
265
|
location: Location;
|
|
261
266
|
content: Array<Node | FormattingCodes>;
|
|
262
267
|
}
|
|
268
|
+
export interface ParaTerm {
|
|
269
|
+
type: 'para';
|
|
270
|
+
name: 'term';
|
|
271
|
+
text: string;
|
|
272
|
+
content: Array<Node | FormattingCodes>;
|
|
273
|
+
}
|
|
263
274
|
export interface Code {
|
|
264
275
|
type: 'code';
|
|
265
276
|
text: string;
|
|
@@ -273,8 +284,8 @@ export interface BlankLine {
|
|
|
273
284
|
export interface List {
|
|
274
285
|
type: 'list';
|
|
275
286
|
level: string | number;
|
|
276
|
-
content: Array<BlockItem | BlankLine | List>;
|
|
277
|
-
list: 'itemized';
|
|
287
|
+
content: Array<BlockItem | BlockDefn | BlankLine | List>;
|
|
288
|
+
list: 'itemized' | 'task' | 'variable';
|
|
278
289
|
}
|
|
279
290
|
export interface ConfigItemKV {
|
|
280
291
|
[key: string]: string | number | boolean;
|
|
@@ -387,7 +398,7 @@ export interface TableSeparator {
|
|
|
387
398
|
export type BlockAny = BlockNamed;
|
|
388
399
|
export interface BlockNamed extends Omit<Block, 'content'> {
|
|
389
400
|
name: string;
|
|
390
|
-
content:
|
|
401
|
+
content: Array<Node> | RootBlock;
|
|
391
402
|
}
|
|
392
403
|
export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
|
|
393
404
|
name: 'Diagram';
|
|
@@ -408,7 +419,7 @@ export interface BlockFormula extends Omit<BlockNamed, 'content'> {
|
|
|
408
419
|
content: [Verbatim];
|
|
409
420
|
}
|
|
410
421
|
export type FormattingCodes = FormattingCodeA | FormattingCodeC | FormattingCodeB | FormattingCodeD | FormattingCodeE | FormattingCodeF | FormattingCodeI | FormattingCodeL | FormattingCodeW | FormattingCodeN | FormattingCodeX | FormattingCodeZ | FormattingCodeV | FormattingCodeS | FormattingCodeAny;
|
|
411
|
-
export type PodNode = Ambient | BlockPod | BlockData | BlockFormula | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockInclude | 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;
|
|
422
|
+
export type PodNode = Ambient | BlockPod | BlockData | BlockFormula | BlockCode | BlankLine | BlockNested | BlockMarkdown | BlockOutput | BlockInput | BlockInclude | BlockPara | BlockHead | BlockComment | BlockDefn | string | Para | ParaTerm | ParaBuilt | Text | Code | BlockNamed | BlockAny | Verbatim | BlockTable | List | BlockConfig | BlockItem | Alias | BlockToc | BlockPicture | BlockImage | Image | RootBlock | Separator | BlockCaption | FormattingCodes | Toc;
|
|
412
423
|
export type Node = PodNode;
|
|
413
424
|
export type AstTree = Array<PodNode>;
|
|
414
425
|
export type PodliteDocument = RootBlock;
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.68";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED