django - ENML to plain text converter for Python -
port enml library javascript (enml.js)
enml.plaintextofenml evernote-sdk-js works me , find port of tool python.
i tried use these library's, got errors:
https://github.com/carllee/enml_py
importerror: no module named bs4
https://github.com/wanasit/enml-py
feb 2013, without documentations,
importerror: no module named internals
for example
get:
any sort of liquid damage apple product void warranty.
from
<?xml version="1.0" encoding="utf-8"?><!doctype en-note system "http://xml.evernote.com/pub/enml2.dtd"><en-note>any sort of liquid damage apple product void warranty.</en-note>
the part of code in want use enml:
views.py
title_contents = {} note in result_list.notes: content = note_store.getnotecontent(auth_token, note_store.getnote(note.guid, true,false, false, false).guid) title_contents[note.title] = content enter code herereturn render_to_response('oauth/callback.html', {'notebooks': notebooks, 'result_list': result_list, 'title_contents': title_contents})
callback.html
..... <ul> {% title, content in title_contents.items %} <li><b>{{ title }}</b><br>{{ content }}</li> {% endfor %} </ul>
this combination accomplish things needed:
from fenml import enmltohtml # fenml.py internal fork of # https://github.com/carllee/enml_py/blob/master/__init__.py # modified code. bs4 import beautifulsoup import html2text .... title_contents[note.title] = html2text.html2text(beautifulsoup(enmltohtml(content)).prettify())
Comments
Post a Comment