todo_archive: fix leading-space stripping
This commit is contained in:
parent
6e5ac0799b
commit
5ae4c105b1
1 changed files with 8 additions and 2 deletions
|
|
@ -22,7 +22,13 @@ from stage_left.types import State, Group, Item
|
||||||
|
|
||||||
def format_item(item: Item) -> str:
|
def format_item(item: Item) -> str:
|
||||||
"""Format an item back to [x]it! syntax."""
|
"""Format an item back to [x]it! syntax."""
|
||||||
return f"[{item.state.value}] {item.description}"
|
lines = item.description.split('\n')
|
||||||
|
first_line = f"[{item.state.value}] {lines[0]}"
|
||||||
|
if len(lines) == 1:
|
||||||
|
return first_line
|
||||||
|
# Indent continuation lines (4 spaces to align with content after "[x] ")
|
||||||
|
continuation_lines = [' ' + line for line in lines[1:]]
|
||||||
|
return '\n'.join([first_line] + continuation_lines)
|
||||||
|
|
||||||
|
|
||||||
def sort_groups(groups: list[Group]) -> list[Group]:
|
def sort_groups(groups: list[Group]) -> list[Group]:
|
||||||
|
|
@ -59,7 +65,7 @@ def extract_archivable_items(groups: list[Group]) -> tuple[list[Group], list[Gro
|
||||||
(archivable_groups, remaining_groups) - Both preserve group structure.
|
(archivable_groups, remaining_groups) - Both preserve group structure.
|
||||||
Empty groups are preserved in remaining_groups.
|
Empty groups are preserved in remaining_groups.
|
||||||
"""
|
"""
|
||||||
archivable_states = {State.CHECKED, State.OBSOLETE}
|
archivable_states = {State.CHECKED, State.OBSOLETE, State.IN_QUESTION}
|
||||||
archivable_groups = []
|
archivable_groups = []
|
||||||
remaining_groups = []
|
remaining_groups = []
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue