diff --git a/jimsite/__init__.py b/jimsite/__init__.py index 2ed9366..f8b83e5 100644 --- a/jimsite/__init__.py +++ b/jimsite/__init__.py @@ -76,7 +76,7 @@ def build_site(site: SiteConfig, templates: DotMap): def main(): logger.info('Loading config.') - with open('/home/jim/projects/shepich.com/config.yaml', 'r') as config_file: + with open('./config.yaml', 'r') as config_file: config = yaml.safe_load(config_file.read()) logger.info('Loading global templates.') diff --git a/jimsite/articles.py b/jimsite/articles.py index e6074a1..cd2b9b7 100644 --- a/jimsite/articles.py +++ b/jimsite/articles.py @@ -3,7 +3,7 @@ import glob import yaml import markdown import pydantic -from typing import Optional +from typing import Optional, Union from dotmap import DotMap from datetime import date @@ -26,7 +26,7 @@ class Article(pydantic.BaseModel): metadata: Optional[ArticleMetadata] = None -def load_markdown(md: str) -> tuple[ArticleMetadata|None, str]: +def load_markdown(md: str) -> tuple[Optional[ArticleMetadata], str]: '''Loads a Markdown file into a (metadata: ArticleMetadata, content: str) pair.''' # Load the file contents if a filepath is specified, and strip document delimiters ('---'). @@ -59,7 +59,7 @@ def build_index(site: SiteConfig) -> dict[str, Article]: for a in site.articles or {}: expanded_article_list.extend( # Article paths are defined relative to the build cache; construct the full path. - glob.glob(f'{site.build_cache}/{a.removeprefix('./').lstrip("/")}') + glob.glob(f"{site.build_cache}/{a.removeprefix('./').lstrip('/')}") ) diff --git a/jimsite/blog.py b/jimsite/blog.py index 5ec4c16..8a3b4b8 100644 --- a/jimsite/blog.py +++ b/jimsite/blog.py @@ -103,21 +103,21 @@ def build_blog_archive( **kwargs ) - with open(f'{site.web_root.rstrip('/')}/archive.html', 'w') as f: + with open(f"{site.web_root.rstrip('/')}/archive.html", 'w') as f: f.write(archive_html_page) def build_rss_feed(site: SiteConfig, index: dict[str, Article]): feed = rfeed.Feed( title = site.title, - link = f'{site.base_url.rstrip('/')}/rss.xml', + link = f"{site.base_url.rstrip('/')}/rss.xml", description = site.description, language = "en-US", lastBuildDate = datetime.now(), items = [ rfeed.Item( title = article.metadata.title, - link = f'{site.base_url.rstrip('/')}/{article.path}', + link = f"{site.base_url.rstrip('/')}/{article.path}", description = article.metadata.description, author = article.metadata.author, guid = rfeed.Guid(article.path), @@ -131,5 +131,5 @@ def build_rss_feed(site: SiteConfig, index: dict[str, Article]): ] ) - with open(f'{site.web_root.rstrip('/')}/rss.xml', 'w') as f: + with open(f"{site.web_root.rstrip('/')}/rss.xml", 'w') as f: f.write(feed.rss()) \ No newline at end of file