sunshengfei / google-code-prettify

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

Use of [ ] inside java string produces incorrect output #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use html like the following:
<pre class="prettyprint">
  throw new RuntimeException("Element [" + element.getName() + 
    "] missing attribute.");
  variable++;
</pre>

What is the expected output?  What do you see instead?
1. Expect that 'variable ++;' line is colored as code, but it is instead
displayed as a comment. The last double-quote character on the preceding
line is printed 'fancy', and all following characters on this same line are
 also colored as comment (colored as code would be expected).

What version are you using?  On what browser?
31-Aug-2007 (small) on Firefox 2.0.0.14. Same problem occurs on Internet
Explorer 7.

Original issue reported on code.google.com by basil.va...@gmail.com on 1 Jul 2008 at 10:30

GoogleCodeExporter commented 8 years ago
I can't repeat this problem on either Firefox 2.0.0.14 or IE 6.
I get the attached.  Do the testcases run correctly on your setup?

Original comment by mikesamuel@gmail.com on 5 Jul 2008 at 10:11

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the fast response.
Yes, the test case runs correctly for me.

I've looked into this further, and it appears the problem is on my end. I'm 
using
WordPress to publish content on my site, and WordPress is converting a trailing
double-quote into a ” character, which is similar but not identical, so code
prettifier correctly thinks the string is not terminated and continues the 
coloring
onto the next line.

This <a href="http://wordpress.org/support/topic/125038">WordPress support
article</a> describes how to prevent WordPress from doing this conversion. 

So in conclusion there is no defect in Code Prettify.

Original comment by basil.va...@gmail.com on 5 Jul 2008 at 10:51

GoogleCodeExporter commented 8 years ago
Glad you found the problem.

I will add that article to the FAQ.

Happy prettyprinting.

Original comment by mikesamuel@gmail.com on 5 Jul 2008 at 11:54