Files
Gainsight/Scripts/API_Notes/conf_functionsonly.py
2023-02-10 15:15:33 -05:00

60 lines
1.6 KiB
Python

import markdown
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)
# FEAT: Add Conversion variable to payload for hubspot. Copy functions from the other files.
if __name__ == "__main__":
meetingSections(rootdir)
# noteSections(rootdir)