summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xhtml.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/xhtml.py b/src/xhtml.py
index 29017be3..d755229f 100644
--- a/src/xhtml.py
+++ b/src/xhtml.py
@@ -71,7 +71,13 @@ def convert_links_to_plaintext(text):
previous_child = None
for child in parent:
if child.tag == '{http://www.w3.org/1999/xhtml}a':
- link_text = '\n%s (%s)'%(child.attrib['href'], child.text)
+ if child.attrib['href'] != child.text:
+ if child.text is None and 'title' in child.attrib:
+ link_text = '\n%s (%s)'%(child.attrib['href'], child.attrib['title'])
+ else:
+ link_text = '\n%s (%s)'%(child.attrib['href'], child.text)
+ else:
+ link_text = child.text
if previous_child is not None:
if previous_child.tail is None:
previous_child.tail = link_text