|
|
|
@ -15,8 +15,8 @@ def describe_node(node):
|
|
|
|
|
name = node.tag
|
|
|
|
|
if node.get('id', ''):
|
|
|
|
|
name += '#' + node.get('id')
|
|
|
|
|
if node.get('class', ''):
|
|
|
|
|
name += '.' + node.get('class').replace(' ', '.')
|
|
|
|
|
if node.get('class', '').strip():
|
|
|
|
|
name += '.' + '.'.join(node.get('class').split())
|
|
|
|
|
if name[:4] in ['div#', 'div.']:
|
|
|
|
|
name = name[3:]
|
|
|
|
|
if name in ['tr', 'td', 'div', 'p']:
|
|
|
|
@ -27,7 +27,7 @@ def describe_node(node):
|
|
|
|
|
return name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def describe(node, depth=2):
|
|
|
|
|
def describe(node, depth=1):
|
|
|
|
|
global uids, uids_document
|
|
|
|
|
doc = node.getroottree().getroot()
|
|
|
|
|
if doc != uids_document:
|
|
|
|
@ -37,8 +37,8 @@ def describe(node, depth=2):
|
|
|
|
|
#return repr(NodeRepr(node))
|
|
|
|
|
parent = ''
|
|
|
|
|
if depth and node.getparent() is not None:
|
|
|
|
|
parent = describe(node.getparent(), depth=depth - 1)
|
|
|
|
|
return parent + '/' + describe_node(node)
|
|
|
|
|
parent = describe(node.getparent(), depth=depth - 1) + '>'
|
|
|
|
|
return parent + describe_node(node)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RE_COLLAPSE_WHITESPACES = re.compile('\s+', re.U)
|
|
|
|
|