mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Tue 29 Aug 10:47:52 EEST 2023
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
8828313adc
commit
42fcd971e0
2 changed files with 18 additions and 1 deletions
|
@ -123,6 +123,7 @@
|
|||
"recent-title-trunc": 32,
|
||||
"server-host": "127.0.0.1",
|
||||
"server-port": 8080,
|
||||
"post-preview-size": 196,
|
||||
"posts": {
|
||||
"blogging-system-rewrite-again-3": {
|
||||
"title": "blogging system rewrite ( again ) :3",
|
||||
|
|
|
@ -137,6 +137,7 @@ DEFAULT_CONFIG: typing.Dict[str, typing.Any] = {
|
|||
"recent-title-trunc": 32,
|
||||
"server-host": "127.0.0.1",
|
||||
"server-port": 8080,
|
||||
"post-preview-size": 196,
|
||||
"posts": {},
|
||||
}
|
||||
|
||||
|
@ -1108,7 +1109,22 @@ def apis(config: typing.Dict[str, typing.Any]) -> int:
|
|||
"""generate and hash apis"""
|
||||
|
||||
with open("recents.json", "w") as recents:
|
||||
json.dump(dict(tuple(config["posts"].items())[: config["recents"]]), recents)
|
||||
json.dump(
|
||||
dict(
|
||||
map(
|
||||
lambda kv: (
|
||||
kv[0],
|
||||
{
|
||||
"title": kv[1]["title"],
|
||||
"content": trunc(kv[1]["content"], config["post-preview-size"]),
|
||||
"created": kv[1]["created"],
|
||||
},
|
||||
),
|
||||
tuple(config["posts"].items())[: config["recents"]],
|
||||
)
|
||||
),
|
||||
recents,
|
||||
)
|
||||
lnew(f"generated {recents.name!r}")
|
||||
|
||||
for api in recents.name, CONFIG_FILE:
|
||||
|
|
Loading…
Add table
Reference in a new issue