Skip to content

Commit ae08ca2

Browse files
committed
rm unformatted markdown from cards
1 parent 9923eba commit ae08ca2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

portal/src/blogpost.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
import argparse
33
import json
4+
import re
45
import sys
56
from pathlib import Path
67

@@ -43,14 +44,18 @@
4344
for ii in content.splitlines()
4445
if not any(ii.startswith(char) for char in skip_lines)
4546
)
47+
4648
N_WORDS = 50
47-
words = " ".join(content.split(" ")[:N_WORDS])
49+
content_no_links = re.sub(r"\[([^\]]+)\]\([^)]+\)", r"\1", content)
50+
content_no_bold = re.sub(r"\*\*", "", content_no_links)
51+
words = " ".join(content_no_bold.split(" ")[:N_WORDS])
52+
4853
if "author" not in meta:
4954
meta["author"] = "Project Pythia Team"
5055
meta["content"] = meta.get("description", words)
5156
posts.append(meta)
5257
posts = pd.DataFrame(posts)
53-
posts["date"] = pd.to_datetime(posts["date"])
58+
posts["date"] = pd.to_datetime(posts["date"]).dt.tz_localize("UTC")
5459
posts = posts.dropna(subset=["date"])
5560
posts = posts.sort_values("date", ascending=False)
5661

0 commit comments

Comments
 (0)