maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r514440 - /maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
Date Sun, 04 Mar 2007 17:17:17 GMT
Author: dennisl
Date: Sun Mar  4 09:17:16 2007
New Revision: 514440

URL: http://svn.apache.org/viewvc?view=rev&rev=514440
Log:
[JXR-25] The generated class pages contains invalid xhtml

o Use class instead of id in css selectors.
o This also involved replacing som eof the code that handles syntax highlighting.

Modified:
    maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java

Modified: maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java
URL: http://svn.apache.org/viewvc/maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java?view=diff&rev=514440&r1=514439&r2=514440
==============================================================================
--- maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java (original)
+++ maven/jxr/trunk/src/main/java/org/apache/maven/jxr/JavaCodeTransform.java Sun Mar  4 09:17:16
2007
@@ -100,7 +100,7 @@
     /**
      * start comment delimeter
      */
-    public static final String COMMENT_START = "<em id=\"jxr_comment\">";
+    public static final String COMMENT_START = "<em class=\"jxr_comment\">";
 
     /**
      * end comment delimeter
@@ -110,7 +110,7 @@
     /**
      * start javadoc comment delimeter
      */
-    public static final String JAVADOC_COMMENT_START = "<em id=\"jxr_javadoccomment\">";
+    public static final String JAVADOC_COMMENT_START = "<em class=\"jxr_javadoccomment\">";
 
     /**
      * end javadoc comment delimeter
@@ -120,7 +120,7 @@
     /**
      * start String delimeter
      */
-    public static final String STRING_START = "<span id=\"jxr_string\">";
+    public static final String STRING_START = "<span class=\"jxr_string\">";
 
     /**
      * end String delimeter
@@ -130,7 +130,7 @@
     /**
      * start reserved word delimeter
      */
-    public static final String RESERVED_WORD_START = "<strong id=\"jxr_keyword\">";
+    public static final String RESERVED_WORD_START = "<strong class=\"jxr_keyword\">";
 
     /**
      * end reserved word delimeter
@@ -904,6 +904,8 @@
      */
     private final String keywordFilter( String line )
     {
+        final String CLASS_KEYWORD = "class";
+
         if ( line == null || line.equals( "" ) )
         {
             return "";
@@ -927,10 +929,20 @@
                 }
             }
             String tempString = temp.toString();
-            if ( reservedWords.containsKey( tempString ) && !usedReservedWords.containsKey(
tempString ) )
+
+            // Special handling of css style class definitions
+            if(CLASS_KEYWORD.equals(tempString) && ch == '=')
+            {
+                i++;
+            }
+            else if ( reservedWords.containsKey( tempString ) )
             {
-                usedReservedWords.put( tempString, tempString );
-                line = replace( line, tempString, ( RESERVED_WORD_START + tempString + RESERVED_WORD_END
) );
+                StringBuffer newLine = new StringBuffer( line.substring( 0, i - tempString.length()
) );
+                newLine.append( RESERVED_WORD_START );
+                newLine.append( tempString );
+                newLine.append( RESERVED_WORD_END );
+                newLine.append( line.substring( i ) );
+                line = newLine.toString();
                 i += ( RESERVED_WORD_START.length() + RESERVED_WORD_END.length() );
             }
             else



Mime
View raw message