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

Ruby: Added missing regex interpolation #2841

Merged
merged 3 commits into from Apr 3, 2021

Conversation

RunDevelopment
Copy link
Member

This fixes #2839.

@github-actions
Copy link

github-actions bot commented Mar 30, 2021

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of +2 B (+0.2%).

file master pull size diff % diff
components/prism-ruby.min.js 1.02 KB 1.02 KB +2 B +0.2%

Generated by 🚫 dangerJS against f7cca6e

Copy link

@sampatbadhe sampatbadhe left a comment

Choose a reason for hiding this comment

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

Thank You @RunDevelopment for fixing it quickly. PR looks good to me for interpolation fix.

Screen Shot 2021-04-03 at 8 23 51 AM

I found below of scenarios while testing it on my local 👇

1 - When regex present with interpolation and in-line comment on same line it treats interpolation as comment for regex with /.../ works fine for %r[...].

Screen Shot 2021-04-03 at 8 26 05 AM

2 - Regex Encoding options are supported, I can raise separate ticket for this.

Regular expressions are assumed to use the source encoding. This can be overridden with one of the following modifiers.
/pat/u - UTF-8
/pat/e - EUC-JP
/pat/s - Windows-31J
/pat/n - ASCII-8BIT

Screen Shot 2021-04-03 at 8 26 35 AM

Can we fix Issue 1 in this PR? or should I raise separate issue for the same?

@RunDevelopment
Copy link
Member Author

Thank you for the comment @sampatbadhe!

  1. The real problem here is that the /.../ regexes aren't recognized as regexes at all. I'll fix it.
  2. I looked through the doc you linked. There are actually a few other flags we don't support either. I opened Add missing Ruby regex flags #2844 for this.

@sampatbadhe
Copy link

@RunDevelopment recent changes looks good to me 👌

@RunDevelopment RunDevelopment merged commit f08c2f7 into PrismJS:master Apr 3, 2021
@RunDevelopment RunDevelopment deleted the issue2839 branch April 3, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interpolation in Regex /foo#{bar}/ not highlighted for ruby
2 participants