File: imports.py

package info (click to toggle)
cssutils 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,312 kB
  • sloc: python: 23,625; javascript: 803; sh: 62; makefile: 8
file content (47 lines) | stat: -rw-r--r-- 895 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os.path

import cssutils

EXPOUT = '''@charset "iso-8859-1";
@import "1inherit-iso.css";

##############################
1inherit-iso.css
##############################
@charset "iso-8859-1";
@import "2inherit-iso.css";
/* 1 inherited encoding iso-8859-1 */

====================
2inherit-iso.css
====================
@charset "iso-8859-1";
/* 2 inherited encoding iso-8859-1 */



'''
EXPERR = ''


def main():
    def p(s, len=0):
        c = '#=-'[len] * (30 - len * 10)
        for r in s.cssRules.rulesOfType(cssutils.css.CSSRule.IMPORT_RULE):
            print(c)
            print(r.href)
            print(c)
            print(r.styleSheet.cssText)
            print()
            p(r.styleSheet, len=len + 1)
            print()

    s = cssutils.parseFile(os.path.join('sheets', '1import.css'))
    print(s.cssText)
    print()

    p(s)


if __name__ == '__main__':
    main()