-
Notifications
You must be signed in to change notification settings - Fork 10
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
[Feature Request] Journal Prettifier #232
Comments
Right. This is a reasonable feature request, but its hard to do.
I have seen such formatters. I really wish it was built into hledger. Like
gofmt is built into the go toolchain, and preserves comments. I don’t
really want to build another hledger parser that will be bound to drift
from the canonical parser.
The current parser we have for this extension is very weak: just a few
regexps, not powerful enough for reformatting.
…On Mon, 5 Sep 2022 at 19:46, Pranesh Prakash ***@***.***> wrote:
One of the features that the Vim/Emacs ledger-language support add-ons
have is reformatting of the transactions to make them look prettier (e.g.,
with transaction amounts aligned neatly, etc.)
While this is not a very important feature (since one can run hledger
print to obtain somewhat similar results, though it is lossy since it
doesn't preserve inter-transaction comments, etc.), it would be good to
have.
—
Reply to this email directly, view it on GitHub
<#232>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZYOLCKNXQDOITXDDQXJ3V4W6QBANCNFSM6AAAAAAQE2G2G4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
What's wrong with piping through hledger print (and handling inter transaction content
separately) ?
|
Nothing at all. It's just that doing so requires a separate script[1]. So it's just a matter of laziness vs. convenience. At one point, I was using the [1]: Here's a script that does the job for me, at least wrt to the
|
I suppose I'd want to be very careful not to lose data. So I'd want to be very confident that I'm not going to lose data before releasing anything like this. I just tried I assumed Let's try a test for a few language features:
Let's see how much it preserves:
It's good that some of the comments are preserved! But statements for I believe these autoformatters best live alongside the canonical parser: that is, in hledger core, so that the autoformatter parser evolves along with the autoformatter (cf gofmt, rustfmt, clang-format). |
Ah. I misunderstood what @simonmichael meant. I mistakenly thought his question was aimed at me, rather than at @mhansen. The things that
So intra-transaction comments (those attached to transactions and postings) are handled just fine. What aren't handled are inter-transaction comments.
Yes, |
One of the features that the Vim/Emacs ledger-language support add-ons have is reformatting of the transactions to make them look prettier (e.g., with transaction amounts aligned neatly, etc.)
While this is not a very important feature (since one can run
hledger print
to obtain somewhat similar results, though it is lossy since it doesn't preserve inter-transaction comments, etc.), it would be good to have.The text was updated successfully, but these errors were encountered: