def handle_data(self, data):
        """
        Any space immediately following another collapsible space will be
        collapsed.

        .. seealso::
           `CSS Text Module Level 3 - The White Space Processing Rules
            <http://www.w3.org/TR/css3-text/#egbidiwscollapse>`_
        """

        tag_stack = self._tag_stack
        if tag_stack and tag_stack[-1] in _RM_WS_ELEMENTS:
            # just ignore the content of this element
            assert data.strip() == ''
            return

        if self._preserve == 0:
            if self._remove_begining_ws:
                data = data.lstrip()
                if not data:
                    return

                self._remove_begining_ws = False

            self._last_text_idx = len(self._buffer)

            data = _WS_PATTERN.sub(' ', data)
            if data and data[-1] == ' ':
                # immediately followed spaces will be collapsed
                self._remove_begining_ws = True
        else:
            # the content cannot be stripped
            self._reset_newline_status()

        self._buffer.append(data)
def handle_data ( self , data ) : tag_stack = self . _tag_stack if tag_stack and tag_stack [ - 1 ] in _RM_WS_ELEMENTS : assert data . strip ( ) == '' return if self . _preserve == 0 : if self . _remove_begining_ws : data = data . lstrip ( ) if not data : return self . _remove_begining_ws = False self . _last_text_idx = len ( self . _buffer ) data = _WS_PATTERN . sub ( ' ' , data ) if data and data [ - 1 ] == ' ' : self . _remove_begining_ws = True else : self . _reset_newline_status ( ) self . _buffer . append ( data )
Any space immediately following another collapsible space will be
        collapsed.

        .. seealso::
           `CSS Text Module Level 3 - The White Space Processing Rules
            <http://www.w3.org/TR/css3-text/#egbidiwscollapse>`_