pzdn2009 / syntaxhighlighter

Automatically exported from code.google.com/p/syntaxhighlighter
GNU General Public License v3.0
0 stars 0 forks source link

Two comments on one line clobber text in between #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Syntax highlight the following HTML:
<!-- Comment 1 -->Some Text<!-- Comment 2 -->

What is the expected output?
  The comments should be green, the text should be black.

What do you see instead?
  The whole line is green

What version of the product are you using? On what operating system?
  1.5.0, Cross platform

Please provide any additional information below.

The regex is too greedy.  It looks like you already attempted to solve
this, but missed slightly.  Here's the existing code in shBrushXml.js:
       // Match comments
       // <!--\s*.*\s*?-->
       this.GetMatches(new RegExp('<!--\\s*.*\\s*?-->', 'gm'), 'comments');
Here's the corrected code:
       // Match comments
       // <!--\s*.*?\s*-->
       this.GetMatches(new RegExp('<!--\\s*.*?\\s*-->', 'gm'), 'comments');
Just move the '?' to the previous token.

Original issue reported on code.google.com by neil.fra...@gmail.com on 25 Jun 2007 at 1:13

GoogleCodeExporter commented 9 years ago

Original comment by alex.gor...@gmail.com on 28 Jun 2007 at 11:04

GoogleCodeExporter commented 9 years ago

Original comment by alex.gor...@gmail.com on 5 Aug 2007 at 1:13

GoogleCodeExporter commented 9 years ago

Original comment by alex.gor...@gmail.com on 5 Aug 2007 at 2:52