Created
February 19, 2024 17:48
-
-
Save amb26/e6e301875b30911aa8a93784412ac3b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env node */ | |
"use strict"; | |
const linkedom = require("linkedom"); | |
const arrow = ` | |
<div class="long-down-arrow"> | |
<svg width="16" height="111"> | |
<use href="#downarrow" /> | |
</svg> | |
</div>`; | |
const addArrows = function (document, container) { | |
const sections = container.querySelectorAll(".section.level2"); | |
console.log("Adding arrows to " + sections.length + " sections"); | |
[...sections].slice(0, -1).forEach(section => { | |
const node = linkedom.parseHTML(arrow).document.firstElementChild; | |
section.parentNode.insertBefore(node, section.nextSibling); | |
}); | |
}; | |
const rewriteTaxonLinks = function (document, container) { | |
const links = container.querySelectorAll("a"); | |
console.log("Got ", links.length, " links"); | |
link | |
}; | |
module.exports = {addArrows, rewriteTaxonLinks}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment