Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 20 additions & 10 deletions src/task.typ
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
task-text-style: emph,
/// The body of the task.
/// Either:
/// - empty
/// - [content]
/// - [task text][content]
/// -> content..
Expand All @@ -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 {
Expand Down Expand Up @@ -316,6 +321,7 @@
task-text-style: emph,
/// The body of the subtask.
/// Either:
/// - empty
/// - [content]
/// - [task text][content]
/// -> content..
Expand All @@ -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 => {
Expand Down
Loading