@airmark/quiver 0.37.0 → 0.38.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airmark/quiver",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Airmark Quiver — Air Force and DAF document Quills for Quillmark.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@quillmark/quiver": "0.38.0",
22
- "@quillmark/wasm": "^0.126.1",
22
+ "@quillmark/wasm": "^0.126.2",
23
23
  "quillkit": "0.18.0"
24
24
  },
25
25
  "scripts": {
@@ -92,6 +92,7 @@ main:
92
92
  accomplishments:
93
93
  type: richtext
94
94
  multiline: false
95
+ max: 1350
95
96
  default: ""
96
97
  description: "The citation paragraph. 1350 characters, including spaces."
97
98
 
@@ -18,86 +18,6 @@
18
18
 
19
19
  #let ink(key) = ink-value(qm.data.at(key))
20
20
 
21
- // The accomplishments paragraph is 1350 characters. A space counts.
22
- #let counted(c) = {
23
- c == [ ] or c.func() == linebreak or c.func() == parbreak or c.func() == smartquote
24
- }
25
-
26
- #let char-count(c) = {
27
- if type(c) == str { return c.clusters().len() }
28
- if type(c) != content { return 0 }
29
- if counted(c) { return 1 }
30
- if c.has("text") and type(c.at("text")) == str { return c.text.clusters().len() }
31
- if c.has("children") { return c.children.map(char-count).sum(default: 0) }
32
- if c.has("body") { return char-count(c.body) }
33
- if c.has("child") { return char-count(c.child) }
34
- 0
35
- }
36
-
37
- // Returns (kept content or none, characters still available).
38
- #let take-chars(c, left) = {
39
- if left <= 0 { return (none, 0) }
40
- if type(c) == str {
41
- let clusters = c.clusters()
42
- if clusters.len() <= left { return (c, left - clusters.len()) }
43
- return (clusters.slice(0, left).join(), 0)
44
- }
45
- if type(c) != content { return (c, left) }
46
- if counted(c) { return (c, left - 1) }
47
- if c.has("text") and type(c.at("text")) == str {
48
- let clusters = c.text.clusters()
49
- if clusters.len() <= left { return (c, left - clusters.len()) }
50
- let kept = clusters.slice(0, left).join()
51
- let fields = c.fields()
52
- fields.remove("text")
53
- let out = if fields.len() == 0 { text(kept) } else { text(..fields, kept) }
54
- return (out, 0)
55
- }
56
- if c.has("children") {
57
- let kept = ()
58
- let rest = left
59
- for k in c.children {
60
- if rest <= 0 { break }
61
- let (piece, next) = take-chars(k, rest)
62
- rest = next
63
- if piece != none { kept.push(piece) }
64
- }
65
- if kept.len() == 0 { return (none, rest) }
66
- let out = if c.fields().keys() == ("children",) {
67
- kept.sum(default: [])
68
- } else {
69
- let fields = c.fields()
70
- fields.remove("children")
71
- c.func()(..fields, children: kept)
72
- }
73
- return (out, rest)
74
- }
75
- if c.has("body") {
76
- let (piece, rest) = take-chars(c.body, left)
77
- if piece == none { return (none, rest) }
78
- let fields = c.fields()
79
- fields.remove("body")
80
- let out = if fields.len() == 0 { c.func()(piece) } else { c.func()(..fields, piece) }
81
- return (out, rest)
82
- }
83
- if c.has("child") {
84
- let (piece, rest) = take-chars(c.child, left)
85
- if piece == none { return (none, rest) }
86
- let fields = c.fields()
87
- fields.remove("child")
88
- let out = if fields.len() == 0 { c.func()(piece) } else { c.func()(..fields, piece) }
89
- return (out, rest)
90
- }
91
- (c, left)
92
- }
93
-
94
- #let capped(body, limit) = {
95
- if type(body) != content { return body }
96
- if char-count(body) <= limit { return body }
97
- let (out, _) = take-chars(body, limit)
98
- if out == none { [] } else { out }
99
- }
100
-
101
21
  #let period-pattern = "[day padding:none] [month repr:long] [year]"
102
22
  #let shown-date(key) = {
103
23
  let shown = qm.ink(qm.data, key, period-pattern)
@@ -119,7 +39,7 @@
119
39
  service: ink("service"),
120
40
  period_from: shown-date("period_from"),
121
41
  period_to: shown-date("period_to"),
122
- accomplishments: capped(ink("accomplishments"), 1350),
42
+ accomplishments: ink("accomplishments"),
123
43
  commander_title: ink("commander_title"),
124
44
  )
125
45