Issue #422: Allow importers to specify formatting of postings (blais/beancount)

119 megtekintés
Ugrás az első olvasatlan üzenetre

tbm13

olvasatlan,
2020. febr. 25. 5:07:512020. 02. 25.
– bean...@googlegroups.com
New issue 422: Allow importers to specify formatting of postings
https://bitbucket.org/blais/beancount/issues/422/allow-importers-to-specify-formatting-of

Martin Michlmayr:

By default, bean-extract generates transactions like this:

```
2019-12-07 * "Anonymous" "Donation"
Assets:Receivable 100.00 USD
Income:Donations -100.00 USD
```

I know I can just pipe it into bean-format but I’m wondering if it would be possible to allow importers to format the postings, including spacing and amounts? \(I know I can do amounts by just rounding to the precision I want\).

In any ideal world, this would be per-posting? I like to align different postings with different spacing depending on their nature.

Good idea? Bad idea? Maybe I should just pipe the output to a script that formats it \(that’s actually what I do now\)


Frederick Zhu

olvasatlan,
2023. szept. 15. 0:39:032023. 09. 15.
– Beancount
Hi!

I'd love to reopen this conversation. I think an easy way to go is to provide a way to set up the displaycontext when we write an Importer.

Any thoughts?

Thanks!

Daniele Nicolodi

olvasatlan,
2023. szept. 15. 8:19:272023. 09. 15.
– bean...@googlegroups.com
On 15/09/23 06:29, Frederick Zhu wrote:
> Hi!
>
> I'd love to reopen this conversation. I think an easy way to go is to
> provide a way to set up the displaycontext when we write an Importer.
>
> Any thoughts?

What problem would this solve exactly and how?

Cheers,
Dan

Frederick Zhu

olvasatlan,
2023. szept. 17. 11:02:182023. 09. 17.
– bean...@googlegroups.com
Hi,

I’d like to format my document when extracted. I know bean-format can make alignments for all entries, but first it is another round of iteration, and second, more importantly, it does not attach delimiter to numbers.

For my own usage, I specifically want my currency “USD” ending at column 80, with 2 decimal precision, and the comma delimiter.

Thanks.
> --
> You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/VmAOLXaGb0s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/d5d2ed63-811c-fee9-2a4c-3c16bf23805e%40grinta.net.

Daniele Nicolodi

olvasatlan,
2023. szept. 17. 11:54:332023. 09. 17.
– bean...@googlegroups.com
On 17/09/23 17:02, Frederick Zhu wrote:
> Hi,
>
> I’d like to format my document when extracted. I know bean-format can make alignments for all entries, but first it is another round of iteration, and second, more importantly, it does not attach delimiter to numbers.
>
> For my own usage, I specifically want my currency “USD” ending at column 80, with 2 decimal precision, and the comma delimiter.

How is this fixed by letting the Importer specify the displaycontext?

Cheers,
Dan

Frederick Zhu

olvasatlan,
2023. szept. 17. 23:16:222023. 09. 17.
– bean...@googlegroups.com
DisplayContext allows to set the delimiter. Is there any other way to set the delimiter?

Thanks!
Frederick
> --
> You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/VmAOLXaGb0s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/9f8c8751-615a-5b7b-f21e-5d9b28c8774a%40grinta.net.

Red S

olvasatlan,
2023. szept. 21. 12:59:392023. 09. 21.
– Beancount

May not be what you’re looking for, but I find autobean-format to excel at at this. It’s now a part of my importer scripts, and is also a part of my editor. Here’s everything except precision:

bean-extract <your_args> | autobean-format - --indent " " --thousands-separator=add --spaces-in-braces --currency-column 80 --cost-column 85

And here’s how I use it in vim:

au Filetype beancount let &formatprg="autobean-format - --sort --indent ' ' --thousands-separator=add --spaces-in-braces --currency-column 80 --cost-column 85"

Frederick Zhu

olvasatlan,
2023. szept. 24. 0:47:372023. 09. 24.
– Beancount
Hi! This is super helpful! I am using this now and it is very powerful.

Thanks!

Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet