Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicRenderer: Postings not properly aligned #50

Open
OliverEvans96 opened this issue Sep 6, 2023 · 0 comments
Open

BasicRenderer: Postings not properly aligned #50

OliverEvans96 opened this issue Sep 6, 2023 · 0 comments

Comments

@OliverEvans96
Copy link

Hello,

Thank you for this package! It's overall been great.

Just a minor bug I noticed: postings are aligned individually using tabs. If there is a significant difference in the length of the account names, the costs will not be aligned.

for posting in &transaction.postings {
self.render(posting, w)?;
}
render_key_value(self, w, &transaction.meta)
}
}
impl<'a, W: Write> Renderer<&'a Posting<'_>, W> for BasicRenderer {
type Error = BasicRendererError;
fn render(&self, posting: &'a Posting<'_>, w: &mut W) -> Result<(), Self::Error> {
write!(w, "\t")?;
if let Some(flag) = &posting.flag {
write!(w, "{} ", flag)?;
}
self.render(&posting.account, w)?;
write!(w, "\t")?;
self.render(&posting.units, w)?;
if let Some(cost) = &posting.cost {
write!(w, " ")?;
self.render(cost, w)?;
}
if let Some(price) = &posting.price {
write!(w, " @ ")?;
self.render(price, w)?;
}
writeln!(w)?;
render_key_value(self, w, &posting.meta)
}
}

An example output:

2023-09-06 * "Invoice #3 - ML GPU Benchmarks"
	Income:TomJohnson	2500.00 USD
	Assets:AccountsReceivable	2500.00 USD

Thanks,
Oliver

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

No branches or pull requests

1 participant