def _filter(self, text):
        """Context delimiter filter."""

        if self.line_endings:
            text = self.norm_nl(text)

        new_text = []
        index = 0
        last = 0
        end = len(text)
        while index < end:
            m = self.escapes.match(text, pos=index) if self.escapes else None
            if m:
                index = m.end(0)
                continue
            handled = False
            for delimiter in self.delimiters:
                m = delimiter[0].match(text, pos=index)
                if m:
                    if self.context_visible_first is True:
                        new_text.append(text[last:m.start(0)])
                    else:
                        new_text.append(m.group(delimiter[1]))
                    index = m.end(0)
                    last = index
                    handled = True
                    break
            if handled:
                continue
            index += 1
        if last < end and self.context_visible_first is True:
            new_text.append(text[last:end])

        return ' '.join(new_text)
def _filter ( self , text ) : if self . line_endings : text = self . norm_nl ( text ) new_text = [ ] index = 0 last = 0 end = len ( text ) while index < end : m = self . escapes . match ( text , pos = index ) if self . escapes else None if m : index = m . end ( 0 ) continue handled = False for delimiter in self . delimiters : m = delimiter [ 0 ] . match ( text , pos = index ) if m : if self . context_visible_first is True : new_text . append ( text [ last : m . start ( 0 ) ] ) else : new_text . append ( m . group ( delimiter [ 1 ] ) ) index = m . end ( 0 ) last = index handled = True break if handled : continue index += 1 if last < end and self . context_visible_first is True : new_text . append ( text [ last : end ] ) return ' ' . join ( new_text )
Context delimiter filter.