def write_pseudo_elements(atoms, target_filename): pseudos = [] for atom in atoms: if atom.type() == "nsICSSPseudoElement" or atom.type() == "nsICSSAnonBoxPseudo": pseudos.append(atom) pseudo_definition_template = os.path.join(GECKO_DIR, "pseudo_element_definition.mako.rs") contents = build.render(pseudo_definition_template, PSEUDOS=pseudos) with FileAvoidWrite(target_filename) as f: f.write(contents)
def write_pseudo_elements(atoms, target_filename): pseudos = [] for atom in atoms: if atom.type() == "nsCSSPseudoElementStaticAtom" or atom.type() == "nsCSSAnonBoxPseudoStaticAtom": pseudos.append(atom) pseudo_definition_template = os.path.join(GECKO_DIR, "pseudo_element_definition.mako.rs") print("cargo:rerun-if-changed={}".format(pseudo_definition_template)) contents = build.render(pseudo_definition_template, PSEUDOS=pseudos) with FileAvoidWrite(target_filename) as f: f.write(contents)