Fixed notes on read page
This commit is contained in:
8
main.py
8
main.py
@@ -15,9 +15,11 @@ def readBook():
|
||||
filepath = request.args.get('filepath')+"/book.md"
|
||||
with open(filepath) as f:
|
||||
mdtext = f.read()
|
||||
notespath = request.args.get('filepath')+"/notes.txt"
|
||||
with open(notespath) as f:
|
||||
notestext = f.read()
|
||||
renderedMd = markdown.markdown(mdtext)
|
||||
finalHTML = "<a href='http://localhost:5000/'>Home</a>" + renderedMd
|
||||
return finalHTML
|
||||
return render_template('read.html', markdown=renderedMd, path=request.args.get('filepath'), notes=notestext)
|
||||
|
||||
@app.route('/notes')
|
||||
def notesForBook():
|
||||
@@ -28,7 +30,7 @@ def notesForBook():
|
||||
|
||||
@app.route('/savenotes', methods=['POST'])
|
||||
def saveNotes():
|
||||
path = request.form.get("path")
|
||||
path = request.form.get("path")+"/notes.txt"
|
||||
notes = request.form.get("notes")
|
||||
with open(path, "w") as f:
|
||||
f.write(notes)
|
||||
|
||||
Reference in New Issue
Block a user