Checklists in the body, colour from tags, and commit-derived CalVer #4

Merged
bvandeusen merged 73 commits from dev into main 2026-08-29 13:39:45 -04:00
Showing only changes of commit fe1f72ae1b - Show all commits
+18 -16
View File
@@ -139,27 +139,32 @@ def test_derive_display_title_is_the_first_body_line():
assert derive_display_title("\n \nreal line\nmore") == "real line"
def test_derive_display_title_falls_back_to_the_first_item():
# What step 2 bought: a note that is only a checklist still has a name. Without
# this it would have none at all, which is why the title could not go first.
assert derive_display_title("", "milk") == "milk"
assert derive_display_title(" \n ", " eggs ") == "eggs"
# The body still wins when it has anything to say.
assert derive_display_title("shopping", "milk") == "shopping"
def test_derive_display_title_names_a_list_only_note():
# The same property the old `first_item` fallback protected — a note that is only
# a checklist still has a name — reached a different way. Items ARE body lines now
# (M304), so the first one is simply the first line, with its marker stripped:
# calling the note "- [ ] milk" would show someone the storage instead of the note.
assert derive_display_title("- [ ] milk\n- [ ] eggs") == "milk"
assert derive_display_title(" * [x] eggs ") == "eggs"
# Prose still wins when it comes first, because it IS the first line.
assert derive_display_title("shopping\n\n- [ ] milk") == "shopping"
# An EMPTY item does not name the note "" — a half-typed list still has a name.
assert derive_display_title("- [ ]\n- [ ] eggs") == "eggs"
def test_derive_display_title_empty():
assert derive_display_title(None) == ""
assert derive_display_title("") == ""
assert derive_display_title(" \n ", None) == ""
assert derive_display_title(" \n ", " ") == ""
assert derive_display_title(" \n ") == ""
# A list of nothing but empty items is still a note with no name.
assert derive_display_title("- [ ]\n- [ ]") == ""
def test_derive_display_title_caps_length():
long = "x" * 300
assert derive_display_title(long) == "x" * 200
# the item fallback is capped on the same rule
assert derive_display_title("", long) == "x" * 200
# A first line that happens to be an item is capped on the same rule.
assert derive_display_title(f"- [ ] {long}") == "x" * 200
def test_parse_tags():
@@ -502,13 +507,10 @@ def test_append_item_spacing():
assert append_item("", "done", True) == "- [x] done"
def test_strip_marker_and_display_title():
def test_strip_marker():
assert strip_marker("- [x] milk") == "milk"
assert strip_marker("just prose") == "just prose"
# A list-only note is named by its first item, without the marker.
assert derive_display_title("- [ ] milk\n- [ ] eggs") == "milk"
# An EMPTY item does not name the note "" — a half-typed list still has a name.
assert derive_display_title("- [ ]\n- [ ] eggs") == "eggs"
assert strip_marker("- [ ]") == ""
def test_the_migration_folds_exactly_like_the_app():