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
pygments 2.7.3 broke pygments-ansi-color's html formatter subclass #1644
Comments
This is a private API (it's a private function after all), so we're free to change. However: What was the use case to use that in the first place that broke? Maybe we can do something about that. |
I'm trying to add additional css classes based on the tokens. For example right now, to mark something as bold red the token is named So there's a special override of This has worked nicely until |
@kurtmckee , assuming you're around: Was it important to have |
My guess is that putting the span into the return value was helpful for memory reduction -- longer strings meant greater memory savings. Let me take a look back at this when I'm off work and get back to you.
|
Thanks Kurt! If it makes anything slower then please keep the change as-is. As to the original issue, I wonder if that should be an option actually, i.e. to turn |
@Anteru, it looks like I can move the span wrapping code to the @asottile, sorry for the problems this caused.
That parenthesized bit concerns me, but I don't recognize those tokens. Are you saying that Pygments is returning identical tokens with different names? If so, please open a bug report with any relevant info you can provide, and @ me somewhere in it. I'd be interested in figuring out why that's happening, but I want to investigate that separately from fixing this. |
They come from the lexer linked which parses ansi escape sequences. For example these (rightfully) will produce two sets of tokens:
the first has Text.Color.Bold then Text.Color.Bold.Red then Text.Color.Red then Text |
This should revert the behavior of the function without losing the overall caching behavior that was intended. Closes pygments#1644
This should revert the behavior of the function without losing the overall caching behavior that was intended. Closes #1644
The changes in #1569 made changes to
_get_css_classes
(which now returns a<span ...>
instead of css classes like the name suggests)I understand this is a private api and all bets are off, but I was surprised to see a break in a patch version nonetheless.
See also chriskuehl/pygments-ansi-color#11
The text was updated successfully, but these errors were encountered: