Skip to content

Add Display impls for directive#114

Open
jakobhellermann wants to merge 1 commit intojcornaz:mainfrom
jakobhellermann:display-impls
Open

Add Display impls for directive#114
jakobhellermann wants to merge 1 commit intojcornaz:mainfrom
jakobhellermann:display-impls

Conversation

@jakobhellermann
Copy link
Contributor

@jakobhellermann jakobhellermann commented Jan 31, 2026

Even if this library is not meant do modify beancount syntax in place, it's still useful to be able to print a directive in a readable way that corresponds to actual beancount code.

This PR, specifically d54defe, adds Display impls for Directive and its component types.

The impls aren't exactly syntax preserving, e.g. floats get normalized 50.0 -> 50, spaces get removed etc.

Maybe there should also be a comment somewhere that these display impls aren't guaranteed to be stable across semver non-breaking versions.

builds on top of #113 for stable order

@jakobhellermann jakobhellermann force-pushed the display-impls branch 2 times, most recently from d2ee167 to 5ccffc3 Compare February 8, 2026 20:36
These all emit parsable beancount code, but don't promise to keep the
exact syntax. E.g. floats are normalized, spacing gets removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant