From 08b588b9aeedd0703bf3616fb6b28605649c0f68 Mon Sep 17 00:00:00 2001 From: Rasmus Buurman Date: Mon, 16 Mar 2026 15:15:25 +0100 Subject: [PATCH 1/2] Allow (sub)tasks without body --- src/task.typ | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/task.typ b/src/task.typ index d4cfc4a..d93590a 100644 --- a/src/task.typ +++ b/src/task.typ @@ -114,6 +114,7 @@ task-text-style: emph, /// The body of the task. /// Either: + /// - empty /// - [content] /// - [task text][content] /// -> content.. @@ -123,15 +124,19 @@ assert(body-args.named().len() == 0, message: "Unexpected named argument.") assert( - body-args.pos().len() == 1 or body-args.pos().len() == 2, + body-args.pos().len() <= 2, message: "task expects either [content] or [task text][content] as body arguments.", ) let body-args = body-args.pos() - let (task-text, body) = ( - if body-args.len() == 2 { body-args.at(0) } else { none }, - if body-args.len() == 2 { body-args.at(1) } else { body-args.at(0) }, - ) + let body-n = body-args.len() + let (task-text, body) = if body-n == 0 { + (none, none) + } else if body-n == 1 { + (none, body-args.at(0)) + } else if body-n == 2 { + (body-args.at(0), body-args.at(1)) + } if counter != auto { c("sheetstorm-task").update(counter) } if skip != none and type(skip) == int { @@ -316,6 +321,7 @@ task-text-style: emph, /// The body of the subtask. /// Either: + /// - empty /// - [content] /// - [task text][content] /// -> content.. @@ -325,15 +331,19 @@ assert(body-args.named().len() == 0, message: "Unexpected named argument.") assert( - body-args.pos().len() == 1 or body-args.pos().len() == 2, + body-args.pos().len() <= 2, message: "subtask expects either [content] or [task text][content] as body arguments.", ) let body-args = body-args.pos() - let (task-text, body) = ( - if body-args.len() == 2 { body-args.at(0) } else { none }, - if body-args.len() == 2 { body-args.at(1) } else { body-args.at(0) }, - ) + let body-n = body-args.len() + let (task-text, body) = if body-n == 0 { + (none, none) + } else if body-n == 1 { + (none, body-args.at(0)) + } else if body-n == 2 { + (body-args.at(0), body-args.at(1)) + } if counter != auto { state("sheetstorm-subtask").update(xs => { From b37327c27fe004636a9b4545ccee9228dff14ce3 Mon Sep 17 00:00:00 2001 From: Rasmus Buurman Date: Mon, 16 Mar 2026 15:18:20 +0100 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fa4efc..7430f8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ ### Fixed - Fixed `todo` option of `task` to propagate globally +### Added +- Added support for `task` and `subtask` without body argument + ## [0.5.0] - 2026-01-24 ### Breaking