Minimal formatting to render beancount results legibly on web interface

This commit is contained in:
Debanjum Singh Solanky 2022-08-13 04:46:03 +03:00
parent a0759dd923
commit 3300378804

View file

@ -38,6 +38,12 @@
}).join("\n"));
}
function render_ledger(query, data) {
return `<div id="results-ledger">` + data.map(function (item) {
return `<p>${item.entry}</p>`
}).join("\n") + `</div>`;
}
function render_json(data, query, type) {
if (type === "markdown") {
return render_markdown(query, data);
@ -47,6 +53,8 @@
return render_org(query, data, "music-");
} else if (type === "image") {
return data.map(render_image).join('');
} else if (type === "ledger") {
return render_ledger(query, data);
} else {
return `<pre id="json">${JSON.stringify(data, null, 2)}</pre>`;
}
@ -223,7 +231,11 @@
#json {
white-space: pre-wrap;
}
#results-markdown {
#results-ledger {
white-space: pre-line;
text-align: left;
}
#results-markdown {
text-align: left;
}
#results-music,