Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda