A nicer repr for Tag objects

This commit is contained in:
Kovid Goyal 2014-12-11 08:56:41 +05:30
parent d31bf5a1ac
commit e10538e05c

View File

@ -36,6 +36,11 @@ class Tag(object):
self.name = tag self.name = tag
self.self_closing = self_closing self.self_closing = self_closing
def __repr__(self):
return '<%s start_block=%s start_offset=%s end_block=%s end_offset=%s self_closing=%s>' % (
self.name, self.start_block.blockNumber(), self.start_offset, self.end_block.blockNumber(), self.end_offset, self.self_closing)
__str__ = __repr__
def next_tag_boundary(block, offset, forward=True): def next_tag_boundary(block, offset, forward=True):
while block.isValid(): while block.isValid():
ud = block.userData() ud = block.userData()