mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Thu Jul 11 04:41:40 EEST 2024
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
2abdc6d73d
commit
05d2ca3089
1 changed files with 5 additions and 2 deletions
|
@ -959,6 +959,9 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
pd: Counter[int] = Counter()
|
pd: Counter[int] = Counter()
|
||||||
ph: Counter[int] = Counter()
|
ph: Counter[int] = Counter()
|
||||||
|
|
||||||
|
w_regex: re.Pattern[str] = re.compile(r"\b[a-zA-Z']+\b")
|
||||||
|
url_regex: re.Pattern[str] = re.compile(r"https?://\S+|www\.\S+")
|
||||||
|
|
||||||
def build_post(slug: str, post: dict[str, typing.Any]) -> None:
|
def build_post(slug: str, post: dict[str, typing.Any]) -> None:
|
||||||
ct: float = ctimer()
|
ct: float = ctimer()
|
||||||
|
|
||||||
|
@ -966,11 +969,11 @@ def build(config: dict[str, typing.Any]) -> int:
|
||||||
os.makedirs(post_dir)
|
os.makedirs(post_dir)
|
||||||
|
|
||||||
rtm: MarkdownResult = read_time_of_markdown(post["content"], config["read-wpm"])
|
rtm: MarkdownResult = read_time_of_markdown(post["content"], config["read-wpm"])
|
||||||
cont: str = post["content"] + " " + post["title"]
|
cont: str = url_regex.sub("", post["content"]) + " " + post["title"]
|
||||||
|
|
||||||
rt.append(rtm.seconds)
|
rt.append(rtm.seconds)
|
||||||
cc.append(len(cont))
|
cc.append(len(cont))
|
||||||
ws.update(Counter(cont.lower().split()))
|
ws.update(Counter(w_regex.findall(cont.lower().strip())))
|
||||||
tgs.update(Counter(list(map(str.lower, post["keywords"]))))
|
tgs.update(Counter(list(map(str.lower, post["keywords"]))))
|
||||||
|
|
||||||
dt, s = rf_format_time(post["created"])
|
dt, s = rf_format_time(post["created"])
|
||||||
|
|
Loading…
Add table
Reference in a new issue