From 9311577116505151413708316982192fb1b2e875 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 11:45:22 +0900 Subject: html: add relpath() more simply link path Signed-off-by: Kuninori Morimoto --- scripts/html.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/html.py b/scripts/html.py index d7e4890..80842cc 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -118,6 +118,9 @@ class periject_html(base.base): super().__init__() self.git = self.config("git-linux") + def relpath(self, path, frm): + return os.path.relpath("{}/{}".format(self.top(), path), frm) + def relpath_y2h(self, file, frm): return os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), frm) @@ -183,11 +186,11 @@ class periject_html(base.base): html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) status = v.get_data("status") - summary.option({"href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}) + summary.option({"href":self.relpath("html/{}.html".format(status), dir)}) html("td").print(summary.text(status)) assignee = v.get_data("assignee") - summary.option({"href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}) + summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)}) html("td").print(summary.text(assignee)) html("td").print(v.get_data("title")) @@ -287,9 +290,9 @@ class periject_html(base.base): with html("tr"): html("td").print(os.path.relpath(v.file, self.top())) html("td").print(html("a", {"target":"summary", - "href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}).text(status)) + "href":self.relpath("html/{}.html".format(status), dir)}).text(status)) html("td").print(html("a", {"target":"summary", - "href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}).text(assignee)) + "href":self.relpath("html/{}.html".format(assignee), dir)}).text(assignee)) html("td").print(v.get_data("key")) #-------------------- -- cgit v1.2.3