Sublime Text2中Evernote 插件的使用

Sublime Text2是个强大的编辑器, 有好多插件供我们使用, 其中有个插件SublimeEvernote, 可以把代码发送到Evernote里。 

但是没找见使用说明, 今天看了下Sublime_Evernote.py源码, 配置如下:

/* Sublime evernote default settings */
{
    "authToken": "your dev authToken",

    "noteStoreUrl": "your noteStore url"
}


这个插件发送代码到默认notebook里, 我们可以修改其代码, 可以默认,也可以输入notebook名字。其源码:

   def sendnote(title,tags):
            xh =  XHTML()
            note = Types.Note()
            note.title = title.encode('utf-8')
            note.content = '<?xml version="1.0" encoding="UTF-8"?>'
            note.content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
            note.content += '<en-note><pre>%s'%xh.p(content.encode('utf-8'))
            note.content += '</pre></en-note>'
            note.tagNames = tags and tags.split(",") or []
            try:
                sublime.status_message("please wait...")  
                cnote = noteStore.createNote(authToken, note)  
                sublime.status_message("send success guid:%s"%cnote.guid) 
                sublime.message_dialog("success")
            except Errors.EDAMUserException,e:
                args = dict(title=title,tags=tags)
                if e.errorCode == 9:
                    self.connect(self.send_note,**args)
                else:
                    if sublime.ok_cancel_dialog('error %s! retry?'%e):
                        self.connect(self.send_note,**args)
            except  Exception,e:
                sublime.error_message('error %s'%e)

createNote 方法为Evernote提供的api, 如果note对象没有指定notebookGuid, 则用默认notebook, 我们可以在代码里设置其guid为我们想要的notebookGuid。

原文地址:https://www.cnblogs.com/muzizongheng/p/3173557.html