@sushichan044/kg-core 0.6.5 → 0.8.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 +62 -13
- package/dist/composed-manuscript-QgIdae8p.d.mts +1740 -0
- package/dist/describe-cause-BV8mZ3Um.mjs +18 -0
- package/dist/index.d.mts +6481 -18298
- package/dist/index.mjs +50 -2475
- package/dist/lint.d.mts +461 -0
- package/dist/lint.mjs +812 -0
- package/dist/novel-composer-BCt9g172.d.mts +9781 -0
- package/dist/novel-composer-CROZLBqt.mjs +1929 -0
- package/dist/plugin.d.mts +3 -0
- package/dist/plugin.mjs +3 -0
- package/dist/question-or-exclamation-spacing-B5o23ZLf.mjs +251 -0
- package/package.json +11 -4
package/dist/lint.d.mts
ADDED
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, o as ManuscriptDiagnostic, r as NamespacedId, t as ComposedManuscript } from "./composed-manuscript-QgIdae8p.mjs";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
//#region src/proofreading/invalid-rule-options.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A built-in rule factory was given options it cannot honour. Distinct from {@link ProofreadError}
|
|
6
|
+
* because it happens while configuring rules, long before any manuscript is checked.
|
|
7
|
+
*/
|
|
8
|
+
type InvalidRuleOptions = Readonly<{
|
|
9
|
+
kind: "InvalidRuleOptions";
|
|
10
|
+
ruleId: string;
|
|
11
|
+
option: string;
|
|
12
|
+
issues: readonly ValidationIssue[];
|
|
13
|
+
}>;
|
|
14
|
+
declare const InvalidRuleOptions: {
|
|
15
|
+
readonly describe: (error: InvalidRuleOptions) => string;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/proofreading/proofread-error.d.ts
|
|
19
|
+
/**
|
|
20
|
+
* Everything that can go wrong while running a set of rules over a manuscript.
|
|
21
|
+
*/
|
|
22
|
+
type ProofreadError = Readonly<{
|
|
23
|
+
kind: "InvalidRuleId";
|
|
24
|
+
ruleId: string;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
kind: "DuplicateRuleId";
|
|
27
|
+
ruleId: NamespacedId;
|
|
28
|
+
}> | Readonly<{
|
|
29
|
+
kind: "InvalidRuleMetadata";
|
|
30
|
+
ruleId: NamespacedId;
|
|
31
|
+
issues: readonly ValidationIssue[];
|
|
32
|
+
}> | Readonly<{
|
|
33
|
+
kind: "InvalidReport";
|
|
34
|
+
ruleId: NamespacedId;
|
|
35
|
+
issues: readonly ValidationIssue[];
|
|
36
|
+
}> | Readonly<{
|
|
37
|
+
kind: "UnknownMessageId";
|
|
38
|
+
ruleId: NamespacedId;
|
|
39
|
+
messageId: string;
|
|
40
|
+
}> | Readonly<{
|
|
41
|
+
kind: "RuleThrew";
|
|
42
|
+
ruleId: NamespacedId;
|
|
43
|
+
cause: unknown;
|
|
44
|
+
}>;
|
|
45
|
+
declare const ProofreadError: {
|
|
46
|
+
/**
|
|
47
|
+
* Human-readable rendering. Branch on `kind` instead when the caller needs to react.
|
|
48
|
+
*/
|
|
49
|
+
readonly describe: (error: ProofreadError) => string;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/proofreading/proofreading-report.d.ts
|
|
53
|
+
declare const ProofreadingReportSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
54
|
+
readonly range: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
55
|
+
readonly source: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
56
|
+
readonly start: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
57
|
+
readonly end: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
58
|
+
}, undefined>, v.ReadonlyAction<{
|
|
59
|
+
start: number;
|
|
60
|
+
end: number;
|
|
61
|
+
}>]>, v.CheckAction<Readonly<{
|
|
62
|
+
start: number;
|
|
63
|
+
end: number;
|
|
64
|
+
}>, "range end must not precede its start">]>, v.BrandAction<Readonly<{
|
|
65
|
+
start: number;
|
|
66
|
+
end: number;
|
|
67
|
+
}>, "SourceRange">]>;
|
|
68
|
+
readonly display: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
69
|
+
readonly start: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
70
|
+
readonly end: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
71
|
+
}, undefined>, v.ReadonlyAction<{
|
|
72
|
+
start: number;
|
|
73
|
+
end: number;
|
|
74
|
+
}>]>, v.CheckAction<Readonly<{
|
|
75
|
+
start: number;
|
|
76
|
+
end: number;
|
|
77
|
+
}>, "range end must not precede its start">]>, v.BrandAction<Readonly<{
|
|
78
|
+
start: number;
|
|
79
|
+
end: number;
|
|
80
|
+
}>, "DisplayRange">]>;
|
|
81
|
+
readonly graphemes: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
82
|
+
readonly start: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
83
|
+
readonly end: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
84
|
+
}, undefined>, v.ReadonlyAction<{
|
|
85
|
+
start: number;
|
|
86
|
+
end: number;
|
|
87
|
+
}>]>, v.CheckAction<Readonly<{
|
|
88
|
+
start: number;
|
|
89
|
+
end: number;
|
|
90
|
+
}>, "range end must not precede its start">]>, v.BrandAction<Readonly<{
|
|
91
|
+
start: number;
|
|
92
|
+
end: number;
|
|
93
|
+
}>, "GraphemeRange">]>;
|
|
94
|
+
}, undefined>, v.ReadonlyAction<{
|
|
95
|
+
source: Readonly<{
|
|
96
|
+
start: number;
|
|
97
|
+
end: number;
|
|
98
|
+
}> & v.Brand<"SourceRange">;
|
|
99
|
+
display: Readonly<{
|
|
100
|
+
start: number;
|
|
101
|
+
end: number;
|
|
102
|
+
}> & v.Brand<"DisplayRange">;
|
|
103
|
+
graphemes: Readonly<{
|
|
104
|
+
start: number;
|
|
105
|
+
end: number;
|
|
106
|
+
}> & v.Brand<"GraphemeRange">;
|
|
107
|
+
}>]>;
|
|
108
|
+
readonly messageId: v.StringSchema<undefined>;
|
|
109
|
+
readonly data: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<{
|
|
110
|
+
[x: string]: string | number;
|
|
111
|
+
}>]>, undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* Omitted means `error`: a rule that says nothing is claiming it found a real defect.
|
|
114
|
+
*/
|
|
115
|
+
readonly severity: v.OptionalSchema<v.PicklistSchema<["warning", "error"], undefined>, undefined>;
|
|
116
|
+
}, undefined>, v.ReadonlyAction<{
|
|
117
|
+
readonly range: Readonly<{
|
|
118
|
+
source: Readonly<{
|
|
119
|
+
start: number;
|
|
120
|
+
end: number;
|
|
121
|
+
}> & v.Brand<"SourceRange">;
|
|
122
|
+
display: Readonly<{
|
|
123
|
+
start: number;
|
|
124
|
+
end: number;
|
|
125
|
+
}> & v.Brand<"DisplayRange">;
|
|
126
|
+
graphemes: Readonly<{
|
|
127
|
+
start: number;
|
|
128
|
+
end: number;
|
|
129
|
+
}> & v.Brand<"GraphemeRange">;
|
|
130
|
+
}>;
|
|
131
|
+
messageId: string;
|
|
132
|
+
data?: Readonly<{
|
|
133
|
+
[x: string]: string | number;
|
|
134
|
+
}> | undefined;
|
|
135
|
+
severity?: "error" | "warning" | undefined;
|
|
136
|
+
}>]>;
|
|
137
|
+
/**
|
|
138
|
+
* What a rule hands back for one finding. The rule names a message it declared rather than
|
|
139
|
+
* formatting text itself, so the same rule can be presented in any language.
|
|
140
|
+
*/
|
|
141
|
+
type ProofreadingReport = v.InferOutput<typeof ProofreadingReportSchema>;
|
|
142
|
+
declare const ProofreadingReport: {
|
|
143
|
+
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
144
|
+
readonly range: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
145
|
+
readonly source: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
146
|
+
readonly start: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
147
|
+
readonly end: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
148
|
+
}, undefined>, v.ReadonlyAction<{
|
|
149
|
+
start: number;
|
|
150
|
+
end: number;
|
|
151
|
+
}>]>, v.CheckAction<Readonly<{
|
|
152
|
+
start: number;
|
|
153
|
+
end: number;
|
|
154
|
+
}>, "range end must not precede its start">]>, v.BrandAction<Readonly<{
|
|
155
|
+
start: number;
|
|
156
|
+
end: number;
|
|
157
|
+
}>, "SourceRange">]>;
|
|
158
|
+
readonly display: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
159
|
+
readonly start: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
160
|
+
readonly end: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
161
|
+
}, undefined>, v.ReadonlyAction<{
|
|
162
|
+
start: number;
|
|
163
|
+
end: number;
|
|
164
|
+
}>]>, v.CheckAction<Readonly<{
|
|
165
|
+
start: number;
|
|
166
|
+
end: number;
|
|
167
|
+
}>, "range end must not precede its start">]>, v.BrandAction<Readonly<{
|
|
168
|
+
start: number;
|
|
169
|
+
end: number;
|
|
170
|
+
}>, "DisplayRange">]>;
|
|
171
|
+
readonly graphemes: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
172
|
+
readonly start: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
173
|
+
readonly end: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
174
|
+
}, undefined>, v.ReadonlyAction<{
|
|
175
|
+
start: number;
|
|
176
|
+
end: number;
|
|
177
|
+
}>]>, v.CheckAction<Readonly<{
|
|
178
|
+
start: number;
|
|
179
|
+
end: number;
|
|
180
|
+
}>, "range end must not precede its start">]>, v.BrandAction<Readonly<{
|
|
181
|
+
start: number;
|
|
182
|
+
end: number;
|
|
183
|
+
}>, "GraphemeRange">]>;
|
|
184
|
+
}, undefined>, v.ReadonlyAction<{
|
|
185
|
+
source: Readonly<{
|
|
186
|
+
start: number;
|
|
187
|
+
end: number;
|
|
188
|
+
}> & v.Brand<"SourceRange">;
|
|
189
|
+
display: Readonly<{
|
|
190
|
+
start: number;
|
|
191
|
+
end: number;
|
|
192
|
+
}> & v.Brand<"DisplayRange">;
|
|
193
|
+
graphemes: Readonly<{
|
|
194
|
+
start: number;
|
|
195
|
+
end: number;
|
|
196
|
+
}> & v.Brand<"GraphemeRange">;
|
|
197
|
+
}>]>;
|
|
198
|
+
readonly messageId: v.StringSchema<undefined>;
|
|
199
|
+
readonly data: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, v.ReadonlyAction<{
|
|
200
|
+
[x: string]: string | number;
|
|
201
|
+
}>]>, undefined>;
|
|
202
|
+
/**
|
|
203
|
+
* Omitted means `error`: a rule that says nothing is claiming it found a real defect.
|
|
204
|
+
*/
|
|
205
|
+
readonly severity: v.OptionalSchema<v.PicklistSchema<["warning", "error"], undefined>, undefined>;
|
|
206
|
+
}, undefined>, v.ReadonlyAction<{
|
|
207
|
+
readonly range: Readonly<{
|
|
208
|
+
source: Readonly<{
|
|
209
|
+
start: number;
|
|
210
|
+
end: number;
|
|
211
|
+
}> & v.Brand<"SourceRange">;
|
|
212
|
+
display: Readonly<{
|
|
213
|
+
start: number;
|
|
214
|
+
end: number;
|
|
215
|
+
}> & v.Brand<"DisplayRange">;
|
|
216
|
+
graphemes: Readonly<{
|
|
217
|
+
start: number;
|
|
218
|
+
end: number;
|
|
219
|
+
}> & v.Brand<"GraphemeRange">;
|
|
220
|
+
}>;
|
|
221
|
+
messageId: string;
|
|
222
|
+
data?: Readonly<{
|
|
223
|
+
[x: string]: string | number;
|
|
224
|
+
}> | undefined;
|
|
225
|
+
severity?: "error" | "warning" | undefined;
|
|
226
|
+
}>]>;
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/proofreading/proofreading-rule-context.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Handed to a rule for the duration of one check; the only way a rule emits findings.
|
|
232
|
+
*/
|
|
233
|
+
type ProofreadingRuleContext = Readonly<{
|
|
234
|
+
report: (report: ProofreadingReport) => void;
|
|
235
|
+
}>;
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/proofreading/proofreading-rule.d.ts
|
|
238
|
+
declare const ProofreadingRuleMessagesSchema: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.ReadonlyAction<{
|
|
239
|
+
[x: string]: string;
|
|
240
|
+
}>]>;
|
|
241
|
+
/**
|
|
242
|
+
* Message templates the rule can name in a report, keyed by message ID.
|
|
243
|
+
*/
|
|
244
|
+
type ProofreadingRuleMessages = v.InferOutput<typeof ProofreadingRuleMessagesSchema>;
|
|
245
|
+
declare const ProofreadingRuleMetaSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
246
|
+
readonly id: v.StringSchema<undefined>;
|
|
247
|
+
readonly messages: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.ReadonlyAction<{
|
|
248
|
+
[x: string]: string;
|
|
249
|
+
}>]>;
|
|
250
|
+
}, undefined>, v.ReadonlyAction<{
|
|
251
|
+
id: string;
|
|
252
|
+
readonly messages: Readonly<{
|
|
253
|
+
[x: string]: string;
|
|
254
|
+
}>;
|
|
255
|
+
}>]>;
|
|
256
|
+
type ProofreadingRuleMeta = v.InferOutput<typeof ProofreadingRuleMetaSchema>;
|
|
257
|
+
declare const ProofreadingRuleMeta: {
|
|
258
|
+
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
259
|
+
readonly id: v.StringSchema<undefined>;
|
|
260
|
+
readonly messages: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.ReadonlyAction<{
|
|
261
|
+
[x: string]: string;
|
|
262
|
+
}>]>;
|
|
263
|
+
}, undefined>, v.ReadonlyAction<{
|
|
264
|
+
id: string;
|
|
265
|
+
readonly messages: Readonly<{
|
|
266
|
+
[x: string]: string;
|
|
267
|
+
}>;
|
|
268
|
+
}>]>;
|
|
269
|
+
readonly messagesSchema: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.ReadonlyAction<{
|
|
270
|
+
[x: string]: string;
|
|
271
|
+
}>]>;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* A rule that only needs the parsed manuscript. The `kind` sits on the rule itself, not inside
|
|
275
|
+
* `meta`, so the runner narrows to the right `check` signature without a cast.
|
|
276
|
+
*/
|
|
277
|
+
type ParsedProofreadingRule = Readonly<{
|
|
278
|
+
kind: "parsed";
|
|
279
|
+
meta: ProofreadingRuleMeta;
|
|
280
|
+
check: (manuscript: ParsedManuscript, context: ProofreadingRuleContext) => void;
|
|
281
|
+
}>;
|
|
282
|
+
/**
|
|
283
|
+
* A rule that needs the composed manuscript, for findings that depend on placement.
|
|
284
|
+
*/
|
|
285
|
+
type ComposedProofreadingRule<TComposed extends ComposedManuscript = ComposedManuscript> = Readonly<{
|
|
286
|
+
kind: "composed";
|
|
287
|
+
meta: ProofreadingRuleMeta;
|
|
288
|
+
check: (manuscript: TComposed, context: ProofreadingRuleContext) => void;
|
|
289
|
+
}>;
|
|
290
|
+
type ProofreadingRule = ParsedProofreadingRule | ComposedProofreadingRule;
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/proofreading/proofread-manuscript.d.ts
|
|
293
|
+
/**
|
|
294
|
+
* `TRule` is deliberately unconstrained: a rule written for one composer's manuscript is not a
|
|
295
|
+
* `ProofreadingRule`, because accepting a narrower manuscript makes it a narrower function. The
|
|
296
|
+
* overloads below pin down which rules each call actually accepts.
|
|
297
|
+
*/
|
|
298
|
+
type ProofreadOptions<TRule> = Readonly<{
|
|
299
|
+
rules: readonly TRule[];
|
|
300
|
+
}>;
|
|
301
|
+
type Diagnostics = readonly ManuscriptDiagnostic[];
|
|
302
|
+
type ProofreadOutcome = ManuscriptResult<Diagnostics, ProofreadError>;
|
|
303
|
+
declare function proofreadManuscript(manuscript: ParsedManuscript, options: ProofreadOptions<ParsedProofreadingRule>): ProofreadOutcome;
|
|
304
|
+
/**
|
|
305
|
+
* Rules are typed against the exact composed manuscript being checked, so a grid-specific rule
|
|
306
|
+
* cannot be handed a manuscript from a different composer.
|
|
307
|
+
*/
|
|
308
|
+
declare function proofreadManuscript<TComposed extends ComposedManuscript>(manuscript: TComposed, options: ProofreadOptions<ParsedProofreadingRule | ComposedProofreadingRule<TComposed>>): ProofreadOutcome;
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/proofreading/rules/consistent-kanji-opening.d.ts
|
|
311
|
+
declare const KanjiOpeningPairSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
312
|
+
readonly closed: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
313
|
+
readonly opened: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
|
|
314
|
+
}, undefined>, v.ReadonlyAction<{
|
|
315
|
+
closed: string;
|
|
316
|
+
opened: string;
|
|
317
|
+
}>]>, v.CheckAction<Readonly<{
|
|
318
|
+
closed: string;
|
|
319
|
+
opened: string;
|
|
320
|
+
}>, "a pair must hold two different spellings">]>;
|
|
321
|
+
/**
|
|
322
|
+
* One word in both of its spellings — `出来る` against `できる`. Japanese editing names the two choices
|
|
323
|
+
* rather than the two forms: writing a word in kanji is 閉じる and writing it in kana is 開く, which is
|
|
324
|
+
* where the field names come from. Which one a work prefers is its own house style; using both
|
|
325
|
+
* within one work is 表記ゆれ.
|
|
326
|
+
*/
|
|
327
|
+
type KanjiOpeningPair = v.InferOutput<typeof KanjiOpeningPairSchema>;
|
|
328
|
+
type ConsistentKanjiOpeningOptions = Readonly<{
|
|
329
|
+
pairs?: readonly KanjiOpeningPair[];
|
|
330
|
+
}>;
|
|
331
|
+
declare const consistentKanjiOpeningRule: () => ParsedProofreadingRule;
|
|
332
|
+
declare function createConsistentKanjiOpeningRule(options?: ConsistentKanjiOpeningOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/proofreading/rules/consistent-latin-width.d.ts
|
|
335
|
+
/**
|
|
336
|
+
* Halfwidth and fullwidth Latin letters (半角英字 and 全角英字) in one work. In vertical writing the two
|
|
337
|
+
* are set differently — a fullwidth letter stands upright on its own em, a halfwidth one joins a
|
|
338
|
+
* run that may turn sideways — so mixing them is 表記ゆれ the reader can see. Which one a work uses is
|
|
339
|
+
* its own choice, hence a warning.
|
|
340
|
+
*/
|
|
341
|
+
declare const consistentLatinWidthRule: () => ParsedProofreadingRule;
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/proofreading/rules/consistent-numeral-width.d.ts
|
|
344
|
+
/**
|
|
345
|
+
* Halfwidth and fullwidth digits (半角数字 and 全角数字) in one work. A fullwidth digit stands upright on
|
|
346
|
+
* its own em; a halfwidth pair sets as 縦中横 inside one. Mixing them is 表記ゆれ, but which one a work
|
|
347
|
+
* uses is its own choice, hence a warning.
|
|
348
|
+
*/
|
|
349
|
+
declare const consistentNumeralWidthRule: () => ParsedProofreadingRule;
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/proofreading/rules/dash.d.ts
|
|
352
|
+
declare const DashCharacterSchema: v.PicklistSchema<readonly ["―", "—", "─"], undefined>;
|
|
353
|
+
type DashCharacter = v.InferOutput<typeof DashCharacterSchema>;
|
|
354
|
+
type DashOptions = Readonly<{
|
|
355
|
+
preferred?: DashCharacter;
|
|
356
|
+
}>;
|
|
357
|
+
declare const dashRule: () => ParsedProofreadingRule;
|
|
358
|
+
declare function createDashRule(options?: DashOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/proofreading/rules/default-rules.d.ts
|
|
361
|
+
/**
|
|
362
|
+
* The built-in rule set at its default configuration. Infallible by construction: every rule is
|
|
363
|
+
* built from constants, so there is no options error for a caller to handle.
|
|
364
|
+
*
|
|
365
|
+
* Rules whose answer depends on the work's own conventions — which width numerals take, whether a
|
|
366
|
+
* word is written in kanji or kana — are exported individually instead of included here.
|
|
367
|
+
*/
|
|
368
|
+
declare function createDefaultProofreadingRules(): readonly ParsedProofreadingRule[];
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/proofreading/rules/ellipsis-character.d.ts
|
|
371
|
+
/**
|
|
372
|
+
* Stand-ins for the ellipsis (三点リーダー) `…`. Only the real character is set on its own em and pairs
|
|
373
|
+
* into a 2倍リーダ; a run of ASCII periods is neither. Runs of `。` and `・` are left to the rules that
|
|
374
|
+
* already count them, so one substitute is never reported twice.
|
|
375
|
+
*/
|
|
376
|
+
declare const ellipsisCharacterRule: () => ParsedProofreadingRule;
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/proofreading/rules/even-ellipsis.d.ts
|
|
379
|
+
/**
|
|
380
|
+
* The ellipsis a novel sets is the 2倍リーダ: two copies of `…` read as one mark six dots long. An odd
|
|
381
|
+
* run leaves half of it, the same way an odd dash run does.
|
|
382
|
+
*/
|
|
383
|
+
declare const evenEllipsisRule: () => ParsedProofreadingRule;
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/proofreading/rules/fullwidth-japanese-punctuation.d.ts
|
|
386
|
+
/**
|
|
387
|
+
* Halfwidth punctuation (約物) where Japanese prose calls for the fullwidth form. Japanese
|
|
388
|
+
* punctuation is designed to occupy one em, and the composer's spacing rules are stated in those
|
|
389
|
+
* terms, so a halfwidth form neither lands on the grid nor picks up the spacing its character class
|
|
390
|
+
* calls for.
|
|
391
|
+
*
|
|
392
|
+
* The three checks differ in how much the surroundings decide the answer, which is why only the
|
|
393
|
+
* first is decisive on its own.
|
|
394
|
+
*/
|
|
395
|
+
declare const fullwidthJapanesePunctuationRule: () => ParsedProofreadingRule;
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/proofreading/rules/max-arabic-numeral-digits.d.ts
|
|
398
|
+
type MaxArabicNumeralDigitsOptions = Readonly<{
|
|
399
|
+
maxDigits?: number;
|
|
400
|
+
}>;
|
|
401
|
+
declare const maxArabicNumeralDigitsRule: () => ParsedProofreadingRule;
|
|
402
|
+
declare function createMaxArabicNumeralDigitsRule(options?: MaxArabicNumeralDigitsOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/proofreading/rules/minus-before-number.d.ts
|
|
405
|
+
/**
|
|
406
|
+
* A minus sign (U+2212, JLReq 演算記号) with no number after it. It is almost always a mistyped dash or
|
|
407
|
+
* prolonged sound mark, which look alike but belong to different character classes and so are
|
|
408
|
+
* spaced and broken differently.
|
|
409
|
+
*/
|
|
410
|
+
declare const minusBeforeNumberRule: () => ParsedProofreadingRule;
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/proofreading/rules/no-consecutive-interpunct.d.ts
|
|
413
|
+
/**
|
|
414
|
+
* A repeated interpunct (中黒, JLReq 中点類 cl-05). The interpunct separates items; repeating it is
|
|
415
|
+
* almost always a stand-in for an ellipsis, which `kg/ellipsis-character` names properly.
|
|
416
|
+
*/
|
|
417
|
+
declare const noConsecutiveInterpunctRule: () => ParsedProofreadingRule;
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/proofreading/rules/no-consecutive-punctuation.d.ts
|
|
420
|
+
/**
|
|
421
|
+
* A repeated full stop or comma (句読点 — JLReq 句点類 cl-06 and 読点類 cl-07). Each ends its clause once,
|
|
422
|
+
* so a run of them is not punctuation at all: it is a sentence trailing off, which Japanese prose
|
|
423
|
+
* writes with `…`.
|
|
424
|
+
*/
|
|
425
|
+
declare const noConsecutivePunctuationRule: () => ParsedProofreadingRule;
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/proofreading/rules/paragraph-opening.d.ts
|
|
428
|
+
type ParagraphOpeningOptions = Readonly<{
|
|
429
|
+
openingBrackets?: string;
|
|
430
|
+
}>;
|
|
431
|
+
declare const paragraphOpeningRule: () => ParsedProofreadingRule;
|
|
432
|
+
declare function createParagraphOpeningRule(options?: ParagraphOpeningOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
433
|
+
//#endregion
|
|
434
|
+
//#region src/proofreading/rules/punctuation-before-closing-quote.d.ts
|
|
435
|
+
/**
|
|
436
|
+
* A full stop or comma immediately before a closing bracket (終わり括弧類). The bracket already closes
|
|
437
|
+
* the quotation, and both characters are set on a half em, so the pair reads as a gap in the line
|
|
438
|
+
* rather than as punctuation. Japanese practice drops the punctuation and keeps the bracket.
|
|
439
|
+
*/
|
|
440
|
+
declare const punctuationBeforeClosingQuoteRule: () => ParsedProofreadingRule;
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/proofreading/rules/space-after-question-or-exclamation.d.ts
|
|
443
|
+
/**
|
|
444
|
+
* The gap that follows every run of ! or ? (区切り約物, JLReq 3.1.6). A dividing punctuation mark ends a
|
|
445
|
+
* sentence without a full stop, so a full em of white stands in for the one a 句点 would have
|
|
446
|
+
* carried. A run at the end of a line or right before a closing bracket is already separated from
|
|
447
|
+
* what follows and needs no gap; anywhere else it takes exactly one ideographic space.
|
|
448
|
+
*/
|
|
449
|
+
declare const spaceAfterQuestionOrExclamationRule: () => ParsedProofreadingRule;
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/proofreading/rules/variant-character.d.ts
|
|
452
|
+
/**
|
|
453
|
+
* Variant forms of a character (異体字) and the selectors that request them (字形選択子 / IVS). Whether
|
|
454
|
+
* such a form survives depends on the font and the platform, so a manuscript that relies on one
|
|
455
|
+
* will not read the same everywhere it is published.
|
|
456
|
+
*
|
|
457
|
+
* Scans the source rather than the display text: notation removal must not hide a variant.
|
|
458
|
+
*/
|
|
459
|
+
declare const variantCharacterRule: () => ParsedProofreadingRule;
|
|
460
|
+
//#endregion
|
|
461
|
+
export { type ComposedProofreadingRule, type ConsistentKanjiOpeningOptions, type DashOptions, InvalidRuleOptions, type KanjiOpeningPair, type MaxArabicNumeralDigitsOptions, type ParagraphOpeningOptions, type ParsedProofreadingRule, ProofreadError, type ProofreadOptions, type ProofreadingReport, type ProofreadingRule, type ProofreadingRuleContext, type ProofreadingRuleMessages, ProofreadingRuleMeta, consistentKanjiOpeningRule, consistentLatinWidthRule, consistentNumeralWidthRule, createConsistentKanjiOpeningRule, createDashRule, createDefaultProofreadingRules, createMaxArabicNumeralDigitsRule, createParagraphOpeningRule, dashRule, ellipsisCharacterRule, evenEllipsisRule, fullwidthJapanesePunctuationRule, maxArabicNumeralDigitsRule, minusBeforeNumberRule, noConsecutiveInterpunctRule, noConsecutivePunctuationRule, paragraphOpeningRule, proofreadManuscript, punctuationBeforeClosingQuoteRule, spaceAfterQuestionOrExclamationRule, variantCharacterRule };
|