Skip to content

Commit

Permalink
better latex macros
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Feb 10, 2025
1 parent f0da7d6 commit 60f52c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
33 changes: 12 additions & 21 deletions infra/nightly-resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,7 @@ function addTableTo(element, data, title) {
navigator.clipboard.writeText(table);
};

// add a button that copies latex macros for table
const copyMacrosButton = document.createElement("button");
copyMacrosButton.innerText = "Copy Latex Macros";
copyMacrosButton.onclick = () => {
const macros = nestedJsonToLatexMacros(
data,
"name",
"executions",
"runMethod",
);
console.log("macros");
console.log(macros);
navigator.clipboard.writeText(macros);
};

element.appendChild(copyButton);
element.appendChild(copyMacrosButton);

// add a new div for the table
const tableDiv = document.createElement("div");
Expand Down Expand Up @@ -130,18 +114,25 @@ function refreshView() {

// fill in the overall stats table
const overallStats = getOverallStatistics();

console.log("here");
addTableTo(document.getElementById("tables"), overallStats, "Overall Stats");

var latexMacros = "";
latexMacros = latexMacros + jsonToLatexMacros(overallStats, "runMethod", "");

for (const suite of getSuites()) {
const tableData = tableForSuite(suite);
addTableTo(document.getElementById("tables"), tableData, suite + " Stats");
latexMacros = latexMacros + nestedJsonToLatexMacros(
tableData,
"name",
"executions",
"runMethod",
);
}

renderWarnings();
refreshChart();
refreshLatexMacros();
refreshLatexMacros(latexMacros);
}

function renderWarnings() {
Expand Down Expand Up @@ -227,10 +218,10 @@ async function buildNightlyDropdown(element, previousRuns, initialIdx) {
select.value = formatRun(previousRuns[initialIdx]);
}

async function refreshLatexMacros() {
async function refreshLatexMacros(tableMacros) {
const latexMacrosTextArea = document.getElementById("latex-macros-text");
const latexMacros = await fetch("nightlymacros.tex").then((r) => r.text());
latexMacrosTextArea.value = latexMacros;
latexMacrosTextArea.value = tableMacros + latexMacros;
}

function addGraphs() {
Expand Down
3 changes: 3 additions & 0 deletions infra/nightly-resources/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ function ConvertJsonToTable(
tableClassName,
linkText,
) {
// copy the table right away so we don't mutate it
parsedJson = JSON.parse(JSON.stringify(parsedJson));

//Patterns for links and NULL value
var italic = "<i>{0}</i>";
var link = linkText
Expand Down

0 comments on commit 60f52c3

Please sign in to comment.