Adjusted the UI

This commit is contained in:
jyamihud 2022-03-31 21:08:42 +03:00
parent 55648f5629
commit 982f2c9a53
3 changed files with 22 additions and 36 deletions

View file

@ -16,25 +16,32 @@ def html(page, json):
if "licenses" in json and json["licenses"]:
free = True
page = page + "\n <h1>"
try:
page = page + '\n<img src="'+ json["links"]["icon"] + '" alt="Logo" style="width:50px;">'
except:
pass
# Name / Website link
name = json.get("names",["Unknown"])[0]
page = page + "\n" + name
page = page + "</h1>"
# Few words about it
page = page + "<p>"+json.get("comment","")+"</p>"
# I want to show nothing else from if it's proprietary
if not free:
l = json.get("issues", [])
page = page +"<h2>Anti-Features / Problems:</h2>"
for i in l:
page = page + "<br>&nbsp;&nbsp;"+i
return page
# Links
# <table>
@ -55,36 +62,15 @@ def html(page, json):
"""
page = page + "<table><tr>"
website = json.get("links",{}).get("website", "")
if free and website:
page = page + """
<th><form action=\""""+website+"""\">
<button type="submit">Website</button>
</form></th>
"""
git = json.get("links",{}).get("git", "")
if git:
links = json.get("links", {})
for website in links:
if website in ["icon"]:
continue
link = links[website]
page = page + """
<th><form action=\""""+git+"""\">
<button type="submit">Source Code</button>
</form></th>
"""
wikipedia = json.get("links",{}).get("wikipedia", "")
if wikipedia:
page = page + """
<th><form action=\""""+wikipedia+"""\">
<button type="submit">Wikipedia</button>
</form></th>
"""
documentation = json.get("links",{}).get("documentation", "")
if documentation:
page = page + """
<th><form action=\""""+documentation+"""\">
<button type="submit">Documentation</button>
<th><form action=\""""+link+"""\">
<button title=\""""+link+"""\" type="submit">"""+website.upper()+"""</button>
</form></th>
"""
@ -108,10 +94,10 @@ def html(page, json):
continue
page = page + "<details>"
page = page +"<summary>"+categories[c]+"</summary>"
page = page +"<summary>"+categories[c]+":</summary>"
for i in l:
page = page + "<span>&nbsp;&nbsp;"+i+"</span><br>"
page = page + "&nbsp;&nbsp;"+i+"<br>"
page = page + "</details>"