canto-next icon indicating copy to clipboard operation
canto-next copied to clipboard

Added string padding/justification option

Open drizbit opened this issue 9 years ago • 1 comments

Added two variables to allow the user to "even out" the entries in their Reddit RSS feed.

The variables are passed as parameters to str.ljust() for entry["reddit-score"] and entry["subreddit"].

drizbit avatar Oct 01 '16 06:10 drizbit

Hey, thanks for the pull request. I like the intention of this patch, but I think it might be improved a bit.

In order to overwrite the old score, there's a regex substitution that assumes there's only one space after the previous score, so as items get re-processed, the padding slowly increases as the extra justify spaces aren't removed. You should update that regex to something like "^\d+\s+", although that would also eat opening whitespace of titles if subreddit isn't prepended it's an improvement over the current state. Subreddit looks okay since that's only done once.

Also, just a nit, the example is needlessly verbose. I'd do away with the 0 / 0 example since that's the default behavior even without this change, and just keep the 7 / 15 example. Might be nice to not reference Trump in the example too, even though I got a good laugh out of it, I just don't think I can stand the idea of his name sitting in my codebase.

themoken avatar Oct 01 '16 20:10 themoken