From 5cda7c582a61b12c3c21ef114dc03570c8c3d0e9 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 22 Nov 2023 15:27:41 -1000 Subject: [PATCH] ;doc: amount formatting: edits (#2115) --- hledger/hledger.m4.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 614a6f029..472175fa9 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -4345,30 +4345,31 @@ file. If you're wondering why your `print` report sometimes shows trailing decimal marks, even when there are no decimal digits; it does this to -disambiguate [ambiguous amounts](decimal-marks-digit-group-marks) +disambiguate [ambiguous amounts](#decimal-marks-digit-group-marks) (amounts which have one digit group mark and no decimal digits), allowing them to be re-parsed reliably. More generally: hledger output falls into three rough categories, which format amounts a little bit differently to suit different consumers: -**1. "hledger-readable output" - should be readable by hledger and by humans** +**1. "hledger-readable output" - should be readable by hledger (and by humans)** - - It is produced by reports that show full journal entries: `print`, `import`, `close`, `rewrite` etc. + - This is produced by reports that show full journal entries: `print`, `import`, `close`, `rewrite` etc. - It shows amounts with their original journal precisions, which may not be consistent. - It adds a trailing decimal mark when needed to avoid showing ambiguous amounts. - - It can be parsed reliably. + - It can be parsed reliably (by hledger and ledger2beancount at least, but perhaps not by Ledger..) **2. "human-readable output" - usually for humans** - - It is produced by all other reports. + - This is produced by all other reports. - It shows amounts with standard display precisions, which will be consistent within each commodity. - - It can show ambiguous amounts. - - It can be parsed reliably in the context of a known report (because of consistent style). + - It shows ambiguous amounts unmodified. + - It can be parsed reliably in the context of a known report + (when you know decimals are consistently not being shown, you can assume a single mark is a digit group mark). **3. "machine-readable output" - usually for other software** - - It is produced by all reports when an output format like `csv`/`tsv`/`json`/`sql` is selected. + - This is produced by all reports when an output format like `csv`, `tsv`, `json`, or `sql` is selected. - It shows no digit group marks. - It shows a period decimal mark (.) when there are decimal digits. - It can be parsed reliably.