Skip to content

Commit

Permalink
recurring events fix
Browse files Browse the repository at this point in the history
  • Loading branch information
boss committed Apr 19, 2019
1 parent 7d282f2 commit 3149a79
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mdcalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def eomDt(dt):
# ---------------------------------
f_md = open(cfg.mdInPath,'r')

isPreface = True
status = "pre"
preface = ""

calDtList = []
Expand All @@ -41,7 +41,7 @@ def eomDt(dt):
line = line.strip()

if line[0:4]=="### ":
isPreface = False
status = "cal"
# Custom Ids
if ("(" in line) and (")" in line):
customId = line[line.find("("):line.find(")")+1]
Expand All @@ -62,18 +62,20 @@ def eomDt(dt):

elif line[0:2]=="+ ":
# Recurring Events
isPreface = False
status = "rec"
thisDt = parser.parse(line[2:line.find('-')])
calKey = thisDt.strftime('%Y-%m-%d')
if calKey not in rrDict:
rrDtList.append(thisDt)
rrDict[calKey] = line[line.find('-'):]

else:
if not isPreface and not (line[0:3]=="---"):
if status=="cal" and not (line[0:3]=="---"):
calDict[calKey] += line + '\n'
if status=="rec" and not (line[0:3]=="---"):
rrDict[calKey] += line + '\n'

if isPreface and not (line[0:3]=="---"):
if status=="pre" and not (line[0:3]=="---"):
preface += line + '\n'

f_md.close()
Expand Down Expand Up @@ -126,4 +128,3 @@ def eomDt(dt):
f_new.write(calDict[dt.strftime('%Y-%m-%d')])

f_new.close()
print(rrDict)

0 comments on commit 3149a79

Please sign in to comment.