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

Add sprintf formatting support #2

Open
rymohr opened this issue Mar 8, 2013 · 1 comment
Open

Add sprintf formatting support #2

rymohr opened this issue Mar 8, 2013 · 1 comment

Comments

@rymohr
Copy link
Member

rymohr commented Mar 8, 2013

Support standard sprintf notation with this library: http://www.diveintojavascript.com/projects/javascript-sprintf

template = "{{followers/following%0.2f}}" # round to two decimals

We'll want to build in sensible defaults too.

We'll also want to add in a shorthand notation for rounding (will be the most common operation by far):

"{{expression%0}}" => round to whole
"{{expression%n}}" => round nth decimal

Anyone that's worried about padding can use the sprintf notation.

@rymohr
Copy link
Member Author

rymohr commented Mar 9, 2013

For shorthand notation we can just rely on javascript's toFixed method.

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