Skip to content

Commit 7effb3c

Browse files
authored
Merge pull request #12 from Endeavour233/fixcalendar
fix #9
2 parents 127a55c + b8584dc commit 7effb3c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mdcal.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,17 @@ def update_calendar(year, month, day, with_isoweek=False, start_from_Sun=False,
8888
calendar_section_lines += calendar_section.split("\n")[2:]
8989

9090
star_flag = True
91-
for i in range(len(calendar_section_lines) - 1, 3, -1):
91+
month_start_flag = False
92+
for i in range(4, len(calendar_section_lines)):
9293
if re.match("^\\|([ ]*.*[ ]*\|)+$", calendar_section_lines[i]):
9394
day_cells = calendar_section_lines[i].split("|")
94-
for j in range(len(day_cells) - 2, 0, -1):
95+
for j in range(1, len(day_cells) - 1):
9596
digit = re.findall(r'\d+', day_cells[j].strip())
9697
if len(digit) == 0:
9798
continue
98-
if digit[0] == str(day) and "🌟" not in day_cells[j] and star_flag:
99+
if digit[0] == "1":
100+
month_start_flag = True
101+
if digit[0] == str(day) and "🌟" not in day_cells[j] and star_flag and month_start_flag:
99102
day_cells[j] = day_cells[j].strip() + "🌟"
100103
star_flag = False
101104
calendar_section_lines[i] = "|".join(day_cells)

0 commit comments

Comments
 (0)