46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
import io
|
|
from datetime import date
|
|
import markdown
|
|
from re import search
|
|
import re
|
|
# import pypandoc and/or panflute
|
|
|
|
rootdir = "/Users/normrasmussen/Documents/Northpass/Scripts/API_Notes/SampleNotes/"
|
|
#meetingstart = "##"
|
|
#meetingend = "##"
|
|
#rx = r'{}.*?{}'.format(re.escape(meetingstart), re.escape(meetingend))
|
|
|
|
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(f"## {today}"):
|
|
notes_flag = True
|
|
elif notes_flag:
|
|
notes += line
|
|
if not line.strip(): break
|
|
mdConvert(rootdir, notes)
|
|
|
|
def mdConvert(rootdir, notes):
|
|
conversion = markdown.markdown(notes)
|
|
print(notes)
|
|
# Add Conversion variable to payload for hubspot. Copy functions from the other files.
|
|
|
|
if __name__ == "__main__":
|
|
noteSections(rootdir)
|
|
|