hackberrydev/alas

Parsing failure when last list item lacks preceding checkbox

Closed this issue · 5 comments

kwbr commented

If a day ends with a list item that is not preceded with a checkbox parsing the plan file fails:

$ alas --stats test.md
Plan can not be parsed: last parsed line is line 9.

Here is a minimal example reproducing the problem:

# My Plan

## Inbox

## 2022-07-28, Thursday

- [ ] Develop photos
- [X] Pay bills
- Met with Mike and Molly

Whereas if the line is somewhere in between parsing works.

# My Plan

## Inbox

## 2022-07-28, Thursday

- Met with Mike and Molly
- [ ] Develop photos
- [X] Pay bills

Thanks for the bug report.

I implemented the plan parser to expect events (- Met with Mike and Molly) to be before tasks (- [ ] Develop photos). However, I see now that this is not clearly defined in the documentation - https://www.hackberry.dev/alas-format/.

So, there are two ways to approach this:

  1. Update the documentation so that it clearly states that events have to be before tasks.
  2. Update the parser to allow events and tasks to be mixed.

I'm leaning toward 1. I feel that that's simpler and it makes the plan "cleaner".

I can consider implementing 2, if there's a good reason to mix events and tasks. Do you have an example where 2 would be more desirable?

kwbr commented

Update the documentation so that it clearly states that events have to be before tasks.

This sounds reasonable. Any other restrictions to be aware, for example has everything to be in a single list?

kwbr commented

Found this unexpected behavior when adding a subitem to a list:

# My Plan

## Inbox

## 2022-07-28, Thursday

- Met with Mike and Molly
  - THIS LINE CAN NOT BE PARSED 
- [ ] Develop photos
- [X] Pay bills

This sounds reasonable.

OK. I'll update the documentation.

Any other restrictions to be aware, for example has everything to be in a single list?

What do you mean by "single list"? Thanks.

Found this unexpected behavior when adding a subitem to a list...

I believe that events can only have a title now. But, I have to check. I think it's reasonable for an event to have a body. So I'll probably create a separate feature request for this.

I released a new version (https://github.com/hackberrydev/alas/releases/tag/v1.4) that supports body for events.

I also updated documentation.

I believe that this resolves the issue. Let me know if this is incorrect.

Thanks again for reporting it!