1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 def generate(output
, template
, dataFile
):
10 with
open(template
, "r") as f
:
11 template
= string
.Template(f
.read())
12 data
= runpy
.run_path(dataFile
)["data"]
18 for prop
in data
.values():
19 if prop
.type() != "alias":
20 if prop
.type() == "longhand":
21 assert shorthand_count
== 0
24 assert alias_count
== 0
26 property_ids
.append("eCSSProperty_{}".format(prop
.id))
29 property_ids
.append("eCSSPropertyAlias_{}".format(prop
.alias_id
))
31 output
.write("/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT */\n\n")
35 "property_ids": "\n".join(" {},".format(p
) for p
in property_ids
),
36 "longhand_count": property_ids
[longhand_count
],
37 "shorthand_count": property_ids
[longhand_count
+ shorthand_count
],