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
Switch to table-layout for tabular layout #1850
base: master
Are you sure you want to change the base?
Conversation
38a1ee2
to
5ffa4bb
Compare
This PR would open the door to a number of potential improvements/customisations.
|
e3117f8
to
4f48997
Compare
93346f1
to
acaf9b9
Compare
It also means that --layout=bare can function with custom format strings. The commodity column will be displayed immediately after the totals column, left aligned. Default width for a balance report with --layout=bare is harmonised with the ordinary balance report.
of WideBuilder. Use buildCell to convert this to String, Text, Builder, or other representable forms.
Text.WideString and Text.Tabular.AsciiWide modules are now redundant and can be removed. A local definition of Table and concatTables has been moved to Hledger.Utils.Text.
showMixedAmountOneLineB will now return an ElidableList. This will be padded or trimmed automagically when rendered with grid or table-producing functions, or with the pad or trim functions. The return types of showMixedAmount(|Lines|OneLine)B have changed, but since the return types are still instances of Cell they can be treated the same: just use buildCell to render as you will.
I know you already updated this a bunch of times, but when you get time could you do it once more and I'll review and merge if possible. The hledger-lib/Text/WideString.hs utils are might be useful down the road, could we to keep them around a bit longer ? As you saw in chat I would like to tweak table borders, adding consistent separators for totals. Maybe also using the same style for all borders, making life simpler (rather than adding more complex styling - but no harm to have that ability in the toolbox). How could using table-layout help with decimal aligning ? |
"Align content in a column at a character occurence.", I see, nifty. Might be a bit tricky with our variable decimal marks.. |
It's possible with a custom implementation of |
Fixes #1679. This gets rid of our home-customised Text.Tabular.AsciiWide and Text.WideString modules in favour of the external library table-layout.
At the moment this relies on a few PRs awaiting merge over at table-layout so it's probably not ready to be merged quite yet, but I'm putting it here for comment. I've broken it into several commits so that the changes are more bite-sized, but these changes are not atomic and tests will fail in the middle (mostly due to colouring negative amounts not being reintroduced until showMixedAmountB being updated), though it compiles at each step.