Gets a map of spec name to list of available versions For example: "align" -> [3, 4] Parses spec directory names in the format "css-{name}-{version}"
(client: &Client)
| 101 | /// |
| 102 | /// Parses spec directory names in the format "css-{name}-{version}" |
| 103 | pub async fn get_spec_versions(client: &Client) -> Result<HashMap<String, Vec<usize>>> { |
| 104 | let text = fetch_cached(client, GITHUB_CSSWG_TREE_URL, "index.json").await?; |
| 105 | let v: Value = serde_json::from_str(&text)?; |
| 106 | let paths = extract_tree_directories(&v)?; |
| 107 | |
| 108 | let mut map: HashMap<String, Vec<usize>> = HashMap::new(); |
| 109 | for path in paths { |
| 110 | if let Some((name, version)) = parse_spec_path(&path) { |
| 111 | map.entry(name).or_default().push(version); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | for versions in map.values_mut() { |
| 116 | versions.sort(); |
| 117 | } |
| 118 | |
| 119 | Ok(map) |
| 120 | } |
| 121 | |
| 122 | /// Gets the commit SHA of the csswg-drafts repository main branch |
| 123 | /// |
no test coverage detected