Closed xuhcc closed 5 years ago
So in regular ledger this is actually invalid. It will parse everything about account
as the account name:
account Assets:Test ; test
check payee =~ /Test/
2019-01-01 * Tex
Assets:Test 10.00 EUR
Assets:Cash
ledger -f a bal --strict --explicit
Warning: "/home/tbm/src/tbm/ledger2beancount/a", line 6: Unknown account 'Assets:Test'
Warning: "/home/tbm/src/tbm/ledger2beancount/a", line 7: Unknown account 'Assets:Cash'
0 Assets
-10.00 EUR Cash
10.00 EUR Test
--------------------
0
And with --debug
:
22ms [DEBUG] Considering account: Assets:Test ; test
So it's unfortunate ledger and hledger don't have the same behaviour here. Although you could argue that ledger's behaviour is broken.
@simonmichael
I can fix ledger2beancount but I'm not sure if I should make it conditional on whether hledger parsing more is on. Arguably treating this a a comment is the right behaviour.
Hmm, the problem is that this is actually valid:
account Assets:Test ; test
check payee =~ /Test/
2019-01-01 * Tex
Assets:Test ; test 10.00 EUR
Assets:Cash
ledger -f a bal --strict --explicit
Warning: "/home/tbm/src/tbm/ledger2beancount/a", line 7: Unknown account 'Assets:Cash'
Warning: "/home/tbm/src/tbm/ledger2beancount/a", line 7: Transaction check failed: (payee =~ /Test/)
0 Assets
-10.00 EUR Cash
10.00 EUR Test ; test
--------------------
0
Yes I think Ledger's behaviour should be changed here.
(I put my account comments on the next line to avoid this incompatibility. But I'd rather declare accounts with one line each.)
Currently ledger2beancount parses them incorrectly:
Results in:
I'm using comments to set account types for hledger:
https://hledger.org/journal.html#account-types-declared-with-tags