Port enml library from javascript (enml.js)
ENML.PlainTextOfENML for evernote-sdk-js works good for me
and I would like to find a good port of this tool for Python.
I tried to use these library's, but got an errors:
https://github.com/CarlLee/ENML_PY
ImportError: No module named bs4
https://github.com/wanasit/enml-py
Feb 2013, without the documentations,
ImportError: No module named internals
For example
I would like to get:
any sort of liquid damage to an Apple product will void your 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 to an Apple product will void your warranty.</en-note>
The part of code in which I want to use enml:
views.py
title_contents = {}
for 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>
{% for title, content in title_contents.items %}
<li><b>{{ title }}</b><br>{{ content }}</li>
{% endfor %}
</ul>
This combination accomplish all the things needed:
from fenml import ENMLToHTML
# the fenml.py is my internal fork of the
# https://github.com/CarlLee/ENML_PY/blob/master/__init__.py
# with slightly modified code.
from bs4 import BeautifulSoup
import html2text
....
title_contents[note.title] = html2text.html2text(BeautifulSoup(ENMLToHTML(content)).prettify())