diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2009-06-12 16:13:34 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2009-06-12 16:13:34 +0200 |
| commit | d43511f6130dfe7794827c99cb9e11750c5760c3 (patch) | |
| tree | 2a31926cde0a167fd178b926ef29b4a929f5049c /bin/report/render/html2html/html2html.py | |
| parent | 8688e0870530e4f4ad82a3585be026dd27ef24bb (diff) | |
| parent | aed02eac4d2fbb506c01040ac09b0370911e2ab4 (diff) | |
merge
bzr revid: fp@tinyerp.com-20090612141334-hmetl32rubyl1yh1
Diffstat (limited to 'bin/report/render/html2html/html2html.py')
| -rw-r--r-- | bin/report/render/html2html/html2html.py | 18 |
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('<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('<a')>=0: + t = '<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 |
