(self, parent, block)
return level, parent
Get level of indent based on list level.
Get level of indent based on list level.
Get level of indent based on list level .
def get_level(self, parent, block):
        """ Get level of indent based on list level. """
        # Get indent level
        m = self.INDENT_RE.match(block)
        if m:
            indent_level = len(m.group(1))/self.tab_length
        else:
            indent_level = 0
        if self.parser.state.isstate('list'):
            # We're in a tightlist - so we already are at correct parent.
            level = 1
        else:
            # We're in a looselist - so we need to find parent.
            level = 0
        # Step through children of tree to find matching indent level.
        while indent_level > level:
            child = self.lastChild(parent)
            if child and (child.tag in self.LIST_TYPES or child.tag in self.ITEM_TYPES):
                if child.tag in self.LIST_TYPES:
                    level += 1
                parent = child
            else:
                # No more child levels. If we're short of indent_level,
                # we have a code block. So we stop here.
                break
        return level, parent
def get_level ( self , parent , block ) : # Get indent level m = self . INDENT_RE . match ( block ) if m : indent_level = len ( m . group ( 1 ) ) / self . tab_length else : indent_level = 0 if self . parser . state . isstate ( 'list' ) : # We're in a tightlist - so we already are at correct parent. level = 1 else : # We're in a looselist - so we need to find parent. level = 0 # Step through children of tree to find matching indent level. while indent_level > level : child = self . lastChild ( parent ) if child and ( child . tag in self . LIST_TYPES or child . tag in self . ITEM_TYPES ) : if child . tag in self . LIST_TYPES : level += 1 parent = child else : # No more child levels. If we're short of indent_level, # we have a code block. So we stop here. break return level , parent