Skip to content

Commit

Permalink
Disable embedded comment by default (see #219)
Browse files Browse the repository at this point in the history
  • Loading branch information
bordaigorl committed Sep 20, 2022
1 parent dc4b5f8 commit 2067ca5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions sublime_evernote.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def set_view_metadata(view, note, reset_modified=True):
view.settings().set("$evernote", True)
view.settings().set("$evernote_guid", note.guid)
view.settings().set("$evernote_title", note.title)
view.settings().set("$evernote_created", note.created)
if reset_modified:
note_is_current(view)

Expand Down Expand Up @@ -513,11 +514,12 @@ def populate_note(self, note, contents):
content = '<?xml version="1.0" encoding="UTF-8"?>'
content += '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
content += '<en-note%s>' % wrapper_style
hidden = ('\n%s%s%s\n' %
(SUBLIME_EVERNOTE_COMMENT_BEG,
b64encode(contents.encode('utf8')).decode('utf8'),
SUBLIME_EVERNOTE_COMMENT_END))
content += hidden
if self.settings.get('use_legacy_comments', False):
hidden = ('\n%s%s%s\n' %
(SUBLIME_EVERNOTE_COMMENT_BEG,
b64encode(contents.encode('utf8')).decode('utf8'),
SUBLIME_EVERNOTE_COMMENT_END))
content += hidden
content += body
LOG(body)
content += '</en-note>'
Expand Down Expand Up @@ -1090,7 +1092,8 @@ def do_open_note(self, guid, convert=True, **unk_args):
newview.set_scratch(True)
replace_view_text(newview, note_contents)
newview.set_name(note.title)
newview.settings().set("$evernote_guid", note.guid)
# newview.settings().set("$evernote_guid", note.guid)
set_view_metadata(newview, note, False)
self.message('Note "%s" opened!' % note.title)
self.update_status_info(note, newview)
# note_is_current(newview)
Expand Down Expand Up @@ -1389,7 +1392,9 @@ def on_done_async(i):
self.token(), note.resources[i].guid,
True, False, False, False).data.body
mime = resources[i].mime or "application/octet-stream"
_, tmp = tempfile.mkstemp(mimetypes.guess_extension(mime) or "")
ext = mimetypes.guess_extension(mime) or ""
if ext == ".jpe": ext = ".jpg"
_, tmp = tempfile.mkstemp(ext)
mime = mime.split("/")[0]
with open(tmp, 'wb') as tmpf:
tmpf.write(contents)
Expand Down

0 comments on commit 2067ca5

Please sign in to comment.