Skip to content

Commit dd64d34

Browse files
committed
fixed section becoming part of section above if there's a subsection at the end of above section
1 parent 6982607 commit dd64d34

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

TODOlist.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ def read_data_file():
134134
if len(subsection) != 0:
135135
section.append(subsection.copy())
136136
subsection.clear()
137+
if i[0] == '--':
138+
list_data.append(section.copy())
139+
section.clear()
137140

138141
if i[0] == '----' and previous_line[0] == '----':
139142
subsection.append({' '.join(i[1:-1]): booleans[i[-1]]})
@@ -150,7 +153,6 @@ def read_data_file():
150153
subsection.append({' '.join(i[1:-1]): booleans[i[-1]]})
151154

152155
if i[0] == '--':
153-
154156
if i[-1] not in tasks and previous_line[0] == '--' and previous_line[-1] not in tasks:
155157
list_data.append(section.copy())
156158
section.clear()

data.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ Data:
3838
-- Play (O)
3939
--- CS:GO (F)
4040
--- Train (C)
41-
---- Aim (F)
41+
---- Aim (F)
42+
-- Practice (C)
43+
--- Aim (F)

0 commit comments

Comments
 (0)