from dataclasses import dataclass from pathlib import Path import re @dataclass class Article: path: str def read_contents(self) -> str: return Path(self.path).read_text() articles = [ Article( "./input/art-001.html", ), ] # generate slugs and read articles slugs = [] article_contents = [] for article in articles: contents = article.read_contents() id_match = re.search(r'