moneyguru icon indicating copy to clipboard operation
moneyguru copied to clipboard

Pretty print moneyguru XML file

Open brownnrl opened this issue 6 years ago • 4 comments

Instead of single line serialization, it would be nice to pretty print the XML file for readability. I use a git repo to back up and ensure that moneyguru doesn’t corrupt my financial records. Commits always look like an unreadable single line update so it would be nice to be able to use the history over time. Minor feature, so if it’s interesting enough I can do a PR?

brownnrl avatar Jan 10 '19 03:01 brownnrl

Yes

hsoft avatar Jan 10 '19 12:01 hsoft

Note that loaders/savers are on the radar for short term conversion to C, so the way to pretty print will radically change rather soon (I'll use Glib's XML capabilities, if it works, otherwise I'll probably use libxml)

hsoft avatar Jan 10 '19 12:01 hsoft

The last time I looked into the XML-diff-mess (when also starting to use git to "bullet-proof" my data) IIRC the outcome was that XML inherently does not have a way to mandate sorting elements or some such and it would be up to the tools used to implement some kind of sorting. I think some naive pretty-print-the-saved-file-before-committing attempts resulted in juge blocks being reordered anyway every so often, so I just commit those huge changes and hope fervently to never having to actually use them :)

Maybe we could re-evaluate the options available nowadays (xml, json, yaml, ...?) and the storage scheme used? (I vagely remember some mentioning of chunking the data by year.... ah, there it is: #378)

tuxlifan avatar Jan 10 '19 23:01 tuxlifan

XML serializes elements in the order they're given. IIRC, moneyGuru creates transaction XML nodes in a fairly predictable order (date + position index). A simple pretty printing should go a long way to make moneyGuru files diff-friendly.

hsoft avatar Jan 10 '19 23:01 hsoft