@@ -15,8 +15,8 @@ def describe_node(node):
15
15
name = node .tag
16
16
if node .get ('id' , '' ):
17
17
name += '#' + node .get ('id' )
18
- if node .get ('class' , '' ):
19
- name += '.' + node .get ('class' ).replace ( ' ' , '.' )
18
+ if node .get ('class' , '' ). strip () :
19
+ name += '.' + '.' . join ( node .get ('class' ).split () )
20
20
if name [:4 ] in ['div#' , 'div.' ]:
21
21
name = name [3 :]
22
22
if name in ['tr' , 'td' , 'div' , 'p' ]:
@@ -27,7 +27,7 @@ def describe_node(node):
27
27
return name
28
28
29
29
30
- def describe (node , depth = 2 ):
30
+ def describe (node , depth = 1 ):
31
31
global uids , uids_document
32
32
doc = node .getroottree ().getroot ()
33
33
if doc != uids_document :
@@ -37,8 +37,8 @@ def describe(node, depth=2):
37
37
#return repr(NodeRepr(node))
38
38
parent = ''
39
39
if depth and node .getparent () is not None :
40
- parent = describe (node .getparent (), depth = depth - 1 )
41
- return parent + '/' + describe_node (node )
40
+ parent = describe (node .getparent (), depth = depth - 1 ) + '>'
41
+ return parent + describe_node (node )
42
42
43
43
44
44
RE_COLLAPSE_WHITESPACES = re .compile ('\s+' , re .U )
0 commit comments