Python 的 ENML 到纯文本转换器
ENML to plain text converter for Python
来自 javascript (enml.js) 的端口 enml 库
ENML.PlainTextOfENML for evernote-sdk-js 对我来说很好用
我想为 Python 找到这个工具的一个很好的端口。
我尝试使用这些库,但出现错误:
https://github.com/CarlLee/ENML_PY
导入错误:没有名为 bs4 的模块
https://github.com/wanasit/enml-py
2013 年 2 月,没有文档,
ImportError: 没有名为 internals 的模块
例如
我想得到:
any sort of liquid damage to an Apple product will void your warranty.
来自
<?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>
我想使用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>
这个组合完成了所有需要的事情:
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())
来自 javascript (enml.js) 的端口 enml 库
ENML.PlainTextOfENML for evernote-sdk-js 对我来说很好用
我想为 Python 找到这个工具的一个很好的端口。
我尝试使用这些库,但出现错误:
https://github.com/CarlLee/ENML_PY
导入错误:没有名为 bs4 的模块
https://github.com/wanasit/enml-py
2013 年 2 月,没有文档,
ImportError: 没有名为 internals 的模块
例如
我想得到:
any sort of liquid damage to an Apple product will void your warranty.
来自
<?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>
我想使用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>
这个组合完成了所有需要的事情:
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())