File size: 2,945 Bytes
9286790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#let ink = rgb("#111827")
#let accent = rgb("#0e7490")
#let rule = rgb("#9ca3af")
#let quiet = rgb("#56657a")
#let sans = ("Segoe UI", "Helvetica Neue", "Arial", "Libertinus Serif")
#let mono = ("Cascadia Mono", "Consolas", "DejaVu Sans Mono")
#let today = datetime.today().display("[year]-[month]-[day]")

#let tag(body) = text(font: mono, size: 7.5pt, fill: quiet, upper(body))

#let base(header-left, header-right, body) = {
  set text(font: sans, size: 10pt, fill: ink, lang: "en")
  set par(justify: true, leading: 0.68em, spacing: 1.15em)
  set page(
    paper: "a4",
    margin: (x: 2.2cm, top: 2.8cm, bottom: 2.4cm),
    header: {
      tag(header-left)
      h(1fr)
      tag(header-right)
      v(-0.7em)
      line(length: 100%, stroke: 0.5pt + rule)
    },
    footer: context {
      line(length: 100%, stroke: 0.5pt + rule)
      v(-0.6em)
      h(1fr)
      tag(counter(page).display("1 of 1", both: true))
    },
  )
  set heading(numbering: "1.1")
  set table(stroke: 0.5pt + rule, inset: 6pt)
  show heading: set text(fill: accent)
  show heading: set block(above: 1.5em, below: 0.8em)
  show raw: set text(font: mono)
  show table.cell.where(y: 0): strong
  body
}

#let title-block(title, ..fields) = {
  let cells = fields.pos().map(((label, value)) => [#tag(label) \ #value])
  table(
    columns: (1fr,) * calc.max(cells.len(), 1),
    stroke: 0.8pt + ink,
    inset: 8pt,
    table.cell(colspan: calc.max(cells.len(), 1), text(size: 18pt, weight: "bold", title)),
    ..cells,
  )
  v(1em)
}

#let requirement(id, body) = block(
  width: 100%,
  inset: (left: 10pt, y: 4pt),
  stroke: (left: 2pt + accent),
  [#text(font: mono, size: 9pt, weight: "bold", fill: accent, id) #h(0.6em) #body],
)

#let note(body) = block(width: 100%, inset: 10pt, fill: rgb("#eef2f5"), stroke: 0.5pt + rule, body)

#let result(status) = {
  let colour = if lower(status) == "pass" { rgb("#15803d") } else if lower(status) == "fail" { rgb("#b91c1c") } else {
    rgb("#b45309")
  }
  box(inset: (x: 5pt, y: 2pt), radius: 2pt, fill: colour, text(font: mono, size: 8pt, weight: "bold", fill: white, upper(status)))
}

#let specification(title: "Title", number: "DOC-0001", revision: "A", status: "Draft", author: none, date: today, body) = {
  show: base.with([#number · Rev #revision], title)
  title-block(title, ("Document", number), ("Revision", revision), ("Status", status), ("Author", author), ("Date", date))
  outline(depth: 2)
  body
}

#let design(title: "Title", author: none, status: "Draft", reviewers: none, date: today, body) = {
  show: base.with([Design document · #status], title)
  title-block(title, ("Author", author), ("Reviewers", reviewers), ("Status", status), ("Date", date))
  body
}

#let test-report(title: "Title", number: "TR-0001", tester: none, date: today, body) = {
  show: base.with([#number · Test report], title)
  title-block(title, ("Report", number), ("Tested by", tester), ("Date", date))
  body
}