mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 17:49:24 +01:00
update @ Thu 20 Oct 20:04:16 EEST 2022
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
6c675d8cfc
commit
db2044b8bb
14 changed files with 109 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,4 +6,5 @@ index.html
|
||||||
venv/
|
venv/
|
||||||
/backups/
|
/backups/
|
||||||
.ccls-cache/
|
.ccls-cache/
|
||||||
|
/blog_json_hash.txt
|
||||||
|
|
||||||
|
|
31
content/fonts/Hack.css
Normal file
31
content/fonts/Hack.css
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: Hack;
|
||||||
|
src: url(/content/fonts/hack-regular.woff2) format("woff2"),
|
||||||
|
url(/content/fonts/hack-regular.woff) format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: Hack;
|
||||||
|
src: url(/content/fonts/hack-bold.woff2) format("woff2"),
|
||||||
|
url(/content/fonts/hack-bold.woff) format("woff");
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: Hack;
|
||||||
|
src: url(/content/fonts/hack-italic.woff2) format("woff2"),
|
||||||
|
url(/content/fonts/hack-italic.woff) format("woff");
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: Hack;
|
||||||
|
src: url(/content/fonts/hack-bolditalic.woff2) format("woff2"),
|
||||||
|
url(/content/fonts/hack-bolditalic.woff) format("woff");
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
45
content/fonts/LICENSE
Normal file
45
content/fonts/LICENSE
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License
|
||||||
|
|
||||||
|
The work in the DejaVu project was committed to the public domain.
|
||||||
|
|
||||||
|
Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera"
|
||||||
|
|
||||||
|
### MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Source Foundry Authors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
### BITSTREAM VERA LICENSE
|
||||||
|
|
||||||
|
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.
|
||||||
|
|
||||||
|
The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".
|
||||||
|
|
||||||
|
This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.
|
||||||
|
|
||||||
|
The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.
|
||||||
|
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
|
3
content/fonts/README
Normal file
3
content/fonts/README
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Hack typeface: https://github.com/source-foundry/Hack
|
||||||
|
License: https://github.com/source-foundry/Hack/blob/master/LICENSE.md
|
||||||
|
https://blog.ari-web.xyz/content/fonts/LICENSE
|
BIN
content/fonts/hack-bold.woff
Normal file
BIN
content/fonts/hack-bold.woff
Normal file
Binary file not shown.
BIN
content/fonts/hack-bold.woff2
Normal file
BIN
content/fonts/hack-bold.woff2
Normal file
Binary file not shown.
BIN
content/fonts/hack-bolditalic.woff
Normal file
BIN
content/fonts/hack-bolditalic.woff
Normal file
Binary file not shown.
BIN
content/fonts/hack-bolditalic.woff2
Normal file
BIN
content/fonts/hack-bolditalic.woff2
Normal file
Binary file not shown.
BIN
content/fonts/hack-italic.woff
Normal file
BIN
content/fonts/hack-italic.woff
Normal file
Binary file not shown.
BIN
content/fonts/hack-italic.woff2
Normal file
BIN
content/fonts/hack-italic.woff2
Normal file
Binary file not shown.
BIN
content/fonts/hack-regular.woff
Normal file
BIN
content/fonts/hack-regular.woff
Normal file
Binary file not shown.
BIN
content/fonts/hack-regular.woff2
Normal file
BIN
content/fonts/hack-regular.woff2
Normal file
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
@import url("https://cdn.jsdelivr.net/npm/hack-font@3/build/web/hack.min.css");
|
@import url("/content/fonts/Hack.min.css");
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
|
|
30
scripts/blog
30
scripts/blog
|
@ -16,7 +16,7 @@ from shutil import rmtree
|
||||||
from tempfile import gettempdir
|
from tempfile import gettempdir
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from timeit import default_timer as code_timer
|
from timeit import default_timer as code_timer
|
||||||
from typing import Dict, List, Optional, Set, Tuple
|
from typing import Callable, Dict, List, Optional, Set, Tuple
|
||||||
from warnings import filterwarnings as filter_warnings
|
from warnings import filterwarnings as filter_warnings
|
||||||
|
|
||||||
import ujson # type: ignore
|
import ujson # type: ignore
|
||||||
|
@ -145,7 +145,9 @@ BLOG_HTML_TEMPLATE: str = f"""<!DOCTYPE html>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<article id="blog-content">
|
<article id="blog-content">
|
||||||
{{blog}}
|
|
||||||
|
{{blog}}
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
@ -212,7 +214,9 @@ HOME_PAGE_HTML_TEMPLATE: str = f"""<!DOCTYPE html>
|
||||||
|
|
||||||
|
|
||||||
def log(message: str, header: str = "ERROR", code: int = EXIT_ERR) -> int:
|
def log(message: str, header: str = "ERROR", code: int = EXIT_ERR) -> int:
|
||||||
|
if not (not NOT_CI_BUILD and header != "ERROR"):
|
||||||
sys.stderr.write(f"{header}: {message}\n")
|
sys.stderr.write(f"{header}: {message}\n")
|
||||||
|
|
||||||
return code
|
return code
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,8 +380,28 @@ def build(config: Dict) -> Tuple[int, Dict]:
|
||||||
saved_stdout = sys.stdout
|
saved_stdout = sys.stdout
|
||||||
sys.stdout = open(os.devnull, "w")
|
sys.stdout = open(os.devnull, "w")
|
||||||
|
|
||||||
|
css_threads: List[Thread] = []
|
||||||
|
|
||||||
|
def _thread(t: Callable) -> None:
|
||||||
|
css_threads.append(Thread(target=t, daemon=True))
|
||||||
|
css_threads[-1].start()
|
||||||
|
|
||||||
if os.path.isfile("content/styles.css"):
|
if os.path.isfile("content/styles.css"):
|
||||||
process_single_css_file("content/styles.css")
|
log("Minifying main styles", "MINIFY")
|
||||||
|
_thread(lambda: process_single_css_file("content/styles.css"))
|
||||||
|
|
||||||
|
if os.path.isdir("content/fonts"):
|
||||||
|
log("Minifying fonts...", "MINIFY")
|
||||||
|
|
||||||
|
for font in iglob("content/fonts/*.css"):
|
||||||
|
if font.endswith(".min.css"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
log(f"Minifying font file: {font}", "MINIFY")
|
||||||
|
_thread(lambda: process_single_css_file(font))
|
||||||
|
|
||||||
|
for t in css_threads:
|
||||||
|
t.join()
|
||||||
|
|
||||||
sys.stdout.close()
|
sys.stdout.close()
|
||||||
sys.stdout = saved_stdout
|
sys.stdout = saved_stdout
|
||||||
|
|
Loading…
Add table
Reference in a new issue