Compare commits
10 Commits
d54fb438c6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 471f4c59e6 | |||
| 82cee5b15c | |||
| b1e7f9a63a | |||
| d41a6adea5 | |||
| bdbed7ec2c | |||
| 1086827cf7 | |||
| 71325101e3 | |||
| d91a42b6c6 | |||
| 176948f871 | |||
| 51775a8d64 |
42
.gitea/workflows/docker.yml
Normal file
42
.gitea/workflows/docker.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
- "master"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # all history for all branches and tags
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: gitea.squi.fr
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
env:
|
||||||
|
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: gitea.squi.fr/justine/squi_notes:latest
|
||||||
|
|
||||||
@ -33,6 +33,8 @@ 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
|
* Replace all css for .codehilite in src/static/main.css with what's in styles.css
|
||||||
|
|
||||||
## Run with Docker
|
## Run with Docker
|
||||||
|
Automated images for amd and arm should be included in this repo.
|
||||||
|
|
||||||
### Using traefik
|
### Using traefik
|
||||||
If you use traefik, you only have to change the url in the label "traefik.http.routers.sqnotes.rule". You can also modify the labels to rename the service from "sqnotes" to anything else.
|
If you use traefik, you only have to change the url in the label "traefik.http.routers.sqnotes.rule". You can also modify the labels to rename the service from "sqnotes" to anything else.
|
||||||
|
|
||||||
@ -50,3 +52,7 @@ docker-compose up -d
|
|||||||
|
|
||||||
## Future features, todo
|
## Future features, todo
|
||||||
* Replace pickle with sqlite or smth
|
* Replace pickle with sqlite or smth
|
||||||
|
* Use as a CGI script rather than using flask's in-built server
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
Automation : git.rznet.fr
|
||||||
|
|||||||
91
export_tools/notesplit.py
Normal file
91
export_tools/notesplit.py
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#coding: utf-8
|
||||||
|
|
||||||
|
#!---------- notesplit.py ----------
|
||||||
|
# Used for splitting notes extracted from my note-taking webapp
|
||||||
|
# into single markdown files.
|
||||||
|
# It was a good run but I am switching to obsidian.
|
||||||
|
#-----------------------------------!
|
||||||
|
|
||||||
|
|
||||||
|
#----------! FUNC
|
||||||
|
def get_args():
|
||||||
|
'''Gets all the arguments passed to the script and returns them in a parse_args()-type object.
|
||||||
|
No args
|
||||||
|
Returns:
|
||||||
|
-args : an args object containing all the optional arguments passed to the script.
|
||||||
|
'''
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("-f", "--file", help = "File to split", action="store", type=str, required=True)
|
||||||
|
parser.add_argument("-d", "--dest", help = "Folder to put the resulting files in - will overwrite anything already there !", action="store", type=str, required=True)
|
||||||
|
|
||||||
|
#Creating the args object
|
||||||
|
args=parser.parse_args()
|
||||||
|
|
||||||
|
return args
|
||||||
|
|
||||||
|
def filesplit(file: str):
|
||||||
|
'''Split the extract file and return a dict name.md : text of the note
|
||||||
|
takes the path of the file
|
||||||
|
'''
|
||||||
|
import re
|
||||||
|
with open(file, "r") as contents:
|
||||||
|
contents = contents.read()
|
||||||
|
|
||||||
|
res = {}
|
||||||
|
contents = re.split(r'[^\-]\-\-\-\-\-[^\-]', contents)
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
for note in contents:
|
||||||
|
n = note.splitlines()
|
||||||
|
title = f"untitled_{i}"
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
for line in n:
|
||||||
|
if line.startswith("#"):
|
||||||
|
title = line[1:]
|
||||||
|
print(f"FOUND TITLE {title} in {line}")
|
||||||
|
break
|
||||||
|
res[title] = note
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
def sanitize(title):
|
||||||
|
'''Take a notetitle and make it a valid filename. Add md extension.
|
||||||
|
'''
|
||||||
|
title = title.replace("/", "_")
|
||||||
|
title = title.replace(" ", "_")
|
||||||
|
title = title.replace("\n", "_")
|
||||||
|
title = title.replace("?", "_")
|
||||||
|
title = title.replace("(", "_")
|
||||||
|
title = title.replace(")", "_")
|
||||||
|
title = title.replace(":", "_")
|
||||||
|
title = title.replace(";", "_")
|
||||||
|
title = title.replace('"', "_")
|
||||||
|
title = title.replace("'", "_")
|
||||||
|
title = f"{title}.md"
|
||||||
|
|
||||||
|
return title
|
||||||
|
|
||||||
|
def savenotes(notes: dict, dest: str):
|
||||||
|
'''Save notes to files in folder dest
|
||||||
|
'''
|
||||||
|
import os
|
||||||
|
os.chdir(dest)
|
||||||
|
|
||||||
|
for title in notes:
|
||||||
|
text = notes[title]
|
||||||
|
filename = sanitize(title)
|
||||||
|
with open(filename, "w") as writer:
|
||||||
|
writer.write(text)
|
||||||
|
print(f"Saved {filename} in {dest}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------! MAIN
|
||||||
|
args = get_args()
|
||||||
|
file = args.file
|
||||||
|
notes = filesplit(file)
|
||||||
|
savenotes(notes, args.dest)
|
||||||
294
src/static/styles/2-sunset.css
Normal file
294
src/static/styles/2-sunset.css
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: "Work Sans";
|
||||||
|
src: url(WorkSans-Regular.ttf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Work Sans";
|
||||||
|
src: url(WorkSans-Bold.ttf);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Work Sans";
|
||||||
|
src: url(WorkSans-Italic.ttf);
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Work Sans";
|
||||||
|
src: url(WorkSans-BoldItalic.ttf);
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
html {
|
||||||
|
background-color: #2e2e2e;
|
||||||
|
font-family: 'Work Sans';
|
||||||
|
color: #ffbc80;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #f76e11;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: #f76e11;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
color: #f76e11;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
color: #f76e11;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
color: #f76e11;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
color: #b958a5;
|
||||||
|
padding: 1px 2px;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 1em;
|
||||||
|
font-style: normal;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
border: 3px dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #b958a5;
|
||||||
|
text-decoration: underline;
|
||||||
|
font-style: normal;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbar {
|
||||||
|
background-color: #eee8d5;
|
||||||
|
border: none;
|
||||||
|
color: #ff9f45;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: none*;
|
||||||
|
font-style: normal;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topbutton {
|
||||||
|
float: right;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #ff9f45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exportlink {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.pagetitle {
|
||||||
|
font-size: 3em;
|
||||||
|
color: #fc4f4f;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.backlink {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notetitle {
|
||||||
|
color: #f76e11;
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notetime {
|
||||||
|
color: #ff9f45;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
.title {
|
||||||
|
background: #44475a;
|
||||||
|
color: #f76e11;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 2em
|
||||||
|
border-style: none;
|
||||||
|
border-radius: 1px;
|
||||||
|
outline: none;
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text {
|
||||||
|
width: 100%;
|
||||||
|
background: #404040;
|
||||||
|
color: #ff9f45;
|
||||||
|
border-radius: 5px;
|
||||||
|
border-style: none;
|
||||||
|
outline: none;
|
||||||
|
border-width: 1px;
|
||||||
|
height: 40%;
|
||||||
|
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: #404040;
|
||||||
|
color: #ff9f45;
|
||||||
|
border-radius: 5px;
|
||||||
|
border-style: none;
|
||||||
|
outline: none;
|
||||||
|
border-width: 1px;
|
||||||
|
height: 25px;
|
||||||
|
margin: 5px 0px 5px 0px;
|
||||||
|
font-size: 15px;
|
||||||
|
-webkit-box-shadow: 0 3px 6px rgba(0,0,0,.16),0 3px 6px rgba(0,0,0,.23);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rawtext {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Coming from SqTodo
|
||||||
|
.priorityinput {
|
||||||
|
background-color: #404040;
|
||||||
|
color: #ff9f45;
|
||||||
|
border-radius: 5px;
|
||||||
|
border-style: none;
|
||||||
|
border-width: 1px;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
color: #ff9f45;
|
||||||
|
padding: 1px 2px;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 1em;
|
||||||
|
font-style: normal;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
/* Hide priority select arrows
|
||||||
|
Chrome, Safari, Edge, Opera */
|
||||||
|
input::-webkit-outer-spin-button,
|
||||||
|
input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Firefox */
|
||||||
|
input[type=number] {
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
.donemarkselect {
|
||||||
|
background-color: #404040;
|
||||||
|
color: #ff9f45;
|
||||||
|
border-radius: 5px;
|
||||||
|
border-style: inset;
|
||||||
|
border-color: #ff79c6;
|
||||||
|
border-width: 1px;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/* Syntax highlighting */
|
||||||
|
pre { line-height: 125%; }
|
||||||
|
td.linenos .normal { color: #5d6262; background-color: #353535; padding-left: 5px; padding-right: 5px; }
|
||||||
|
span.linenos { color: #5d6262; background-color: #353535; padding-left: 5px; padding-right: 5px; }
|
||||||
|
td.linenos .special { color: #7a8080; background-color: #353535; padding-left: 5px; padding-right: 5px; }
|
||||||
|
span.linenos.special { color: #7a8080; background-color: #353535; padding-left: 5px; padding-right: 5px; }
|
||||||
|
.codehilite .hll { background-color: #484848 }
|
||||||
|
.codehilite { background: #3f3f3f; color: #dcdccc }
|
||||||
|
.codehilite .c { color: #7f9f7f; font-style: italic } /* Comment */
|
||||||
|
.codehilite .err { color: #e37170; font-weight: bold } /* Error */
|
||||||
|
.codehilite .esc { color: #dcdccc } /* Escape */
|
||||||
|
.codehilite .g { color: #ecbcbc; font-weight: bold } /* Generic */
|
||||||
|
.codehilite .k { color: #efdcbc } /* Keyword */
|
||||||
|
.codehilite .l { color: #9fafaf } /* Literal */
|
||||||
|
.codehilite .n { color: #dcdccc } /* Name */
|
||||||
|
.codehilite .o { color: #f0efd0 } /* Operator */
|
||||||
|
.codehilite .x { color: #dcdccc } /* Other */
|
||||||
|
.codehilite .p { color: #f0efd0 } /* Punctuation */
|
||||||
|
.codehilite .ch { color: #7f9f7f; font-style: italic } /* Comment.Hashbang */
|
||||||
|
.codehilite .cm { color: #7f9f7f; font-style: italic } /* Comment.Multiline */
|
||||||
|
.codehilite .cp { color: #dfaf8f; font-weight: bold; font-style: italic } /* Comment.Preproc */
|
||||||
|
.codehilite .cpf { color: #cc9393; font-style: italic } /* Comment.PreprocFile */
|
||||||
|
.codehilite .c1 { color: #7f9f7f; font-style: italic } /* Comment.Single */
|
||||||
|
.codehilite .cs { color: #dfdfdf; font-weight: bold; font-style: italic } /* Comment.Special */
|
||||||
|
.codehilite .gd { color: #c3bf9f; font-weight: bold; background-color: #313c36 } /* Generic.Deleted */
|
||||||
|
.codehilite .ge { color: #ffffff; font-weight: bold } /* Generic.Emph */
|
||||||
|
.codehilite .gr { color: #ecbcbc; font-weight: bold } /* Generic.Error */
|
||||||
|
.codehilite .gh { color: #efefef; font-weight: bold } /* Generic.Heading */
|
||||||
|
.codehilite .gi { color: #709080; font-weight: bold; background-color: #313c36 } /* Generic.Inserted */
|
||||||
|
.codehilite .go { color: #5b605e; font-weight: bold } /* Generic.Output */
|
||||||
|
.codehilite .gp { color: #ecbcbc; font-weight: bold } /* Generic.Prompt */
|
||||||
|
.codehilite .gs { color: #ecbcbc; font-weight: bold } /* Generic.Strong */
|
||||||
|
.codehilite .gu { color: #efefef; font-weight: bold } /* Generic.Subheading */
|
||||||
|
.codehilite .gt { color: #80d4aa; font-weight: bold; background-color: #2f2f2f } /* Generic.Traceback */
|
||||||
|
.codehilite .kc { color: #dca3a3 } /* Keyword.Constant */
|
||||||
|
.codehilite .kd { color: #f0dfaf } /* Keyword.Declaration */
|
||||||
|
.codehilite .kn { color: #f0dfaf } /* Keyword.Namespace */
|
||||||
|
.codehilite .kp { color: #efdcbc } /* Keyword.Pseudo */
|
||||||
|
.codehilite .kr { color: #efdcbc } /* Keyword.Reserved */
|
||||||
|
.codehilite .kt { color: #dfdfbf; font-weight: bold } /* Keyword.Type */
|
||||||
|
.codehilite .ld { color: #9fafaf } /* Literal.Date */
|
||||||
|
.codehilite .m { color: #8cd0d3 } /* Literal.Number */
|
||||||
|
.codehilite .s { color: #cc9393 } /* Literal.String */
|
||||||
|
.codehilite .na { color: #efef8f } /* Name.Attribute */
|
||||||
|
.codehilite .nb { color: #efef8f } /* Name.Builtin */
|
||||||
|
.codehilite .nc { color: #efef8f } /* Name.Class */
|
||||||
|
.codehilite .no { color: #dca3a3 } /* Name.Constant */
|
||||||
|
.codehilite .nd { color: #dcdccc } /* Name.Decorator */
|
||||||
|
.codehilite .ni { color: #cfbfaf } /* Name.Entity */
|
||||||
|
.codehilite .ne { color: #c3bf9f; font-weight: bold } /* Name.Exception */
|
||||||
|
.codehilite .nf { color: #efef8f } /* Name.Function */
|
||||||
|
.codehilite .nl { color: #dcdccc } /* Name.Label */
|
||||||
|
.codehilite .nn { color: #dcdccc } /* Name.Namespace */
|
||||||
|
.codehilite .nx { color: #dcdccc } /* Name.Other */
|
||||||
|
.codehilite .py { color: #dcdccc } /* Name.Property */
|
||||||
|
.codehilite .nt { color: #e89393; font-weight: bold } /* Name.Tag */
|
||||||
|
.codehilite .nv { color: #dcdccc } /* Name.Variable */
|
||||||
|
.codehilite .ow { color: #f0efd0 } /* Operator.Word */
|
||||||
|
.codehilite .w { color: #dcdccc } /* Text.Whitespace */
|
||||||
|
.codehilite .mb { color: #8cd0d3 } /* Literal.Number.Bin */
|
||||||
|
.codehilite .mf { color: #c0bed1 } /* Literal.Number.Float */
|
||||||
|
.codehilite .mh { color: #8cd0d3 } /* Literal.Number.Hex */
|
||||||
|
.codehilite .mi { color: #8cd0d3 } /* Literal.Number.Integer */
|
||||||
|
.codehilite .mo { color: #8cd0d3 } /* Literal.Number.Oct */
|
||||||
|
.codehilite .sa { color: #cc9393 } /* Literal.String.Affix */
|
||||||
|
.codehilite .sb { color: #cc9393 } /* Literal.String.Backtick */
|
||||||
|
.codehilite .sc { color: #cc9393 } /* Literal.String.Char */
|
||||||
|
.codehilite .dl { color: #cc9393 } /* Literal.String.Delimiter */
|
||||||
|
.codehilite .sd { color: #7f9f7f } /* Literal.String.Doc */
|
||||||
|
.codehilite .s2 { color: #cc9393 } /* Literal.String.Double */
|
||||||
|
.codehilite .se { color: #cc9393 } /* Literal.String.Escape */
|
||||||
|
.codehilite .sh { color: #cc9393 } /* Literal.String.Heredoc */
|
||||||
|
.codehilite .si { color: #dca3a3; font-weight: bold } /* Literal.String.Interpol */
|
||||||
|
.codehilite .sx { color: #cc9393 } /* Literal.String.Other */
|
||||||
|
.codehilite .sr { color: #cc9393 } /* Literal.String.Regex */
|
||||||
|
.codehilite .s1 { color: #cc9393 } /* Literal.String.Single */
|
||||||
|
.codehilite .ss { color: #cc9393 } /* Literal.String.Symbol */
|
||||||
|
.codehilite .bp { color: #dcdccc } /* Name.Builtin.Pseudo */
|
||||||
|
.codehilite .fm { color: #efef8f } /* Name.Function.Magic */
|
||||||
|
.codehilite .vc { color: #dcdccc } /* Name.Variable.Class */
|
||||||
|
.codehilite .vg { color: #dcdccc } /* Name.Variable.Global */
|
||||||
|
.codehilite .vi { color: #dcdccc } /* Name.Variable.Instance */
|
||||||
|
.codehilite .vm { color: #dcdccc } /* Name.Variable.Magic */
|
||||||
|
.codehilite .il { color: #8cd0d3 } /* Literal.Number.Integer.Long */
|
||||||
|
|
||||||
@ -1,6 +1,10 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='styles/main.css') }}" type="text/css" />
|
<style>
|
||||||
|
.rawtext {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<!--<link href='https://fonts.googleapis.com/css?family=Source Sans Pro' rel='stylesheet'> -->
|
<!--<link href='https://fonts.googleapis.com/css?family=Source Sans Pro' rel='stylesheet'> -->
|
||||||
<title>sqnotes</title>
|
<title>sqnotes</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user