From 653af55372f8f034cd40d71bfa43a49bd71be8b6 Mon Sep 17 00:00:00 2001 From: wangxiaomo Date: Wed, 6 Aug 2014 09:16:37 +0800 Subject: [PATCH 1/2] support chinese yinxiang note --- plugin/evervim.vim | 10 +++++++--- plugin/py/evernoteapi.py | 9 ++++++--- plugin/py/evervim_editor.py | 3 ++- plugin/py/evervimmer.py | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/plugin/evervim.vim b/plugin/evervim.vim index ade87ed..3926a9a 100644 --- a/plugin/evervim.vim +++ b/plugin/evervim.vim @@ -33,15 +33,19 @@ if !exists('g:evervim_sorttags') " (name) (asc|desc) let g:evervim_sorttags= 'name asc' endif -if !exists('g:evervim_xmlindent') " +if !exists('g:evervim_xmlindent') let g:evervim_xmlindent= ' ' endif " use markdown when edit content(default = 1 means use markdown) -if !exists('g:evervim_usemarkdown') " +if !exists('g:evervim_usemarkdown') let g:evervim_usemarkdown= 1 endif -if !exists('g:evervim_asyncupdate') " +if !exists('g:evervim_yinxiang') + let g:evervim_yinxiang = 0 +endif + +if !exists('g:evervim_asyncupdate') let g:evervim_asyncupdate = 0 endif diff --git a/plugin/py/evernoteapi.py b/plugin/py/evernoteapi.py index c8201a3..0c0b7d8 100644 --- a/plugin/py/evernoteapi.py +++ b/plugin/py/evernoteapi.py @@ -31,9 +31,10 @@ class EvernoteAPI(object): #}}} #### constractuor. - def __init__(self, devtokens): # {{{ + def __init__(self, devtokens, is_yinxiang=False): # {{{ """ initialize """ self.devtokens = devtokens + self.is_yinxiang = is_yinxiang self.__setUserStore() self.__versioncheck() @@ -158,7 +159,8 @@ def auth(self): # {{{ def __setUserStore(self): # {{{ """ setup userStore. """ - userStoreHttpClient = THttpClient.THttpClient(USERSTORE_URI) + host = YINXIANG_HOST if self.is_yinxiang == '1' else EVERNOTE_HOST + userStoreHttpClient = THttpClient.THttpClient(USERSTORE_URI_FORMAT % host) userStoreProtocol = TBinaryProtocol.TBinaryProtocol(userStoreHttpClient) self.userStore = UserStore.Client(userStoreProtocol) #}}} @@ -220,7 +222,8 @@ def __init__(self): #EVERNOTE_HOST = "sandbox.evernote.com" EVERNOTE_HOST = "www.evernote.com" -USERSTORE_URI = "https://" + EVERNOTE_HOST + "/edam/user" +YINXIANG_HOST = "app.yinxiang.com" +USERSTORE_URI_FORMAT = "https://%s/edam/user" CONSUMER_SECRET = '960305afca85b6b0' NOTESTORE_URIBASE = "https://" + EVERNOTE_HOST + "/edam/note/" diff --git a/plugin/py/evervim_editor.py b/plugin/py/evervim_editor.py index cc1b891..cddaf20 100644 --- a/plugin/py/evervim_editor.py +++ b/plugin/py/evervim_editor.py @@ -24,6 +24,7 @@ def __init__(self): self.usemarkdown = None self.encoding = None self.asyncupdate = None + self.is_yinxiang = None self.enscriptpath = None @classmethod @@ -55,7 +56,7 @@ def setAPI(self): if EvervimPref.getInstance().devtoken is None: raise AttributeError("devtoken must be set!!") - self.api = EvernoteAPI(pref.devtoken) + self.api = EvernoteAPI(pref.devtoken, pref.is_yinxiang) def note2buffer(self, note): """ return strings array for buffer from note. """ diff --git a/plugin/py/evervimmer.py b/plugin/py/evervimmer.py index 0ca04e5..bb13a80 100644 --- a/plugin/py/evervimmer.py +++ b/plugin/py/evervimmer.py @@ -50,6 +50,7 @@ def setPref(self): # {{{ self.pref.xmlindent = vim.eval("g:evervim_xmlindent") self.pref.usemarkdown = vim.eval("g:evervim_usemarkdown") self.pref.asyncupdate = vim.eval("g:evervim_asyncupdate") + self.pref.is_yinxiang = vim.eval("g:evervim_yinxiang") self.pref.encoding = vim.eval('&enc') self.pref.enscriptpath = None # }}} From 3e25f9ef5410526abc21096392ebb8bc794d5c12 Mon Sep 17 00:00:00 2001 From: wangxiaomo Date: Wed, 6 Aug 2014 11:09:17 +0800 Subject: [PATCH 2/2] update doc --- README.md | 2 +- doc/evervim.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5609b22..8d39869 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # evervim.vim ## description: -edit evernote on vim. +edit evernote on vim. support [chinese yinxiang note](https://www.yinxiang.com/). ## requires: * python diff --git a/doc/evervim.txt b/doc/evervim.txt index 7a39940..ccde490 100644 --- a/doc/evervim.txt +++ b/doc/evervim.txt @@ -52,6 +52,9 @@ and set g:evervim_devtoken, evervim will initialize on start VIM. vimrc example: let g:evervim_devtoken='S=s999:U=9ee99c9:E=999d9999c99:C=99a99a99999:P=9cd:A=en-devtoken:H=cd99999de9999c99b999d99d999cb9f9' +if you are using chinese yinxiang note(https://www.yinxiang.com/), please add: + let g:evervim_yinxiang=1 + Initialize is not yet, set g:evervim_devtoken and do > :EvervimSetup