From 2d570a402887b01969b9422f9392813271a29866 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 27 May 2011 23:36:20 +0200 Subject: [PATCH] Fixes #2137 (altough it could have been done better) --- src/xhtml.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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