mrwilson / adr-viewer

Generate easy-to-read web pages for your Architecture Decision Records
MIT License
160 stars 27 forks source link

Support checklist style list items in status resolver #35

Open colindean opened 1 year ago

colindean commented 1 year ago

The current status resolver mechanism adequately accounts for lists in the Status H2 but a list containing a checklist style list gets ignored because the square brackets remain.

https://github.com/mrwilson/adr-viewer/blob/f3d5fdc10471370e5f8d7b97b0b04b5e178ff74a/adr_viewer/__init__.py#L35-L44

This could be modified to use needle in haystack instead of haystack.startswith(needle), or

https://github.com/mrwilson/adr-viewer/blob/f3d5fdc10471370e5f8d7b97b0b04b5e178ff74a/adr_viewer/__init__.py#L23

could handle the HTML better by removing [ ] or [X] or [x] that precedes text, or looks for text inside of the li (skipping input[type=checkbox] if present).

colindean commented 1 year ago

To be clearer,

## Status

- Accepted

works but

## Status

- [ ] Accepted

does not.

Ideally, I'd like to have something like this work:

## Status

- [X] Pending
- [X] Accepted
- [ ] Amended
- [ ] Superceded

should result in accepted status.

## Status

- [X] Pending
- [X] Accepted
- [ ] Amended
- [X] Superceded

should result in superceded, and so on. We tend to add dates after these but the startswith() check handles that.

So, if the check box is present, use the last checked.