mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Minimal formatting to render beancount results legibly on web interface
This commit is contained in:
@@ -38,6 +38,12 @@
|
|||||||
}).join("\n"));
|
}).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) {
|
function render_json(data, query, type) {
|
||||||
if (type === "markdown") {
|
if (type === "markdown") {
|
||||||
return render_markdown(query, data);
|
return render_markdown(query, data);
|
||||||
@@ -47,6 +53,8 @@
|
|||||||
return render_org(query, data, "music-");
|
return render_org(query, data, "music-");
|
||||||
} else if (type === "image") {
|
} else if (type === "image") {
|
||||||
return data.map(render_image).join('');
|
return data.map(render_image).join('');
|
||||||
|
} else if (type === "ledger") {
|
||||||
|
return render_ledger(query, data);
|
||||||
} else {
|
} else {
|
||||||
return `<pre id="json">${JSON.stringify(data, null, 2)}</pre>`;
|
return `<pre id="json">${JSON.stringify(data, null, 2)}</pre>`;
|
||||||
}
|
}
|
||||||
@@ -223,7 +231,11 @@
|
|||||||
#json {
|
#json {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
#results-markdown {
|
#results-ledger {
|
||||||
|
white-space: pre-line;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
#results-markdown {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
#results-music,
|
#results-music,
|
||||||
|
|||||||
Reference in New Issue
Block a user