mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Thu Dec 26 04:29:22 EET 2024
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
be725528ab
commit
f3145db1e0
4 changed files with 204 additions and 162 deletions
280
blog.json
280
blog.json
File diff suppressed because one or more lines are too long
|
@ -309,7 +309,7 @@ INDEX_TEMPLATE: typing.Final[str] = (
|
||||||
href="#main">skip</a>
|
href="#main">skip</a>
|
||||||
<span role="seperator" aria-hidden="true"> | </span>
|
<span role="seperator" aria-hidden="true"> | </span>
|
||||||
|
|
||||||
<span role="menuitem">latest post : <a href="/{latest_post_path}">{latest_post_title_trunc}</a> at <time>{latest_post_creation_time}</time> GMT</span>
|
<span role="menuitem">latest post: <a href="/{latest_post_path}">{latest_post_title_trunc}</a> at <time>{latest_post_creation_time}</time> GMT</span>
|
||||||
<span role="seperator" aria-hidden="true"> | </span>
|
<span role="seperator" aria-hidden="true"> | </span>
|
||||||
|
|
||||||
<span role="menuitem">visitor <img src="{visitor_count}" alt="visitor count" /></span>
|
<span role="menuitem">visitor <img src="{visitor_count}" alt="visitor count" /></span>
|
||||||
|
@ -343,14 +343,14 @@ STATS_TEMPLATE: typing.Final[str] = (
|
||||||
+ """
|
+ """
|
||||||
<title>{blog_title} -> stats</title>
|
<title>{blog_title} -> stats</title>
|
||||||
<meta property="og:title" content="{blog_title} -> stats" />
|
<meta property="og:title" content="{blog_title} -> stats" />
|
||||||
<meta name="description" content="stats of {blog_title}, {blog_description}" />
|
<meta name="description" content="Statistics of {blog_title}, {blog_description}" />
|
||||||
<meta property="og:description" content="stats of {blog_title}, {blog_description}" />
|
<meta property="og:description" content="Statistics of {blog_title}, {blog_description}" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header role="group">
|
<header role="group">
|
||||||
<h1 role="heading" aria-level="1">stats of {blog_header}</h1>
|
<h1 role="heading" aria-level="1">Statistics of {blog_header}</h1>
|
||||||
|
|
||||||
<nav id="info-bar" role="menubar">
|
<nav id="info-bar" role="menubar">
|
||||||
<a role="menuitem"
|
<a role="menuitem"
|
||||||
|
@ -384,57 +384,57 @@ STATS_TEMPLATE: typing.Final[str] = (
|
||||||
<article id="main">
|
<article id="main">
|
||||||
|
|
||||||
<ul id=blist>
|
<ul id=blist>
|
||||||
<li>total count of blog posts : <code>{post_count}</code></li>
|
<li>Total count of blog posts: <code>{post_count}</code></li>
|
||||||
<li>edited post count : <code>{edited_post_count}</code>, <code>{edited_post_count_p:.2f}%</code></li>
|
<li>Edited post count: <code>{edited_post_count}</code>, <code>{edited_post_count_p:.2f}%</code></li>
|
||||||
<li>
|
<li>
|
||||||
total read time : <time>{read_time}</time>
|
Total read time: <time>{read_time}</time>
|
||||||
<ul>
|
<ul>
|
||||||
<li>average read time : <time>{avg_read_time}</time></li>
|
<li>Average read time: <time>{avg_read_time}</time></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
content
|
Content
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>characters : <code>{char_count}</code></li>
|
<li>Characters: <code>{char_count}</code></li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>average count of characters : <code>{avg_chars:.2f}</code></li>
|
<li>Average count of characters: <code>{avg_chars:.2f}</code></li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>words : <code>{word_count}</code></li>
|
<li>Words: <code>{word_count}</code></li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>average count of words : <code>{avg_words:.2f}</code></li>
|
<li>Average count of words: <code>{avg_words:.2f}</code></li>
|
||||||
<li>average word length : <code>{avg_word_len:.2f}</code></li>
|
<li>Average word length: <code>{avg_word_len:.2f}</code></li>
|
||||||
<li>
|
<li>
|
||||||
top {top_words} used words
|
Top {top_words} used words:
|
||||||
<ol>{word_most_used}</ol>
|
<ol>{word_most_used}</ol>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>tags : <code>{tag_count}</code></li>
|
<li>Tags: <code>{tag_count}</code></li>
|
||||||
<ul>
|
<ul>
|
||||||
<li>average count of tags : <code>{avg_tags}</code></li>
|
<li>Average count of tags: <code>{avg_tags:.2f}</code></li>
|
||||||
<li>
|
<li>
|
||||||
top {top_tags} used tags
|
Top {top_tags} used tags:
|
||||||
<ol>{tags_most_used}</ol>
|
<ol>{tags_most_used}</ol>
|
||||||
</li>
|
</li>
|
||||||
<li>default tags <ol>{default_tags}</ol></li>
|
<li>Default tags: <ol>{default_tags}</ol></li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
time ( GMT )
|
Time (GMT)
|
||||||
<ul>
|
<ul>
|
||||||
<li>average posts by year : {posts_by_yr_avg} <ol>{posts_by_yr}</ol></li>
|
<li>Average posts by year: {posts_by_yr_avg} <ol>{posts_by_yr}</ol></li>
|
||||||
<li>average posts by month : {posts_by_month_avg} <ol>{posts_by_month}</ol></li>
|
<li>Average posts by month: {posts_by_month_avg} <ol>{posts_by_month}</ol></li>
|
||||||
<li>average posts by day : {posts_by_day_avg} <ol>{posts_by_day}</ol></li>
|
<li>Average posts by day: {posts_by_day_avg} <ol>{posts_by_day}</ol></li>
|
||||||
<li>average posts by hour : {posts_by_hr_avg} <ol>{posts_by_hr}</ol></li>
|
<li>Average posts by hour: {posts_by_hr_avg} <ol>{posts_by_hr}</ol></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -729,7 +729,7 @@ def s_to_str(seconds: float) -> str:
|
||||||
readable_text = time_periods[0]
|
readable_text = time_periods[0]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
f"{readable_text} ( {round(seconds, 2)} second{'' if seconds == 1 else 's'} )"
|
f"{readable_text} ({round(seconds, 2)} second{'' if seconds == 1 else 's'})"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
36
scripts/v2-titles.py
Normal file
36
scripts/v2-titles.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""changes titles to be capitalised"""
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
from warnings import filterwarnings as filter_warnings
|
||||||
|
|
||||||
|
|
||||||
|
def t(title: str):
|
||||||
|
if title:
|
||||||
|
title = title[0].upper() + title[1:]
|
||||||
|
title = title.replace("Doml #", "DOML #")
|
||||||
|
return title
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
"""entry / main function"""
|
||||||
|
|
||||||
|
with open("blog.json", "r") as fp:
|
||||||
|
blog = json.load(fp)
|
||||||
|
|
||||||
|
for slug in blog["posts"]:
|
||||||
|
blog["posts"][slug]["title"] = t(blog["posts"][slug]["title"])
|
||||||
|
|
||||||
|
with open("blog.json", "w") as fp:
|
||||||
|
json.dump(blog, fp, 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())
|
Loading…
Add table
Reference in a new issue