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

Edited Python language: Added 'self' keyword and 'class-name' #677

Merged
merged 4 commits into from
Aug 19, 2015

Conversation

gibsjose
Copy link
Contributor

Added 'self' as keyword and added 'class-name' matching to Python language.

@@ -8,9 +8,16 @@ Prism.languages.python= {
pattern: /((^|\s)def[ \t]+)([a-zA-Z_][a-zA-Z0-9_]*(?=\())/g,
lookbehind: true
},
'keyword' : /\b(as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,
'keyword' : /\b(as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|self|try|while|with|yield)\b/,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon further review, it appears that self is not a keyword (which is likely why it wasn't there in the first place...). I will correct this and commit an updated version only including the class-name.

@@ -14,3 +14,10 @@ Prism.languages.python= {
'operator' : /[-+]|<=?|>=?|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|@|~|\^|%|\b(or|and|not)\b/,
'punctuation' : /[{}[\];(),.:]/
};

Prism.languages.insertBefore('python', 'keyword', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need for the insertBefore() here. The class-name pattern could go directly into before the keyword key in the object above.

@Golmote
Copy link
Contributor

Golmote commented Aug 18, 2015

Thanks for contributing! Please take a look at my comment.

@gibsjose
Copy link
Contributor Author

Fixed!

Golmote added a commit that referenced this pull request Aug 19, 2015
Edited Python language: Added 'class-name'
@Golmote Golmote merged commit d9d4ab2 into PrismJS:gh-pages Aug 19, 2015
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

Successfully merging this pull request may close these issues.

None yet

2 participants