1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
//! The vocabulary and shapes every document reader's output is built from: the
//! block headers and unit marks, the story names and the cell addresses shared by
//! the OOXML readers ([`crate::ooxml`]) and the legacy `.doc`/`.xls`/`.ppt` one
//! ([`crate::legacy`]).
//!
//! A reader's output is assembled from a handful of shapes — a header over
//! indented lines, a label over a run of text, a sheet or slide header carrying
//! its state, a cell address — and a mark or a name. What more than one reader
//! prints is stated once here, so two of them cannot name one thing two ways: the
//! Excel reader and the legacy one both print a sheet block, the Word reader and
//! the legacy one both print the stories a Word file carries, and every reader
//! that writes a spreadsheet cell address writes it through [`column_letters`].
//! What a reading found in a file and did not show is stated here as well
//! ([`Unshown`]): each kind's own words, one line per kind, so every reader's arm
//! and both delivery layers report a loss the same way, and
//! [`unshown_report_examples`] quotes a report line in the model-facing
//! description of a reading.
//! The names only the Word reader prints — the story names a `.docx` and a `.doc`
//! reading share, and the block a text box prints as — sit beside them rather than
//! inside one of the two files that print them: the marks the kit's refusals match
//! are stated in `assets/docgen/rules.json`, and the Word reader's own tests pin
//! the list to what a reading shows. The vocabulary a chart's content prints as —
//! its block header, its field labels, the annotations a value carries and the
//! marks standing in for values — is stated here as well, because all three OOXML
//! readers print it through one module and the model-facing description of a
//! reading names it.
//!
//! The words of the PowerPoint marks — `(title)`, `(hidden slide)`,
//! `(diagram text)`, `(diagram text could not be read)`, `(no text)` — are
//! stated in `assets/docgen/rules.json` rather than here, because the document
//! kit's refusals name them too (see [`crate::docgen::ppt_marks`]), and
//! `(no text)` in particular must be read from there by whoever prints it.
//! [`slide_header`] composes the slide's number with that same hidden-slide mark,
//! and [`ppt_description_substitutions`] binds those marks and the three slide
//! labels to the `{{ppt_…}}` keys the model-facing texts naming a reading's marks
//! spell.
use ;
// ── Shared text shapes ──────────────────────────────────────────
/// `header` then one indented line per entry. Every reader builds its blocks
/// from this, so the text shapes stay one implementation.
pub
/// [`text_lines`], or `header (marker)` when there is nothing to list — each
/// reader supplies the marker its own empty unit prints.
pub
/// `Label:` then each line of `text` indented by two spaces — the shape
/// [`text_lines`] gives the other two families, for a caller holding a block of
/// text as one string rather than as lines.
pub
/// The lines of `text`, as [`text_lines`] takes them.
pub
// ── Column addresses ────────────────────────────────────────────
/// The spreadsheet column letters for a zero-based column index (`0` is `A`).
/// Every reader that writes a cell address writes it through this.
pub
/// The zero-based column index of a cell reference (`"B12"` -> `1`), or `None`
/// when it does not start with a column letter — the inverse of
/// [`column_letters`], so a reference one side writes is read back by one
/// implementation.
pub
// ── Sheet marks ─────────────────────────────────────────────────
/// The mark a sheet with no valued cell prints in place of its lines.
pub const NO_VALUES: &str = "(no values)";
/// The mark a value carries when it is the number the file stores rather than a
/// display of it: the cell's or the chart cache's number format was not read, is
/// not one this reader reproduces for this value, or shows nothing at all for it.
/// A spreadsheet cell and a chart's cached value carry the same one, so one
/// number is not spelled two ways in one answer.
pub const MARK_STORED: &str = " (stored number, format not shown)";
/// The line a chart sheet prints first — the tab is one chart over the whole
/// sheet rather than a grid of cells — with the chart's own content under it,
/// and the report naming the chart unless its content was described.
pub const CHART_SHEET: &str = "(chart sheet)";
/// A sheet's block header, marked when the workbook hides the sheet. The state a
/// workbook writes is one of two words, and a producer's own casing is no reason
/// to pass a hidden sheet off as an ordinary one. The legacy `.xls` reader
/// deliberately passes `None`: the old format takes none of the newer arms' marks
/// — not a hidden sheet, though the crate's own `Sheet::hidden` is right there and
/// that arm reads the sheet struct anyway — so a legacy sheet is never marked (see
/// [`crate::legacy`]).
pub
// ── Slide marks ─────────────────────────────────────────────────
/// One slide's block header: `Slide <n>:`, plus ` (hidden slide)` when the
/// presentation hides it. The mark is the kit's own ([`crate::docgen::ppt_marks`])
/// and the label the kit's refusals name is the shared template
/// ([`crate::docgen::ppt_slide_labels`]), so the reader and the kit cannot name
/// either two ways.
pub
/// The header of the block a slide's speaker notes print under: `Slide <n>
/// notes:`.
pub
/// The header of the block a slide's comments and their replies print under:
/// `Slide <n> comments:`.
pub
/// `template` with its `{n}` replaced by `number` — the one place a slide's own
/// label is built from the shared template, for a reading and for the
/// model-facing descriptions alike. A description passes `<n>`, the way the rest
/// of that text spells a place a real value fills, so the prompt names the label
/// the reader prints without spelling it a second time.
pub
/// The `{{ppt_…}}` pairs a model-facing text spells for a reading's marks: the
/// kit's five marks and the three slide labels, with `<n>` where a description
/// leaves the slide's number to the reader — a reading prints a real number
/// through [`slide_header`], [`slide_notes_header`] and [`slide_comments_header`]
/// instead. The chart keys stay bound in the `read` description alone, which is
/// their only consumer.
pub
/// The mark a text box is printed as, by both Word readers: a `[text box]`
/// block in the enclosing flow.
pub const TEXT_BOX: &str = "[text box]";
/// The mark that follows a Word link's own content: `(link: ADDRESS)`, or
/// `(link: internal)` for an anchor inside the same document. The address and
/// its closing `)` are the reader's; this is the opening the description names.
pub const DOC_LINK: &str = "(link: ";
// ── Chart marks ─────────────────────────────────────────────────
//
// The vocabulary a chart's content prints as, wherever a reading prints it: the
// three OOXML readers all print it through [`crate::ooxml::chart`], and the
// model-facing description of a reading names it from here (`src/tools/read.rs`),
// so the two cannot spell one mark two ways. A chart's own field labels are
// deliberately not patterns in the document kit's refusals (`docx_marks`):
// `Title:`, `Text:` and `Label:` are ordinary words a document's own text can
// hold. So is the bare `Chart:` of a part that names no kind, which would refuse
// any document's own sentence opening with it. The header a named kind prints,
// the series label (named or numbered), the annotation beside a value and the
// marks standing in for values are patterns.
/// The label a chart's own title prints under.
pub const CHART_TITLE: &str = "Title:";
/// The label an axis title prints under.
pub const CHART_TEXT: &str = "Text:";
/// The label a data label's own text prints under.
pub const CHART_LABEL: &str = "Label:";
/// The mark a series with no values in the chart part carries in place of them.
pub const CHART_NO_VALUES: &str = "(no values in the chart part)";
/// The mark a series whose values are only in the table the chart attaches
/// carries in place of them: that table is not opened by a reading.
pub const CHART_VALUES_ATTACHED: &str = "(values only in the attached table)";
/// The mark a chart part that cannot be read prints.
pub const CHART_UNREADABLE: &str = "(the chart part could not be read)";
/// The mark an extended (`chartEx`) chart part prints: its own schema is not
/// read here.
pub const CHART_EXTENDED: &str = "(an extended chart kind, not read)";
/// The header a chart's content prints under: `Chart (<kind>):`, or `Chart:` for
/// a part that names no kind. A model-facing description passes `<kind>`, the way
/// it passes `<n>` for a slide's number, so the header is stated once.
pub
/// The label a series' values print under: `Series "<name>":`, or the series'
/// number when the part gives it no name. A model-facing description passes
/// `<name>`, the way it passes `<n>` for a slide's number, so the label is
/// stated once.
pub
/// The annotation a bubble point's size prints beside its value.
pub
/// How much of a bounded list a chart's lines leave out: `3 more value(s)`.
pub
// ── Word story names ────────────────────────────────────────────
//
// The names of the Word stories a reader prints. The `.docx` reader numbers one
// block per definition — `Footnote 1:` — and pairs a header or footer with the
// variants that use it — `Header (default):`; the legacy `.doc` reader is handed
// a whole story at once, so it prints the same name with no number.
/// A Word header part's block name.
pub const WORD_HEADER: &str = "Header";
/// A Word footer part's block name.
pub const WORD_FOOTER: &str = "Footer";
/// A `w:footnote` definition's block name.
pub const WORD_FOOTNOTE: &str = "Footnote";
/// A `w:endnote` definition's block name.
pub const WORD_ENDNOTE: &str = "Endnote";
/// A `w:comment` definition's block name.
pub const WORD_COMMENT: &str = "Comment";
// The names the legacy `.doc` reader prints. Its own reader hands it a whole
// story at once — every footnote in one, every header and every footer in one —
// so there is nothing to number and the same word is used in the plural; the
// header story holds every header and every footer, so it names both. These are
// the same names the `WORD_*` block above gives one definition at a time, and
// the colon a printed block header carries is added where the block is built.
/// The legacy `.doc` header/footer story's name.
pub const DOC_HEADERS_FOOTERS: &str = "Headers and footers";
/// The legacy `.doc` footnote story's name.
pub const DOC_FOOTNOTES: &str = "Footnotes";
/// The legacy `.doc` endnote story's name.
pub const DOC_ENDNOTES: &str = "Endnotes";
/// The legacy `.doc` comment story's name.
pub const DOC_COMMENTS: &str = "Comments";
// ── The report of what a reading did not show ───────────────────
/// One kind of content a reading found in a file and did not show. The variants'
/// own order is the report's order: the document's structure first, the media a
/// package embeds after it, and the pages a reading could not deliver last, so two
/// documents holding the same kinds read the same way.
pub
/// What a reading found in the file and did not show, counted per kind: the
/// report a conversion returns beside its text and its notes, so a loss is named
/// rather than left to be read as content that is not there.
///
/// A reader counts only what its own pass met and only what it really left out: a
/// kind at zero prints nothing, so the report never names content the file does
/// not hold. What no reader looks at — a PDF text page's vector drawings, or the
/// parts of a package that hold nothing a model reads (its themes, its document
/// properties) — is deliberately absent, and belongs in the model-facing
/// description of the reading instead: a kind here is a promise the reading
/// keeps. A PDF's own description is the exception: it *is* read (see
/// [`crate::pdf_marks`]), while a Word, Excel or PowerPoint package's document
/// properties are not. A package's styles part is read as far as a paragraph's
/// heading follows from it (see [`crate::ooxml::docx`]), and the rest of what it
/// states is formatting, not content a report could name.
pub
/// Two of the report's lines, as the model-facing description of a reading spells
/// them: built by the same code that prints a report, so a kind renamed here
/// cannot leave the description quoting a line no reading prints.
pub