paperlint 18.1.0 → 18.2.0
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/README.md +2 -2
- package/dist/adapters/latex/document-class.d.ts +28 -5
- package/dist/adapters/latex/document-class.d.ts.map +1 -1
- package/dist/adapters/latex/document-class.js +208 -21
- package/dist/adapters/latex/document-class.js.map +1 -1
- package/dist/adapters/latex/index.d.ts +4 -4
- package/dist/adapters/latex/index.d.ts.map +1 -1
- package/dist/adapters/latex/index.js +5 -2
- package/dist/adapters/latex/index.js.map +1 -1
- package/dist/adapters/latex/parse.d.ts.map +1 -1
- package/dist/adapters/latex/parse.js +5 -0
- package/dist/adapters/latex/parse.js.map +1 -1
- package/dist/domain/body-pages.d.ts.map +1 -1
- package/dist/domain/body-pages.js +4 -2
- package/dist/domain/body-pages.js.map +1 -1
- package/dist/domain/tex-document.d.ts +52 -4
- package/dist/domain/tex-document.d.ts.map +1 -1
- package/dist/domain/tex-document.js +9 -0
- package/dist/domain/tex-document.js.map +1 -1
- package/dist/eslint-rules/latex-language.d.ts +10 -0
- package/dist/eslint-rules/latex-language.d.ts.map +1 -1
- package/dist/eslint-rules/latex-language.js +41 -2
- package/dist/eslint-rules/latex-language.js.map +1 -1
- package/dist/ports/latex.d.ts +13 -1
- package/dist/ports/latex.d.ts.map +1 -1
- package/dist/presets.d.ts +15 -0
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +9 -0
- package/dist/presets.js.map +1 -1
- package/dist/tex-requirements.d.ts +2 -0
- package/dist/tex-requirements.d.ts.map +1 -1
- package/dist/tex-requirements.js +7 -2
- package/dist/tex-requirements.js.map +1 -1
- package/dist/tex-venue-rules.d.ts +36 -3
- package/dist/tex-venue-rules.d.ts.map +1 -1
- package/dist/tex-venue-rules.js +181 -33
- package/dist/tex-venue-rules.js.map +1 -1
- package/docs/rules/cycle/port-done.md +3 -0
- package/docs/rules/tex/template.md +96 -1
- package/docs/rules.md +18 -13
- package/docs/venues.md +51 -12
- package/eslint-rules/latex-language.test.mjs +64 -1
- package/eslint-rules/latex-language.ts +44 -2
- package/eslint.config.mjs +1 -0
- package/fixtures/build-e2e/neurips/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/neurips/expect.json +20 -0
- package/fixtures/build-e2e/neurips/paper.tex +60 -0
- package/fixtures/build-e2e/neurips/paperlint.json +1 -0
- package/fixtures/build-e2e/neurips-nostyle/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/neurips-nostyle/expect.json +26 -0
- package/fixtures/build-e2e/neurips-nostyle/paper.tex +56 -0
- package/fixtures/build-e2e/neurips-nostyle/paperlint.json +1 -0
- package/fixtures/build-e2e/neurips-over/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/neurips-over/expect.json +24 -0
- package/fixtures/build-e2e/neurips-over/paper.tex +56 -0
- package/fixtures/build-e2e/neurips-over/paperlint.json +1 -0
- package/fixtures/real-papers.test.ts +17 -6
- package/package.json +3 -1
- package/presets/aaai-2027.jsonc +126 -0
- package/presets/aaai-2027.md +127 -0
- package/presets/aaai-press.jsonc +167 -0
- package/presets/aaai-press.md +126 -0
- package/presets/icml-2027.jsonc +111 -0
- package/presets/icml-2027.md +130 -0
- package/presets/icml-style.jsonc +125 -0
- package/presets/icml-style.md +77 -0
- package/presets/neurips-2026.jsonc +123 -0
- package/presets/neurips-2026.md +137 -0
- package/presets/neurips-style.jsonc +113 -0
- package/presets/neurips-style.md +85 -0
- package/presets/venue-profile.schema.json +6 -0
- package/skills/build-label-page/scripts/label-page-browser.test.ts +275 -114
- package/src/adapters/latex/document-class.ts +292 -20
- package/src/adapters/latex/index.test.ts +263 -0
- package/src/adapters/latex/index.ts +12 -3
- package/src/adapters/latex/parse.ts +5 -0
- package/src/cli.test.ts +6 -1
- package/src/domain/body-pages.test.ts +22 -6
- package/src/domain/body-pages.ts +4 -2
- package/src/domain/tex-document.ts +64 -5
- package/src/folder-venue-rule.test.ts +51 -0
- package/src/new-paper.test.ts +2 -2
- package/src/paper-settings-commands.test.ts +1 -1
- package/src/ports/latex.ts +14 -0
- package/src/preset-card-rule.test.ts +44 -27
- package/src/presets.test.ts +177 -1
- package/src/presets.ts +27 -0
- package/src/rule-cases.test.ts +52 -0
- package/src/tex-requirements.harness.ts +17 -3
- package/src/tex-requirements.ts +13 -2
- package/src/tex-venue-rules.test.ts +1020 -0
- package/src/tex-venue-rules.ts +248 -38
- package/src/venue-rules.test.ts +369 -2
package/src/tex-venue-rules.ts
CHANGED
|
@@ -34,20 +34,31 @@ import {
|
|
|
34
34
|
collapse,
|
|
35
35
|
documentClassLine,
|
|
36
36
|
missingOptions,
|
|
37
|
+
optionsInEffect,
|
|
38
|
+
readWhole,
|
|
37
39
|
runText,
|
|
38
40
|
spanIn,
|
|
41
|
+
usepackageLine,
|
|
39
42
|
type ClassCandidate,
|
|
40
43
|
type ClassLine,
|
|
41
44
|
type DocumentClass,
|
|
42
45
|
type Heading,
|
|
43
46
|
type LayoutOverride,
|
|
44
47
|
type Outline,
|
|
48
|
+
type PackageLoad,
|
|
45
49
|
type Place,
|
|
50
|
+
type StylePackage,
|
|
46
51
|
type Span,
|
|
47
52
|
type TextRun,
|
|
48
53
|
} from "./domain/tex-document.ts";
|
|
49
54
|
import type { LatexReader } from "./ports/latex.ts";
|
|
50
|
-
import {
|
|
55
|
+
import {
|
|
56
|
+
paperPreset,
|
|
57
|
+
shippedStyles,
|
|
58
|
+
shippedVenueNames,
|
|
59
|
+
type Preset,
|
|
60
|
+
type PresetTemplate,
|
|
61
|
+
} from "./presets.ts";
|
|
51
62
|
import type { NamedVenue } from "./domain/venue-name.ts";
|
|
52
63
|
import { editionLabel } from "./domain/edition.ts";
|
|
53
64
|
import type { PaperSource } from "./domain/paper-source.ts";
|
|
@@ -119,7 +130,10 @@ interface Wanted {
|
|
|
119
130
|
|
|
120
131
|
/**
|
|
121
132
|
* A class line that names a class, against the template's: the same class, with every option, and
|
|
122
|
-
* none of the options the preset forbids.
|
|
133
|
+
* none of the options the preset forbids. An option `\PassOptionsToClass` gave the class before the
|
|
134
|
+
* line counts as the line's, and a forbidden one is reported where it is passed. When an option is
|
|
135
|
+
* built by a macro, what it carries is not known: no option is said to be missing, and a forbidden
|
|
136
|
+
* option written out is still reported — it is in effect whatever the macro holds.
|
|
123
137
|
*/
|
|
124
138
|
function judgeClass(
|
|
125
139
|
line: Extract<ClassLine, { readonly kind: "class" }>,
|
|
@@ -129,15 +143,22 @@ function judgeClass(
|
|
|
129
143
|
const at = spanOf(line.place);
|
|
130
144
|
if (line.cls !== want.cls.cls)
|
|
131
145
|
return [{ messageId: "wrongClass", data: { ...data, got: line.cls }, at }];
|
|
132
|
-
const forbidden = want.forbids.filter((o) => line.options.includes(o));
|
|
133
146
|
const without = want.forbids.map((o) => `\`${o}\``).join(", ");
|
|
147
|
+
const forbidden = (options: readonly string[], where: Span | null) =>
|
|
148
|
+
want.forbids
|
|
149
|
+
.filter((o) => options.includes(o))
|
|
150
|
+
.map((option) => ({
|
|
151
|
+
messageId: "forbiddenOption",
|
|
152
|
+
data: { ...data, option, without },
|
|
153
|
+
at: where,
|
|
154
|
+
}));
|
|
155
|
+
const missing = readWhole(line)
|
|
156
|
+
? missingOptions(optionsInEffect(line), want.cls)
|
|
157
|
+
: [];
|
|
134
158
|
return [
|
|
135
|
-
...
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
at,
|
|
139
|
-
})),
|
|
140
|
-
...missingOptions(line, want.cls).map((option) => ({
|
|
159
|
+
...line.passed.flatMap((p) => forbidden(p.options, spanOf(p.place))),
|
|
160
|
+
...forbidden(line.options, at),
|
|
161
|
+
...missing.map((option) => ({
|
|
141
162
|
messageId: "missingOption",
|
|
142
163
|
data: { ...data, option },
|
|
143
164
|
at,
|
|
@@ -145,23 +166,33 @@ function judgeClass(
|
|
|
145
166
|
];
|
|
146
167
|
}
|
|
147
168
|
|
|
148
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* A candidate as the message names it: its line, or an empty `\documentclass{}` — the one other
|
|
171
|
+
* kind a message names, since an unread candidate may match and silences the switch.
|
|
172
|
+
*/
|
|
149
173
|
const candidateLine = (c: ClassCandidate): string =>
|
|
150
174
|
c.kind === "class" ? documentClassLine(c) : "\\documentclass{}";
|
|
151
175
|
|
|
176
|
+
/** Whether a candidate may be the template's line: a class line with no finding, or an unread one. */
|
|
177
|
+
const mayMatch = (
|
|
178
|
+
c: ClassCandidate,
|
|
179
|
+
want: Wanted,
|
|
180
|
+
data: TemplateData,
|
|
181
|
+
): boolean =>
|
|
182
|
+
c.kind === "unread" ||
|
|
183
|
+
(c.kind === "class" && judgeClass(c, want, data).length === 0);
|
|
184
|
+
|
|
152
185
|
/**
|
|
153
186
|
* Several class lines behind a TeX switch: satisfied when any candidate is the template's class
|
|
154
|
-
* with its options; otherwise one finding, at the first
|
|
187
|
+
* with its options, or may be (one built by a macro); otherwise one finding, at the first
|
|
188
|
+
* candidate, naming every one.
|
|
155
189
|
*/
|
|
156
190
|
function judgeCandidates(
|
|
157
191
|
candidates: readonly [ClassCandidate, ...ClassCandidate[]],
|
|
158
192
|
want: Wanted,
|
|
159
193
|
data: TemplateData,
|
|
160
194
|
): readonly Located[] {
|
|
161
|
-
|
|
162
|
-
(c) => c.kind === "class" && judgeClass(c, want, data).length === 0,
|
|
163
|
-
);
|
|
164
|
-
if (matches) return [];
|
|
195
|
+
if (candidates.some((c) => mayMatch(c, want, data))) return [];
|
|
165
196
|
const named = candidates.map((c) => `\`${candidateLine(c)}\``).join(", ");
|
|
166
197
|
const found = { ...data, count: candidates.length, candidates: named };
|
|
167
198
|
return [
|
|
@@ -178,6 +209,10 @@ function judgeClassLine(
|
|
|
178
209
|
switch (line.kind) {
|
|
179
210
|
case "missing":
|
|
180
211
|
return [{ messageId: "noClass", data, at: null }];
|
|
212
|
+
// A class this reader cannot see or read is not judged: it may be the venue's.
|
|
213
|
+
case "unseen":
|
|
214
|
+
case "unread":
|
|
215
|
+
return [];
|
|
181
216
|
case "empty":
|
|
182
217
|
return [{ messageId: "emptyClass", data, at: spanOf(line.place) }];
|
|
183
218
|
case "class":
|
|
@@ -195,7 +230,8 @@ function judgeClassLine(
|
|
|
195
230
|
export function judgeTemplate(
|
|
196
231
|
line: ClassLine,
|
|
197
232
|
preset: Preset,
|
|
198
|
-
latex: Pick<LatexReader, "template">,
|
|
233
|
+
latex: Pick<LatexReader, "template" | "templateStyle">,
|
|
234
|
+
style: StyleInput = NO_STYLE_INPUT,
|
|
199
235
|
): readonly Located[] {
|
|
200
236
|
const t = preset.template;
|
|
201
237
|
if (t === null) return [];
|
|
@@ -205,7 +241,159 @@ export function judgeTemplate(
|
|
|
205
241
|
return [{ messageId: "badTemplate", data, at: null }];
|
|
206
242
|
}
|
|
207
243
|
const data = { venue: preset.label, template: documentClassLine(want) };
|
|
208
|
-
|
|
244
|
+
// The style is judged only over the template's class: another class (or one this reader cannot
|
|
245
|
+
// read) may load a style of its own, and its finding is the class's.
|
|
246
|
+
return [
|
|
247
|
+
...judgeClassLine(line, { cls: want, forbids: t.forbids }, data),
|
|
248
|
+
...(isClass(line, want.cls) ? judgeStyle(style, preset, latex) : []),
|
|
249
|
+
];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Whether the class line is `cls` — behind a switch, whether one of its candidates is. */
|
|
253
|
+
const isClass = (line: ClassLine, cls: string): boolean =>
|
|
254
|
+
line.kind === "ambiguous"
|
|
255
|
+
? line.candidates.some((c) => c.kind === "class" && c.cls === cls)
|
|
256
|
+
: line.kind === "class" && line.cls === cls;
|
|
257
|
+
|
|
258
|
+
/** What the style check reads: the packages the paper loads, and the styles of other shipped venues. */
|
|
259
|
+
export interface StyleInput {
|
|
260
|
+
readonly packages: readonly PackageLoad[];
|
|
261
|
+
/** The package names of the `template_style` of every shipped venue off this paper's chain. */
|
|
262
|
+
readonly others: readonly string[];
|
|
263
|
+
/** The preamble may load a package the reader does not see (`LatexReader.packagesUnseen`). */
|
|
264
|
+
readonly unseen: boolean;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const NO_STYLE_INPUT: StyleInput = { packages: [], others: [], unseen: false };
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* The same package name in another case (`NeurIPS_2026`): a case-insensitive file system loads the
|
|
271
|
+
* style under it and a case-sensitive one does not, so nothing is said either way.
|
|
272
|
+
*/
|
|
273
|
+
const sameNameOtherCase = (a: string, b: string): boolean =>
|
|
274
|
+
a !== b && a.toLowerCase() === b.toLowerCase();
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* A style's series: its name without the edition and what follows it — `neurips_2026` → `neurips`,
|
|
278
|
+
* `iclr2027_conference` → `iclr`, `ijcai26` → `ijcai`. Two names of one series and two editions are
|
|
279
|
+
* another year's style.
|
|
280
|
+
*/
|
|
281
|
+
const seriesOf = (name: string): string =>
|
|
282
|
+
name.replace(/[-_]?\d{2,4}(?:[-_].*)?$/u, "");
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Another style than the template's, loaded in its place: one a shipped preset off this paper's chain
|
|
286
|
+
* names, or one of the same series and another edition. Any other package is the paper's own.
|
|
287
|
+
*/
|
|
288
|
+
const isOtherStyle = (
|
|
289
|
+
name: string,
|
|
290
|
+
want: string,
|
|
291
|
+
others: readonly string[],
|
|
292
|
+
): boolean =>
|
|
293
|
+
name !== want &&
|
|
294
|
+
(others.includes(name) ||
|
|
295
|
+
(seriesOf(name) !== "" && seriesOf(name) === seriesOf(want)));
|
|
296
|
+
|
|
297
|
+
/** Whether a load is the style with every option the template names, among the options LaTeX hands it. */
|
|
298
|
+
const carries = (load: PackageLoad, want: StylePackage): boolean =>
|
|
299
|
+
load.name === want.name &&
|
|
300
|
+
want.options.every((o) => load.options.includes(o));
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Whether the paper is known to load the preset's style with its options: a load that carries them,
|
|
304
|
+
* read whole. True when the preset names no style; false for a style line the reader cannot read.
|
|
305
|
+
* Silence from `judgeStyle` is not enough: it is also silent when a macro may carry an option.
|
|
306
|
+
*/
|
|
307
|
+
export function isStyleLoaded(
|
|
308
|
+
packages: readonly PackageLoad[],
|
|
309
|
+
preset: Preset,
|
|
310
|
+
latex: Pick<LatexReader, "templateStyle">,
|
|
311
|
+
): boolean {
|
|
312
|
+
if (preset.templateStyle === null) return true;
|
|
313
|
+
const want = latex.templateStyle(preset.templateStyle.text);
|
|
314
|
+
return want !== null && packages.some((p) => carries(p, want));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The lines that load the template's style, none carrying every option it names (the caller
|
|
319
|
+
* checked): each option the first line lacks, at that line.
|
|
320
|
+
*/
|
|
321
|
+
function judgeLoaded(
|
|
322
|
+
first: PackageLoad,
|
|
323
|
+
loads: readonly PackageLoad[],
|
|
324
|
+
want: StylePackage,
|
|
325
|
+
data: { readonly venue: string; readonly style: string },
|
|
326
|
+
): readonly Located[] {
|
|
327
|
+
// An option built by a macro may be the one wanted: what it holds is not known, so nothing is said.
|
|
328
|
+
if (loads.some((l) => l.unread.length > 0)) return [];
|
|
329
|
+
return want.options
|
|
330
|
+
.filter((o) => !first.options.includes(o))
|
|
331
|
+
.map((option) => ({
|
|
332
|
+
messageId: "missingStyleOption",
|
|
333
|
+
data: { ...data, option },
|
|
334
|
+
at: spanOf(first.place),
|
|
335
|
+
}));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The paper's packages against the preset's `template_style`: loaded with every option it names (by
|
|
340
|
+
* any of the lines, as several class lines behind a switch); loaded without one; another venue's or
|
|
341
|
+
* another year's style loaded instead; or not loaded at all.
|
|
342
|
+
*/
|
|
343
|
+
export function judgeStyle(
|
|
344
|
+
{ packages, others, unseen }: StyleInput,
|
|
345
|
+
preset: Preset,
|
|
346
|
+
latex: Pick<LatexReader, "templateStyle">,
|
|
347
|
+
): readonly Located[] {
|
|
348
|
+
const s = preset.templateStyle;
|
|
349
|
+
if (s === null) return [];
|
|
350
|
+
const want = latex.templateStyle(s.text);
|
|
351
|
+
if (want === null) {
|
|
352
|
+
const data = { file: s.file, text: JSON.stringify(s.text) };
|
|
353
|
+
return [{ messageId: "badStyle", data, at: null }];
|
|
354
|
+
}
|
|
355
|
+
const data = { venue: preset.label, style: usepackageLine(want) };
|
|
356
|
+
const loads = packages.filter((p) => p.name === want.name);
|
|
357
|
+
if (loads.some((l) => carries(l, want))) return [];
|
|
358
|
+
// What the reader cannot see may load the style or pass its options: an error never fires on that.
|
|
359
|
+
if (unseen || packages.some((p) => sameNameOtherCase(p.name, want.name)))
|
|
360
|
+
return [];
|
|
361
|
+
const [first] = loads;
|
|
362
|
+
if (first !== undefined) return judgeLoaded(first, loads, want, data);
|
|
363
|
+
const instead = packages.find((p) => isOtherStyle(p.name, want.name, others));
|
|
364
|
+
return instead === undefined
|
|
365
|
+
? [{ messageId: "missingStyle", data, at: null }]
|
|
366
|
+
: [
|
|
367
|
+
{
|
|
368
|
+
messageId: "wrongStyle",
|
|
369
|
+
data: { ...data, got: instead.name },
|
|
370
|
+
at: spanOf(instead.place),
|
|
371
|
+
},
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Whether the paper's class line is known to be the template's: read whole — no class or option
|
|
377
|
+
* built by a macro, no class unseen — and judged without a finding; behind a switch, one candidate
|
|
378
|
+
* so. Silence from `judgeTemplate` is not enough: it is also silent on a line it cannot read.
|
|
379
|
+
*/
|
|
380
|
+
export function isTemplate(
|
|
381
|
+
line: ClassLine,
|
|
382
|
+
t: PresetTemplate,
|
|
383
|
+
venue: string,
|
|
384
|
+
latex: Pick<LatexReader, "template">,
|
|
385
|
+
): boolean {
|
|
386
|
+
const want = latex.template(t.text);
|
|
387
|
+
if (want === null) return false;
|
|
388
|
+
const wanted = { cls: want, forbids: t.forbids };
|
|
389
|
+
const data = { venue, template: documentClassLine(want) };
|
|
390
|
+
const proved = (c: ClassLine): boolean =>
|
|
391
|
+
c.kind === "class" &&
|
|
392
|
+
readWhole(c) &&
|
|
393
|
+
judgeClass(c, wanted, data).length === 0;
|
|
394
|
+
return line.kind === "ambiguous"
|
|
395
|
+
? line.candidates.some(proved)
|
|
396
|
+
: proved(line);
|
|
209
397
|
}
|
|
210
398
|
|
|
211
399
|
/** Where a heading starts, or null when the parser gave it no place. */
|
|
@@ -433,6 +621,8 @@ interface Reading {
|
|
|
433
621
|
readonly latex: LatexReader;
|
|
434
622
|
readonly preset: Preset;
|
|
435
623
|
readonly others: () => readonly OtherVenue[];
|
|
624
|
+
/** The package names of the styles other shipped venues' templates load. */
|
|
625
|
+
readonly styles: () => readonly string[];
|
|
436
626
|
}
|
|
437
627
|
type Judge = (r: Reading) => readonly Located[];
|
|
438
628
|
|
|
@@ -464,7 +654,11 @@ const RULES: Readonly<
|
|
|
464
654
|
> = {
|
|
465
655
|
template: {
|
|
466
656
|
judge: (r) =>
|
|
467
|
-
judgeTemplate(r.latex.documentClass(r.src), r.preset, r.latex
|
|
657
|
+
judgeTemplate(r.latex.documentClass(r.src), r.preset, r.latex, {
|
|
658
|
+
packages: r.latex.packages(r.src),
|
|
659
|
+
others: r.styles(),
|
|
660
|
+
unseen: r.latex.packagesUnseen(r.src),
|
|
661
|
+
}),
|
|
468
662
|
meta: {
|
|
469
663
|
type: "problem",
|
|
470
664
|
docs: {
|
|
@@ -486,6 +680,14 @@ const RULES: Readonly<
|
|
|
486
680
|
"the class option `{{option}}` is missing: {{venue}} requires `{{template}}`",
|
|
487
681
|
forbiddenOption:
|
|
488
682
|
"the class option `{{option}}` is forbidden: {{venue}} requires `{{template}}` without {{without}}",
|
|
683
|
+
badStyle:
|
|
684
|
+
'{{file}}: the preset\'s "template_style" {{text}} is not one \\usepackage line naming one package, so the style cannot be checked',
|
|
685
|
+
missingStyle:
|
|
686
|
+
"{{venue}} requires `{{style}}`; paper.tex loads no such package — the page, the fonts and the margins the venue checks come from it",
|
|
687
|
+
wrongStyle:
|
|
688
|
+
"paper.tex loads `{{got}}`, another venue's or another year's style; {{venue}} requires `{{style}}`",
|
|
689
|
+
missingStyleOption:
|
|
690
|
+
"the style option `{{option}}` is missing: {{venue}} requires `{{style}}`",
|
|
489
691
|
noCandidate:
|
|
490
692
|
"none of the {{count}} \\documentclass lines is `{{template}}`, which {{venue}} requires: {{candidates}}. The source picks one behind a TeX switch, which is not evaluated; make one of them the venue's",
|
|
491
693
|
},
|
|
@@ -584,6 +786,22 @@ export function otherVenues(
|
|
|
584
786
|
}));
|
|
585
787
|
}
|
|
586
788
|
|
|
789
|
+
/**
|
|
790
|
+
* The package names of the styles every shipped venue off this paper's chain loads into its class:
|
|
791
|
+
* what `tex/template` reports when a paper loads one instead of its own venue's.
|
|
792
|
+
*/
|
|
793
|
+
export function otherStyles(
|
|
794
|
+
preset: Pick<Preset, "chain">,
|
|
795
|
+
deps: TexVenueRuleDeps,
|
|
796
|
+
): readonly string[] {
|
|
797
|
+
return shippedStyles(deps)
|
|
798
|
+
.filter((s) => !s.chain.every((f) => preset.chain.includes(f)))
|
|
799
|
+
.flatMap((s) => {
|
|
800
|
+
const parsed = deps.latex.templateStyle(s.text);
|
|
801
|
+
return parsed === null ? [] : [parsed.name];
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
|
|
587
805
|
/** What the venue-conformance rules are built with: the preset store, the LaTeX reader, and the paper's files as the build recorded them. */
|
|
588
806
|
export interface TexVenueRuleDeps extends VenueRuleDeps, ProseDeps {}
|
|
589
807
|
|
|
@@ -606,9 +824,10 @@ function readingOf(
|
|
|
606
824
|
return null;
|
|
607
825
|
const preset = p.preset;
|
|
608
826
|
const others = () => otherVenues(preset, deps);
|
|
827
|
+
const styles = () => otherStyles(preset, deps);
|
|
609
828
|
const paper = readPaper(filename, src, deps);
|
|
610
829
|
return {
|
|
611
|
-
reading: { src: paper.text, latex: deps.latex, preset, others },
|
|
830
|
+
reading: { src: paper.text, latex: deps.latex, preset, others, styles },
|
|
612
831
|
paper,
|
|
613
832
|
};
|
|
614
833
|
}
|
|
@@ -663,25 +882,16 @@ export function judgePortDone(
|
|
|
663
882
|
r: Pick<Reading, "src" | "latex" | "preset">,
|
|
664
883
|
cycleId: string,
|
|
665
884
|
): readonly Located[] {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
messageId: "done",
|
|
677
|
-
data: {
|
|
678
|
-
venue: r.preset.label,
|
|
679
|
-
template: r.preset.template.text,
|
|
680
|
-
id: cycleId,
|
|
681
|
-
},
|
|
682
|
-
at: null,
|
|
683
|
-
},
|
|
684
|
-
];
|
|
885
|
+
const t = r.preset.template;
|
|
886
|
+
if (t === null) return [];
|
|
887
|
+
const line = r.latex.documentClass(r.src);
|
|
888
|
+
// Only a class line read whole and found to be the venue's ends the port: one built by a macro
|
|
889
|
+
// gets no finding from tex/template, and is not the venue's for that. And the style with it: a
|
|
890
|
+
// port from one article-based style to another is not done while the class line already matches.
|
|
891
|
+
if (!isTemplate(line, t, r.preset.label, r.latex)) return [];
|
|
892
|
+
if (!isStyleLoaded(r.latex.packages(r.src), r.preset, r.latex)) return [];
|
|
893
|
+
const data = { venue: r.preset.label, template: t.text, id: cycleId };
|
|
894
|
+
return [{ messageId: "done", data, at: null }];
|
|
685
895
|
}
|
|
686
896
|
|
|
687
897
|
const PORT_DONE_META: TexRuleModule["meta"] = {
|