Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support checklist style list items in status resolver #35

Open
colindean opened this issue Mar 20, 2023 · 1 comment
Open

Support checklist style list items in status resolver #35

colindean opened this issue Mar 20, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@colindean
Copy link
Contributor

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.

if any([line.startswith("Amended by") for line in status]):
status = 'amended'
elif any([line.startswith("Accepted") for line in status]):
status = 'accepted'
elif any([line.startswith("Superseded by") for line in status]):
status = 'superseded'
elif any([line.startswith("Pending") for line in status]):
status = 'pending'
else:
status = 'unknown'

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

yield from (li.text for li in current_node.children if li.name == "li")

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
Copy link
Contributor Author

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.

@mrwilson mrwilson added the enhancement New feature or request label Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants