CompletePHPInlineDocsHover.py 文件源码

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

项目:CompletePHP 作者: desean1625 项目源码 文件源码
def show_doc_popup(self, view, point, word):
        if not word in functions:
            return
        max_width, max_height = 600, 300
        word = word.replace("_","-")
        filepath = re.sub("{{.*?}}",word,self.settings.get('pathToPHPDocs'))
        print(filepath)
        html_file = filepath
        html_str = sublime.load_resource(html_file)
        html_str = re.sub("<!DOCTYPE.*?>","",html_str)
        #strip Meta tag
        html_str = re.sub("<meta .*?>","",html_str)
        #remove entities that python has trouble with from what I saw 
        html_str = re.sub("&mdash;","-",html_str)
        html_str = re.sub("&quot;",'"',html_str)
        html_str = re.sub("&#039;","'",html_str)
        html_str = re.sub("&raquo;","»",html_str)
        #replace &$ with entity many functions had this
        html_str = re.sub("&\$","&amp;$",html_str)
        #remove all spans
        html_str = re.sub("<span.*?>(.*?)</span>",r"\1",html_str)
        html_str = re.sub("<head>","",html_str)
        html_str = re.sub("</head>","",html_str)
        view.show_popup(html_str,
                        sublime.HIDE_ON_MOUSE_MOVE_AWAY,
                        point,
                        max_width,
                        max_height,
                        lambda s: self.on_navigate(s, view, point),
                        )
        print("here")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号