mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 17:49:24 +01:00
update @ Tue 29 Aug 10:51:42 EEST 2023
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
42fcd971e0
commit
b3c36c2f88
1 changed files with 3 additions and 3 deletions
|
@ -526,8 +526,8 @@ def open_file(editor: typing.Sequence[str], path: str) -> None:
|
||||||
subprocess.run([(token.replace("%s", path)) for token in editor])
|
subprocess.run([(token.replace("%s", path)) for token in editor])
|
||||||
|
|
||||||
|
|
||||||
def trunc(data: str, length: int) -> str:
|
def trunc(data: str, length: int, end: str = " ...") -> str:
|
||||||
return data[:length] + (" ..." if len(data) > length else "")
|
return data[:length] + (end if len(data) > length else "")
|
||||||
|
|
||||||
|
|
||||||
def read_post(path: str) -> str:
|
def read_post(path: str) -> str:
|
||||||
|
@ -1116,7 +1116,7 @@ def apis(config: typing.Dict[str, typing.Any]) -> int:
|
||||||
kv[0],
|
kv[0],
|
||||||
{
|
{
|
||||||
"title": kv[1]["title"],
|
"title": kv[1]["title"],
|
||||||
"content": trunc(kv[1]["content"], config["post-preview-size"]),
|
"content": trunc(kv[1]["content"], config["post-preview-size"], ""),
|
||||||
"created": kv[1]["created"],
|
"created": kv[1]["created"],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Reference in a new issue