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。
- 前言
- PythonPath在Windows 下的設置
- Sublime Text: [Decode error - output not utf-8]
- Python 寫文件時的Unicode設置
- python中文件打開的各個標識含義
- python 3中對list進行sort時,返回值為None
- python 3中使用getattr和*args時, 出現傳入參數不一致的問題
- import module, from module import funtion區別
- Python 中list, dictionary 與 file相互操作
- 編譯Python出現Tab,空格的問題
- Sublime Text2中Evernote 插件的使用
- python中全局變量的使用
- python中string和bool的轉換
- python中http的一些編碼轉換
- python中http請求中添加cookie支持
- python構造一個http請求
- python中如何定義main方法
- python為類定義構造函數
- python中print的幾種用法
- 自己寫的工具:把Evernote(印象筆記)的筆記導入到博客(Blog)中
- Python打包成exe
- python中lxml的應用