diff --git a/README.md b/README.md index aa193ad..5aefd61 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ This is a *very* basic notes-taking program. It uses python with flask and pickl ![Screenshot of the application](./squipnotes.png) -## Future features -* Allow for notes modification -* Markdown interface +## Future features, todo +* Allow for notes modification and deletion * A squirrel ascii picture somewhere in the page :3 * Less ugly colors and font +* Better syntax coloring and markdown rendering in general diff --git a/squipnotes.png b/squipnotes.png index 1c3dfc4..1d9d793 100644 Binary files a/squipnotes.png and b/squipnotes.png differ diff --git a/src/app.py b/src/app.py index b53e608..af16603 100755 --- a/src/app.py +++ b/src/app.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 #coding: utf-8 from flask import Flask, render_template, Markup, request -from os.path import exists -import datetime, time, pickle +import markdown #!---------- squiNotes.py ---------- # My notes-taking app #-----------------------------! + + class note: def __init__(self, createtime: int, modtime: int, title: str, text: str): """ @@ -22,6 +23,7 @@ class note: """ Render the given timestamp as dd/mm/yyyy-hh:mm """ + import datetime timestamp = datetime.datetime.fromtimestamp(pretimestamp) timestamp = timestamp.strftime("%d/%m/%Y-%H:%M:%S") return timestamp @@ -34,7 +36,7 @@ class note:
{Markup.escape(self.title)}

Created : {self.rendertime(self.createtime)} Modified : {self.rendertime(self.modtime)}

-
{Markup.escape(self.text)}

""" +
{markdown.markdown(self.text)}

""" return Markup(rendered) def __str__(self): @@ -54,6 +56,7 @@ def dumpnotes(notes): """ Get our notes list and save them as pickle to notes.pickle """ + import pickle with open('notes.pickle', 'wb') as mpf: pickle.dump(notes, mpf) @@ -63,6 +66,9 @@ def getnotes(): """ Get our notes from the file notes.pickle """ + from os.path import exists + import pickle + if exists("./notes.pickle"): with open('notes.pickle', 'rb') as mpf: notes = pickle.load(mpf) @@ -82,6 +88,7 @@ def render(): @app.route('/', methods=['POST']) def homepage(): + import time notetitle = request.form['title'] notetext = request.form['text'] rightnow = int(time.time()) diff --git a/src/notes.pickle b/src/notes.pickle index 7c5a58a..99f2adc 100644 Binary files a/src/notes.pickle and b/src/notes.pickle differ