@podlite/schema 0.0.84 → 0.0.86
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 +50 -0
- package/esm/codes/scan.js +26 -22
- package/esm/codes/scan.js.map +1 -1
- package/esm/helpers/itemNumbering.d.ts +2 -1
- package/esm/helpers/itemNumbering.js +3 -2
- package/esm/helpers/itemNumbering.js.map +1 -1
- package/esm/helpers/numberedShorthand.d.ts +2 -1
- package/esm/helpers/numberedShorthand.js +24 -4
- package/esm/helpers/numberedShorthand.js.map +1 -1
- package/esm/index.d.ts +4 -1
- package/esm/index.js +4 -1
- package/esm/index.js.map +1 -1
- package/esm/markup-code-letters.d.ts +2 -0
- package/esm/markup-code-letters.js +65 -0
- package/esm/markup-code-letters.js.map +1 -0
- package/esm/pluggableParser.js +6 -2
- package/esm/pluggableParser.js.map +1 -1
- package/esm/plugin-data-table.js +76 -39
- package/esm/plugin-data-table.js.map +1 -1
- package/esm/plugin-defn-fill-term.js +7 -0
- package/esm/plugin-defn-fill-term.js.map +1 -1
- package/esm/plugin-formatting-codes.js +6 -1
- package/esm/plugin-formatting-codes.js.map +1 -1
- package/esm/plugin-group-defn.js +6 -8
- package/esm/plugin-group-defn.js.map +1 -1
- package/esm/plugin-group-items.js +2 -2
- package/esm/plugin-group-items.js.map +1 -1
- package/esm/plugin-items.js +6 -5
- package/esm/plugin-items.js.map +1 -1
- package/esm/plugin-tables.d.ts +30 -3
- package/esm/plugin-tables.js +155 -50
- package/esm/plugin-tables.js.map +1 -1
- package/esm/selectors.d.ts +1 -0
- package/esm/selectors.js +37 -4
- package/esm/selectors.js.map +1 -1
- package/esm/types.d.ts +3 -2
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/codes/scan.js +26 -22
- package/lib/helpers/itemNumbering.d.ts +2 -1
- package/lib/helpers/itemNumbering.js +5 -3
- package/lib/helpers/numberedShorthand.d.ts +2 -1
- package/lib/helpers/numberedShorthand.js +26 -5
- package/lib/index.d.ts +4 -1
- package/lib/index.js +8 -2
- package/lib/markup-code-letters.d.ts +2 -0
- package/lib/markup-code-letters.js +69 -0
- package/lib/pluggableParser.js +6 -2
- package/lib/plugin-data-table.js +75 -38
- package/lib/plugin-defn-fill-term.js +7 -0
- package/lib/plugin-formatting-codes.js +6 -1
- package/lib/plugin-group-defn.js +6 -8
- package/lib/plugin-group-items.js +2 -5
- package/lib/plugin-items.js +5 -4
- package/lib/plugin-tables.d.ts +30 -3
- package/lib/plugin-tables.js +161 -49
- package/lib/selectors.d.ts +1 -0
- package/lib/selectors.js +38 -4
- package/lib/types.d.ts +3 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/schema/AstTree.json +11 -2
- package/schema/PodliteDocument.json +11 -2
package/lib/plugin-data-table.js
CHANGED
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const makeTransformer_1 = __importDefault(require("./helpers/makeTransformer"));
|
|
7
7
|
const config_1 = __importDefault(require("./helpers/config"));
|
|
8
8
|
const plugin_tables_1 = require("./plugin-tables");
|
|
9
|
+
// a MIME type inferred from a file extension has no parameters
|
|
9
10
|
const extensionMimeMap = {
|
|
10
|
-
csv: 'text/csv
|
|
11
|
-
tsv: 'text/tab-separated-values
|
|
12
|
-
tab: 'text/tab-separated-values
|
|
11
|
+
csv: 'text/csv',
|
|
12
|
+
tsv: 'text/tab-separated-values',
|
|
13
|
+
tab: 'text/tab-separated-values',
|
|
13
14
|
};
|
|
14
15
|
function inferMimeFromExtension(path) {
|
|
15
16
|
const m = path.match(/\.([a-z0-9]+)$/i);
|
|
@@ -17,6 +18,8 @@ function inferMimeFromExtension(path) {
|
|
|
17
18
|
return undefined;
|
|
18
19
|
return extensionMimeMap[m[1].toLowerCase()];
|
|
19
20
|
}
|
|
21
|
+
// The spaces around the items of a comma list are the syntax of the list; a
|
|
22
|
+
// single value keeps its spaces, which are part of a column name.
|
|
20
23
|
function parseColumnsList(values) {
|
|
21
24
|
if (!Array.isArray(values) || values.length === 0)
|
|
22
25
|
return [];
|
|
@@ -26,12 +29,11 @@ function parseColumnsList(values) {
|
|
|
26
29
|
.map(s => s.trim())
|
|
27
30
|
.filter(s => s.length > 0);
|
|
28
31
|
}
|
|
29
|
-
return values.map(v => String(v)
|
|
32
|
+
return values.map(v => String(v)).filter(s => s.trim().length > 0);
|
|
30
33
|
}
|
|
31
34
|
function resolveColumnIndex(col, headerRow, maxCols) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const n = parseInt(trimmed, 10);
|
|
35
|
+
if (/^\d+$/.test(col)) {
|
|
36
|
+
const n = parseInt(col, 10);
|
|
35
37
|
const idx = n - 1;
|
|
36
38
|
if (idx < 0 || idx >= maxCols) {
|
|
37
39
|
throw new Error(`column index ${n} out of range (1..${maxCols})`);
|
|
@@ -48,23 +50,33 @@ function resolveColumnIndex(col, headerRow, maxCols) {
|
|
|
48
50
|
}
|
|
49
51
|
return idx;
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
// without a header the widest row sets the width, so no value of a longer row is lost
|
|
54
|
+
const sourceWidth = (rows, hasHeader) => hasHeader ? rows[0].length : rows.reduce((widest, row) => Math.max(widest, row.length), 0);
|
|
55
|
+
// A row of the source wider or narrower than the source is reported by its place
|
|
56
|
+
// among the source records, the header row first; a table showing chosen columns
|
|
57
|
+
// neither pads nor drops the row, so its report says only what the source holds.
|
|
58
|
+
function reportSourceWidths(rows, width, projected, report, node) {
|
|
59
|
+
rows.forEach((row, i) => {
|
|
60
|
+
if (row.length === width)
|
|
61
|
+
return;
|
|
62
|
+
const place = `data-table ${projected ? 'source ' : ''}row ${i + 1} has ${row.length} of ${width} cells`;
|
|
63
|
+
const repair = row.length < width ? `, padded with ${width - row.length} empty` : `, dropped ${row.length - width}`;
|
|
64
|
+
report('table-row-cells', projected ? place : place + repair, node);
|
|
65
|
+
});
|
|
58
66
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
return rows;
|
|
62
|
-
const headerRow = [...rows[0]];
|
|
67
|
+
function renameLabels(rename, shown, headerRow, width) {
|
|
68
|
+
const given = new Map();
|
|
63
69
|
for (const [key, newName] of Object.entries(rename)) {
|
|
64
|
-
const idx = resolveColumnIndex(key, headerRow,
|
|
65
|
-
|
|
70
|
+
const idx = resolveColumnIndex(key, headerRow, width);
|
|
71
|
+
if (!shown.includes(idx))
|
|
72
|
+
throw new Error(`:rename names column ${key}, which :columns leaves out`);
|
|
73
|
+
const earlier = given.get(idx);
|
|
74
|
+
if (earlier !== undefined && earlier !== String(newName)) {
|
|
75
|
+
throw new Error(`:rename gives column ${key} two names, "${earlier}" and "${newName}"`);
|
|
76
|
+
}
|
|
77
|
+
given.set(idx, String(newName));
|
|
66
78
|
}
|
|
67
|
-
return
|
|
79
|
+
return shown.map(i => given.get(i) ?? (headerRow ? headerRow[i] ?? '' : String(i + 1)));
|
|
68
80
|
}
|
|
69
81
|
function processDataTable(node, tree, report) {
|
|
70
82
|
const attrs = (0, config_1.default)(node, {});
|
|
@@ -74,16 +86,18 @@ function processDataTable(node, tree, report) {
|
|
|
74
86
|
const columnsPresent = attrs.exists('columns');
|
|
75
87
|
const columns = columnsPresent ? parseColumnsList(attrs.getAllValues('columns')) : null;
|
|
76
88
|
const bodyText = (0, plugin_tables_1.extractDataText)(node);
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
|
|
89
|
+
// a blank line is body content too, and an empty :src is an option all the same
|
|
90
|
+
if (attrs.exists('src') && bodyText.length > 0) {
|
|
91
|
+
report('table-source-conflict', ':src and a body are both given; a data table takes its rows from one of them', node, 'error');
|
|
92
|
+
return { ...node, name: 'table', content: [] };
|
|
80
93
|
}
|
|
81
94
|
if (columnsPresent && (!columns || columns.length === 0)) {
|
|
82
95
|
throw new Error(':columns must have at least one entry; omit the attribute to render all columns');
|
|
83
96
|
}
|
|
84
97
|
let csvText;
|
|
85
98
|
let mimeType;
|
|
86
|
-
let
|
|
99
|
+
let mimeParams;
|
|
100
|
+
let carryCover = built => built;
|
|
87
101
|
if (srcRaw) {
|
|
88
102
|
const srcStr = String(srcRaw);
|
|
89
103
|
const m = srcStr.match(/^(file|data|http|https|doc):(.+)$/);
|
|
@@ -104,8 +118,14 @@ function processDataTable(node, tree, report) {
|
|
|
104
118
|
}
|
|
105
119
|
const parsed = (0, plugin_tables_1.parseMimeType)(dataMime);
|
|
106
120
|
mimeType = parsed.type;
|
|
107
|
-
|
|
121
|
+
mimeParams = parsed.params;
|
|
122
|
+
// a header written on the source is reported at the source
|
|
123
|
+
if (own && own.from === undefined)
|
|
124
|
+
(0, plugin_tables_1.reportHeaderOf)(mimeType, mimeParams, '=data-table', node, report);
|
|
108
125
|
csvText = (0, plugin_tables_1.extractDataText)(dataBlock);
|
|
126
|
+
// whatever is built out of a covered =data block is covered as well
|
|
127
|
+
if ((0, config_1.default)(dataBlock, {}).getFirstValue('masked'))
|
|
128
|
+
carryCover = built => ({ ...built, guarded: true });
|
|
109
129
|
}
|
|
110
130
|
else {
|
|
111
131
|
return node;
|
|
@@ -117,32 +137,49 @@ function processDataTable(node, tree, report) {
|
|
|
117
137
|
}
|
|
118
138
|
const parsed = (0, plugin_tables_1.parseMimeType)(mimeAttr);
|
|
119
139
|
mimeType = parsed.type;
|
|
120
|
-
|
|
140
|
+
mimeParams = parsed.params;
|
|
141
|
+
(0, plugin_tables_1.reportHeaderOf)(mimeType, mimeParams, '=data-table', node, report);
|
|
121
142
|
csvText = bodyText;
|
|
122
143
|
}
|
|
123
144
|
const isCsv = mimeType === 'text/csv';
|
|
124
145
|
const isTsv = mimeType === 'text/tab-separated-values';
|
|
146
|
+
// content that is not tabular is shown as written, as =table shows it
|
|
125
147
|
if (!isCsv && !isTsv) {
|
|
126
|
-
report('table-source-unreadable', `unsupported mime-type ${mimeType},
|
|
127
|
-
return
|
|
148
|
+
report('table-source-unreadable', `unsupported mime-type ${mimeType}, rendered as =code`, node);
|
|
149
|
+
return carryCover((0, plugin_tables_1.buildCodeFromText)(node, csvText));
|
|
128
150
|
}
|
|
129
|
-
|
|
151
|
+
const read = (0, plugin_tables_1.readTabular)(isCsv, mimeParams, csvText, srcRaw ? String(srcRaw) : 'the body', node, report);
|
|
152
|
+
if (!read)
|
|
153
|
+
return carryCover((0, plugin_tables_1.buildCodeFromText)(node, csvText));
|
|
154
|
+
const hasHeader = read.hasHeader;
|
|
155
|
+
const rows = read.rows;
|
|
156
|
+
const rename = renameMap ? Object.entries(renameMap) : [];
|
|
130
157
|
if (rows.length === 0) {
|
|
158
|
+
if (rename.length > 0)
|
|
159
|
+
throw new Error(`:rename names column ${rename[0][0]}, which the source does not have`);
|
|
131
160
|
report('table-source-empty', `${isCsv ? 'CSV' : 'TSV'} source has no rows, table rendered as empty`, node);
|
|
132
|
-
return { ...node, name: 'table', content: [] };
|
|
161
|
+
return carryCover({ ...node, name: 'table', content: [] });
|
|
133
162
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
163
|
+
const width = sourceWidth(rows, hasHeader);
|
|
164
|
+
const headerRow = hasHeader ? rows[0] : null;
|
|
165
|
+
const shown = columns ? columns.map(col => resolveColumnIndex(col, headerRow, width)) : null;
|
|
166
|
+
const data = hasHeader ? rows.slice(1) : rows;
|
|
167
|
+
const projected = shown ? data.map(row => shown.map(i => row[i] ?? '')) : data;
|
|
168
|
+
let labels = headerRow && (shown ? shown.map(i => headerRow[i] ?? '') : headerRow);
|
|
169
|
+
// a :rename, an empty one too, labels the columns of a source without a header
|
|
170
|
+
if (attrs.exists('rename')) {
|
|
171
|
+
const all = Array.from({ length: width }, (_, i) => i);
|
|
172
|
+
labels = renameLabels(Object.fromEntries(rename), shown ?? all, headerRow, width);
|
|
139
173
|
}
|
|
174
|
+
// reported once the columns and the labels are known to be readable
|
|
175
|
+
reportSourceWidths(rows, width, shown !== null, report, node);
|
|
140
176
|
const filledNode = {
|
|
141
177
|
...node,
|
|
142
178
|
name: 'table',
|
|
143
|
-
content: (0, plugin_tables_1.csvToTableContent)(
|
|
179
|
+
content: (0, plugin_tables_1.csvToTableContent)(labels ? [labels, ...projected] : projected, labels !== null, attrs.getAllValues('allow')),
|
|
144
180
|
};
|
|
145
|
-
|
|
181
|
+
// the rows of the source are reported above, by their place in the source
|
|
182
|
+
return carryCover((0, plugin_tables_1.normalizeCellCounts)(filledNode, 'data-table', () => { }, 'data-table'));
|
|
146
183
|
}
|
|
147
184
|
exports.default = (opt = {}) => tree => {
|
|
148
185
|
const report = (0, plugin_tables_1.makeTableReport)(opt);
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
* and the remaining content is treated as the definition for the term.
|
|
10
10
|
*/
|
|
11
11
|
const makeTransformer_1 = __importDefault(require("./helpers/makeTransformer"));
|
|
12
|
+
const numberedShorthand_1 = require("./helpers/numberedShorthand");
|
|
12
13
|
exports.default = () => tree => {
|
|
13
14
|
const transformer = (0, makeTransformer_1.default)({
|
|
14
15
|
defn: node => {
|
|
@@ -18,6 +19,8 @@ exports.default = () => tree => {
|
|
|
18
19
|
const count = content.length;
|
|
19
20
|
let newContent = [];
|
|
20
21
|
let isFirstParaProcessed = false;
|
|
22
|
+
// a leading # numbers the definition only when the term is the first text of the block
|
|
23
|
+
let termComesFirst = true;
|
|
21
24
|
for (let i = 0; i < count; i++) {
|
|
22
25
|
const item = content[i];
|
|
23
26
|
if (item.type === 'para' && !isFirstParaProcessed) {
|
|
@@ -34,6 +37,8 @@ exports.default = () => tree => {
|
|
|
34
37
|
text: term,
|
|
35
38
|
content: [{ type: 'text', value: term }],
|
|
36
39
|
};
|
|
40
|
+
if (termComesFirst)
|
|
41
|
+
(0, numberedShorthand_1.applyNumberedShorthand)(node, newTermPara);
|
|
37
42
|
newContent.push(newTermPara);
|
|
38
43
|
if (!(splited.length == 1 && splited[0] === '')) {
|
|
39
44
|
textNode.value = splited.join('\n');
|
|
@@ -43,6 +48,8 @@ exports.default = () => tree => {
|
|
|
43
48
|
isFirstParaProcessed = true;
|
|
44
49
|
}
|
|
45
50
|
else {
|
|
51
|
+
if (!isFirstParaProcessed && !(0, numberedShorthand_1.isBeforeText)(item))
|
|
52
|
+
termComesFirst = false;
|
|
46
53
|
newContent.push(item);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
@@ -180,7 +180,12 @@ const middle = opt => tree => {
|
|
|
180
180
|
},
|
|
181
181
|
':block': (node, ctx) => transformerBlocks(node, { ...ctx, allowedIn, allowFromTable: passesAllow }),
|
|
182
182
|
});
|
|
183
|
-
|
|
183
|
+
const read_ = { ...n, content: transformer(n.content, inner) };
|
|
184
|
+
// the body of a data block stays as written for those who read it as data
|
|
185
|
+
if (name !== 'data')
|
|
186
|
+
return read_;
|
|
187
|
+
const body = (Array.isArray(n.content) ? n.content : []).find(c => c && c.type === 'verbatim');
|
|
188
|
+
return body && typeof body.value === 'string' ? { ...read_, dataText: body.value } : read_;
|
|
184
189
|
},
|
|
185
190
|
});
|
|
186
191
|
// a document needs no enclosing block, so the top level is a scope of its own
|
package/lib/plugin-group-defn.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const itemNumbering_1 = require("./helpers/itemNumbering");
|
|
3
4
|
exports.default = () => tree => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
(n1
|
|
7
|
-
|
|
8
|
-
n1['level'] === n2.level &&
|
|
9
|
-
isNumbered(n1) === isNumbered(n2);
|
|
10
|
-
const isNumbered = node => Boolean(node.config && node.config.numbered);
|
|
5
|
+
// a =config defn or =alias defn carries the name too, but it is a directive, not a definition
|
|
6
|
+
const isDefn = node => node.type === 'block' && node.name === 'defn';
|
|
7
|
+
const isNodesEqual = (n1, n2) => isDefn(n1) && isDefn(n2) && n1['level'] === n2.level && isNumbered(n1) === isNumbered(n2);
|
|
8
|
+
const isNumbered = node => (0, itemNumbering_1.numberedOf)(node.config) === true;
|
|
11
9
|
const group = a => {
|
|
12
10
|
let lastItem = {};
|
|
13
11
|
let result = a.reduce((a, i) => {
|
|
14
|
-
if (i
|
|
12
|
+
if (isDefn(i)) {
|
|
15
13
|
if (isNodesEqual(lastItem, i)) {
|
|
16
14
|
// group items into arrays
|
|
17
15
|
a[a.length - 1].push(i);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.MAX_LIST_LEVEL = void 0;
|
|
7
|
-
const
|
|
4
|
+
const itemNumbering_1 = require("./helpers/itemNumbering");
|
|
8
5
|
// lists nest no deeper than this: deeper trees overflow the stack of the renderers
|
|
9
6
|
exports.MAX_LIST_LEVEL = 50;
|
|
10
7
|
exports.default = (opt = {}) => tree => {
|
|
@@ -15,7 +12,7 @@ exports.default = (opt = {}) => tree => {
|
|
|
15
12
|
n1['level'] === n2.level &&
|
|
16
13
|
isNumbered(n1) === isNumbered(n2) &&
|
|
17
14
|
isChecked(n1) === isChecked(n2);
|
|
18
|
-
const isNumbered = node =>
|
|
15
|
+
const isNumbered = node => (0, itemNumbering_1.numberedOf)(node.config) === true;
|
|
19
16
|
const isChecked = node => node.checked !== undefined;
|
|
20
17
|
// the level a list is built at; the level the author wrote stays on the item
|
|
21
18
|
const nestAt = item => Math.min(Number(item.level), exports.MAX_LIST_LEVEL);
|
package/lib/plugin-items.js
CHANGED
|
@@ -20,9 +20,10 @@ exports.default = () => tree => {
|
|
|
20
20
|
if (checkedConfig) {
|
|
21
21
|
node.checked = checkedConfig.value !== false && checkedConfig.value !== 0 && checkedConfig.value !== '0';
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// the first text of the item, as for the # shorthand: only a paragraph carries a check box
|
|
24
|
+
const startText = node.content.find(child => !(0, numberedShorthand_1.isBeforeText)(child));
|
|
25
|
+
if (startText?.type === 'para') {
|
|
26
|
+
if (typeof startText.text === 'string' && startText.text) {
|
|
26
27
|
// Check for checkbox syntax [x] or [ ] at start of text
|
|
27
28
|
if (!checkedConfig) {
|
|
28
29
|
const checkboxRe = /^\[( |x)\]\s*/;
|
|
@@ -38,9 +39,9 @@ exports.default = () => tree => {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
(0, numberedShorthand_1.applyNumberedShorthand)(node);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
(0, numberedShorthand_1.applyNumberedShorthand)(node);
|
|
44
45
|
}
|
|
45
46
|
visit(node.content);
|
|
46
47
|
}
|
package/lib/plugin-tables.d.ts
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import { ConfigScope } from './helpers/configPropagation';
|
|
2
|
+
export declare class CsvError extends Error {
|
|
3
|
+
}
|
|
2
4
|
export declare function parseCsv(text: any): any[];
|
|
3
5
|
export declare function parseTsv(text: any): any;
|
|
6
|
+
export declare function headerInEffect(params: Record<string, string>): {
|
|
7
|
+
present: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
};
|
|
4
10
|
export declare function parseMimeType(raw: any): {
|
|
5
11
|
type: string;
|
|
6
12
|
params: Record<string, string>;
|
|
7
13
|
};
|
|
8
14
|
export declare function findDataBlockByKey(tree: any, key: any): any;
|
|
9
15
|
export declare function extractDataText(dataNode: any): any;
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
16
|
+
export declare function detectSourceReference(tableNode: any): {
|
|
17
|
+
scheme: string;
|
|
18
|
+
target: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function csvToTableContent(csvRows: any, hasHeader: boolean, allow?: string[]): any;
|
|
21
|
+
export type TableReport = (code: string, message: string, node: any, severity?: 'warning' | 'error') => void;
|
|
12
22
|
export declare function makeTableReport(opt: any): TableReport;
|
|
13
|
-
export
|
|
23
|
+
export type TableMode = 'text' | 'row' | 'data' | 'data-table';
|
|
24
|
+
export declare function normalizeCellCounts(tableNode: any, source?: string, report?: TableReport, mode?: TableMode): any;
|
|
25
|
+
export declare function buildCodeFromText(tableNode: any, text: string): {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
margin: any;
|
|
29
|
+
location: any;
|
|
30
|
+
content: {
|
|
31
|
+
type: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}[];
|
|
34
|
+
config: any[];
|
|
35
|
+
};
|
|
36
|
+
export declare function reportHeaderOf(type: string, params: Record<string, string>, where: string, node: any, report: TableReport): void;
|
|
37
|
+
export declare function readTabular(isCsv: boolean, params: Record<string, string>, text: string, where: string, node: any, report: TableReport): {
|
|
38
|
+
rows: string[][];
|
|
39
|
+
hasHeader: boolean;
|
|
40
|
+
} | null;
|
|
14
41
|
declare const _default: (opt?: {
|
|
15
42
|
config?: ConfigScope;
|
|
16
43
|
}) => (tree: any) => any;
|