Add the list block and the module layer with the note module
The list block prints items with a dot, dash, number or checkbox bullet,
wrapping a long item with a hanging indent; a checkbox list ticks its
done items as [√], or [x] on code pages without √. It stands alone or
inside a box, and its items, bullet and done fields carry their enums
and limits as jsonschema tags.
internal/pkg/modules holds modules that build ordinary jobs from their
own payloads: a registry by name, an Env with the clock, time zone and
time layout, strict payload decoding that reports every problem, ErrSkip
and PayloadError. The note module prints a boxed note with an optional
checklist and a time stamp in the footer.
Three routes join the route table: POST /api/v1/print/{module} and
POST /api/v1/preview/{module}, which take ?copies and a reserved
?printer, and GET /api/v1/modules. Print and the module route share one
submit path, and preview shares one too. New error codes:
invalid_payload, invalid_query, unknown_printer, module_not_found and
module_failed; a module that builds an invalid receipt is logged and
reported to Sentry once. [format] gains timezone and time_layout, the
binary embeds the time zone database, and uberbringer preview takes
--module.
The note receipt passed on the TM-T88IV, and its bytes are pinned in
TestPaperReceipts. docs/api.md describes the list block, the module
routes and the note payload; docs/swagger.json is regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b2e402f1a
commit
3e9779f71a
69 files changed
+3092
-262
No files matched your search
@@ -0,0 +1,64 @@
|
||||
· Replace drive bay 3
|
||||
· Order 2x 8 TB
|
||||
- Dashes
|
||||
- for a plain list
|
||||
1. First item that is long enough to wrap
|
||||
with a hanging indent
|
||||
2. Second
|
||||
[x] Done item
|
||||
[ ] Open item
|
||||
··········································
|
||||
1. One
|
||||
2. Two
|
||||
3. Three
|
||||
4. Four
|
||||
5. Five
|
||||
6. Six
|
||||
7. Seven
|
||||
8. Eight
|
||||
9. Nine
|
||||
10. Ten
|
||||
11. Eleven
|
||||
12. Twelve, which wraps to a hanging
|
||||
indent past the widest number
|
||||
· A paragraph
|
||||
and a second one, both indented under
|
||||
the bullet
|
||||
· A tab
|
||||
· https://example.com/a/very/long/path/wit
|
||||
hout/any/spaces/in/it
|
||||
[ ] Centred in 24
|
||||
columns
|
||||
[x] Done
|
||||
1. Size 2
|
||||
2. Wraps at 21
|
||||
columns of its own
|
||||
- Font B is fifty-six columns wide, so this line wraps
|
||||
later
|
||||
[xN
|
||||
a
|
||||
r
|
||||
r
|
||||
o
|
||||
w
|
||||
+- NAS REPORT ---------------------------+
|
||||
| Host ........................... nas01 |
|
||||
| Pool ................... tank (raidz2) |
|
||||
| Used ............................. 94% |
|
||||
+-- Services ----------------------------+
|
||||
| · grafana up |
|
||||
| · offsite-backup DOWN since 19:00 |
|
||||
+------------------------ 29 Nov 21:04 --+
|
||||
+- Shopping -----------------------------+
|
||||
| Milk, eggs and the good bread from the |
|
||||
| bakery on Elm St. |
|
||||
| |
|
||||
| [ ] Milk |
|
||||
| [ ] Eggs |
|
||||
| [x] Bread |
|
||||
+------------------------ 29 Nov 21:04 --+
|
||||
+------------------------+
|
||||
| 1. A fit box |
|
||||
| 2. shrinks to its list |
|
||||
+------------------------+
|
||||
- - - - - - - partial cut - - - - - - - -
|
||||
@@ -0,0 +1,64 @@
|
||||
· Replace drive bay 3
|
||||
· Order 2x 8 TB
|
||||
- Dashes
|
||||
- for a plain list
|
||||
1. First item that is long enough to wrap
|
||||
with a hanging indent
|
||||
2. Second
|
||||
[√] Done item
|
||||
[ ] Open item
|
||||
··········································
|
||||
1. One
|
||||
2. Two
|
||||
3. Three
|
||||
4. Four
|
||||
5. Five
|
||||
6. Six
|
||||
7. Seven
|
||||
8. Eight
|
||||
9. Nine
|
||||
10. Ten
|
||||
11. Eleven
|
||||
12. Twelve, which wraps to a hanging
|
||||
indent past the widest number
|
||||
· A paragraph
|
||||
and a second one, both indented under
|
||||
the bullet
|
||||
· A tab
|
||||
· https://example.com/a/very/long/path/wit
|
||||
hout/any/spaces/in/it
|
||||
[ ] Centred in 24
|
||||
columns
|
||||
[√] Done
|
||||
1. Size 2
|
||||
2. Wraps at 21
|
||||
columns of its own
|
||||
- Font B is fifty-six columns wide, so this line wraps
|
||||
later
|
||||
[√N
|
||||
a
|
||||
r
|
||||
r
|
||||
o
|
||||
w
|
||||
┌─ NAS REPORT ───────────────────────────┐
|
||||
│ Host ........................... nas01 │
|
||||
│ Pool ................... tank (raidz2) │
|
||||
│ Used ............................. 94% │
|
||||
├── Services ────────────────────────────┤
|
||||
│ · grafana up │
|
||||
│ · offsite-backup DOWN since 19:00 │
|
||||
└──────────────────────── 29 Nov 21:04 ──┘
|
||||
┌─ Shopping ─────────────────────────────┐
|
||||
│ Milk, eggs and the good bread from the │
|
||||
│ bakery on Elm St. │
|
||||
│ │
|
||||
│ [ ] Milk │
|
||||
│ [ ] Eggs │
|
||||
│ [√] Bread │
|
||||
└──────────────────────── 29 Nov 21:04 ──┘
|
||||
╔════════════════════════╗
|
||||
║ 1. A fit box ║
|
||||
║ 2. shrinks to its list ║
|
||||
╚════════════════════════╝
|
||||
- - - - - - - partial cut - - - - - - - -
|
||||
@@ -0,0 +1,64 @@
|
||||
· Replace drive bay 3
|
||||
· Order 2x 8 TB
|
||||
- Dashes
|
||||
- for a plain list
|
||||
1. First item that is long enough to wrap
|
||||
with a hanging indent
|
||||
2. Second
|
||||
[x] Done item
|
||||
[ ] Open item
|
||||
··········································
|
||||
1. One
|
||||
2. Two
|
||||
3. Three
|
||||
4. Four
|
||||
5. Five
|
||||
6. Six
|
||||
7. Seven
|
||||
8. Eight
|
||||
9. Nine
|
||||
10. Ten
|
||||
11. Eleven
|
||||
12. Twelve, which wraps to a hanging
|
||||
indent past the widest number
|
||||
· A paragraph
|
||||
and a second one, both indented under
|
||||
the bullet
|
||||
· A tab
|
||||
· https://example.com/a/very/long/path/wit
|
||||
hout/any/spaces/in/it
|
||||
[ ] Centred in 24
|
||||
columns
|
||||
[x] Done
|
||||
1. Size 2
|
||||
2. Wraps at 21
|
||||
columns of its own
|
||||
- Font B is fifty-six columns wide, so this line wraps
|
||||
later
|
||||
[xN
|
||||
a
|
||||
r
|
||||
r
|
||||
o
|
||||
w
|
||||
┌─ NAS REPORT ───────────────────────────┐
|
||||
│ Host ........................... nas01 │
|
||||
│ Pool ................... tank (raidz2) │
|
||||
│ Used ............................. 94% │
|
||||
├── Services ────────────────────────────┤
|
||||
│ · grafana up │
|
||||
│ · offsite-backup DOWN since 19:00 │
|
||||
└──────────────────────── 29 Nov 21:04 ──┘
|
||||
┌─ Shopping ─────────────────────────────┐
|
||||
│ Milk, eggs and the good bread from the │
|
||||
│ bakery on Elm St. │
|
||||
│ │
|
||||
│ [ ] Milk │
|
||||
│ [ ] Eggs │
|
||||
│ [x] Bread │
|
||||
└──────────────────────── 29 Nov 21:04 ──┘
|
||||
╔════════════════════════╗
|
||||
║ 1. A fit box ║
|
||||
║ 2. shrinks to its list ║
|
||||
╚════════════════════════╝
|
||||
- - - - - - - partial cut - - - - - - - -
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
{"elements": [
|
||||
{"type": "list", "items": ["Replace drive bay 3", "Order 2x 8 TB"]},
|
||||
{"type": "list", "bullet": "dash", "items": ["Dashes", "for a plain list"]},
|
||||
{"type": "list", "bullet": "number", "items": ["First item that is long enough to wrap with a hanging indent", "Second"]},
|
||||
{"type": "list", "bullet": "checkbox", "items": ["Done item", "Open item"], "done": [0]},
|
||||
{"type": "rule", "style": "dotted"},
|
||||
{"type": "list", "bullet": "number", "items": ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve, which wraps to a hanging indent past the widest number"]},
|
||||
{"type": "list", "items": ["A paragraph\nand a second one, both indented under the bullet", "\tA tab"]},
|
||||
{"type": "list", "items": ["https://example.com/a/very/long/path/without/any/spaces/in/it"]},
|
||||
{"type": "list", "bullet": "CHECKBOX", "columns": 24, "items": ["Centred in 24 columns", "Done"], "done": [1]},
|
||||
{"type": "list", "size": 2, "bullet": "number", "items": ["Size 2", "Wraps at 21 columns of its own"]},
|
||||
{"type": "list", "font": "b", "bullet": "dash", "items": ["Font B is fifty-six columns wide, so this line wraps later"]},
|
||||
{"type": "list", "columns": 3, "bullet": "checkbox", "items": ["Narrow"], "done": [0]},
|
||||
{"type": "box", "title": "NAS REPORT", "footer": "29 Nov 21:04", "children": [
|
||||
{"type": "kv", "pairs": [{"key": "Host", "value": "nas01"}, {"key": "Pool", "value": "tank (raidz2)"}, {"key": "Used", "value": "94%", "bold": true}]},
|
||||
{"type": "rule", "text": "Services", "align": "left"},
|
||||
{"type": "list", "items": ["grafana up", "offsite-backup DOWN since 19:00"]}
|
||||
]},
|
||||
{"type": "box", "title": "Shopping", "footer": "29 Nov 21:04", "children": [
|
||||
{"type": "text", "text": "Milk, eggs and the good bread from the bakery on Elm St."},
|
||||
{"type": "feed"},
|
||||
{"type": "list", "bullet": "checkbox", "items": ["Milk", "Eggs", "Bread"], "done": [2]}
|
||||
]},
|
||||
{"type": "box", "fit": true, "style": "double", "children": [
|
||||
{"type": "list", "bullet": "number", "items": ["A fit box", "shrinks to its list"]}
|
||||
]}
|
||||
]}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
1b401b74001b61001b4d001d21001b45001b2d001d4200dac42053686f707069
|
||||
6e6720c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4
|
||||
bf0ab3204d696c6b2c206567677320616e642074686520676f6f642062726561
|
||||
642066726f6d2074686520b30ab32062616b657279206f6e20456c6d2053742e
|
||||
20202020202020202020202020202020202020202020b30ab320202020202020
|
||||
2020202020202020202020202020202020202020202020202020202020202020
|
||||
20b30ab3205b205d204d696c6b20202020202020202020202020202020202020
|
||||
202020202020202020202020b30ab3205b205d20456767732020202020202020
|
||||
2020202020202020202020202020202020202020202020b30ab3205bfb5d2042
|
||||
7265616420202020202020202020202020202020202020202020202020202020
|
||||
2020b30ac0c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4c4203330
|
||||
204e6f762030383a353620c4c4d90a1b45001b2d001d42001d21001b4d001d56
|
||||
4200
|
||||
@@ -0,0 +1,7 @@
|
||||
{"elements": [
|
||||
{"type": "box", "title": "Shopping", "footer": "30 Nov 08:56", "children": [
|
||||
{"type": "text", "text": "Milk, eggs and the good bread from the bakery on Elm St."},
|
||||
{"type": "feed"},
|
||||
{"type": "list", "bullet": "checkbox", "items": ["Milk", "Eggs", "Bread"], "done": [2]}
|
||||
]}
|
||||
]}
|
||||
Reference in new issue
Block a user