(self, source)
Wrap the pygmented code.

        Sublime popups don't really support 'pre', but since it doesn't
        hurt anything, we leave it in for the possiblity of future support.
        We get around the lack of proper 'pre' suppurt by converting any
        spaces after the intial space to nbsp.  We go ahead and convert tabs
        to 4 spaces as well.  We also manually inject line breaks.
Wrap the pygmented code.
Wrap the pygmented code .
def _wrap_code(self, source):
        """
        Wrap the pygmented code.

        Sublime popups don't really support 'pre', but since it doesn't
        hurt anything, we leave it in for the possiblity of future support.
        We get around the lack of proper 'pre' suppurt by converting any
        spaces after the intial space to nbsp.  We go ahead and convert tabs
        to 4 spaces as well.  We also manually inject line breaks.
        """

        yield 0, '<div class="%s"><pre>' % self.cssclass
        for i, t in source:
            text = ''
            matched = False
            for m in html_re.finditer(t):
                matched = True
                if m.group(1):
                    text += m.group(1)
                elif m.group(3):
                    text += m.group(3)
                else:
                    text += multi_space.sub(
                        replace_nbsp, m.group(2).replace('\t', ' ' * 4)
                    ).replace('&#39;', '\'').replace('&quot;', '"')
            if not matched:
                text = multi_space.sub(
                    replace_nbsp, t.replace('\t', ' ' * 4)
                ).replace('&#39;', '\'').replace('&quot;', '"')
            if i == 1:
                # it's a line of formatted code
                text += '<br>'
            yield i, text
        yield 0, '</pre></div>'
def _wrap_code ( self , source ) : yield 0 , '<div class="%s"><pre>' % self . cssclass for i , t in source : text = '' matched = False for m in html_re . finditer ( t ) : matched = True if m . group ( 1 ) : text += m . group ( 1 ) elif m . group ( 3 ) : text += m . group ( 3 ) else : text += multi_space . sub ( replace_nbsp , m . group ( 2 ) . replace ( '\t' , ' ' * 4 ) ) . replace ( '&#39;' , '\'' ) . replace ( '&quot;' , '"' ) if not matched : text = multi_space . sub ( replace_nbsp , t . replace ( '\t' , ' ' * 4 ) ) . replace ( '&#39;' , '\'' ) . replace ( '&quot;' , '"' ) if i == 1 : # it's a line of formatted code text += '<br>' yield i , text yield 0 , '</pre></div>'