Skip to content
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: allow decimal point aligning, like ledger-mode (WIP) #1052

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simonmichael
Copy link
Owner

@simonmichael simonmichael commented Jun 13, 2019

Part of #1045. I created showTransaction2 and helpers, with the immediate goal of (a) clarifying this code and (b) implementing output like ledger-mode's :decimal setting.

What I had in mind: for postingAsLines to do decimal point alignment, it needs to know which part of each rendered amount is to left and which to the right of the decimal point. The decimal mark can be period or comma, and that character can also appear in a (double quoted) commodity symbol, so parsing the rendered amount seems a bit fiddly with potential to get out of sync with rendering code. I thought instead to have helpers like showMixedAmountLR & showMixedAmountOneLineLR which return the left and right parts; possibly showMixedAmount[OneLine] would use these also. These would need a showAmountLR :: Amount -> (String,String).

And use it. Plus some comments on decimal point aligning.
@simonmichael simonmichael changed the title print: duplicate/refactor/document txn rendering code (#1045) (WIP) print: allow decimal point aligning, like ledger-mode (WIP) Jun 13, 2019
@simonmichael simonmichael added A-WISH Some kind of improvement request, hare-brained proposal, or plea. help wanted print labels Jun 13, 2019
@simonmichael simonmichael added the needs:code To unblock: needs code/code updates label Jul 15, 2019
@alerque
Copy link
Collaborator

alerque commented Oct 8, 2019

I've tampered with this a couple times but my Haskell isn't really up to delivering anything useful. On the other hand I do wish for it to be done quite frequently. My current reliance on the vim plugin to normalize my journal files is somewhat brittle and, while it gets closer to this output than hledger does now, leaves a lot to be desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request, hare-brained proposal, or plea. needs:code To unblock: needs code/code updates needs:rebase To unblock: needs to be rebased against latest master branch print
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants