Sassydirtygirl / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

Ruby class variables aren't fully highlighted #275

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Specify a ruby class variable, e.g. `@@myvar`
2. The first ampersand is not highlighted like the rest of the line

<pre class="prettyprint lang-ruby">
class Foo
  @class_instance_var = 3
  @@class_var = 4
end
</pre>

The class instance variable is fully highlighted, but the class variable is 
not. This came about after noticing the issue on Stack Overflow. See 
http://meta.stackoverflow.com/questions/175167/bug-with-class-variable-highlight
ing-in-ruby-code-blocks.

Using revision 298, and it happens on all browsers (due to it being a regex 
issue). However, I'm using Chrome on Ubuntu.

I've attached a diff that is a potential fix to run_prettify.js, which is where 
I identified the regular expression to be. It simply adds an optional `@` to 
the regex that determines the literal, on line 1167 of the source. However, 
there may be more places where this is an issue.

Thanks

Original issue reported on code.google.com by j...@joncairns.com on 5 Apr 2013 at 9:09

Attachments: