DOCX: Fix incorrect styling of hyperlinks

The <w:r> tags for hyperlinks are not children of <w:p>, use the
ancestor axis instead of getparent().
This commit is contained in:
Kovid Goyal 2013-06-06 13:52:31 +05:30
parent 6fd3d84f3b
commit 02a28056de

View File

@ -265,7 +265,8 @@ class Styles(object):
def resolve_run(self, r): def resolve_run(self, r):
ans = self.run_cache.get(r, None) ans = self.run_cache.get(r, None)
if ans is None: if ans is None:
p = r.getparent() p = XPath('ancestor::w:p[1]')(r)
p = p[0] if p else None
ans = self.run_cache[r] = RunStyle() ans = self.run_cache[r] = RunStyle()
direct_formatting = None direct_formatting = None
for rPr in XPath('./w:rPr')(r): for rPr in XPath('./w:rPr')(r):