It mostly matches the current KiCADv8 s-expression styling but diverges from KiCADv8's output style in that the 'xy' element inside 'pts' is also indented on a new line. This is because KiCADv8's styling rule is not consistent specifically regarding the 'pts' element.
But aside from that, it matches close enough to be useful as a 'output' cleaner for your utility, so you may want to consider piping your output though this at least.
This also provides an additional opportunity for testing your function. If you get a valid KiCADv8 document and you then lint it and also formatter the output of your kiutils then you will be able to do an automated diff to make sure there is no regression introduced.
This is because if I do not make any changes to a document then opening/saving the document should emit the same output.
While debugging a bug in kiutils. I've written up a https://gist.github.com/mofosyne/93ad8d64fb40ef80f6af3b09dc755414 s-expression formatter for it.
It mostly matches the current KiCADv8 s-expression styling but diverges from KiCADv8's output style in that the 'xy' element inside 'pts' is also indented on a new line. This is because KiCADv8's styling rule is not consistent specifically regarding the 'pts' element.
But aside from that, it matches close enough to be useful as a 'output' cleaner for your utility, so you may want to consider piping your output though this at least.
This also provides an additional opportunity for testing your function. If you get a valid KiCADv8 document and you then lint it and also formatter the output of your kiutils then you will be able to do an automated diff to make sure there is no regression introduced.
This is because if I do not make any changes to a document then opening/saving the document should emit the same output.