summaryrefslogtreecommitdiffstats
path: root/g2h/tree_page.py
diff options
context:
space:
mode:
Diffstat (limited to 'g2h/tree_page.py')
-rw-r--r--g2h/tree_page.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/g2h/tree_page.py b/g2h/tree_page.py
index 22e563a..977e981 100644
--- a/g2h/tree_page.py
+++ b/g2h/tree_page.py
@@ -2,9 +2,12 @@ import os
from .page import Page
+def tree_prefix(sha, tree):
+ return os.path.join(sha, 't', tree)
+
class TreePage(Page):
def __init__(self, out_dir, name, commit, sub_tree, repo, content_subdir):
- super(TreePage, self).__init__('tree.md', out_dir, os.path.join(commit.hexsha, 't', sub_tree, 'index.md'), name, content_subdir)
+ super(TreePage, self).__init__('tree.md', out_dir, os.path.join(tree_prefix(commit.hexsha, sub_tree), 'index.md'), name, content_subdir)
self.tree = commit.tree.join(sub_tree) if sub_tree else commit.tree
self.repo = repo
self.commit = commit
@@ -30,7 +33,9 @@ class TreePage(Page):
def context(self):
return {
+ 'content_subdir': self.content_subdir,
'entries': self._get_entries(),
+ 'subdir': '/'.join([self.content_subdir, tree_prefix(self.commit.hexsha, self.tree.path)]),
'title': self.name + ': Tree'
}