mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
spec - Cleanup body to only keep "spec-container"
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const cheerio = require("cheerio");
|
||||
|
||||
const dir = path.join(__dirname, "spec-built/multipage");
|
||||
fs.readdirSync(dir).forEach((file) => {
|
||||
if (!file.endsWith(".html")) return;
|
||||
const filePath = path.join(dir, file);
|
||||
const content = fs.readFileSync(filePath, "utf-8");
|
||||
const $ = cheerio.load(content);
|
||||
const container = $("#spec-container");
|
||||
if (container.length) {
|
||||
$("body").empty().append(container);
|
||||
fs.writeFileSync(filePath, $.html());
|
||||
console.log(`Processed ${file}`);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user