hledger icon indicating copy to clipboard operation
hledger copied to clipboard

hledger is not a subset of ledger format

Open tbm opened this issue 5 years ago • 15 comments

https://hledger.org/journal.html

hledger’s journal format is a compatible subset, mostly, of ledger’s journal format, so hledger can work with compatible ledger journal files as well

I don't think that's true anymore. You have some syntax that is not allowed in ledger.

I can think of at least:

  • ~~transactions with zero postings~~
  • The =* and ==* syntax

Feel free to close this bug since this is fairly minor, but I think it's best to clarify it in the docs, i.e. that hledger's format is inspired and largely compatible but has diverged in some areas.

tbm avatar Jul 26 '20 05:07 tbm

Actually, to my surprise transactions with zero postings are allowed in ledger.

tbm avatar Jul 26 '20 05:07 tbm

Maybe the right solution is to propose the =* syntax for inclusion in ledger.

tbm avatar Jul 26 '20 05:07 tbm

A decimal mark can be written as a period or a comma

This is only allowed in ledger with a command-line option and you can't mixed in the same file as you can in hledger.

tbm avatar Jul 26 '20 08:07 tbm

separated by a “digit group mark” - a space, comma, or period

space: not supported in ledger.

tbm avatar Jul 26 '20 08:07 tbm

end aliases will give an error in ledger:

Error: 'end' or 'end apply' found, but no enclosing 'apply' directive

tbm avatar Jul 26 '20 08:07 tbm

Two spaces between period expression and description

I think that's not allowed in ledger

tbm avatar Jul 26 '20 08:07 tbm

"You can make a stronger “total” balance assertion by writing a double equals sign" -> not in ledger

tbm avatar Jul 26 '20 12:07 tbm

@tbm thanks for these. It says "mostly", which I figured gave enough wiggle room. It could be made more informative.

But where do you think is best:

  • https://hledger.org/faq.html#journal-format is where differences are listed currently, I could update those sections.
  • a dedicated "compatibility" document (page) describing hledger's similarities and differences to Ledger; Beancount; and whatever else comes along.
  • a separate document for each comparison: hledger and Ledger, hledger and Beancount, hledger and gnucash...
  • instead of separate documents, new sections (or one cover-all section) within each hledger manual: hledger, journal, timeclock...

?

simonmichael avatar Jul 28 '20 00:07 simonmichael

PS, the advantage of putting it in the manuals of course is that it'll be available wherever folks are using man or info, including offline. And it'll be nearer to the relevant main doc. But it'd be more fragmented. A FAQ entry could tie those sections together again with links.

simonmichael avatar Jul 28 '20 00:07 simonmichael

  1. I would add a link to the FAQ from the journal page which says subset.
  2. The FAQ entry doesn't seem complete, e.g. ==* is not emtnioned.
  3. I'd like to see compatibility overview. I've been thinking of writing one too.

tbm avatar Jul 28 '20 00:07 tbm

There's also plaintextaccounting.org -> Syntax Quick Reference for the Ledger-Likes, https://plaintextaccounting.org/quickref, which was a start at giving equal focus to at least the big three tools. I had some ideas for how to redo this more efficiently (a markdown file with standard structure maintained by each project, a script to combine these into one big table..).

simonmichael avatar Jul 28 '20 00:07 simonmichael

https://plaintextaccounting.org/quickref

That's a great document!

tbm avatar Jul 28 '20 01:07 tbm

Thanks, feel free to take it over!

simonmichael avatar Jul 28 '20 04:07 simonmichael

Also typed metadata, see #1388

tbm avatar Nov 20 '20 05:11 tbm

Also: hledger supports digit group separators like: INR 1,00,00,000.00 whereas ledger doesn't.

the-solipsist avatar Dec 21 '21 21:12 the-solipsist

I've done the first (successful) attempt at parsing journals in Rust and will try to sum up the syntax in a syntax diagram (railroad diagram). See the link and the diagram at the Formats section of the readme: https://github.com/ledger-rs/ledger-rs-prototype

Any input is welcome. I.e. if you wish to add/modify the syntax, you can use the direct link to the diagram editor. Please share back so I can include it in the docs/readme and collaborate. Or just comment and I'll make the changes.

The syntax (for now) covers the basics, i.e. no tags, scheduled transactions, and other exotics.

alensiljak avatar May 10 '23 11:05 alensiljak

2023 update: ledger/hledger file format and other differences are documented in detail at https://hledger.org/ledger.html , and I have pushed an update to the "subset" wording at https://hledger.org/dev/hledger.html#about-journal-format .

simonmichael avatar May 10 '23 12:05 simonmichael