Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion html2text.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# TODO:
# Support decoded entities with unifiable.

# Exception handle
try:
True
except NameError:
Expand All @@ -18,6 +18,7 @@ def has_key(x, y):
if hasattr(x, 'has_key'): return x.has_key(y)
else: return y in x

# Exception Handle for Library
try:
import htmlentitydefs
import urlparse
Expand Down Expand Up @@ -72,6 +73,7 @@ def name2cp(k):
if k.startswith("&#") and k.endswith(";"): return int(k[2:-1]) # not in latin-1
return ord(codecs.latin_1_decode(k)[0])

# Defining Dictionary
unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"',
'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*',
'ndash':'-', 'oelig':'oe', 'aelig':'ae',
Expand Down