maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r771284 - in /maven/doxia: doxia-sitetools/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/ doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/ doxia-sitetools/trunk/...
Date Mon, 04 May 2009 12:11:58 GMT
Author: vsiveton
Date: Mon May  4 12:11:58 2009
New Revision: 771284

URL: http://svn.apache.org/viewvc?rev=771284&view=rev
Log:
DOXIA-309: Ligature in author name shows up on page

o support predefined entities (it is probably a temp solution, see dev@)
o updated test case

Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/resources/site/xdoc/entityTest.xml
    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

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java?rev=771284&r1=771283&r2=771284&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/sink/SiteRendererSink.java
Mon May  4 12:11:58 2009
@@ -121,7 +121,9 @@
     {
         if ( getTextBuffer().length() > 0 )
         {
-            authors.add( getTextBuffer().toString() );
+            String text = HtmlTools.escapeHTML( getTextBuffer().toString() );
+            text = StringUtils.replace( text, "&#", "&#" );
+            authors.add( text.trim() );
         }
 
         resetTextBuffer();

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java?rev=771284&r1=771283&r2=771284&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
Mon May  4 12:11:58 2009
@@ -54,8 +54,31 @@
 
         author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 1 );
         assertNotNull( author );
-        // FIXME! DOXIA-309
-        //assertTrue( author.toString().indexOf( "Ampersand &" ) > 0 );
+        assertTrue( author.toString().indexOf( "Ampersand &" ) > 0 );
+
+        author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 2 );
+        assertNotNull( author );
+        assertTrue( author.toString().indexOf( "Less than <" ) > 0 );
+
+        author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 3 );
+        assertNotNull( author );
+        assertTrue( author.toString().indexOf( "Greater than >" ) > 0 );
+
+        author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 4 );
+        assertNotNull( author );
+        assertTrue( author.getContentAttribute().equals( "Apostrophe '" ) );
+
+        author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 5 );
+        assertNotNull( author );
+        assertTrue( author.toString().indexOf( "Quote "" ) > 0 );
+
+        author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 6 );
+        assertNotNull( author );
+        assertTrue( author.toString().indexOf( "test@email.com" ) > 0 );
+
+        author = (HtmlMeta) page.getHtmlElementsByName( "author" ).get( 7 );
+        assertNotNull( author );
+        assertTrue( author.toString().indexOf( "test©email.com" ) > 0 );
 
         HtmlElement element = page.getHtmlElementById( "contentBox" );
         assertNotNull( element );

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/resources/site/xdoc/entityTest.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/resources/site/xdoc/entityTest.xml?rev=771284&r1=771283&r2=771284&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/resources/site/xdoc/entityTest.xml
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/resources/site/xdoc/entityTest.xml
Mon May  4 12:11:58 2009
@@ -35,6 +35,12 @@
     <title>Test entities, cdatas and comments</title>
     <author email="test@email.com">Ligature &AElig;</author>
     <author email="test@email.com">Ampersand &amp;</author>
+    <author email="test@email.com">Less than &lt;</author>
+    <author email="test@email.com">Greater than &gt;</author>
+    <author email="test@email.com">Apostrophe &apos;</author>
+    <author email="test@email.com">Quote &quot;</author>
+    <author email="test@email.com">test@email.com</author>
+    <author email="test@email.com">test&copy;email.com</author>
   </properties>
 
   <body>

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=771284&r1=771283&r2=771284&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
Mon May  4 12:11:58 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;
 
 /**
  * <a href="http://maven.apache.org/doxia/references/xdoc-format.html">Xdoc</a>
Sink implementation.
@@ -195,7 +196,9 @@
         if ( getTextBuffer().length() > 0 )
         {
             writeStartTag( AUTHOR_TAG );
-            content( getTextBuffer().toString() );
+            String text = HtmlTools.escapeHTML( getTextBuffer().toString() );
+            text = StringUtils.replace( text, "&amp;#", "&#" );
+            write( text );
             writeEndTag( AUTHOR_TAG );
             resetTextBuffer();
         }

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=771284&r1=771283&r2=771284&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
Mon May  4 12:11:58 2009
@@ -27,6 +27,8 @@
 
 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;
 
 /**
  * <a href="http://www.w3.org/TR/xhtml1/">Xhtml 1.0 Transitional</a> sink implementation.
@@ -183,7 +185,9 @@
         {
             MutableAttributeSet att = new SinkEventAttributeSet();
             att.addAttribute( Attribute.NAME, "author" );
-            att.addAttribute( Attribute.CONTENT, getTextBuffer().toString() );
+            String text = HtmlTools.escapeHTML( getTextBuffer().toString() );
+            text = StringUtils.replace( text, "&amp;#", "&#" );
+            att.addAttribute( Attribute.CONTENT, text );
 
             writeSimpleTag( Tag.META, att );
 



Mime
View raw message