summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-12-23 14:27:52 +0900
committerKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-12-23 14:27:52 +0900
commitdc71f3518c95f8d9d306e8a4e53bc9bd2e9928e3 (patch)
tree54552f6ba6cec40e16cef5c22043d9f510087e00 /scripts
parentbb506a3f4c5441ecb212874077ad8b1bf335c936 (diff)
parent05040a728026b28ce7c6183d2adfa80218b306cb (diff)
Merge remote-tracking branch 'gitlab/wiki' into HEAD
Diffstat (limited to 'scripts')
-rw-r--r--scripts/css44
-rwxr-xr-xscripts/myhtml.py (renamed from scripts/html.py)86
2 files changed, 121 insertions, 9 deletions
diff --git a/scripts/css b/scripts/css
new file mode 100644
index 0000000..cff3876
--- /dev/null
+++ b/scripts/css
@@ -0,0 +1,44 @@
+h1 {
+ color: #364e96;
+ border: solid 3px #364e96;
+ padding: 0.5em;
+ border-radius: 25px 0px 0px 25px;
+ background: linear-gradient(transparent 20%, #aaddff 80%);
+}
+
+h2 {
+ background: linear-gradient(transparent 20%, #a7d6ff 80%);
+}
+
+h3 {
+ border-left: solid 5px #a0d0ff;
+ padding: 0.25em 0.5em;
+}
+
+
+table {
+ border-collapse: collapse;
+ border: solid 1px gray;
+ background-color: #fff2d9;
+}
+
+table th {
+ border: solid 1px gray;
+ background: linear-gradient(#ffdd99,#bbaa88);
+ padding: 1px 0;
+}
+
+table td {
+ border: solid 1px gray;
+}
+
+pre {
+ background: linear-gradient(#eeffee,#88dd66);
+ border: solid 3px gray;
+ padding: 10px 10px;
+ border-radius: 10px;
+}
+
+strong {
+ background: linear-gradient(transparent 30%, #bbbb00);
+}
diff --git a/scripts/html.py b/scripts/myhtml.py
index 07727d0..f7d5349 100755
--- a/scripts/html.py
+++ b/scripts/myhtml.py
@@ -5,6 +5,7 @@
#
# 2019/02/18 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
#===============================
+import textile
import sys
import os
import re
@@ -13,7 +14,6 @@ import base
import find
import view
import datetime
-
#====================================
#
# html
@@ -136,6 +136,14 @@ class periject_html(base.base):
return "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id={}".format(id)
#--------------------
+ # print_css
+ #--------------------
+ def print_css(self, dir):
+ html("link", {"rel":"stylesheet",
+ "type":"text/css",
+ "href":self.relpath("scripts/css", dir)}).print()
+
+ #--------------------
# index
#--------------------
def index(self):
@@ -254,7 +262,16 @@ class periject_html(base.base):
# -------
#
# -------
- self.__summary(dir, self.top() + "/" + dir, find.find([dir]).get())
+ self.print_css(dir)
+ with html("body"):
+ self.__summary(dir, self.top() + "/" + dir, find.find([dir]).get())
+
+ #--------------------
+ # menu_wiki
+ #--------------------
+ def menu_wiki(self):
+ html("a", {"target":"_blank",
+ "href":"./wiki/top.html"}).print("Peri Peri Wiki")
#--------------------
# menu_folder
@@ -318,7 +335,11 @@ class periject_html(base.base):
#--------------------
def menu(self):
+ self.print_css("html")
with html("body"):
+ html("h1").print("Wiki")
+ self.menu_wiki()
+
html("h1").print("Folder")
with html("ul"):
self.menu_folder("./projects")
@@ -339,9 +360,43 @@ class periject_html(base.base):
datetime.datetime.now().strftime("%Y/%m/%d %H:%M")))
#--------------------
+ # wiki
+ #--------------------
+ def wiki(self, argv):
+
+ with open(argv[0], "r") as f:
+ text = f.read()
+
+ # parse http[s]
+ text = re.sub(r'(\s+)http://(.*)(\s+)', r'\1"http://\2":http://\2\3', text)
+ text = re.sub(r'(\s+)https://(.*)(\s+)', r'\1"https://\2":https://\2\3', text)
+
+ # parse img
+ text = re.sub(r'!(\S+)!', r'!../../wiki/\1!', text)
+
+ # [[foo bar]]
+ # -> "foo bar":foo_bar.html
+ while 1:
+ hit = re.search(r'\[\[.*\]\]', text)
+
+ if (not hit):
+ break;
+
+ link = text[hit.start()+2:hit.end()-2]
+ link = "\"{}\":{}.html".format(link, re.sub(r' ', r'_', link))
+
+ text = text[:hit.start()] + link + text[hit.end():]
+
+ # textile
+ self.print_css("html/wiki")
+ with html("body"):
+ print(textile.textile(text))
+
+ #--------------------
# body
#--------------------
def body(self):
+ self.print_css("html")
with html("body"):
html("div").print("select tasks from menu")
@@ -453,7 +508,7 @@ class periject_html(base.base):
commit = upstream[item]
with html("tr"):
- html("td").print(item)
+ html("th").print(item)
html("td").print(html("a", {"href":self.upstream_url(commit),
"target":"subbody"}).text(self.git_title(commit)))
@@ -528,8 +583,11 @@ class periject_html(base.base):
v = view.viewer([argv[0]])
v.set_data(argv[0])
+ dir = os.path.dirname(argv[0].replace("projects", "html"))
+
+ self.print_css(dir)
with html("body"):
- html("h1").print(v.get_data("title"))
+ html("h2").print(v.get_data("title"))
self.task_head(v)
self.task_commit(v)
self.task_comment(v)
@@ -540,9 +598,11 @@ class periject_html(base.base):
def member(self, argv):
mem = argv.pop(0)
+ dir = "{}/html".format(self.top())
+ self.print_css(dir)
with html("body"):
- self.__summary(mem, "{}/html".format(self.top()), argv)
+ self.__summary(mem, dir, argv)
#--------------------
# status
@@ -550,9 +610,11 @@ class periject_html(base.base):
def status(self, argv):
argv.pop(0)
+ dir = "{}/html".format(self.top())
+ self.print_css(dir)
with html("body"):
- self.__summary(None, "{}/html".format(self.top()), argv)
+ self.__summary(None, dir, argv)
#--------------------
# team
@@ -560,9 +622,11 @@ class periject_html(base.base):
def team(self, argv):
team = argv.pop(0)
+ dir = "{}/html".format(self.top())
+ self.print_css(dir)
with html("body"):
- self.__summary(team, "{}/html".format(self.top()), argv)
+ self.__summary(team, dir, argv)
#--------------------
# bsp
@@ -576,8 +640,10 @@ class periject_html(base.base):
cnt_all = 0
cnt_done= 0
tmp = 0
+
+ self.print_css("html")
with html("body"):
- html("h1").print("BSP patch list")
+ html("h2").print("BSP patch list")
with html("table", {"border":"1"}):
with html("tr"):
@@ -597,7 +663,7 @@ class periject_html(base.base):
with html("tr"):
a.option({"href":
self.relpath_y2h(file, "{}/html".format(self.top()))})
- html("td").print("{}<br>({})".format(
+ html("th").print("{}<br>({})".format(
a.text(os.path.basename(file).replace(".yaml", "")),
v.get_data("status")))
@@ -657,6 +723,8 @@ class periject_html(base.base):
elif (cmd == "bsp"):
# ./script/find.py -a | xargs ./script/html.py bsp
self.bsp(sys.argv)
+ elif (cmd == "wiki"):
+ self.wiki(sys.argv)
#====================================
#