Make Section Retro-planning (Scheduling) strict and update documentation #14
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram#14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Currently, the retro-planning syntax applied to section titles (e.g.,
## Section ~{-2h}) is defined as free text in the PEG grammar (retroPlanning = "~{" (~"}" any)+ "}"). This means users can technically write~{the day before}or any other non-standard time format.To allow better programmatic usage of retro-planning data in the future (such as generating Gantt charts or calendar integrations), I think it would be better to enforce strict time units just like standard inline timers (
min,h,d).Tasks
grammar.ohmto use strict parsing forretroPlanninginstead of free text (e.g. enforcing-sign andabsoluteQuantity).packages/parser/src/index.tsto return structured time data instead of a raw string.packages/kitchenand the renderers (like HTML formatter) to display the parsed strict time value correctly.document-structure.mdto mention this syntax with a cross-reference totimes.md.times.mdto detail how retro-planning works, specifying that free text is not allowed and that it relies on standard~timerunits.Expected Behavior
## Dough ~{-2h}should be correctly parsed and exposed.## Dough ~{the day before}should result in a parser error.Quick update — this ended up working a bit differently than planned. Making the grammar itself strictly reject bad input turned out to cause more problems than it solved (in some cases it could silently break unrelated parts of a recipe), so the validation happens a bit later in the process instead, the same way timer units are already checked today.
While at it, made the rule a bit stricter too: retro-planning now has to be a real "before" duration, not zero or a positive number. Also fixed day units (d) not converting properly, and an unrelated crash I ran into on the way.
Docs and tests updated accordingly.