import yaml
def parseHTML(item):
if(not ('klickable' in item and item['klickable'] is False)):
item['lable'] = '' + item["lable"] + ''
if('sub' not in item):
return '
'
html = ''
def genHTML(items, parentUrl):
html = ""
for item in items:
if(type(item) is dict):
if('url' not in item):
if('lable' not in item):
print('url or lable reqired')
continue
if('klickable' in item and item['klickable'] is False):
item["url"] = parentUrl
else:
item["url"] = parentUrl + '/' + item["lable"]
if(item["url"][0] != '/'):
item["url"] = parentUrl + '/' + item["url"]
#WARNING: XSS vanrable!
if('lable' not in item):
item["lable"] = item["url"].split('/')[-1]
html += parseHTML(item)
continue
if(type(item) is str):
html += parseHTML({"lable": item, "url": parentUrl + '/' + item})
continue
return html
def getSidebar(items, parentUrl):
html = ''
return html