mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
total rewrite of the blogging system
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
09553e441e
commit
dd29749b5a
10 changed files with 3263 additions and 1609 deletions
2740
blog.json
2740
blog.json
File diff suppressed because one or more lines are too long
|
@ -1,12 +0,0 @@
|
|||
# blog completion -*- shell-script -*-
|
||||
|
||||
_blog() {
|
||||
local cur
|
||||
|
||||
_init_completion -s || return
|
||||
COMPREPLY=($(compgen -W "help new build ls\
|
||||
rm edit defcfg clean metadata static css" -- "$cur"))
|
||||
|
||||
} && complete -F _blog -o bashdefault -o default blog
|
||||
|
||||
# ex: filetype=sh
|
|
@ -181,41 +181,27 @@ blockquote * {
|
|||
color: var(--clr-blockquote-fg);
|
||||
}
|
||||
|
||||
*[data-pl] {
|
||||
padding-top: 0.06em;
|
||||
padding-bottom: 0.06em;
|
||||
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
*[data-pl] * {
|
||||
display: inline;
|
||||
font-size: inherit !important;
|
||||
}
|
||||
|
||||
*[data-pl] > a {
|
||||
padding-right: 0.3em;
|
||||
*[h] > a {
|
||||
opacity: 0.3;
|
||||
-webkit-transition: opacity 0.1s ease-in-out;
|
||||
-o-transition: opacity 0.1s ease-in-out;
|
||||
transition: opacity 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
*[data-pl]:hover > a,
|
||||
*[data-pl]:focus > a {
|
||||
*[h]:hover > a,
|
||||
*[h]:focus > a {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
*[data-pl] > a:hover,
|
||||
*[data-pl] > a:focus {
|
||||
*[h] > a:hover,
|
||||
*[h] > a:focus {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1200px) {
|
||||
*[data-pl] > a,
|
||||
*[data-pl]:hover > a,
|
||||
*[data-pl]:focus > a {
|
||||
*[h] > a,
|
||||
*[h]:hover > a,
|
||||
*[h]:focus > a {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +257,7 @@ nav img {
|
|||
-ms-overflow-style: initial !important;
|
||||
}
|
||||
|
||||
*[data-pl] > a {
|
||||
a {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
|
14
netlify.toml
14
netlify.toml
|
@ -1,5 +1,5 @@
|
|||
[build]
|
||||
command = "python3 ./scripts/blog.py static && rm -rf ./scripts/ ./completions/"
|
||||
command = "python3 ./scripts/blog.py static && rm -rf ./scripts/"
|
||||
|
||||
[[redirects]]
|
||||
from = "/git/*"
|
||||
|
@ -13,18 +13,6 @@
|
|||
status = 200
|
||||
force = true
|
||||
|
||||
[[redirects]]
|
||||
from = "/robots.txt"
|
||||
to = "https://ari-web.xyz/robots.txt"
|
||||
status = 200
|
||||
force = true
|
||||
|
||||
[[redirects]]
|
||||
from = "/sitemap.xml"
|
||||
to = "https://ari-web.xyz/sitemap.xml"
|
||||
status = 200
|
||||
force = true
|
||||
|
||||
[[redirects]]
|
||||
from = "/blogs/:blog"
|
||||
to = "https://legacy.blog.ari-web.xyz/blogs/:blog"
|
||||
|
|
|
@ -12,3 +12,10 @@ stubPath = "src/stubs"
|
|||
typeCheckingMode = "strict"
|
||||
useLibraryCodeForTypes = true
|
||||
reportMissingTypeStubs = true
|
||||
|
||||
[tool.mypy]
|
||||
exclude = [
|
||||
"^venv/.*",
|
||||
"^node_modules/.*",
|
||||
"^__pycache__/.*",
|
||||
]
|
||||
|
|
3
requirements-extra.txt
Normal file
3
requirements-extra.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
pyfzf
|
||||
rebelai
|
||||
requests
|
|
@ -1,9 +1,5 @@
|
|||
css-html-js-minify
|
||||
datetime
|
||||
markdown
|
||||
plumbum
|
||||
pyfzf
|
||||
mistune
|
||||
typing
|
||||
pymdown-extensions
|
||||
ujson
|
||||
readtime
|
||||
unidecode
|
||||
|
|
1911
scripts/blog.py
1911
scripts/blog.py
File diff suppressed because it is too large
Load diff
42
scripts/migrate.py
Normal file
42
scripts/migrate.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""migrates from v1 to v2"""
|
||||
|
||||
|
||||
import json
|
||||
from warnings import filterwarnings as filter_warnings
|
||||
|
||||
|
||||
def t(data: str) -> str:
|
||||
return data[:196] + ("" if len(data) < 196 else " ...")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
"""entry / main function"""
|
||||
|
||||
with open("a.json", "r") as f: # old v1 blog
|
||||
posts = json.load(f)["blogs"]
|
||||
|
||||
with open("blog.json", "r") as f:
|
||||
blog = json.load(f)
|
||||
|
||||
for slug, post in posts.items():
|
||||
blog["posts"][slug] = {
|
||||
"title": post["title"],
|
||||
"description": t(post["content"][:196]),
|
||||
"content": post["content"],
|
||||
"keywords": post["keywords"].split(),
|
||||
"created": post["time"],
|
||||
}
|
||||
|
||||
with open("blog.json", "w") as f:
|
||||
json.dump(blog, f, indent=4)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
assert main.__annotations__.get("return") is int, "main() should return an integer"
|
||||
|
||||
filter_warnings("error", category=Warning)
|
||||
raise SystemExit(main())
|
9
tox.ini
9
tox.ini
|
@ -1,3 +1,8 @@
|
|||
[flake8]
|
||||
max-line-length = 200
|
||||
[tox]
|
||||
envlist = py38
|
||||
|
||||
[flake8]
|
||||
max-line-length = 160
|
||||
|
||||
[pycodestyle]
|
||||
max-line-length = 160
|
||||
|
|
Loading…
Add table
Reference in a new issue