# GENERATE CSSOM from cssattrs import cssidlattributes 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 " + attribute + ";\n" return value def generate_propertytable(): value = "" for attribute in cssidlattributes.split("\n"): identifier = "dom-CSSStyleDeclaration-" + attribute value += " \n " + attribute + "\n \"" + property_from_attribute(attribute) + "\"\n" return value def generate_spec(): source = open("./cssom-source", "r").read() source = source.replace("\n", generate_propertyidl()) source = source.replace("\n", generate_propertytable()) file = open("./Overview.src.html", "w") file.write(source) file.close() if __name__ == '__main__': generate_spec()