From 33003788044c67e62c226b2f3d4776bf08e1b0db Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sat, 13 Aug 2022 04:46:03 +0300 Subject: [PATCH] Minimal formatting to render beancount results legibly on web interface --- src/interface/web/index.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/interface/web/index.html b/src/interface/web/index.html index f95127b9..df4d3187 100644 --- a/src/interface/web/index.html +++ b/src/interface/web/index.html @@ -38,6 +38,12 @@ }).join("\n")); } + function render_ledger(query, data) { + return `
` + data.map(function (item) { + return `

${item.entry}

` + }).join("\n") + `
`; + } + 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 `
${JSON.stringify(data, null, 2)}
`; } @@ -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,