MCPcopy Create free account
hub / github.com/csskit/csskit / generate_single_spec

Function generate_single_spec

crates/csskit_spec_generator/src/main.rs:73–100  ·  view source on GitHub ↗

Generates code for a single spec by processing all its versions Accumulates properties from all spec versions, with later versions overwriting earlier ones for properties with the same name, then generates a single Rust module containing all the property definitions.

(
	client: &reqwest::Client,
	name: &str,
	versions: &[usize],
	verbose: bool,
	property_descriptions: &PropertyDescriptions,
	csswg_sha: Option<&str>,
)

Source from the content-addressed store, hash-verified

71/// earlier ones for properties with the same name, then generates a single Rust
72/// module containing all the property definitions.
73async fn generate_single_spec(
74 client: &reqwest::Client,
75 name: &str,
76 versions: &[usize],
77 verbose: bool,
78 property_descriptions: &PropertyDescriptions,
79 csswg_sha: Option<&str>,
80) -> Result<()> {
81 let (properties, latest_version) = collect_properties_from_versions(client, name, versions).await?;
82
83 if properties.is_empty() {
84 println!(" No properties found across all versions");
85 return Ok(());
86 }
87
88 println!(" Total unique properties across all versions: {}", properties.len());
89
90 let code = generate_spec_module(name, latest_version, &properties, None, None, property_descriptions, csswg_sha);
91 let line_count = code.lines().count();
92
93 if verbose {
94 show_verbose_output(&properties, &code, line_count);
95 }
96
97 write_spec_module(name, &code)?;
98
99 Ok(())
100}
101
102/// Collects and merges properties from all versions of a spec
103///

Callers 1

mainFunction · 0.85

Calls 5

generate_spec_moduleFunction · 0.85
show_verbose_outputFunction · 0.85
write_spec_moduleFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected