Skip to content

Ruby: Added missing regex interpolation#2841

Merged
RunDevelopment merged 3 commits intoPrismJS:masterfrom
RunDevelopment:issue2839
Apr 3, 2021
Merged

Ruby: Added missing regex interpolation#2841
RunDevelopment merged 3 commits intoPrismJS:masterfrom
RunDevelopment:issue2839

Conversation

@RunDevelopment
Copy link
Copy Markdown
Member

This fixes #2839.

@github-actions
Copy link
Copy Markdown

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%).

Details
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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown

@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