maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r771706 - in /maven/doxia/doxia/trunk/doxia-modules: doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/ doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/ doxia-module-xhtml/src/test/java/org/apache/maven...
Date Tue, 05 May 2009 13:11:17 GMT
Author: ltheussl
Date: Tue May  5 13:11:16 2009
New Revision: 771706

URL: http://svn.apache.org/viewvc?rev=771706&view=rev
Log:
Add notes about entity replacement hacks

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java?rev=771706&r1=771705&r2=771706&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xdoc/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
Tue May  5 13:11:16 2009
@@ -30,6 +30,7 @@
 import org.apache.maven.doxia.sink.SinkUtils;
 import org.apache.maven.doxia.sink.XhtmlBaseSink;
 import org.apache.maven.doxia.util.HtmlTools;
+
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -197,6 +198,8 @@
         {
             writeStartTag( AUTHOR_TAG );
             String text = HtmlTools.escapeHTML( getTextBuffer().toString() );
+            // hack: un-escape numerical entities that have been escaped above
+            // note that numerical entities should really be written as one unicode character
in the first place
             text = StringUtils.replace( text, "&#", "&#" );
             write( text );
             writeEndTag( AUTHOR_TAG );

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java?rev=771706&r1=771705&r2=771706&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
Tue May  5 13:11:16 2009
@@ -28,6 +28,7 @@
 import org.apache.maven.doxia.sink.XhtmlBaseSink;
 import org.apache.maven.doxia.sink.SinkEventAttributeSet;
 import org.apache.maven.doxia.util.HtmlTools;
+
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -186,6 +187,8 @@
             MutableAttributeSet att = new SinkEventAttributeSet();
             att.addAttribute( Attribute.NAME, "author" );
             String text = HtmlTools.escapeHTML( getTextBuffer().toString() );
+            // hack: un-escape numerical entities that have been escaped above
+            // note that numerical entities should really be added as one unicode character
in the first place
             text = StringUtils.replace( text, "&#", "&#" );
             att.addAttribute( Attribute.CONTENT, text );
 

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java?rev=771706&r1=771705&r2=771706&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlSinkTest.java
Tue May  5 13:11:16 2009
@@ -319,7 +319,8 @@
             sink.title_();
             sink.comment( "A comment" );
             sink.author();
-            sink.text( "Author" );
+            // note: this is really illegal, there should be no un-resolved entities emitted
into text()
+            sink.text( "ģ&" );
             sink.author_();
             sink.head_();
         }
@@ -328,7 +329,8 @@
             sink.close();
         }
 
-        String exp = "<head><title>Title</title><!-- A comment --><meta
name=\"author\" content=\"Author\" /></head>";
+        String exp =
+                "<head><title>Title</title><!-- A comment --><meta
name=\"author\" content=\"&#x123;&amp;\" /></head>";
         assertTrue( writer.toString().indexOf( exp ) != -1 );
     }
 }



Mime
View raw message