[IMP] added style for the url which are as text

bzr revid: dsh@tinyerp.com-20090610112328-0rd3cr2ig132yt12
This commit is contained in:
dsh (Open ERP) 2009-06-10 16:53:28 +05:30
parent 5992ca0389
commit 683f3fe232
1 changed files with 13 additions and 1 deletions

View File

@ -71,8 +71,20 @@ 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 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 ''
href = n.text.split('<a ')[-1]
n.text = ' '.join(['<a ',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