ToolTipHelper.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:ToolTip-Helper 作者: doobleweb 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号