Files
Gainsight/Scripts/API_Notes/conf_functionsonly.py

46 lines
1.3 KiB
Python
Raw Normal View History

2022-10-10 17:28:58 -04:00
import io
2022-11-08 14:47:53 -05:00
from datetime import date
2022-10-10 17:28:58 -04:00
import markdown
from re import search
import re
# import pypandoc and/or panflute
2022-11-08 14:47:53 -05:00
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/"
2022-10-10 17:28:58 -04:00
#meetingstart = "##"
#meetingend = "##"
#rx = r'{}.*?{}'.format(re.escape(meetingstart), re.escape(meetingend))
def findheadings():
headingsarray = []
2022-11-14 18:01:18 -05:00
with open(rootdir + "Flink.md", "r") as myfile:
2022-10-10 17:28:58 -04:00
file = myfile.readlines()
for headings in file:
if "##" in headings:
headingsarray.append(headings)
print(headingsarray)
2022-11-08 14:47:53 -05:00
# 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(f"## {today}"):
notes_flag = True
elif notes_flag:
notes += line
if not line.strip(): break
mdConvert(rootdir, notes)
2022-10-10 17:28:58 -04:00
2022-11-08 14:47:53 -05:00
def mdConvert(rootdir, notes):
conversion = markdown.markdown(notes)
print(notes)
2022-11-14 18:01:18 -05:00
# Add Conversion variable to payload for hubspot. Copy functions from the other files.
2022-10-10 17:28:58 -04:00
if __name__ == "__main__":
2022-11-08 14:47:53 -05:00
noteSections(rootdir)