Add Display impls for directive#114
Closed
jakobhellermann wants to merge 1 commit intojcornaz:mainfrom
Closed
Conversation
d2ee167 to
5ccffc3
Compare
5ccffc3 to
4827dfc
Compare
These all emit parsable beancount code, but don't promise to keep the exact syntax. E.g. floats are normalized, spacing gets removed.
4827dfc to
9e99921
Compare
Owner
|
Hi, thank you for your contribution, and sorry for the delayed answer. It took me a while to decide what I think about this, but I eventually reached the opinion that this can and should be implemented on the consuming side. There's too much opinions on what would be the correct rendering strategy, and this library's only purpose is to parse beancount syntax, not to produce it. Nevertheless thank you again for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Displayimpls forDirectiveand 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