def result_format(json, keyorder, link, style, location="", file_name=""):
message = ""
if keyorder:
try:
# the output of sorted function is an ordered list of tuples
ordered_result = sorted(json.items(), key=lambda i:keyorder.index(i[0]))
# print("ordered_result: " + str(ordered_result))
except Exception as e:
print(e)
ordered_result = []
message = Utilities.get_html_from_list(ordered_result, style)
else:
message = Utilities.get_html_from_dictionary(json)
# add helper link if there is one
if link:
# message += '<a style="color: white;" href=\"%s\">See more</a>' % link
message += '<a href=\"%s\" style=\"%s\">See more</a>' % (link, style['link'])
if location and file_name:
row = location[0]
col = location[1]
# message += '<br><a style="color: white;" href=\"%s\">Go To Document</a>' % (file_name + '$$$' + str(row) + ',' + str(col))
message += '<br><a href=\"%s\" style=\"%s\">Go To Document</a>' % ((file_name + '$$$' + str(row) + ',' + str(col)), style['link'])
return message
评论列表
文章目录