You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by lt...@apache.org on 2007/10/11 17:01:43 UTC

svn commit: r583842 - in /maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src: main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java

Author: ltheussl
Date: Thu Oct 11 08:01:42 2007
New Revision: 583842

URL: http://svn.apache.org/viewvc?rev=583842&view=rev
Log:
Add author and date to parser, activate identity test.

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.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/XhtmlParser.java?rev=583842&r1=583841&r2=583842&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java Thu Oct 11 08:01:42 2007
@@ -72,10 +72,38 @@
     protected void handleStartTag( XmlPullParser parser, Sink sink )
         throws XmlPullParserException, MacroExecutionException
     {
-        if ( parser.getName().equals( Tag.TITLE.toString() ) )
+        if ( parser.getName().equals( Tag.HTML.toString() ) )
+        {
+            //Do nothing
+            return;
+        }
+        else if ( parser.getName().equals( Tag.TITLE.toString() ) )
         {
             sink.title();
         }
+        else if ( parser.getName().equals( Tag.META.toString() ) )
+        {
+            String name = parser.getAttributeValue( null, Attribute.NAME.toString() );
+
+            String content = parser.getAttributeValue( null, Attribute.CONTENT.toString() );
+
+            if ( "author".equals( name ) )
+            {
+                sink.author();
+
+                sink.text( content );
+
+                sink.author_();
+            }
+            else if ( "date".equals( name ) )
+            {
+                sink.date();
+
+                sink.text( content );
+
+                sink.date_();
+            }
+        }
         /*
          * The ADDRESS element may be used by authors to supply contact information
          * for a model or a major part of a model such as a form. This element
@@ -362,7 +390,12 @@
     protected void handleEndTag( XmlPullParser parser, Sink sink )
         throws XmlPullParserException, MacroExecutionException
     {
-        if ( parser.getName().equals( Tag.TITLE.toString() ) )
+        if ( parser.getName().equals( Tag.HTML.toString() ) )
+        {
+            //Do nothing
+            return;
+        }
+        else if ( parser.getName().equals( Tag.TITLE.toString() ) )
         {
             sink.title_();
         }

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.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/XhtmlIdentityTest.java?rev=583842&r1=583841&r2=583842&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-xhtml/src/test/java/org/apache/maven/doxia/module/xhtml/XhtmlIdentityTest.java Thu Oct 11 08:01:42 2007
@@ -37,6 +37,13 @@
 public class XhtmlIdentityTest extends AbstractIdentityTest
 {
     /** {@inheritDoc} */
+    protected void setUp()
+        throws Exception
+    {
+        assertIdentity( true );
+    }
+
+    /** {@inheritDoc} */
     protected Sink createSink( Writer writer )
     {
         return new XhtmlSink( writer );