mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 21:31:46 +00:00
18 lines
557 B
JavaScript
18 lines
557 B
JavaScript
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}`);
|
|
}
|
|
});
|