-
Notifications
You must be signed in to change notification settings - Fork 737
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
Remove . as a operator in Python lexer #1375
Conversation
Thanks for submitting this, @ajnisbet. This does look like an error in the way Pygments and Rouge approach things. Will have a review over the next few days and see! |
@ajnisbet I made a change as removing the line that tokenised My suggestion is that we add rouge/lib/rouge/lexers/python.rb Line 79 in a2d870a
In themes that render Let me know your thoughts. |
Yeah that seems like a good solution! |
@jneen I don't imagine you're a big Python user but do you have an opinion? I'm hesitant to break ranks with Pygments (see the relevant line in their codebase)—especially given it is a Python project—but tokenising |
@ajnisbet Sorry it took so long to address this. This update will be part of the next version of Rouge which is scheduled for release on Tuesday 14 April. Thanks for the contribution! |
Rouge, consistent with Pygments, lexes `.` as an operator. Doing so causes issues with numbers that use `.`. The Python specification does not identify `.` as an operator. This commit instead causes `.` to be lexed as punctuation.
Fixes #1374