update @ Sun Oct 8 07:37:55 EEST 2023

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2023-10-08 07:37:55 +03:00
parent 21b2928918
commit 9502f7a6c7
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A50D5B4B599AF8A2
8 changed files with 51 additions and 43 deletions

2
.gitignore vendored
View file

@ -11,3 +11,5 @@ venv/
/recents_json_hash.txt
/recents.json
/rss.xml
/sitemap.xml
/robots.txt

View file

@ -1,8 +1,8 @@
:root {
--clr-blockquote-bg: #ede9d3;
--blockquote-width: 2px;
--bq-b: #ede9d3;
--bqw: 2px;
--clr-link: #cdc4c4; /* #9e9b9b; */
--a-f: #cdc4c4; /* #9e9b9b; */
}
*,
@ -43,7 +43,7 @@ li {
a {
text-decoration: none;
font-style: italic;
color: var(--clr-link);
color: var(--a-f);
}
*[h] > a {

View file

@ -8,7 +8,7 @@ blockquote {
blockquote:before {
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;
bottom: 14px;
top: 13px;

View file

@ -1,13 +1,13 @@
@import url(/content/fonts/Hack.min.css);
:root {
--clr-blockquote-fg: #e6e0c8;
--bq-f: #e6e0c8;
--clr-code-bg: #1f1b1a;
--clr-code-fg: #f0f3e6;
--clr-code-bg-dark: #181414;
--cd-b: #1f1b1a;
--cd-f: #f0f3e6;
--cd-bd: #181414;
--scrollbar-height: 6px; /* TODO Firefox */
--scrlh: 6px; /* TODO Firefox */
}
*,
@ -18,7 +18,7 @@
scrollbar-width: none;
-ms-overflow-style: none;
scrollbar-color: var(--clr-code-bg-dark) transparent;
scrollbar-color: var(--cd-bd) transparent;
scroll-behavior: smooth;
@ -27,7 +27,7 @@
::-webkit-scrollbar,
::-webkit-scrollbar-thumb {
height: var(--scrollbar-height);
height: var(--scrlh);
}
::-webkit-scrollbar {
@ -35,7 +35,7 @@
}
::-webkit-scrollbar-thumb {
background-color: var(--clr-code-bg-dark);
background-color: var(--cd-bd);
}
html::-webkit-scrollbar,
@ -50,23 +50,23 @@ a:hover {
pre,
pre * {
background-color: var(--clr-code-bg);
background-color: var(--cd-b);
}
pre,
pre *,
code {
color: var(--clr-code-fg);
color: var(--cd-f);
}
code:not(pre code),
time {
background-color: var(--clr-code-bg);
background-color: var(--cd-b);
}
blockquote,
blockquote * {
color: var(--clr-blockquote-fg);
color: var(--bq-f);
}
*[h]:hover > a,
@ -107,20 +107,20 @@ blockquote * {
@media (prefers-contrast: more) {
:root {
--clr-bg: #000000;
--clr-fg: #ffffff;
--b: #000;
--f: #fff;
--clr-blockquote-fg: #ededed;
--clr-blockquote-bg: #868e91;
--bq-f: #ededed;
--bq-b: #868e91;
--clr-code-bg: #090909;
--clr-code-fg: #f0f0f0;
--cd-b: #090909;
--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 {

View file

@ -1,4 +1,4 @@
css-html-js-minify
web-mini
mistune
typing
readtime

View file

@ -1,4 +0,0 @@
User-agent: *
Disallow: /content/*
Allow: *
Sitemap: https://blog.ari-web.xyz/sitemap.xml

View file

@ -29,8 +29,7 @@ import mistune.core
import mistune.inline_parser
import mistune.plugins
import unidecode
from css_html_js_minify import html_minify # type: ignore
from css_html_js_minify import process_single_css_file # type: ignore
import web_mini
from readtime import of_markdown as read_time_of_markdown # type: ignore
__version__: typing.Final[int] = 2
@ -173,8 +172,8 @@ HTML_BEGIN: typing.Final[
<link rel="manifest" href="/manifest.json" />
<link rel="canonical" href="{blog}/{path}">
<style type="text/css">
:root{{color-scheme:{theme_type};--clr-bg:{theme_primary};--clr-fg:{theme_secondary}}}\
*,*::before,*::after{{background-color:var(--clr-bg);color:var(--clr-fg)}}{critical_css}
:root{{color-scheme:{theme_type};--b:{theme_primary};--f:{theme_secondary}}}\
*,*::before,*::after{{background-color:var(--b);color:var(--f)}}{critical_css}
</style>
<link
href="/{styles}"
@ -557,6 +556,12 @@ def read_post(path: str) -> str:
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
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:
"""build blog posts"""
log("compiling regex")
web_mini.html.html_fns.compileall()
log("setting up posts directory")
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"):
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"):
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:
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:
html.write(
html_minify(
web_mini.html.minify_html(
POST_TEMPLATE.format(
lang=lang,
keywords=html_escape(
@ -936,7 +945,7 @@ def build(config: dict[str, typing.Any]) -> int:
with open("index.html", "w") as index:
index.write(
html_minify(
web_mini.html.minify_html(
INDEX_TEMPLATE.format( # type: ignore
lang=lang,
keywords=html_escape(", ".join(config["blog-keywords"])),
@ -987,6 +996,9 @@ def css(config: dict[str, typing.Any]) -> int:
t: Thread
ts: list[Thread] = []
log("compiling regex")
web_mini.css.css_fns.compileall()
def _thread(c: typing.Callable[..., typing.Any], *args: str) -> None:
def _c() -> None:
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"):
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"):
log(f"minifying fonts in {fonts!r}")
@ -1007,7 +1019,7 @@ def css(config: dict[str, typing.Any]) -> int:
if fcss.endswith(".min.css"):
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:
t.join()

File diff suppressed because one or more lines are too long