mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Sun Oct 8 07:37:55 EEST 2023
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
21b2928918
commit
9502f7a6c7
8 changed files with 51 additions and 43 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,3 +11,5 @@ venv/
|
||||||
/recents_json_hash.txt
|
/recents_json_hash.txt
|
||||||
/recents.json
|
/recents.json
|
||||||
/rss.xml
|
/rss.xml
|
||||||
|
/sitemap.xml
|
||||||
|
/robots.txt
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
:root {
|
:root {
|
||||||
--clr-blockquote-bg: #ede9d3;
|
--bq-b: #ede9d3;
|
||||||
--blockquote-width: 2px;
|
--bqw: 2px;
|
||||||
|
|
||||||
--clr-link: #cdc4c4; /* #9e9b9b; */
|
--a-f: #cdc4c4; /* #9e9b9b; */
|
||||||
}
|
}
|
||||||
|
|
||||||
*,
|
*,
|
||||||
|
@ -43,7 +43,7 @@ li {
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: var(--clr-link);
|
color: var(--a-f);
|
||||||
}
|
}
|
||||||
|
|
||||||
*[h] > a {
|
*[h] > a {
|
||||||
|
|
|
@ -8,7 +8,7 @@ blockquote {
|
||||||
|
|
||||||
blockquote:before {
|
blockquote:before {
|
||||||
content: "";
|
content: "";
|
||||||
border-left: var(--blockquote-width) solid var(--clr-blockquote-bg); /* Thx cel */
|
border-left: var(--bqw) solid var(--bq-b); /* Thx cel */
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 14px;
|
bottom: 14px;
|
||||||
top: 13px;
|
top: 13px;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
@import url(/content/fonts/Hack.min.css);
|
@import url(/content/fonts/Hack.min.css);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--clr-blockquote-fg: #e6e0c8;
|
--bq-f: #e6e0c8;
|
||||||
|
|
||||||
--clr-code-bg: #1f1b1a;
|
--cd-b: #1f1b1a;
|
||||||
--clr-code-fg: #f0f3e6;
|
--cd-f: #f0f3e6;
|
||||||
--clr-code-bg-dark: #181414;
|
--cd-bd: #181414;
|
||||||
|
|
||||||
--scrollbar-height: 6px; /* TODO Firefox */
|
--scrlh: 6px; /* TODO Firefox */
|
||||||
}
|
}
|
||||||
|
|
||||||
*,
|
*,
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
|
|
||||||
scrollbar-color: var(--clr-code-bg-dark) transparent;
|
scrollbar-color: var(--cd-bd) transparent;
|
||||||
|
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
::-webkit-scrollbar,
|
::-webkit-scrollbar,
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
height: var(--scrollbar-height);
|
height: var(--scrlh);
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background-color: var(--clr-code-bg-dark);
|
background-color: var(--cd-bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
html::-webkit-scrollbar,
|
html::-webkit-scrollbar,
|
||||||
|
@ -50,23 +50,23 @@ a:hover {
|
||||||
|
|
||||||
pre,
|
pre,
|
||||||
pre * {
|
pre * {
|
||||||
background-color: var(--clr-code-bg);
|
background-color: var(--cd-b);
|
||||||
}
|
}
|
||||||
|
|
||||||
pre,
|
pre,
|
||||||
pre *,
|
pre *,
|
||||||
code {
|
code {
|
||||||
color: var(--clr-code-fg);
|
color: var(--cd-f);
|
||||||
}
|
}
|
||||||
|
|
||||||
code:not(pre code),
|
code:not(pre code),
|
||||||
time {
|
time {
|
||||||
background-color: var(--clr-code-bg);
|
background-color: var(--cd-b);
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote,
|
blockquote,
|
||||||
blockquote * {
|
blockquote * {
|
||||||
color: var(--clr-blockquote-fg);
|
color: var(--bq-f);
|
||||||
}
|
}
|
||||||
|
|
||||||
*[h]:hover > a,
|
*[h]:hover > a,
|
||||||
|
@ -107,20 +107,20 @@ blockquote * {
|
||||||
|
|
||||||
@media (prefers-contrast: more) {
|
@media (prefers-contrast: more) {
|
||||||
:root {
|
:root {
|
||||||
--clr-bg: #000000;
|
--b: #000;
|
||||||
--clr-fg: #ffffff;
|
--f: #fff;
|
||||||
|
|
||||||
--clr-blockquote-fg: #ededed;
|
--bq-f: #ededed;
|
||||||
--clr-blockquote-bg: #868e91;
|
--bq-b: #868e91;
|
||||||
|
|
||||||
--clr-code-bg: #090909;
|
--cd-b: #090909;
|
||||||
--clr-code-fg: #f0f0f0;
|
--cd-f: #f0f0f0;
|
||||||
|
|
||||||
--clr-link: #a9c4d1;
|
--a-f: #a9c4d1;
|
||||||
|
|
||||||
--blockquote-width: 4px;
|
--bqw: 4px;
|
||||||
|
|
||||||
--scrollbar-height: initial; /* TODO: Firefox */
|
--scrlh: initial; /* TODO: Firefox */
|
||||||
}
|
}
|
||||||
|
|
||||||
html::-webkit-scrollbar {
|
html::-webkit-scrollbar {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
css-html-js-minify
|
web-mini
|
||||||
mistune
|
mistune
|
||||||
typing
|
typing
|
||||||
readtime
|
readtime
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
User-agent: *
|
|
||||||
Disallow: /content/*
|
|
||||||
Allow: *
|
|
||||||
Sitemap: https://blog.ari-web.xyz/sitemap.xml
|
|
|
@ -29,8 +29,7 @@ import mistune.core
|
||||||
import mistune.inline_parser
|
import mistune.inline_parser
|
||||||
import mistune.plugins
|
import mistune.plugins
|
||||||
import unidecode
|
import unidecode
|
||||||
from css_html_js_minify import html_minify # type: ignore
|
import web_mini
|
||||||
from css_html_js_minify import process_single_css_file # type: ignore
|
|
||||||
from readtime import of_markdown as read_time_of_markdown # type: ignore
|
from readtime import of_markdown as read_time_of_markdown # type: ignore
|
||||||
|
|
||||||
__version__: typing.Final[int] = 2
|
__version__: typing.Final[int] = 2
|
||||||
|
@ -173,8 +172,8 @@ HTML_BEGIN: typing.Final[
|
||||||
<link rel="manifest" href="/manifest.json" />
|
<link rel="manifest" href="/manifest.json" />
|
||||||
<link rel="canonical" href="{blog}/{path}">
|
<link rel="canonical" href="{blog}/{path}">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
:root{{color-scheme:{theme_type};--clr-bg:{theme_primary};--clr-fg:{theme_secondary}}}\
|
:root{{color-scheme:{theme_type};--b:{theme_primary};--f:{theme_secondary}}}\
|
||||||
*,*::before,*::after{{background-color:var(--clr-bg);color:var(--clr-fg)}}{critical_css}
|
*,*::before,*::after{{background-color:var(--b);color:var(--f)}}{critical_css}
|
||||||
</style>
|
</style>
|
||||||
<link
|
<link
|
||||||
href="/{styles}"
|
href="/{styles}"
|
||||||
|
@ -557,6 +556,12 @@ def read_post(path: str) -> str:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def min_css_file(file: str, out: str) -> None:
|
||||||
|
with open(file, "r") as icss:
|
||||||
|
with open(out, "w") as ocss:
|
||||||
|
ocss.write(web_mini.css.minify_css(icss.read()))
|
||||||
|
|
||||||
|
|
||||||
# markdown
|
# markdown
|
||||||
|
|
||||||
TITLE_LINKS_RE: typing.Final[str] = r"<#:[^>]+?>"
|
TITLE_LINKS_RE: typing.Final[str] = r"<#:[^>]+?>"
|
||||||
|
@ -844,6 +849,10 @@ def rm(config: dict[str, typing.Any]) -> int:
|
||||||
def build(config: dict[str, typing.Any]) -> int:
|
def build(config: dict[str, typing.Any]) -> int:
|
||||||
"""build blog posts"""
|
"""build blog posts"""
|
||||||
|
|
||||||
|
log("compiling regex")
|
||||||
|
|
||||||
|
web_mini.html.html_fns.compileall()
|
||||||
|
|
||||||
log("setting up posts directory")
|
log("setting up posts directory")
|
||||||
|
|
||||||
if os.path.exists(config["posts-dir"]):
|
if os.path.exists(config["posts-dir"]):
|
||||||
|
@ -865,11 +874,11 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
|
|
||||||
if os.path.isfile(critp := f"{config['assets-dir']}/critical.css"):
|
if os.path.isfile(critp := f"{config['assets-dir']}/critical.css"):
|
||||||
with open(critp, "r") as fp:
|
with open(critp, "r") as fp:
|
||||||
crit_css = fp.read()
|
crit_css = web_mini.css.minify_css(fp.read())
|
||||||
|
|
||||||
if os.path.isfile(critp := f"{config['assets-dir']}/post_critical.css"):
|
if os.path.isfile(critp := f"{config['assets-dir']}/post_critical.css"):
|
||||||
with open(critp, "r") as fp:
|
with open(critp, "r") as fp:
|
||||||
post_crit_css = fp.read()
|
post_crit_css = web_mini.css.minify_css(fp.read())
|
||||||
|
|
||||||
def build_post(slug: str, post: dict[str, typing.Any]) -> None:
|
def build_post(slug: str, post: dict[str, typing.Any]) -> None:
|
||||||
ct: float = ctimer()
|
ct: float = ctimer()
|
||||||
|
@ -879,7 +888,7 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
|
|
||||||
with open(f"{post_dir}/index.html", "w") as html:
|
with open(f"{post_dir}/index.html", "w") as html:
|
||||||
html.write(
|
html.write(
|
||||||
html_minify(
|
web_mini.html.minify_html(
|
||||||
POST_TEMPLATE.format(
|
POST_TEMPLATE.format(
|
||||||
lang=lang,
|
lang=lang,
|
||||||
keywords=html_escape(
|
keywords=html_escape(
|
||||||
|
@ -936,7 +945,7 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
|
|
||||||
with open("index.html", "w") as index:
|
with open("index.html", "w") as index:
|
||||||
index.write(
|
index.write(
|
||||||
html_minify(
|
web_mini.html.minify_html(
|
||||||
INDEX_TEMPLATE.format( # type: ignore
|
INDEX_TEMPLATE.format( # type: ignore
|
||||||
lang=lang,
|
lang=lang,
|
||||||
keywords=html_escape(", ".join(config["blog-keywords"])),
|
keywords=html_escape(", ".join(config["blog-keywords"])),
|
||||||
|
@ -987,6 +996,9 @@ def css(config: dict[str, typing.Any]) -> int:
|
||||||
t: Thread
|
t: Thread
|
||||||
ts: list[Thread] = []
|
ts: list[Thread] = []
|
||||||
|
|
||||||
|
log("compiling regex")
|
||||||
|
web_mini.css.css_fns.compileall()
|
||||||
|
|
||||||
def _thread(c: typing.Callable[..., typing.Any], *args: str) -> None:
|
def _thread(c: typing.Callable[..., typing.Any], *args: str) -> None:
|
||||||
def _c() -> None:
|
def _c() -> None:
|
||||||
ct: float = ctimer()
|
ct: float = ctimer()
|
||||||
|
@ -998,7 +1010,7 @@ def css(config: dict[str, typing.Any]) -> int:
|
||||||
|
|
||||||
if os.path.isfile(styles := f"{config['assets-dir']}/styles.css"):
|
if os.path.isfile(styles := f"{config['assets-dir']}/styles.css"):
|
||||||
lnew(f"minifying {styles!r}")
|
lnew(f"minifying {styles!r}")
|
||||||
_thread(process_single_css_file, styles, f"{config['assets-dir']}/styles.min.css") # type: ignore
|
_thread(min_css_file, styles, f"{config['assets-dir']}/styles.min.css") # type: ignore
|
||||||
|
|
||||||
if os.path.isdir(fonts := f"{config['assets-dir']}/fonts"):
|
if os.path.isdir(fonts := f"{config['assets-dir']}/fonts"):
|
||||||
log(f"minifying fonts in {fonts!r}")
|
log(f"minifying fonts in {fonts!r}")
|
||||||
|
@ -1007,7 +1019,7 @@ def css(config: dict[str, typing.Any]) -> int:
|
||||||
if fcss.endswith(".min.css"):
|
if fcss.endswith(".min.css"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
_thread(process_single_css_file, fcss, f"{os.path.splitext(fcss)[0]}.min.css") # type: ignore
|
_thread(min_css_file, fcss, f"{os.path.splitext(fcss)[0]}.min.css") # type: ignore
|
||||||
|
|
||||||
for t in ts:
|
for t in ts:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue