;doc: amount formatting: edits (#2115)
This commit is contained in:
parent
edf6738109
commit
5cda7c582a
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user