diff options
| author | Christoph Schlosser <christoph@linux.com> | 2025-08-31 01:09:37 +0200 |
|---|---|---|
| committer | Christoph Schlosser <christoph@linux.com> | 2025-08-31 15:53:33 +0200 |
| commit | 284f3972844ea124c0cd9ee5500e99440bb96aac (patch) | |
| tree | b8dee22222c38b12cc00daf98280e1b2060bcca7 /g2h/page_factory.py | |
| parent | b06dbf67b9ac9e329922d7911ee7a9b09419c5f0 (diff) | |
| download | git2hugo-284f3972844ea124c0cd9ee5500e99440bb96aac.tar.gz | |
g2h: Add file page
Also move helpers to dedicated files.
Diffstat (limited to 'g2h/page_factory.py')
| -rw-r--r-- | g2h/page_factory.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/g2h/page_factory.py b/g2h/page_factory.py index c4b89ed..da9c5d5 100644 --- a/g2h/page_factory.py +++ b/g2h/page_factory.py @@ -1,4 +1,7 @@ +import os + from .commit_page import CommitPage +from .file_page import FilePage from .overview_page import OverviewPage from .log_page import LogPage from .tree_page import TreePage @@ -12,6 +15,11 @@ class PageFactory: def new_commit(self, commit): return CommitPage(self.out_dir, self.name, commit, self.content_subdir) + def new_file(self, commit, path): + filename = os.path.basename(path) + dir = os.path.dirname(path) + return FilePage(self.out_dir, self.name, commit, filename, dir, self.content_subdir) + def new_overview(self, branches, tags): return OverviewPage(self.out_dir, self.name, branches, tags, self.content_subdir) |