Esempio n. 1
0
    def __str__(self):
        # Sort declaration
        if self.root.get_opt('sort'):
            self.declareset.sort(
                    key=lambda x: SORTING.get(x.name, 999 ))

        nl, ws, ts = self.root.cache['delims']
        semicolon = '' if self.root.cache['opts'].get('compress') else ';'

        return ''.join((

            # Self
            ''.join((

                # Selector tree
                str(self.name),

                "{%s%s%s" % (nl, ws, ws) if self.name else '',

                # Declarations
                (';%s%s%s' % ( nl, ws, ws )).join(str(d) for d in self.declareset),

                semicolon,

                '%s}%s%s' % ( nl, nl, nl ) if self.name else ''

            )) if self.declareset else '',

            # Children
            ''.join(str(r) for r in self.ruleset)
        ))
Esempio n. 2
0
    def __str__(self):
        # Sort declaration
        if self.root.get_opt('sort'):
            self.declareset.sort(key=lambda x: SORTING.get(x.name, 999))

        nl, ws, ts = self.root.cache['delims']
        semicolon = '' if self.root.cache['opts'].get('compress') else ';'

        return ''.join((

            # Self
            ''.join((

                # Selector tree
                str(self.name),
                "{%s%s%s" % (nl, ws, ws) if self.name else '',

                # Declarations
                (';%s%s%s' % (nl, ws, ws)).join(
                    str(d) for d in self.declareset),
                semicolon,
                '%s}%s%s' %
                (nl, nl, nl) if self.name else '')) if self.declareset else '',

            # Children
            ''.join(str(r) for r in self.ruleset)))
Esempio n. 3
0
 def __str__(self):
     name, expr = ''.join(str(s) for s in self.data[0].data ), self.data[2:]
     if not SORTING.has_key(name.strip('*_')) and self.root.get_opt('warn'):
         warn("Unknown declaration: %s" % name)
     return ( ':' + self.root.delims[1] ).join([
         ''.join(str(s) for s in name),
         ' '.join(str(e) for e in expr)])
Esempio n. 4
0
    def __str__(self):
        self.parse_declareset()

        if self.root.get_opt('sort'):
            self.declaration.sort(key=lambda x: SORTING.get( str(x.data[0]), 999 ))

        nl, ws, ts = self.root.delims

        return ''.join((

            # Rule
            ''.join((

                # Selectors
                '\n' + ', '.join(str(s) for s in self.selectorgroup),

                # Declarations
                ws + '{' + nl + ts,
                (';' + nl + ts).join(
                    str(d) for d in self.declaration),
                '}' + nl

            )) if self.declaration else '',

            # Children rules
            ''.join(str(r) for r in self.ruleset)

        ))
Esempio n. 5
0
    def __str__(self):
        """ Warning on unknown declaration
            and write current in outstring.
        """
        if ( not SORTING.has_key(self.name.strip('*_'))
                and self.root.get_opt('warn') ):
            warn("Unknown declaration: %s" % self.name)

        return (":%s" % self.root.cache['delims'][1] ).join(
                (self.name, self.expr))
Esempio n. 6
0
    def __str__(self):
        """ Warning on unknown declaration
            and write current in outstring.
        """
        if ( not SORTING.has_key(self.name.strip('*_'))
                and self.root.get_opt('warn') ):
            warn("Unknown declaration: %s" % self.name)

        return (":%s" % self.root.cache['delims'][1] ).join(
                (self.name, self.expr))
Esempio n. 7
0
    def __str__(self):
        """ Warning on unknown declaration
            and write current in outstring.
        """
        name = self.name.strip("*_#")
        if name.startswith("-moz-"):
            name = name[5:]
        elif name.startswith("-webkit-"):
            name = name[8:]
        elif name.startswith("-o-"):
            name = name[3:]
        elif name.startswith("-ms-"):
            name = name[4:]

        if not SORTING.has_key(name) and self.root.get_opt("warn"):
            warn("Unknown declaration: %s" % self.name)

        return (":%s" % self.root.cache["delims"][1]).join((self.name, self.expr))
Esempio n. 8
0
    def __str__(self):
        """ Warning on unknown declaration
            and write current in outstring.
        """
        name = self.name.strip('*_#')
        if name.startswith('-moz-'):
            name = name[5:]
        elif name.startswith('-webkit-'):
            name = name[8:]
        elif name.startswith('-o-'):
            name = name[3:]
        elif name.startswith('-ms-'):
            name = name[4:]

        if (not SORTING.has_key(name) and self.root.get_opt('warn')):
            warn("Unknown declaration: %s" % self.name)

        return (":%s" % self.root.cache['delims'][1]).join(
            (self.name, self.expr))