znote-data / src /blueprint /guide.md
arsalan-anwari's picture
Sync templates from znote
16b79eb verified
|
Raw History Blame Contribute Delete
4.01 kB
# Blueprint templates
Engineering documents: specifications, design documents and test reports. A4, sans-serif body,
teal headings, thin grey rules, a boxed title block and a monospace header and footer.
## Templates
- **Specification** (`specification`): formal, numbered requirement documents. Parameters:
`title` (default `"Title"`), `number` (document number, `"DOC-0001"`), `revision` (`"A"`),
`status` (`"Draft"`), `author` (`none`), `date` (today as `YYYY-MM-DD`). Prints a title block
with all fields, then a table of contents (`outline(depth: 2)`).
- **Design document** (`design`): describing a design for review. Parameters: `title`
(`"Title"`), `author` (`none`), `status` (`"Draft"`), `reviewers` (`none`), `date` (today).
Title block, no table of contents.
- **Test report** (`test-report`): recording test runs and their results. Parameters: `title`
(`"Title"`), `number` (`"TR-0001"`), `tester` (`none`), `date` (today). Title block, no table of
contents.
## Writing a page
The template already sets: A4 page and margins, font and size (10pt), justified paragraphs, a
header (document number or kind on the left, title on the right) and a footer with "page of
total", teal headings numbered `1.1`, tables with thin grey borders and a bold first row,
monospace code. The title block is printed from the show-rule parameters; do not write the title
again.
- Start with `=` sections; use `==` and `===` below them. Numbering is automatic: do not type
numbers into headings. In a specification only `=` and `==` appear in the contents.
- Use plain markup for the rest: paragraphs, `-` lists, `+` numbered lists, `*bold*`, `_italic_`,
`` `code` `` and ```` ``` ```` code blocks, `$...$` maths.
- Put tabular data in `#table(...)`; the first row is the header and is bolded automatically.
Wrap it in `#figure(..., caption: [...])` when it needs a caption.
## Helpers
`requirement(id, body)`: one requirement with its identifier, marked by a teal left bar. Use one
per requirement in specifications.
```typ
#requirement("REQ-001")[The pump shall start within 2 s of the start command.]
#requirement("REQ-002")[The controller shall log every fault with a timestamp.]
```
`note(body)`: a light grey boxed note for remarks, assumptions or warnings.
```typ
#note[Values in this section assume an ambient temperature of 20 °C.]
```
`result(status)`: a small coloured status badge. Pass a string: `"pass"` is green, `"fail"` is
red, anything else (for example `"blocked"`) is amber. The text is printed in upper case.
```typ
#table(
columns: (auto, 1fr, auto),
[ID], [Test], [Result],
[T-01], [Start-up time], result("pass"),
[T-02], [Fault logging], result("fail"),
[T-03], [Remote stop], result("blocked"),
)
```
`tag(body)`: small grey upper-case monospace label, as used in the header and title block. Use it
for short labels, not for running text.
```typ
#tag[Measured] 2.1 s
```
`today`: today's date as a `YYYY-MM-DD` string.
Colour and font constants, for the rare case something must be coloured or set in the template's
font: `ink` (body text), `accent` (teal, headings and requirement bars), `rule` (grey lines),
`quiet` (grey secondary text), `sans` (body font list), `mono` (code font list).
```typ
#text(fill: accent)[Critical path]
```
## Do not
- Do not add `#set page`, `#set text`, `#set par` or font changes; the template sets them.
- Do not use your own colours (`rgb(...)`, `red`, ...); use the constants above only when
something must be coloured.
- Do not build your own boxes, callouts or badges with `block`/`rect`/`box`; use `requirement`,
`note` and `result`.
- Do not remove or edit the template header between `// znote:template` and `// znote:end`.
- Do not write a title, title block, document number, date or table of contents; the template
prints them from its parameters.
- Do not number headings by hand or change `heading` numbering.
- Do not pass content to `result` (`result[pass]`); pass a string so the colour is picked.