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 vs...@apache.org on 2008/11/07 22:08:33 UTC

svn commit: r712263 - /maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java

Author: vsiveton
Date: Fri Nov  7 13:08:33 2008
New Revision: 712263

URL: http://svn.apache.org/viewvc?rev=712263&view=rev
Log:
DOXIA-264: XhtmlBaseSink and sub classes should create a valid XHTML

o be sure that p is not write for list, verbatim and table

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java?rev=712263&r1=712262&r2=712263&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/sink/XhtmlBaseSink.java Fri Nov  7 13:08:33 2008
@@ -60,6 +60,9 @@
     /** An indication on if we're inside an image caption flag. */
     private boolean figureCaptionFlag;
 
+    /** An indication on if we're inside a paragraph flag. */
+    private boolean paragraphFlag;
+
     /** An indication on if we're in verbatim mode. */
     private boolean verbatimFlag;
 
@@ -484,6 +487,14 @@
      */
     public void list()
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         writeStartTag( Tag.UL );
     }
 
@@ -557,6 +568,14 @@
      */
     public void numberedList( int numbering, SinkEventAttributes attributes )
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         String style;
         switch ( numbering )
         {
@@ -635,6 +654,14 @@
      */
     public void definitionList()
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         writeStartTag( Tag.DL );
     }
 
@@ -644,6 +671,14 @@
      */
     public void definitionList( SinkEventAttributes attributes )
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         MutableAttributeSet atts = SinkUtils.filterAttributes(
                 attributes, SinkUtils.SINK_BASE_ATTRIBUTES  );
 
@@ -872,6 +907,8 @@
      */
     public void paragraph()
     {
+        paragraphFlag = true;
+
         writeStartTag( Tag.P );
     }
 
@@ -881,6 +918,8 @@
      */
     public void paragraph( SinkEventAttributes attributes )
     {
+        paragraphFlag = true;
+
         MutableAttributeSet atts = SinkUtils.filterAttributes(
                 attributes, SinkUtils.SINK_SECTION_ATTRIBUTES  );
 
@@ -893,7 +932,11 @@
      */
     public void paragraph_()
     {
-        writeEndTag( Tag.P );
+        if ( paragraphFlag )
+        {
+            writeEndTag( Tag.P );
+            paragraphFlag = false;
+        }
     }
 
     /**
@@ -905,6 +948,14 @@
      */
     public void verbatim( boolean boxed )
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         SinkEventAttributeSet att = new SinkEventAttributeSet();
 
         if ( boxed )
@@ -924,6 +975,14 @@
      */
     public void verbatim( SinkEventAttributes attributes )
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         verbatimFlag = true;
 
         MutableAttributeSet atts = SinkUtils.filterAttributes(
@@ -1003,6 +1062,14 @@
     /** {@inheritDoc} */
     public void table()
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         // start table with tableRows
         table( null );
     }
@@ -1010,6 +1077,14 @@
     /** {@inheritDoc} */
     public void table( SinkEventAttributes attributes )
     {
+        if ( paragraphFlag )
+        {
+            // The content of element type "p" must match
+            // "(a|br|span|bdo|object|applet|img|map|iframe|tt|i|b|u|s|strike|big|small|font|basefont|em|strong|
+            // dfn|code|q|samp|kbd|var|cite|abbr|acronym|sub|sup|input|select|textarea|label|button|ins|del|script)".
+            paragraph_();
+        }
+
         tableWriter = new StringWriter();
 
         // start table with tableRows
@@ -1716,7 +1791,6 @@
     //
     // ----------------------------------------------------------------------
 
-
     /**
      * Write HTML escaped text to output.
      *