-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathcssom-generate.py
More file actions
executable file
·163 lines (154 loc) · 2.63 KB
/
cssom-generate.py
File metadata and controls
executable file
·163 lines (154 loc) · 2.63 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# GENERATE CSSOM
cssidlattributes = """azimuth
background
backgroundAttachment
backgroundColor
backgroundImage
backgroundPosition
backgroundRepeat
border
borderCollapse
borderColor
borderSpacing
borderStyle
borderTop
borderRight
borderBottom
borderLeft
borderTopColor
borderRightColor
borderBottomColor
borderLeftColor
borderTopStyle
borderRightStyle
borderBottomStyle
borderLeftStyle
borderTopWidth
borderRightWidth
borderBottomWidth
borderLeftWidth
borderWidth
bottom
captionSide
clear
clip
color
content
counterIncrement
counterReset
cue
cueAfter
cueBefore
cursor
direction
display
elevation
emptyCells
cssFloat
font
fontFamily
fontSize
fontSizeAdjust
fontStretch
fontStyle
fontVariant
fontWeight
height
left
letterSpacing
lineHeight
listStyle
listStyleImage
listStylePosition
listStyleType
margin
marginTop
marginRight
marginBottom
marginLeft
markerOffset
marks
maxHeight
maxWidth
minHeight
minWidth
orphans
outline
outlineColor
outlineStyle
outlineWidth
overflow
padding
paddingTop
paddingRight
paddingBottom
paddingLeft
page
pageBreakAfter
pageBreakBefore
pageBreakInside
pause
pauseAfter
pauseBefore
pitch
pitchRange
playDuring
position
quotes
richness
right
size
speak
speakHeader
speakNumeral
speakPunctuation
speechRate
stress
tableLayout
textAlign
textDecoration
textIndent
textShadow
textTransform
top
unicodeBidi
verticalAlign
visibility
voiceFamily
volume
whiteSpace
widows
width
wordSpacing
zIndex"""
def property_from_attribute(attribute):
output = ""
if attribute == "cssFloat":
return "float"
for char in attribute:
if char.isupper():
output += "-"
output += char.lower()
else:
output += char
return output
def generate_propertyidl():
value = ""
for attribute in cssidlattributes.split("\n"):
value += " attribute DOMString <span title=\"dom-CSSStyleDeclaration-" + attribute + "\">" + attribute + "</span>;\n"
return value
def generate_propertytable():
value = ""
for attribute in cssidlattributes.split("\n"):
identifier = "dom-CSSStyleDeclaration-" + attribute
value += " <tr>\n <td><dfn title=\"" + identifier + "\"><code>" + attribute + "</code></dfn></td>\n <td>\"<code>" + property_from_attribute(attribute) + "</code>\"</td>\n"
return value
def generate_spec():
source = open("./cssom-source", "r").read()
source = source.replace("<!--CSSOM-DECLARATIONIDL-->\n", generate_propertyidl())
source = source.replace("<!--CSSOM-DECLARATIONTABLE-->\n", generate_propertytable())
file = open("./Overview.src.html", "w")
file.write(source)
file.close()
if __name__ == '__main__':
generate_spec()