From b89efe6e7f2b55e6686969c16a9c7c5a9511bc6a Mon Sep 17 00:00:00 2001 From: Folyd Date: Fri, 28 Jun 2024 22:58:10 -0700 Subject: [PATCH] Move some scripts to submodule --- scripts/cargo-subcommands.js | 18 ------------------ scripts/rust-attributes.js | 33 --------------------------------- 2 files changed, 51 deletions(-) delete mode 100644 scripts/cargo-subcommands.js delete mode 100644 scripts/rust-attributes.js diff --git a/scripts/cargo-subcommands.js b/scripts/cargo-subcommands.js deleted file mode 100644 index 6f38b388..00000000 --- a/scripts/cargo-subcommands.js +++ /dev/null @@ -1,18 +0,0 @@ -// https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands -let subcommands = []; -let subcommandIndex = document.querySelectorAll('.markdown-body>ul>li'); -for (let node of subcommandIndex) { - let a = node.firstElementChild; - let text = node.textContent.split(' - '); - text.shift(); - subcommands.push([prefixCargoSubcommandName(a.textContent), a.href, text.join()]); -} - -function prefixCargoSubcommandName(name) { - if (!name.startsWith("cargo")) { - return `cargo-${name}`; - } - return name; -} - -console.log(JSON.stringify(subcommands)); \ No newline at end of file diff --git a/scripts/rust-attributes.js b/scripts/rust-attributes.js deleted file mode 100644 index 11c7f810..00000000 --- a/scripts/rust-attributes.js +++ /dev/null @@ -1,33 +0,0 @@ -// https://doc.rust-lang.org/reference/attributes.html -// https://doc.rust-lang.org/nightly/reference/attributes.html -const attributeMap = { - doc: [ - "- Specifies documentation.", - "https://doc.rust-lang.org/rustdoc/the-doc-attribute.html", - ], - features: [ - "- Used to enable unstable or experimental compiler features.", - "https://doc.rust-lang.org/unstable-book/index.html", - ], -}; -let attributeIndex = document.querySelectorAll("main>ul:last-child>li"); -for (let node of attributeIndex) { - let title = node.firstChild; - if (["documentation", "features"].includes(title.textContent.toLowerCase().trim())) - continue; - let attributes = node.lastElementChild.querySelectorAll("ul>li"); - attributes.forEach(attribute => { - let description = ""; - - attribute.childNodes.forEach(childNode => { - if (childNode.nodeName !== "A" && childNode.textContent.trim().length > 1) { - description += childNode.textContent; - } - }); - attribute.querySelectorAll("a").forEach(a => { - attributeMap[a.firstChild.textContent] = [description.trim(), a.getAttribute("href")]; - }); - }); -} - -console.log(JSON.stringify(attributeMap)); \ No newline at end of file