diff --git a/README.md b/README.md index 76236d4..64f55c4 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,4 @@ pygmentize -S dracula -f html -a .codehilite > styles.css * Replace all css for .codehilite in src/static/main.css with what's in styles.css ## Future features, todo -* A squirrel ascii picture somewhere in the page :3 -* A link "export all in markdown" * Replace pickle with sqlite or smth diff --git a/data/notes.pickle b/data/notes.pickle new file mode 100644 index 0000000..bbb570e Binary files /dev/null and b/data/notes.pickle differ diff --git a/src/__pycache__/classes.cpython-39.pyc b/src/__pycache__/classes.cpython-39.pyc new file mode 100644 index 0000000..612101e Binary files /dev/null and b/src/__pycache__/classes.cpython-39.pyc differ diff --git a/src/__pycache__/funcs.cpython-39.pyc b/src/__pycache__/funcs.cpython-39.pyc new file mode 100644 index 0000000..fdcefa4 Binary files /dev/null and b/src/__pycache__/funcs.cpython-39.pyc differ diff --git a/src/app.py b/src/app.py index b23151f..8d8be04 100755 --- a/src/app.py +++ b/src/app.py @@ -2,7 +2,7 @@ #coding: utf-8 from flask import Flask, render_template, Markup, request, redirect, url_for from classes import note -from funcs import dumpnotes, getnotes, catnotes, delnote, findnote, addnote, mknotedir +from funcs import dumpnotes, getnotes, catnotes, delnote, findnote, addnote, mknotedir, exportnotes #!---------- squiNotes.py ---------- # My notes-taking app @@ -32,6 +32,11 @@ def render(): return render_template("homepage.html", nr = catnotes(getnotes())) +#Export mode +@app.route('/export', methods=['GET']) +def rawnotes(): + return render_template("export.html", rawnotes = exportnotes()) + #Edition mode @app.route('/edit', methods=['GET', 'POST']) def edit(): diff --git a/src/data/notes.pickle b/src/data/notes.pickle new file mode 100644 index 0000000..92fc181 Binary files /dev/null and b/src/data/notes.pickle differ diff --git a/src/funcs.py b/src/funcs.py index 2251222..bbd6d2d 100644 --- a/src/funcs.py +++ b/src/funcs.py @@ -76,3 +76,21 @@ def addnote(mynote: note): notes.append(mynote) notes = sorted(notes, key=lambda note: note.modtime, reverse=True) dumpnotes(notes) + +def exportnotes(): + """ + Export our notes in markdown, one after the other. + """ + notes = getnotes() + rawtext = "" + for note in notes: + rawtext += f"#{note.title}\n" + rawtext += f"* Created: {note.rendertime(note.createtime)}\n" + rawtext += f"* Modified: {note.rendertime(note.modtime)}\n" + rawtext += f"{note.text}\n" + rawtext += f"-----\n\n" + + return rawtext + + return + diff --git a/src/static/styles/main.css b/src/static/styles/main.css index 0f71b16..1d78815 100644 --- a/src/static/styles/main.css +++ b/src/static/styles/main.css @@ -41,9 +41,25 @@ button { cursor: pointer; } +hr { + border: 3px dotted; +} + +a { + color: #8be9fd; + text-decoration: underline; + font-style: italic; + font-size: 1em; +} + +.exportlink { + float: right; +} + .pagetitle { font-size: 3em; color: #ff79c6; + float: left; } @@ -71,18 +87,20 @@ button { */ .text { + width: 100%; background: #44475a; color: #f8f8f2; border-radius: 5px; border-style: none; outline: none; border-width: 1px; - height: 200px; + height: 80%; font-size: 15px; -webkit-box-shadow: 0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23); } .title { + width: 100%; background: #44475a; color: #f8f8f2; border-radius: 5px; @@ -95,6 +113,10 @@ button { -webkit-box-shadow: 0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23); } +.rawtext { + white-space: pre-wrap; +} + /* Syntax highlighting */ pre { line-height: 125%; } td.linenos .normal { color: #f1fa8c; background-color: #44475a; padding-left: 5px; padding-right: 5px; } diff --git a/src/templates/edit.html b/src/templates/edit.html index 619d527..6e5684f 100644 --- a/src/templates/edit.html +++ b/src/templates/edit.html @@ -11,7 +11,7 @@

-
+
Note : you can drag the textbox to make it bigger.
diff --git a/src/templates/export.html b/src/templates/export.html new file mode 100644 index 0000000..1178b0d --- /dev/null +++ b/src/templates/export.html @@ -0,0 +1,13 @@ + + + + + + sqnotes + + +
+{{ rawnotes }} +
+ + diff --git a/src/templates/homepage.html b/src/templates/homepage.html index 781c96d..9883196 100644 --- a/src/templates/homepage.html +++ b/src/templates/homepage.html @@ -7,19 +7,24 @@ -

$ ~/sqnotes

-
+

$ ~/sqnotes

Raw notes


-
Note : you can drag the textbox to make it bigger.
+
Note : you can drag the textbox to make it bigger. Scroll down to see your previous notes.

{{ nr }} -
+