Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda