from datetime import date import markdown import re rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/" def findheadings(): headingsarray = [] with open(rootdir + "Flink.md", "r") as myfile: file = myfile.readlines() for headings in file: if "##" in headings: headingsarray.append(headings) print(headingsarray) # From StackOverflow: def noteSections(rootdir): #today = date.today() #today = today.strftime("%m/%d/%Y") #dateregex = "^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$" with open(rootdir+"Flink.md", "r") as f: notes_flag = False notes = '' for line in f: if line.startswith("## "): notes_flag = True elif notes_flag: notes += line if not line.strip(): break print(notes) # mdConvert(rootdir, notes) def meetingSections(rootdir): dateregex = "^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$" currentnote = rootdir + "Flink.md" with open(currentnote, "r") as f: text = f.read() #print(text) #m = re.search(f"##(.^[0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4}$)\n(.*)\n\n") #m = re.search("##"+dateregex+"(.*)"+"##"+dateregex, text) if m: print("Found a section!") found = m.group(1) print(found) def mdConvert(rootdir, notes): conversion = markdown.markdown(notes) print(conversion) # Add Conversion variable to payload for hubspot. Copy functions from the other files. if __name__ == "__main__": meetingSections(rootdir) #noteSections(rootdir)