shivaprasadks / google-code-prettify

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

XML attributes with < symbol in value breaks syntax highlighting #339

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set language to XML
2. Use attribute value with greater than or less than symbol
2. Syntax highlighting will break

Here's an example of a code snippet which breaks prettify.  

<pre class='prettyprint xml'><code>
    &lt;Person AgeCategory="&lt;3" &gt;&lt;/Person&gt;
</code></pre>

Here's a fiddle with the same code:
http://jsfiddle.net/KyleMit/qpEhr/

What is the expected output?  What do you see instead?
Here's a screenshot of the current output vs. my expected output:
http://i.imgur.com/016JEsw.png

What version are you using?  On what browser?
https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js
Running in Chrome (same for all browsers)

Please provide any additional information below.
Since the < or > symbol exists inside of quotes, it should be treated as a 
string and should not affect the way that the code sample is parsed.

This is particularly an issue when attempting to use ASP.NET code (which 
usually passes as XML) because of the use of inline script tags. 
Here's an asp.net example:
http://jsfiddle.net/KyleMit/qpEhr/0/
http://i.imgur.com/wiuQDoK.png

Original issue reported on code.google.com by Kyle...@gmail.com on 2 Apr 2014 at 7:47