-
-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
print fixes, new amount styling api #2080
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since this type is about to change anyway.
This simplifies the code for styling amounts with or without precision. But it complicates the semantics (Nothing is useful only when setting style). Not sure if it's the best way.
Eg "1,000" (with , as a thousands separator and no decimal digits) is now displayed with a decimal mark: "1,000.". "1 000" (where space is a thousands separator) is less ambiguous, but we do the same thing (eg "1 000.") for consistency, and also to help disambiguate when forgetting to quote a numeric commodity symbol (eg "1234 0" where 1234 is a symbol that should have been in double quotes).
simonmichael
added
A-WISH
Some kind of improvement request, hare-brained proposal, or plea.
print
labels
Aug 31, 2023
Notes on print behaviour: print shows up to four amounts per posting: hledger's amount display styling can be divided into: print's styling behaviour over time:
|
simonmichael
force-pushed
the
2023-08-print-style
branch
from
August 31, 2023 05:25
bbc1113
to
c430744
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a rather extensive set of changes to fix a few issues with
print
.Internal changes:
There's a new, consolidated amount styling api, with a new HasAmounts
typeclass. More cleanup is possible.
AmountStyle now makes setting the precision optional.
This simplifies the code for styling amounts, but it complicates
the semantics (Nothing is useful only when setting style).
Not sure if it's the best way.
Also some other fields have been renamed/reordered more mnemonically.
Reports now typically do a final amount styling pass, where they can
tweak amount rendering if needed (and can style only the amounts they
are rendering).
An internal styling pass when converting to cost is no longer needed
and has been dropped. (The initial styling pass in journalFinalise
could perhaps be dropped some day, but for now it is still needed.)
User-visible changes:
print now styles costs in balance assertions consistently.
print no longer does inappropriate rounding in implicit conversions (#2079).
print now shows a disambiguating decimal mark when needed,
for clarity and reparseability.
Eg "1,000" (with , as a thousands separator and no decimal digits) is
now displayed with a decimal mark: "1,000.".
"1 000" (where space is a thousands separator) is less ambiguous,
but we do the same thing (eg "1 000.") for consistency, and also to
help disambiguate when forgetting to quote a numeric commodity symbol
(eg "1234 0" where 1234 is a symbol that should have been in double quotes).