summaryrefslogtreecommitdiff
path: root/bin/report/render/html2html/html2html.py
diff options
context:
space:
mode:
authorOlivier Laurent <olt@tinyerp.com>2009-06-12 09:44:25 +0200
committerOlivier Laurent <olt@tinyerp.com>2009-06-12 09:44:25 +0200
commit725a31135eed3ef3f3bac5843f852b13b1c5ea9a (patch)
treecacd6c3ae998eab3ae06814cad89af527b658cfd /bin/report/render/html2html/html2html.py
parente2be25ace5ac06c5f232661af3a3c787eb3cdc06 (diff)
parent38c14c6ff9e27291364c77de89aac9f21f449cb4 (diff)
[MERGE]
bzr revid: olt@tinyerp.com-20090612074425-3n8krqi6bh8kfuos
Diffstat (limited to 'bin/report/render/html2html/html2html.py')
-rw-r--r--bin/report/render/html2html/html2html.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/report/render/html2html/html2html.py b/bin/report/render/html2html/html2html.py
index 2cf5b147dd0..db6a1ea511c 100644
--- a/bin/report/render/html2html/html2html.py
+++ b/bin/report/render/html2html/html2html.py
@@ -71,8 +71,24 @@ class html2html(object):
self._node.remove(n)
process_text(self.etree, self._node)
return self._node
+
+ def url_modify(self,root):
+ for n in root.getchildren():
+ if (n.text.find('<a ')>=0 or n.text.find('&lt;a')>=0) and n.text.find('href')>=0 and n.text.find('style')<=0 :
+ node = (n.tag=='span' and n.getparent().tag=='u') and n.getparent().getparent() or ((n.tag=='span') and n.getparent()) or n
+ style = node.get('color') and "style='color:%s; text-decoration: none;'"%node.get('color') or ''
+ if n.text.find('&lt;a')>=0:
+ t = '&lt;a '
+ else :
+ t = '<a '
+ href = n.text.split(t)[-1]
+ n.text = ' '.join([t,style,href])
+ self.url_modify(n)
+ return root
def parseString(node, localcontext = {}):
r = html2html(node, localcontext)
- return r.render()
+ root = r.render()
+ root = r.url_modify(root)
+ return root