Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Statically modify procedurally generated html with javascript server side

This is a bit of a newbie question. I am not quite sure what words to search for...

I am currently using latexml to generate html pages from latex documents. Since the html documents are procedurally generated (and should be regenerated whenever the latex files change) manually editing them is not an option. Now to make proofs collapsible I essentially replace the div tags with details and convert the headline into the summary:

// https://stackoverflow.com/a/65090521/6662425
function changeTag (node, tag) {
    const clone = document.createElement(tag);
    for (const attr of node.attributes) {
      clone.setAttributeNS(null, attr.name, attr.value);
    }
    while (node.firstChild) {
      clone.appendChild(node.firstChild);
    }
    node.replaceWith(clone);
    return clone;
}

window.addEventListener("load", function() {
    const proofs = document.getElementsByClassName("ltx_proof");

    if(proofs.size != 0){
        for(let proof of proofs) {
            proof = changeTag(proof, "details");
            proof_name = changeTag(proof.children[0], "summary");
            proof_name.classList.remove("ltx_runin");
        }
    }
})

which is in some sense tragic, as it waits for the site to load to modify the site once and then pretend it never existed. The html document could have been served like that in the first place of course. So the question is: Is there a way to execute java script server side to realize these static modifications as an html document?

Or would I have to use a different language for that?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!