hledger icon indicating copy to clipboard operation
hledger copied to clipboard

print: allow decimal point aligning, like ledger-mode (WIP)

Open simonmichael opened this issue 6 years ago • 2 comments

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 mark alignment, it needs to know which part of each rendered amount is to left and which to the right of the decimal mark. 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).

simonmichael avatar Jun 13 '19 19:06 simonmichael

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.

alerque avatar Oct 08 '19 15:10 alerque