diff options
| author | user@node5.net <user@node5.net> | 2026-05-12 18:50:37 +0200 |
|---|---|---|
| committer | user@node5.net <user@node5.net> | 2026-05-12 18:50:37 +0200 |
| commit | 5a4bcbe84adb3aac980451259819f3029d7499c8 (patch) | |
| tree | 16f7befb7f752abb41b923c44eaaa4247fe16b15 /src/article.py | |
| parent | 1d81f5dbf63d361c76744fcd759904c4bf616fcc (diff) | |
Nixify app: Add flake, load content from dynamic path
- Package with flake - Load content from a path given with an environment variable, with the intention of loading this from a derivation
Diffstat (limited to 'src/article.py')
| -rw-r--r-- | src/article.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/article.py b/src/article.py index 0b437bc..a35b431 100644 --- a/src/article.py +++ b/src/article.py @@ -87,10 +87,9 @@ class ArticleGenerator: self.articles_path = articles_path def get_web_dir(self, path, name) -> tuple[str, ...]: - dir_structure = path.split(name)[0] - # Split into tuple, remove first part, assemble to path again, all to remove the first source dir agnostically - dir_structure_prefix_striped = pathlib.Path(dir_structure).parts[2:] - return dir_structure_prefix_striped + dir = path.split(name)[0] # Get dir for one file articles and folder articles + web_path = pathlib.Path(dir).relative_to(pathlib.Path(self.articles_path)) + return web_path.parts def parse_article_meta_data(self, source: str) -> typing.Tuple[str, MetaData]: if source.startswith('---'): @@ -189,6 +188,6 @@ class ArticleGenerator: for article_path in articles_paths: article = self.get_article(article_path) logger.debug(article.pretty_print) - self.discover_folder_structure(articles=articles, article=article) + self.discover_folder_structure(article=article, articles=articles) self.sort_articles(articles) return articles |
