update @ Thu Dec 26 04:29:22 EET 2024

Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
Arija A. 2024-12-26 04:29:22 +02:00
parent be725528ab
commit f3145db1e0
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
4 changed files with 204 additions and 162 deletions

280
blog.json

File diff suppressed because one or more lines are too long

View file

@ -343,14 +343,14 @@ STATS_TEMPLATE: typing.Final[str] = (
+ """
<title>{blog_title} -> stats</title>
<meta property="og:title" content="{blog_title} -> stats" />
<meta name="description" content="stats of {blog_title}, {blog_description}" />
<meta property="og:description" content="stats of {blog_title}, {blog_description}" />
<meta name="description" content="Statistics of {blog_title}, {blog_description}" />
<meta property="og:description" content="Statistics of {blog_title}, {blog_description}" />
<meta property="og:type" content="website" />
</head>
<body>
<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">
<a role="menuitem"
@ -384,57 +384,57 @@ STATS_TEMPLATE: typing.Final[str] = (
<article id="main">
<ul id=blist>
<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>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>
total read time : <time>{read_time}</time>
Total read time: <time>{read_time}</time>
<ul>
<li>average read time : <time>{avg_read_time}</time></li>
<li>Average read time: <time>{avg_read_time}</time></li>
</ul>
</li>
<li>
content
Content
<ul>
<li>characters : <code>{char_count}</code></li>
<li>Characters: <code>{char_count}</code></li>
<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>
<li>words : <code>{word_count}</code></li>
<li>Words: <code>{word_count}</code></li>
<ul>
<li>average count of words : <code>{avg_words:.2f}</code></li>
<li>average word length : <code>{avg_word_len:.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>
top {top_words} used words
Top {top_words} used words:
<ol>{word_most_used}</ol>
</li>
</ul>
</ul>
<ul>
<li>tags : <code>{tag_count}</code></li>
<li>Tags: <code>{tag_count}</code></li>
<ul>
<li>average count of tags : <code>{avg_tags}</code></li>
<li>Average count of tags: <code>{avg_tags:.2f}</code></li>
<li>
top {top_tags} used tags
Top {top_tags} used tags:
<ol>{tags_most_used}</ol>
</li>
<li>default tags <ol>{default_tags}</ol></li>
<li>Default tags: <ol>{default_tags}</ol></li>
</ul>
</ul>
</li>
<li>
time ( GMT )
Time (GMT)
<ul>
<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 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 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 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>
</ul>
</li>
</ul>

36
scripts/v2-titles.py Normal file
View 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())