@airmark/quiver 0.33.0 → 0.35.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.
Files changed (54) hide show
  1. package/README.md +18 -12
  2. package/package.json +7 -7
  3. package/quills/af4141/0.1.0/Quill.yaml +3 -12
  4. package/quills/af4141/0.1.0/example.md +53 -0
  5. package/quills/afmc_moa/0.0.1/Quill.yaml +29 -45
  6. package/quills/afmc_moa/0.0.1/example.md +114 -0
  7. package/quills/afmc_moa/0.0.1/packages/typst-afmc-moa/src/config.typ +1 -1
  8. package/quills/classic_resume/{0.0.1 → 0.1.0}/Quill.yaml +88 -168
  9. package/quills/classic_resume/0.1.0/example.md +111 -0
  10. package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/src/components.typ +77 -35
  11. package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/src/config.typ +23 -14
  12. package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/src/layout.typ +37 -7
  13. package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/src/lib.typ +1 -0
  14. package/quills/classic_resume/0.1.0/packages/ttq-classic-resume/src/util.typ +50 -0
  15. package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/typst.toml +0 -5
  16. package/quills/classic_resume/{0.0.1 → 0.1.0}/plate.typ +63 -56
  17. package/quills/cyber_career_plan/0.1.0/Quill.yaml +328 -0
  18. package/quills/cyber_career_plan/0.1.0/example.md +55 -0
  19. package/quills/cyber_career_plan/0.1.0/plate.typ +681 -0
  20. package/quills/daf1206/0.1.0/Quill.yaml +14 -16
  21. package/quills/daf1206/0.1.0/example.md +55 -0
  22. package/quills/daf4392/0.1.0/Quill.yaml +1 -6
  23. package/quills/daf4392/0.1.0/example.md +51 -0
  24. package/quills/usaf_letter/0.1.0/Quill.yaml +7 -42
  25. package/quills/usaf_letter/0.1.0/example.md +35 -0
  26. package/quills/{usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/fonts/Cinzel/LICENSE → usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/fonts/SpectralSC/OFL.txt} +2 -2
  27. package/quills/usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/fonts/SpectralSC/SpectralSC-Italic.ttf +0 -0
  28. package/quills/usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/fonts/SpectralSC/SpectralSC-Regular.ttf +0 -0
  29. package/quills/usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/src/frontmatter.typ +1 -1
  30. package/quills/usaf_letter/0.1.0/plate.typ +1 -4
  31. package/quills/usaf_memo/0.2.0/Quill.yaml +7 -40
  32. package/quills/usaf_memo/0.2.0/example.md +45 -0
  33. package/quills/usaf_memo/0.3.0/Quill.yaml +13 -50
  34. package/quills/usaf_memo/0.3.0/example.md +48 -0
  35. package/quills/{usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/fonts/Cinzel/LICENSE → usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/fonts/SpectralSC/OFL.txt} +2 -2
  36. package/quills/usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/fonts/SpectralSC/SpectralSC-Italic.ttf +0 -0
  37. package/quills/usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/fonts/SpectralSC/SpectralSC-Regular.ttf +0 -0
  38. package/quills/usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/src/frontmatter.typ +1 -1
  39. package/quills/usaf_memo/0.3.0/plate.typ +1 -4
  40. package/templates/deros_extension.md +40 -0
  41. package/templates/templates.json +7 -0
  42. package/quills/classic_resume/0.0.1/packages/ttq-classic-resume/src/util.typ +0 -32
  43. package/quills/cyber_ribbon_chart/0.0.1/Quill.yaml +0 -320
  44. package/quills/cyber_ribbon_chart/0.0.1/plate.typ +0 -428
  45. package/quills/usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/fonts/Cinzel/Cinzel-Regular.ttf +0 -0
  46. package/quills/usaf_letter/0.1.0/packages/tonguetoquill-usaf-letter/fonts/CopperplateCC/CopperplateCC-Heavy.otf +0 -0
  47. package/quills/usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/fonts/Cinzel/Cinzel-Regular.ttf +0 -0
  48. package/quills/usaf_memo/0.3.0/packages/tonguetoquill-usaf-memo/fonts/CopperplateCC/CopperplateCC-Heavy.otf +0 -0
  49. /package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/LICENSE +0 -0
  50. /package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/fonts/EBGaramond/EBGaramond-Bold.ttf +0 -0
  51. /package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/fonts/EBGaramond/EBGaramond-BoldItalic.ttf +0 -0
  52. /package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/fonts/EBGaramond/EBGaramond-Italic.ttf +0 -0
  53. /package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/fonts/EBGaramond/EBGaramond-Regular.ttf +0 -0
  54. /package/quills/classic_resume/{0.0.1 → 0.1.0}/packages/ttq-classic-resume/fonts/EBGaramond/OFL.txt +0 -0
