diff --git a/CHANGELOG.md b/CHANGELOG.md index 28207df..70fa9cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Breaking - Removed `custom-enum-numbering` helper - Removed `subtask-label` helper +- Removed `bonus-show-star` option on `task` (in favor of the new `bonus-style` option) ### Added - Added `subtask` system @@ -17,6 +18,7 @@ - Added task text handling - Added `begin-at-new-page` option for `task` and `subtask` - Added `skip` option for `task` and `subtask` +- Added `bonus-style` option for `task` ## [0.4.0] - 2025-11-22 diff --git a/src/i18n.typ b/src/i18n.typ index 6a1f9b1..928b135 100644 --- a/src/i18n.typ +++ b/src/i18n.typ @@ -9,6 +9,7 @@ Points: ( de: "Punkte", ), + Bonus: (:), // Theorem related Theorem: ( de: "Satz", diff --git a/src/task.typ b/src/task.typ index 6e3303b..b92e3cb 100644 --- a/src/task.typ +++ b/src/task.typ @@ -100,8 +100,8 @@ begin-at-new-page: false, /// Whether the task is a bonus task. -> bool bonus: false, - /// Whether bonus tasks are marked with a star in the title. -> bool - bonus-show-star: true, + /// A styling function applied to the title of bonus tasks. -> function | none + bonus-style: t => [#t (#context i18n.translate("Bonus"))], /// Whether the task is hidden in the score box. -> bool hidden: false, /// Padding above the task. -> auto | length @@ -160,13 +160,19 @@ } let title = { - task-prefix - if counter-show { - if task-prefix != "" [ ] - context c("sheetstorm-task").display() + let text = { + task-prefix + if counter-show { + if task-prefix != "" [ ] + context c("sheetstorm-task").display() + } + if name != none [: #emph(name)] + } + if bonus and type(bonus-style) == function { + text = bonus-style(text) } - if name != none [: #emph(name)] - if bonus and bonus-show-star [\*] + + text if todo-show and maybe-todo != none { h(0.7em) diff --git a/src/widgets.typ b/src/widgets.typ index 4fc74aa..2ebf775 100644 --- a/src/widgets.typ +++ b/src/widgets.typ @@ -19,9 +19,9 @@ tasks: auto, /// Whether to show the points per task. -> bool show-points: true, - /// Whether the points of bonus tasks count into the sum. -> bool - bonus-show-star: true, /// Whether to mark bonus tasks in the score box with a star. -> bool + bonus-show-star: true, + /// Whether the points of bonus tasks count into the sum. -> bool bonus-counts-for-sum: false, /// Whether to fill all available horizontal space. -> bool fill-space: false, diff --git a/tests/examples/assignment/ref/1.png b/tests/examples/assignment/ref/1.png index 84f8837..2986215 100644 Binary files a/tests/examples/assignment/ref/1.png and b/tests/examples/assignment/ref/1.png differ