diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2021-02-09 10:32:29 +0900 |
---|---|---|
committer | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2021-02-09 11:43:31 +0900 |
commit | b372cf17db0b15d2c85cc03423309e59b085c0c8 (patch) | |
tree | 9da359d9a3a5c3a064d5143728dacdc8425e53aa /scripts | |
parent | a286236b7dc147b5b403c74a19fa8ec17662a5cb (diff) |
scripts: add html_menu.py
Because current PeriJect is using scripts/myhtml.py to
creating all HTML files, all files will be re-created
if myhtml.py itself was updated.
It is very verbose. This patch separates "menu" from it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/html_menu.py | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/scripts/html_menu.py b/scripts/html_menu.py new file mode 100755 index 0000000..1199529 --- /dev/null +++ b/scripts/html_menu.py @@ -0,0 +1,132 @@ +#! /usr/bin/env python3 +#=============================== +# +# html_menu +# +# 2021/02/09 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +#=============================== +import sys +import os +import datetime + +import view +import html_base +from html_base import html +#==================================== +# +# periject_html +# +#==================================== +class periject_html(html_base.myhtml): + + #-------------------- + # menu_wiki + #-------------------- + def menu_wiki(self): + html("a", {"target":"_blank", + "href":"./wiki/top.html"}).print("Peri Peri Wiki") + + #-------------------- + # menu_folder + #-------------------- + def menu_folder(self, current): + folders = self.runl("cd {}; ls -F | grep /".format(current)) + path = current.replace("./projects", ".") + link = html("a", {"target":"summary", + "href":"{}/summary.html".format(path)}) + + html("li").print(link.text(os.path.basename(current))) + + if (not folders): + return + + with html("ul"): + for folder in folders: + dir = os.path.basename(folder) + self.menu_folder("{}/{}".format(current, folder[:-1])) + + #-------------------- + # menu_assignee + #-------------------- + def menu_assignee(self): + # from project.schema.yaml + with html("ul"): + for assignee in ['BSP', 'Geert', 'Jacopo', 'Kaneko', 'Kieran', 'Laurent', 'Magnus', 'Marek', + 'Morimoto', 'Niklas', 'Shimoda', 'Simon', 'Ulrich', 'Wolfram', "NoAssignee"]: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(assignee)}).text(assignee)) + + #-------------------- + # menu_status + #-------------------- + def menu_status(self): + # from project.schema.yaml + with html("ul"): + for status in ['New', 'Active', 'Blocked', 'Paused', 'Done', 'Abandoned']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(status)}).text(status)) + + #-------------------- + # menu_team + #-------------------- + def menu_team(self): + # from project.schema.yaml + with html("ul"): + for status in ['Core', 'IO', 'MM']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(status)}).text(status)) + + #-------------------- + # menu_bsp + #-------------------- + def menu_bsp(self, bsp): + html("a", {"target":"summary", + "href":"./{}.html".format(bsp)}).print(bsp) + + #-------------------- + # print + #-------------------- + def print(self, argv): + + # remove this script + argv.pop(0) + + self.print_css("html") + with html("body"): + html("h1").print("Wiki") + self.menu_wiki() + + html("h1").print("Schedule") + html("a", {"target":"summary", + "href":"./schedule.html"}).print("schedule") + + html("h1").print("Folder") + with html("ul"): + self.menu_folder("./projects") + + html("h1").print("Assignee") + self.menu_assignee() + + html("h1").print("Status") + self.menu_status() + + html("h1").print("Team") + self.menu_team() + + html("h1").print("BSP") + with html("ul"): + for bsp in argv: + with html("li"): + self.menu_bsp(bsp) + + html("div").print("<br><br>update<br>{}".format( + datetime.datetime.now().strftime("%Y/%m/%d %H:%M"))) + +#==================================== +# +# As command +# +#==================================== +if __name__=='__main__': + # html_menu.py bsp39x + periject_html().print(sys.argv) |