jafartke / google-code-prettify

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

Java's keyword “interface” not highlighted #225

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The following Java code:

public interface yUNoHighlightMe {
    void someMethod();
}

creates the following Prettify HTML on Stack Exchange sites:

<pre class="lang-java prettyprint">
    <code>
        <span class="kwd">public</span>
        <span class="pln"> interface yUNoHighlightMe </span>
        <span class="pun">{</span>
        <span class="pln"><br>&nbsp; &nbsp; </span>
        <span class="kwd">void</span>
        <span class="pln"> someMethod</span>
        <span class="pun">();</span>
        <span class="pln"><br></span>
        <span class="pun">}</span>
        <span class="pln"><br></span>
    </code>
</pre>

The code is recognized to be Java, but the keyword "interface" 
(http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html) is 
marked up to be a plaintext.

What version are you using?
Holy smokes, do I know. The Stack Exchanges's one. There are no versison 
numbers in your file naming.

The original bug on Stack Overflow with some additional examples can be found 
here: http://meta.stackoverflow.com/q/138302/184794

Original issue reported on code.google.com by PhotoSla...@gmail.com on 1 Jul 2012 at 5:05

GoogleCodeExporter commented 8 years ago
The follow-up:

When tested in local environment (Firefox 14 beta and IE 8) with the current 
Prettify version, the bug _has been confirmed_. The code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <link href="prettify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="prettify.js"></script>
</head>
<body onload="prettyPrint()">
    <pre class="prettyprint lang-java">public interface yUNoHighlightMe {
    void someMethod();
}</pre>
</body>
</html>

The interesting part is that if I omit the "lang-java" language hint, it works 
well and the word gets highlighted.

Original comment by PhotoSla...@gmail.com on 1 Jul 2012 at 8:27

GoogleCodeExporter commented 8 years ago
The same is true for the assert keyword (again the SO version, as demonstrated 
here: 
http://stackoverflow.com/questions/13269318/eclipse-java-invalid-package-name-re
served-words-in-package-name/13269349#13269349).

Original comment by citizen5263@gmail.com on 7 Nov 2012 at 12:20

GoogleCodeExporter commented 8 years ago
Thanks for the bug report.  Fixed at r241 which will be included in the next 
release.

Original comment by mikesamuel@gmail.com on 5 Feb 2013 at 2:34