cone
cone copied to clipboard
Goal: format is left inverse of parse on restricted transactions
This is sort of a vague idea right now. Briefly, we should have format(parse(transaction)) == transaction
. In other words, our format function should be a left inverse of our parse function. At least for a restricted set of transaction strings, without comments, etc.
We might parse a ledger transaction, that is, a string from a ledger file, and then format that transaction and have the result be identical, in terms of indentation, decimal separator, column alignment, whether currency is on left or right, and whether there is spacing between number and currency.
Right now, this would at least require the external numberLocale, so maybe we can just allow for that for now, and leave it as a goal to remove that variable from the process.
This might also serve to motivate a good class definition for transaction that will work across the different parts of app. For example, whether currency is on left or right, might be a property of each posting.