From ffc1cb1c4d260e1d60c59ce0403faaac0c1ad884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Fri, 21 Jun 2024 17:51:29 +0200 Subject: [PATCH] ci: Print version of latest spec page downloaded --- xtask/src/ci/spec_links.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xtask/src/ci/spec_links.rs b/xtask/src/ci/spec_links.rs index 80ab20ab..9d7a5bbe 100644 --- a/xtask/src/ci/spec_links.rs +++ b/xtask/src/ci/spec_links.rs @@ -220,6 +220,31 @@ fn get_page_ids(url: &str) -> Result> { continue; }; + // For the URLs using the "latest" version, log the actual version we got. + if url[URL_PREFIX.len()..].starts_with("latest/") { + // Let's use the `meta` element with the `og:url` property, it contains the original + // relative URL of the page. + if tag.name.0 == b"meta" + && tag + .attributes + .get(b"property".as_slice()) + .is_some_and(|value| value.0 == b"og:url") + { + match tag.attributes.get(b"content".as_slice()) { + Some(value) => { + println!( + "Original URL for latest spec page: {}", + String::from_utf8_lossy(value) + ); + } + None => println!( + "Could not get original URL for latest spec page: /{}", + &url[URL_PREFIX.len()..] + ), + } + } + } + let Some(id) = tag.attributes.get(b"id".as_slice()).and_then(|s| String::from_utf8(s.0.clone()).ok()) else {