@@ -0,0 +1,681 @@
1
+ #import "@local/quillmark-helper:0.1.0": data, roster
2
+
3
+ // ─── tokens ──────────────────────────────────────────────────────────────────
4
+ // Grays only, and none lighter than a copier holds: the chart is read from a
5
+ // photocopy, so a distinction it makes is a value contrast or it is lost.
6
+ #let ink = luma(12%)
7
+ #let mute = luma(40%)
8
+ #let hair = luma(82%)
9
+ #let shade = luma(88%)
10
+
11
+ // One type scale. A size off it is a fit, set to the width it was given, and
12
+ // says so where it is set.
13
+ #let micro = 6pt
14
+ #let small = 7pt
15
+ #let base = 8pt
16
+ #let lead = 9pt
17
+ #let display = 18pt
18
+
19
+ // Every row under the name hangs its label in one rail: the timeline's rows,
20
+ // the record's and the notes'. The labels are the page's headings, and the
21
+ // rail's edge is the one left edge everything after the name stands on.
22
+ #let rail = 1.2in
23
+ #let name-width = 2.5in
24
+
25
+ #let margin = 0.45in
26
+ #set page(width: 11in, height: 8.5in, margin: margin)
27
+ #set text(size: base, fill: ink)
28
+ // Every gap on the page is set where it is wanted rather than inherited.
29
+ #set block(spacing: 0pt)
30
+ #set par(spacing: 0pt)
31
+
32
+ #let officer = data.at("name", default: "").trim()
33
+ #set document(
34
+ title: if officer == "" { "Career Plan" } else { "Career Plan — " + officer },
35
+ author: officer,
36
+ )
37
+
38
+ // A `plaintext` field lowers to content padded with a space on each side, which
39
+ // would print inside a bold run and defeat an emptiness test.
40
+ #let trim(v) = {
41
+ if type(v) != content { return v }
42
+ let kids = v.at("children", default: none)
43
+ if kids == none { return v }
44
+ let pad(c) = c == [ ] or c.func() == parbreak
45
+ while kids.len() > 0 and pad(kids.first()) { kids = kids.slice(1) }
46
+ while kids.len() > 0 and pad(kids.last()) { kids = kids.slice(0, -1) }
47
+ kids.sum(default: [])
48
+ }
49
+ #let blank(v) = { let t = trim(v); t == none or t == [] or t == "" }
50
+ #let or-none(v) = if blank(v) { none } else { trim(v) }
51
+ #let plain(c) = if c == none { "" } else if type(c) == str { c } else if c.has("text") {
52
+ c.text
53
+ } else if c.has("children") {
54
+ c.children.map(plain).sum(default: "")
55
+ } else if c.func() == smartquote { "’" } else { " " }
56
+ #let dash = text(fill: mute)[—]
57
+
58
+ // The bundled fallback face carries no geometric glyphs — no ✓, ■, □, ●, ▸ — so
59
+ // a mark is drawn rather than set. Held against open is a value contrast, and
60
+ // the open box is stroked dark enough that a rater still finds it on a copy.
61
+ #let held-mark = box(baseline: 0.5pt, rect(width: 4.6pt, height: 4.6pt, fill: ink, stroke: 0.5pt + ink))
62
+ #let open-mark = box(baseline: 0.5pt, rect(width: 4.6pt, height: 4.6pt, fill: none, stroke: 0.5pt + mute))
63
+
64
+ #let eyebrow(body) = text(size: micro, weight: 700, tracking: 0.5pt, fill: mute, upper(body))
65
+ #let rail-label(body) = text(size: small, weight: 600, fill: mute, body)
66
+ #let divider(above) = block(above: above, below: 10pt, line(length: 100%, stroke: 0.5pt + ink))
67
+
68
+ #let show-date(d) = if d == none { none } else { d.display("[day padding:none] [month repr:short] [year]") }
69
+
70
+ // ─── inputs ──────────────────────────────────────────────────────────────────
71
+ #let quals = data.qualifications
72
+ #let comm-yg = data.commissioning_yg
73
+ // 0 is read as blank: it was this field's blank before the field took `?`.
74
+ #let adj-yg = { let v = data.at("adjusted_yg", default: none); if v == 0 { none } else { v } }
75
+ #let adjusted = adj-yg != none and adj-yg != comm-yg
76
+ #let board-yg = if adjusted { adj-yg } else { comm-yg }
77
+ // A required year not yet filled in arrives as 0. With no start year the window
78
+ // opens on the year group; with neither, as on a new chart, the axis counts
79
+ // from YG+0 and prints no calendar years rather than the years 0 to 11. With a
80
+ // start year but no year group there is nothing to count the ladder from, so
81
+ // the axis prints calendar years alone and no milestone is drawn.
82
+ #let start-year = if data.timeline_start_year == 0 { board-yg } else { data.timeline_start_year }
83
+ #let dated = start-year != 0
84
+ #let laddered = board-yg != 0 or not dated
85
+ #let yg-offset(k) = if k < 0 [YG#k] else [YG+#k]
86
+ // Eighteen is the widest the marks hold their columns at, and the schema cannot
87
+ // bound an integer, so a wider window draws at eighteen.
88
+ #let years = calc.clamp(data.timeline_years, 1, 18)
89
+ #let cols = years * 2
90
+ #let last-year = start-year + years - 1
91
+ #let window-end = if dated [#last-year] else { yg-offset(last-year - board-yg) }
92
+ #let in-window(y) = y >= start-year and y <= last-year
93
+ #let band-height = 0.46in
94
+ // Marks fit their year column: past twelve years they step off the scale.
95
+ #let narrow = years > 12
96
+ #let mark-size = if narrow { 5.6pt } else { micro }
97
+ #let mark-inset = if narrow { 2pt } else { 3.5pt }
98
+
99
+ // A half-year column is H1 (Jan–Jun, even) or H2 (Jul–Dec, odd), and each one is
100
+ // a VML cycle: Winter moves land in the first half, Summer moves in the second.
101
+ #let cycle-of(col) = if calc.rem(col, 2) == 0 { "Winter" } else { "Summer" }
102
+ #let col-of(year, cycle) = (year - start-year) * 2 + if cycle == "Winter" { 0 } else { 1 }
103
+
104
+ #let afsc = or-none(data.afsc)
105
+ #let duty = or-none(data.duty_title)
106
+ #let unit = or-none(data.unit)
107
+ #let move-year = data.at("move_year", default: none)
108
+
109
+ // Where the vectors branch. Everything left of it is the assignment you hold
110
+ // now, which is the same on every row, so it is drawn once across all of them.
111
+ // A move before the window is kept where it falls, so the tours after it are
112
+ // laid from their real start and cut at the left edge rather than shifted.
113
+ #let move-col = if move-year == none { 0 } else { col-of(move-year, data.move_cycle) }
114
+ #let current-span = if data.vectors.len() == 0 { 0 } else { calc.clamp(move-col, 0, cols) }
115
+
116
+ // ─── the ladder ──────────────────────────────────────────────────────────────
117
+ // Every 17X board and school gate, as an offset from the year group, counted
118
+ // from the adjusted year group where one is set because that is the year a
119
+ // board counts from. A board or a course falls in one year; IDE and SDE are
120
+ // each a window of four yearly looks, drawn as one span. A gate is done once
121
+ // any qualification it names is ticked (an IDE candidate has no looks left)
122
+ // and prints struck rather than as something still ahead.
123
+ #let held(keys) = keys.any(k => k in quals.education)
124
+ #let gates = (
125
+ (yg: 3, name: "Cyber 200", board: false, by: ("cyber_200",)),
126
+ (yg: 4, name: "SOS window", board: false, by: ("sos",)),
127
+ (yg: 8, name: "Maj board", board: true, by: ()),
128
+ (yg: 9, name: "Cyber 300", board: false, by: ("cyber_300",)),
129
+ (yg: 12, name: "Lt Col board", board: true, by: ()),
130
+ ).map(g => (..g, year: board-yg + g.yg, done: held(g.by)))
131
+ // A course whose year has passed unticked is what a rater most needs to see, so
132
+ // it stands before the window, in the rail, saying when it was due. A passed
133
+ // board is history.
134
+ #let gates = if laddered {
135
+ gates.map(g => (..g, overdue: not g.board and not g.done and g.year < start-year))
136
+ } else { () }
137
+ #let looks = ("1st", "2nd", "3rd", "final")
138
+ #let windows = if laddered {
139
+ (
140
+ (yg: 8, name: "IDE", by: ("ide_candidate", "ide_graduate")),
141
+ (yg: 14, name: "SDE", by: ("sde_candidate", "sde_graduate")),
142
+ ).map(w => (..w, done: held(w.by), years: looks.enumerate().map(((k, _)) => board-yg + w.yg + k)))
143
+ } else { () }
144
+ #let ahead = (
145
+ gates.filter(g => not g.done and g.year > last-year).len()
146
+ + windows.filter(w => not w.done).map(w => w.years.filter(y => y > last-year).len()).sum(default: 0)
147
+ )
148
+
149
+ // A board prints heaviest, since it is a date you are ranked against; a course
150
+ // is a seat, and prints plain. A board holds to one line: at eighteen years
151
+ // "Lt Col board" runs a little into YG+13, which the ladder leaves empty.
152
+ #let gate-mark(g) = {
153
+ let plain-mark(body, ..style) = box(inset: (x: 0.5pt, y: 2pt), text(size: mark-size, ..style, body))
154
+ if g.overdue {
155
+ plain-mark([#g.name, due #g.year], weight: 600, style: "italic")
156
+ } else if g.done {
157
+ plain-mark(strike(stroke: 0.5pt + mute, g.name), fill: mute)
158
+ } else if g.board {
159
+ box(fill: ink, inset: (x: mark-inset, y: 2pt), text(size: mark-size, weight: 700, fill: white, g.name.replace(" ", "\u{a0}")))
160
+ } else {
161
+ plain-mark(g.name, fill: mute)
162
+ }
163
+ }
164
+
165
+ // A window is one span over its looks in the chart, split by year and named
166
+ // once. Looks already past are history and the span opens at the left edge;
167
+ // looks past the window run it open into the right.
168
+ #let window-mark(w, shown) = {
169
+ let paint = if w.done { mute } else { ink }
170
+ let edge = 0.5pt + paint
171
+ box(
172
+ width: 100%,
173
+ stroke: (
174
+ top: edge,
175
+ bottom: edge,
176
+ left: if w.years.first() < start-year { none } else { edge },
177
+ right: if w.years.last() > last-year { none } else { edge },
178
+ ),
179
+ grid(
180
+ columns: (1fr,) * shown.len(),
181
+ inset: (x: mark-inset, y: 2pt),
182
+ stroke: (x, _) => (left: if x > 0 { 0.4pt + hair }),
183
+ ..shown.enumerate().map(((n, k)) => {
184
+ let name = [#if n == 0 [#w.name~]#looks.at(k)]
185
+ text(size: mark-size, weight: 600, fill: paint, if w.done { strike(stroke: 0.5pt + mute, name) } else { name })
186
+ }),
187
+ ),
188
+ )
189
+ }
190
+
191
+ // ─── vectors ─────────────────────────────────────────────────────────────────
192
+ #let ranks = ("Primary", "Alternate", "Backup")
193
+ #let current-stroke = 0.9pt + ink
194
+ #let constraint-stroke = 0.6pt + ink
195
+ #let school-stroke = (paint: mute, thickness: 0.5pt, dash: (2pt, 1.5pt))
196
+ #let tour-stroke = 0.5pt + luma(55%)
197
+
198
+ // Tours lay end to end from the move, so each one's cycle is where the one
199
+ // before it ended rather than something to keep in step by hand.
200
+ //
201
+ // Nothing is dropped. A tour the window cuts runs into the window's edge open
202
+ // and says which year it runs past; one starting beyond the window is counted
203
+ // on its row.
204
+ #let lay(tours) = {
205
+ let cursor = move-col
206
+ let out = ()
207
+ for t in tours {
208
+ out.push((tour: t, start: cursor, span: t.span))
209
+ cursor += t.span
210
+ }
211
+ // A tour over before the window opens is history, not plan.
212
+ out.filter(p => p.start + p.span > 0).map(p => {
213
+ let from = calc.max(0, p.start)
214
+ if from >= cols { (..p, beyond: true) } else {
215
+ (
216
+ ..p,
217
+ beyond: false,
218
+ from: from,
219
+ drawn: calc.min(p.start + p.span, cols) - from,
220
+ cut: p.start < 0,
221
+ clipped: p.start + p.span > cols,
222
+ )
223
+ }
224
+ })
225
+ }
226
+
227
+ #let vectors = data.vectors.enumerate().map(((i, v)) => (
228
+ rank: ranks.at(i, default: "Vector " + str(i + 1)),
229
+ track: or-none(v.track),
230
+ // A length is rounded to the half-year first; one that rounds outside 0.5 to
231
+ // 4 draws at the nearer end under a dagger the legend explains, since the
232
+ // schema cannot bound a number.
233
+ placed: lay(v.tours.map(t => {
234
+ let halves = int(calc.round(float(t.years) * 2))
235
+ (
236
+ title: trim(t.title),
237
+ span: calc.clamp(halves, 1, 8),
238
+ out-of-range: halves < 1 or halves > 8,
239
+ school: t.school,
240
+ )
241
+ })),
242
+ ))
243
+
244
+ // The band is ruled to an even height, so a block cannot grow to fit its text:
245
+ // the text sheds what the block cannot hold instead. The notes go a phrase at a
246
+ // time, then the title steps down the scale, and each setting is tried flat and
247
+ // then turned up the side before the next. A block too small for any setting is
248
+ // left blank rather than overprinted; that is the ceiling `title` warns about in
249
+ // Quill.yaml, about twelve characters per year of length.
250
+ //
251
+ // The title is broken here rather than by the paragraph, between words only and
252
+ // each line as full as it will go, so "JFHQ-C" never strands its "C" and a word
253
+ // too long for the block rules the setting out rather than running past its
254
+ // edge. A note holds to one line, and turned up the side nothing breaks.
255
+ #let block-text(title, notes, ..style) = layout(size => {
256
+ let (w, h) = (size.width, size.height)
257
+ let words = plain(title).split(" ").filter(x => x != "")
258
+ let face(s, body) = text(size: s, weight: 600, ..style, body)
259
+ // The title in lines no wider than `room`, or in one line given none.
260
+ let lines(s, room) = words.fold((), (out, x) => {
261
+ if out.len() > 0 and (room == none or measure(face(s, out.last() + " " + x)).width <= room) {
262
+ out.slice(0, -1) + (out.last() + " " + x,)
263
+ } else { out + (x,) }
264
+ })
265
+ let typeset((s, n), room) = (
266
+ ..if words.len() > 0 { (face(s, lines(s, room).join(linebreak())),) },
267
+ ..if n != none { (text(size: micro, fill: mute, n),) },
268
+ ).join(linebreak(), default: [])
269
+ let within(c, room, w, h) = { let m = measure(typeset(c, room)); m.width <= w and m.height <= h }
270
+ let settings = notes.map(n => (base, n)) + (base, small, micro).map(s => (s, none))
271
+ block(width: w, height: h, settings.map(c => (
272
+ if within(c, w, w, h) { align(left + horizon, typeset(c, w)) },
273
+ if within(c, none, h, w) { align(center + bottom, rotate(-90deg, reflow: true, block(width: h, typeset(c, none)))) },
274
+ )).flatten().find(s => s != none))
275
+ })
276
+
277
+ // A vector's label holds to its row the way a block's text does: it steps down
278
+ // the scale until it fits, every word within the rail. One too long at the
279
+ // smallest drops its rank, which the row's place already says, and keeps the
280
+ // whole lines the row holds.
281
+ #let track-label(name, sub) = layout(size => {
282
+ let (w, h) = (size.width, size.height)
283
+ let words = plain(name).split(" ").filter(x => x != "")
284
+ let face(s, body) = text(size: s, weight: 700, body)
285
+ let typeset(s) = [#face(s, name)#if sub != none [#linebreak()#text(size: micro, fill: mute, sub)]]
286
+ let fits(s) = words.all(x => measure(face(s, x)).width <= w) and measure(block(width: w, typeset(s))).height <= h
287
+ let s = (lead, base, small).find(fits)
288
+ if s != none { return block(width: w, height: h, align(left + horizon, typeset(s))) }
289
+ let one = measure(face(small, [A])).height
290
+ let step = measure(face(small, [A#linebreak()A])).height - one
291
+ let kept = one + calc.floor((h - one) / step) * step + 2pt
292
+ block(width: w, height: h, align(left + horizon, block(width: w, height: kept, clip: true, face(small, name))))
293
+ })
294
+
295
+ #let span-label(span) = {
296
+ let years = span / 2
297
+ if calc.rem(span, 2) == 0 { [#int(years) yr] } else { [#years yr] }
298
+ }
299
+
300
+ #let constraints = data.constraints.map(c => (
301
+ note: trim(c.note),
302
+ through: c.through,
303
+ end: calc.min(cols, (c.through - start-year + 1) * 2),
304
+ )).filter(c => c.end > 0)
305
+
306
+ // ═══ IDENTITY ════════════════════════════════════════════════════════════════
307
+ // The name stands on the facts' labels, and the line under it on their values:
308
+ // both hang from the top of their row by one edge, so the two sizes share a
309
+ // baseline, and a degree that wraps or a year group's note hangs below the row
310
+ // rather than lifting it. The AFSC, duty title and unit read as one line,
311
+ // breaking before the unit rather than inside it. The year group printed is the
312
+ // one the boards count from; an adjustment says where it came from, and an
313
+ // unadjusted one prints nothing more.
314
+ #let hang = 0.72 * lead
315
+ #let identity = layout(size => {
316
+ set text(top-edge: hang)
317
+ let parts = (
318
+ if afsc != none { text(weight: 600, afsc) },
319
+ if duty != none { text(weight: 600, duty) },
320
+ if unit != none { text(weight: 500, fill: mute, unit) },
321
+ ).filter(x => x != none)
322
+ let sep = text(fill: mute)[ · ]
323
+ if parts.len() < 2 or measure(parts.join(sep)).width <= size.width {
324
+ parts.join(sep)
325
+ } else {
326
+ parts.slice(0, -1).join(sep) + linebreak() + parts.last()
327
+ }
328
+ })
329
+ #let facts = (
330
+ ("Year group", if board-yg != 0 [#board-yg], if adjusted [adjusted from #comm-yg]),
331
+ ("Date of rank", show-date(data.date_of_rank), none),
332
+ ("Arrived station", show-date(data.date_arrived_station), none),
333
+ // A degree marked "(in progress)" says so in a note under it, as the year
334
+ // group's adjustment does, rather than breaking inside the parenthesis.
335
+ {
336
+ let degree = or-none(data.advanced_degree)
337
+ let flat = plain(degree).trim()
338
+ let mark = "(in progress)"
339
+ if degree != none and flat.ends-with(mark) and flat.len() > mark.len() {
340
+ ("Advanced degree", flat.slice(0, -mark.len()).trim(), [in progress])
341
+ } else { ("Advanced degree", degree, none) }
342
+ },
343
+ )
344
+ #grid(
345
+ columns: (name-width,) + (1fr,) * facts.len(),
346
+ column-gutter: 16pt,
347
+ row-gutter: 3pt,
348
+ align: (_, y) => if y == 0 { bottom } else { top },
349
+ // Raised clear of the line under it by the depth of its descenders.
350
+ pad(bottom: 3pt, text(size: display, weight: 800, tracking: -0.3pt, officer)),
351
+ ..facts.map(((name, ..)) => eyebrow(name)),
352
+ identity,
353
+ ..facts.map(((_, value, note)) => stack(
354
+ spacing: 3pt,
355
+ text(size: lead, weight: 500, top-edge: hang, if value == none { dash } else { value }),
356
+ ..if note != none { (text(size: micro, fill: mute, note),) },
357
+ )),
358
+ )
359
+
360
+ // ═══ PLAN ════════════════════════════════════════════════════════════════════
361
+ #let row-label(body) = table.cell(align: left + horizon, rail-label(body))
362
+ // An empty half-year is its own cell, so the year rules run through it.
363
+ #let empty(n, stroke: none) = range(n).map(_ => table.cell(stroke: stroke)[])
364
+
365
+ #let rows = ()
366
+
367
+ // the axis
368
+ #rows.push(table.cell[])
369
+ #for i in range(years) {
370
+ let offset = yg-offset(start-year + i - board-yg)
371
+ rows.push(table.cell(colspan: 2, stroke: (bottom: 0.7pt + ink), inset: (x: 3pt, bottom: 3pt))[
372
+ #if not dated { text(weight: 700, offset) } else if laddered [
373
+ #text(weight: 700)[#(start-year + i)]
374
+ #linebreak()
375
+ #text(size: micro, fill: mute, offset)
376
+ ] else { text(weight: 700)[#(start-year + i)] }
377
+ ])
378
+ }
379
+
380
+ // One row per constraint, under the axis: a bar from today to the end of the
381
+ // last year it holds, ruled under and closed at its end, so it reads as "until
382
+ // here". The band is not ruled by year, so a label too long for its bar runs
383
+ // on past its end, on one line, over nothing; one too long for that as well is
384
+ // cut at whichever edge leaves more of it, the bar's end or the page's.
385
+ #for (i, c) in constraints.enumerate() {
386
+ rows.push(if i == 0 { row-label[Constraints] } else { table.cell[] })
387
+ let note = [#text(size: micro, weight: 600)[#c.note]#text(size: micro, fill: mute)[#(" · through " + str(c.through))]]
388
+ // The first stands clear of the axis, which would otherwise close its top.
389
+ rows.push(table.cell(colspan: c.end, inset: (x: 1pt, top: if i == 0 { 3pt } else { 0.5pt }, bottom: 0.5pt))[
390
+ #layout(size => {
391
+ // A bar that runs past the window is left open at its end, since the
392
+ // window's edge is not where it stops.
393
+ let open = c.through > last-year
394
+ let wide = measure(note).width
395
+ let inside = size.width - 8pt
396
+ // The half-years right of the bar, less this cell's own inset.
397
+ let after = (size.width + 2pt) / c.end * (cols - c.end) - 4pt
398
+ let (dx, room) = if wide <= inside or (wide > after and inside >= after) { (3pt, inside) } else { (size.width + 3pt, after) }
399
+ box(width: 100%, height: 8.5pt, stroke: (bottom: constraint-stroke, right: if open { none } else { constraint-stroke }))
400
+ // Clipped across only: the inset keeps the ascenders and descenders.
401
+ place(left + bottom, dx: dx, box(width: calc.max(0pt, room), inset: (y: 2pt), clip: true, box(width: 10in, note)))
402
+ })
403
+ ])
404
+ rows += empty(cols - c.end)
405
+ }
406
+
407
+ // Eligibility, in lanes the year rules start from: the boards and courses, each
408
+ // on its year, and under them the IDE and SDE windows, when one is in view.
409
+ #let spans = windows.map(w => (w, range(looks.len()).filter(k => in-window(w.years.at(k))))).filter(((_, shown)) => shown.len() > 0)
410
+ #let lanes = if spans.len() > 0 { 2 } else { 1 }
411
+ #rows.push(table.cell(rowspan: lanes, align: left + horizon, stack(
412
+ spacing: 3pt,
413
+ rail-label[Eligibility],
414
+ ..gates.filter(g => g.overdue).map(gate-mark),
415
+ )))
416
+ #for i in range(years) {
417
+ let here = gates.filter(g => g.year == start-year + i)
418
+ rows.push(table.cell(colspan: 2, inset: (x: 1.5pt, y: 3pt), stack(spacing: 2pt, ..here.map(gate-mark))))
419
+ }
420
+ #if spans.len() > 0 {
421
+ let at = 0
422
+ for (w, shown) in spans {
423
+ let from = (w.years.at(shown.first()) - start-year) * 2
424
+ rows += empty(from - at)
425
+ rows.push(table.cell(colspan: 2 * shown.len(), inset: (x: 1.5pt, top: 0pt, bottom: 3pt), window-mark(w, shown)))
426
+ at = from + 2 * shown.len()
427
+ }
428
+ rows += empty(cols - at)
429
+ }
430
+
431
+ // The assignment held now, drawn once across every vector row. It reads like a
432
+ // tour block, title over a line of small print, and sheds what its space cannot
433
+ // hold the way one does; with nothing left, the header still names the job. The
434
+ // unit is left to the header throughout. A move past the window leaves the
435
+ // block open at the window's edge, as a tour the window cuts is.
436
+ #let current-block = block(
437
+ width: 100%,
438
+ height: 100%,
439
+ stroke: (
440
+ left: current-stroke,
441
+ top: current-stroke,
442
+ bottom: current-stroke,
443
+ right: if move-col > cols { none } else { current-stroke },
444
+ ),
445
+ inset: (x: 3pt, y: 2pt),
446
+ block-text(
447
+ if duty != none { duty } else { [Current assignment] },
448
+ ([Current · to #data.move_cycle #move-year], [to #data.move_cycle #move-year]),
449
+ ),
450
+ )
451
+
452
+ // One row per vector. Its label says which it is, so every duty tour takes the
453
+ // one shade, and a school goes unshaded: a year in a classroom does not read as
454
+ // a year in a job.
455
+ #for (rank, v) in vectors.enumerate() {
456
+ let beyond = v.placed.filter(p => p.beyond)
457
+ let top-rule = (top: 0.4pt + hair)
458
+ let sub = ()
459
+ if v.track != none { sub.push(v.rank) }
460
+ if beyond.len() > 0 { sub.push([+#beyond.len() past #window-end]) }
461
+
462
+ rows.push(table.cell(stroke: top-rule, inset: (right: 5pt, y: 3pt))[
463
+ #block(width: 100%, height: 100%, track-label(
464
+ if v.track != none { v.track } else { [#v.rank] },
465
+ if sub.len() > 0 { sub.join[ · ] },
466
+ ))
467
+ ])
468
+
469
+ if rank == 0 and current-span > 0 {
470
+ rows.push(table.cell(colspan: current-span, rowspan: vectors.len(), inset: (x: 1pt, y: 2pt))[#current-block])
471
+ }
472
+
473
+ let at = current-span
474
+ for p in v.placed.filter(p => not p.beyond) {
475
+ let edge = if p.tour.school { school-stroke } else { tour-stroke }
476
+ let notes = (
477
+ [#span-label(p.span)#if p.tour.out-of-range [#sym.dagger]],
478
+ cycle-of(p.start),
479
+ ..if p.clipped { ([runs past #window-end],) },
480
+ )
481
+ rows.push(table.cell(
482
+ colspan: p.drawn,
483
+ stroke: top-rule,
484
+ inset: (left: if p.cut { 0pt } else { 1pt }, right: if p.clipped { 0pt } else { 1pt }, y: 2pt),
485
+ )[
486
+ // The block is drawn inside its cell rather than as the cell's fill, so
487
+ // adjacent tours part by a gap and an edge. A tour the window cuts runs
488
+ // to the window's edge with that end open.
489
+ #block(
490
+ width: 100%,
491
+ height: 100%,
492
+ fill: if p.tour.school { none } else { shade },
493
+ stroke: (
494
+ top: edge,
495
+ bottom: edge,
496
+ left: if p.cut { none } else { edge },
497
+ right: if p.clipped { none } else { edge },
498
+ ),
499
+ inset: (x: 3pt, y: 2pt),
500
+ block-text(
501
+ p.tour.title,
502
+ range(notes.len(), 0, step: -1).map(n => notes.slice(0, n).join[ · ]),
503
+ style: if p.tour.school { "italic" } else { "normal" },
504
+ ),
505
+ )
506
+ ])
507
+ at = p.from + p.drawn
508
+ }
509
+ rows += empty(cols - at, stroke: top-rule)
510
+ }
511
+
512
+ // The years are ruled from the gates down, so a block is read against the gate
513
+ // above it without a straightedge. A rule stops where a block crosses it: the
514
+ // block is in front of the year, not cut by it. On a blank chart the rules are
515
+ // the grid a pen draws the vectors on. The window's far side is left open,
516
+ // because the career is not over where the chart stops.
517
+ #block(above: 18pt, table(
518
+ columns: (rail,) + (1fr,) * cols,
519
+ rows: (auto,) * (1 + constraints.len() + lanes) + (band-height,) * vectors.len(),
520
+ stroke: none,
521
+ inset: 2pt,
522
+ ..range(years).map(i => table.vline(x: 1 + 2 * i, start: 1 + constraints.len(), stroke: 0.4pt + hair)),
523
+ ..rows,
524
+ table.hline(stroke: 0.4pt + hair),
525
+ ))
526
+
527
+ // The gates and tours carry their own names. The legend keys only the marks
528
+ // that cannot, and only those this chart carries, beside a count of the gates
529
+ // past the window's far side.
530
+ #let drawn-tours = vectors.map(v => v.placed.filter(p => not p.beyond)).flatten()
531
+ #let swatch(..args) = box(width: 14pt, height: 6pt, baseline: 1pt, ..args)
532
+ #let key(mark, name) = [#mark#h(3pt)#name]
533
+ #let legend = (
534
+ if current-span > 0 { key(swatch(stroke: current-stroke), [current assignment]) },
535
+ if drawn-tours.any(p => p.tour.school) { key(swatch(stroke: school-stroke), [school]) },
536
+ if drawn-tours.any(p => p.tour.out-of-range) { key(sym.dagger, [length outside 0.5–4 yr]) },
537
+ ).filter(k => k != none)
538
+ #if legend.len() > 0 or ahead > 0 {
539
+ block(above: 5pt, pad(left: rail, grid(
540
+ columns: (1fr, auto),
541
+ text(size: micro, fill: mute, legend.join(h(12pt), default: [])),
542
+ if ahead > 0 { text(size: micro, fill: mute)[#ahead more milestone#if ahead > 1 [s] past #window-end] },
543
+ )))
544
+ }
545
+
546
+ // ═══ RECORD ══════════════════════════════════════════════════════════════════
547
+ // The record that makes the plan credible, a row to a part: one with nothing
548
+ // in it goes rather than printing empty. Every first line in it hangs from the
549
+ // top of its row by one edge, so a label and its row share a baseline.
550
+ #let row-top = 5pt
551
+
552
+ // A matrix arrives as the members it holds; `roster` gives back the whole
553
+ // vocabulary in the order Quill.yaml declares it, held or not. The labels repeat
554
+ // each matrix's `title`, which the data does not carry. Every member prints: the
555
+ // open boxes say what has not been done yet as plainly as the filled ones say
556
+ // what has. What is held leads its row, and a member holds together on its line.
557
+ #let vocabulary = (
558
+ ("Leadership & command", roster(quals, "command")),
559
+ ("Operations", roster(quals, "operations")),
560
+ ("Staff & functional", roster(quals, "staff")),
561
+ ("Education & PME", roster(quals, "education")),
562
+ )
563
+ #let member(m) = box[
564
+ #let detail = if m.held { m.value.detail } else { "" }
565
+ #if m.held { held-mark } else { open-mark }#h(3pt)#text(
566
+ weight: if m.held { 600 } else { 400 },
567
+ fill: if m.held { ink } else { mute },
568
+ m.title,
569
+ )#if not blank(detail) [#h(2pt)#text(size: micro, style: "italic", fill: mute, trim(detail))]
570
+ ]
571
+ #let members-row(rows) = {
572
+ (rows.filter(m => m.held) + rows.filter(m => not m.held)).map(member).join([#h(10pt) ])
573
+ }
574
+
575
+ // A table, so each rater's column reads down the years. With no Higher Level
576
+ // Reviewer strat on any row, that column goes rather than printing empty. The
577
+ // rows are set at the record's size, so the table reads as one of its rows. A
578
+ // year not yet filled in arrives as 0, sorts last and prints a dash.
579
+ #let strats = data.stratifications.sorted(key: s => -s.year)
580
+ #let any-hlr = strats.any(s => not blank(s.hlr))
581
+ #let strat-cell(v) = if blank(v) { dash } else { trim(v) }
582
+ #let strats-table = table(
583
+ columns: (auto,) * (if any-hlr { 3 } else { 2 }),
584
+ column-gutter: 16pt,
585
+ inset: (_, y) => (x: 0pt, top: if y == 0 { 0pt } else { 2pt }, bottom: 2pt),
586
+ stroke: none,
587
+ table.header([], eyebrow[Rater], ..if any-hlr { (eyebrow[HLR],) }),
588
+ ..strats.map(s => (
589
+ if s.year == 0 { dash } else { text(weight: 700)[#s.year] },
590
+ strat-cell(s.rater),
591
+ ..if any-hlr { (strat-cell(s.hlr),) },
592
+ )).flatten(),
593
+ )
594
+
595
+ // The two things a board reads first, the stratifications and the awards,
596
+ // lead; the experience follows.
597
+ #let listed(name, lines) = if lines.len() > 0 { (([#name], lines.map(trim).join[ · ]),) }
598
+ #let record = (
599
+ ..if strats.len() > 0 { (([Stratifications], strats-table),) },
600
+ ..listed("Awards", data.awards),
601
+ ..vocabulary.map(((name, members)) => ([#name], members-row(members))),
602
+ ..listed("Certifications", data.certifications),
603
+ ..listed("Deployments", data.deployments),
604
+ )
605
+
606
+ #divider(14pt)
607
+ #{
608
+ set text(size: small, top-edge: row-top)
609
+ grid(
610
+ columns: (rail, 1fr),
611
+ row-gutter: 7pt,
612
+ ..record.map(((name, body)) => (rail-label(name), body)).flatten(),
613
+ )
614
+ }
615
+
616
+ // ═══ NOTES ═══════════════════════════════════════════════════════════════════
617
+ // The one thing the page does that the browser tool it came from could not: a
618
+ // rater writes on it during the discussion, and the sheet becomes the record of
619
+ // the conversation. So the ruling prints whether or not anything was typed, the
620
+ // typed notes are set on it, and it runs to the foot of the page: whatever the
621
+ // record above leaves is room to write.
622
+ #divider(12pt)
623
+
624
+ // Narrow rule, a quarter inch: the tightest a pen writes on comfortably.
625
+ #let pitch = 18pt
626
+ #let baseline-drop = 13pt
627
+ #let rule-drop = baseline-drop + 2.5pt
628
+ #let ruling(n) = for k in range(n) {
629
+ place(top + left, dy: k * pitch + rule-drop, line(length: 100%, stroke: 0.4pt + hair))
630
+ }
631
+
632
+ // Every line box is exactly one pitch tall with its baseline at the same drop,
633
+ // so the typed notes land on the rules however many lines they run to, and the
634
+ // rail's label sits on the first.
635
+ #let typed = data.at("$body", default: "")
636
+ #let on-ruling(body) = {
637
+ set text(top-edge: baseline-drop, bottom-edge: baseline-drop - pitch)
638
+ set par(leading: 0pt, spacing: 0pt)
639
+ body
640
+ }
641
+
642
+ // What was typed, on at least the first rule, is the minimum and holds its
643
+ // height; the blank rules under it are whatever the page has left. The notes
644
+ // and the line they are signed on are one unit, so typed notes too long for the
645
+ // page carry the signature with them rather than leaving it alone overleaf.
646
+ //
647
+ // The section is one block sized to the rest of its page, which it reads off a
648
+ // mark left where it starts: the page cannot otherwise tell a block what is left
649
+ // of it, and the mark, being empty, stays put when the block does not fit. Notes
650
+ // too long for what is left make the block taller than that, and it goes to the
651
+ // next page whole.
652
+ #let signature = grid(
653
+ columns: (rail, 1fr),
654
+ rail-label[Discussed with],
655
+ text(size: micro, fill: mute)[
656
+ #box(width: 2.5in, stroke: (bottom: 0.4pt + mute))[]
657
+ #h(12pt) on #box(width: 1.2in, stroke: (bottom: 0.4pt + mute))[]
658
+ ],
659
+ )
660
+ #let signature-gap = 8pt
661
+ #block(height: 0pt)<notes-start>
662
+ #context {
663
+ let width = 11in - 2 * margin - rail
664
+ let notes = if type(typed) != str { on-ruling(typed) } else { [] }
665
+ let used = int(calc.round(measure(block(width: width, notes)).height / pitch))
666
+ let below = signature-gap + measure(signature).height
667
+ let room = 8.5in - margin - locate(<notes-start>).position().y
668
+ // The typed lines need only reach their last rule; the blank rules run on to
669
+ // the signature's gap.
670
+ let lines = calc.max(1, used)
671
+ let need = (lines - 1) * pitch + rule-drop + below
672
+ let rules = calc.max(lines, int(calc.floor((room - below - rule-drop) / pitch)) + 1)
673
+ block(breakable: false, width: 100%, height: calc.max(room, need), {
674
+ grid(
675
+ columns: (rail, 1fr),
676
+ on-ruling(rail-label[Notes]),
677
+ block(width: 100%, { ruling(rules); notes }),
678
+ )
679
+ place(bottom + left, signature)
680
+ })
681
+ }