@turingcode/cli 0.2.4 → 0.2.5
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/dist/features/table/check.js +12 -1
- package/package.json +1 -1
|
@@ -144,6 +144,15 @@ export function tableCheck(input) {
|
|
|
144
144
|
const tableRows = file?.rows.get(p.table);
|
|
145
145
|
return column && tableRows ? { rows: tableRows, column } : null;
|
|
146
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* Whether a reference points at a table of the checked document that could not be read (missing,
|
|
149
|
+
* or a broken header). Its structure error is already reported, so checks against it are skipped
|
|
150
|
+
* instead of failing every value. Dependency tables are not structure-checked, so they never skip.
|
|
151
|
+
*/
|
|
152
|
+
const unread = (ref) => {
|
|
153
|
+
const p = parseRef(ref);
|
|
154
|
+
return !p.alias && !rows.has(p.table);
|
|
155
|
+
};
|
|
147
156
|
/** Non-missing values (list items split) of a reference. */
|
|
148
157
|
const refValues = (ref) => {
|
|
149
158
|
const r = refRows(ref);
|
|
@@ -178,11 +187,13 @@ export function tableCheck(input) {
|
|
|
178
187
|
};
|
|
179
188
|
return {
|
|
180
189
|
ref: (ref, v) => {
|
|
190
|
+
if (unread(ref))
|
|
191
|
+
return true;
|
|
181
192
|
if (!known.has(ref))
|
|
182
193
|
known.set(ref, refValues(ref));
|
|
183
194
|
return known.get(ref).has(v);
|
|
184
195
|
},
|
|
185
|
-
mentioned: (targets, v) => mentions(textOf(targets), v),
|
|
196
|
+
mentioned: (targets, v) => targets.some(t => t !== "*" && unread(t)) || mentions(textOf(targets), v),
|
|
186
197
|
calc: (param, doc) => evaluateCalc(calc(param), doc, numbers)?.holds ?? true,
|
|
187
198
|
calcValues: (param, doc) => evaluateCalc(calc(param), doc, numbers),
|
|
188
199
|
};
|
package/package.json
CHANGED