(self, arg=None)
return '\n'.join(lines)
Return CSS style definitions for the classes produced by the current
        highlighting style. ``arg`` can be a string or list of selectors to
        insert before the token type classes.
Return CSS style definitions for the classes produced by the current
        highlighting style. ``arg`` can be a string or list of selectors to
        insert before the token type classes.
Return CSS style definitions for the classes produced by the current highlighting style . arg can be a string or list of selectors to insert before the token type classes .
def get_style_defs(self, arg=None):
        """
        Return CSS style definitions for the classes produced by the current
        highlighting style. ``arg`` can be a string or list of selectors to
        insert before the token type classes.
        """
        if arg is None:
            arg = ('cssclass' in self.options and '.'+self.cssclass or '')
        if isinstance(arg, basestring):
            args = [arg]
        else:
            args = list(arg)

        def prefix(cls):
            if cls:
                cls = '.' + cls
            tmp = []
            for arg in args:
                tmp.append((arg and arg + ' ' or '') + cls)
            return ', '.join(tmp)

        styles = [(level, ttype, cls, style)
                  for cls, (style, ttype, level) in self.class2style.iteritems()
                  if cls and style]
        styles.sort()
        lines = ['%s { %s } /* %s */' % (prefix(cls), style, repr(ttype)[6:])
                 for (level, ttype, cls, style) in styles]
        if arg and not self.nobackground and \
           self.style.background_color is not None:
            text_style = ''
            if Text in self.ttype2class:
                text_style = ' ' + self.class2style[self.ttype2class[Text]][0]
            lines.insert(0, '%s { background: %s;%s }' %
                         (prefix(''), self.style.background_color, text_style))
        if self.style.highlight_color is not None:
            lines.insert(0, '%s.hll { background-color: %s }' %
                         (prefix(''), self.style.highlight_color))
        return '\n'.join(lines)
def get_style_defs ( self , arg = None ) : if arg is None : arg = ( 'cssclass' in self . options and '.' + self . cssclass or '' ) if isinstance ( arg , basestring ) : args = [ arg ] else : args = list ( arg ) def prefix ( cls ) : if cls : cls = '.' + cls tmp = [ ] for arg in args : tmp . append ( ( arg and arg + ' ' or '' ) + cls ) return ', ' . join ( tmp ) styles = [ ( level , ttype , cls , style ) for cls , ( style , ttype , level ) in self . class2style . iteritems ( ) if cls and style ] styles . sort ( ) lines = [ '%s { %s } /* %s */' % ( prefix ( cls ) , style , repr ( ttype ) [ 6 : ] ) for ( level , ttype , cls , style ) in styles ] if arg and not self . nobackground and self . style . background_color is not None : text_style = '' if Text in self . ttype2class : text_style = ' ' + self . class2style [ self . ttype2class [ Text ] ] [ 0 ] lines . insert ( 0 , '%s { background: %s;%s }' % ( prefix ( '' ) , self . style . background_color , text_style ) ) if self . style . highlight_color is not None : lines . insert ( 0 , '%s.hll { background-color: %s }' % ( prefix ( '' ) , self . style . highlight_color ) ) return '\n' . join ( lines )