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 2006/07/28 19:55:38 UTC

svn commit: r426618 - in /maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module: xdoc/XdocSink.java xhtml/XhtmlSink.java

Author: vsiveton
Date: Fri Jul 28 10:55:37 2006
New Revision: 426618

URL: http://svn.apache.org/viewvc?rev=426618&view=rev
Log:
o Changed itemFlag type to boolean instead of int thus no need to throw a RuntimeException

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

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java?rev=426618&r1=426617&r2=426618&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xdoc/XdocSink.java Fri Jul 28 10:55:37 2006
@@ -47,7 +47,7 @@
      */
     protected boolean titleFlag;
 
-    private int itemFlag;
+    private boolean itemFlag;
 
     private boolean boxedFlag;
 
@@ -68,7 +68,7 @@
     {
         headFlag = false;
         buffer = new StringBuffer();
-        itemFlag = 0;
+        itemFlag = false;
         boxedFlag = false;
         verbatimFlag = false;
         cellJustif = null;
@@ -301,12 +301,12 @@
     public void listItem()
     {
         markup( "<li>" );
-        itemFlag++;
+        itemFlag = true;
+        // What follows is at least a paragraph.
     }
 
     public void listItem_()
     {
-        itemFlag--;
         markup( "</li>" + EOL );
     }
 
@@ -342,12 +342,12 @@
     public void numberedListItem()
     {
         markup( "<li>" );
-        itemFlag++;
+        itemFlag = true;
+        // What follows is at least a paragraph.
     }
 
     public void numberedListItem_()
     {
-        itemFlag--;
         markup( "</li>" + EOL );
     }
 
@@ -374,18 +374,18 @@
     public void definition()
     {
         markup( "<dd>" );
-        itemFlag++;
+        itemFlag = true;
+        // What follows is at least a paragraph.
     }
 
     public void definition_()
     {
-        itemFlag--;
         markup( "</dd>" + EOL );
     }
 
     public void paragraph()
     {
-        if ( itemFlag == 0 )
+        if ( !itemFlag )
         {
             markup( "<p>" );
         }
@@ -393,17 +393,13 @@
 
     public void paragraph_()
     {
-        if ( itemFlag == 0 )
+        if ( itemFlag )
         {
-            markup( "</p>" );
+            itemFlag = false;
         }
         else
         {
-            itemFlag--;
-            if ( itemFlag < 0 )
-            {
-                itemFlag = 0;
-            }
+            markup( "</p>" );
         }
     }
 
@@ -547,7 +543,7 @@
     {
         if ( !headFlag && !titleFlag )
         {
-            String id = HtmlTools.encodeId(name);
+            String id = HtmlTools.encodeId( name );
             markup( "<a id=\"" + id + "\" name=\"" + id + "\">" );
         }
     }

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java?rev=426618&r1=426617&r2=426618&view=diff
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java (original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlSink.java Fri Jul 28 10:55:37 2006
@@ -41,7 +41,7 @@
 
     private boolean headFlag;
 
-    private int itemFlag;
+    private boolean itemFlag;
 
     private boolean verbatimFlag;
 
@@ -77,13 +77,9 @@
     protected void resetState()
     {
         headFlag = false;
-
         resetBuffer();
-
-        itemFlag = 0;
-
+        itemFlag = false;
         verbatimFlag = false;
-
         cellCount = 0;
     }
 
@@ -281,13 +277,12 @@
     public void listItem()
     {
         write( "<li>" );
-
-        itemFlag++;
+        itemFlag = true;
+        // What follows is at least a paragraph.
     }
 
     public void listItem_()
     {
-        itemFlag--;
         write( "</li>" );
     }
 
@@ -323,13 +318,12 @@
     public void numberedListItem()
     {
         write( "<li>" );
-
-        itemFlag++;
+        itemFlag = true;
+        // What follows is at least a paragraph.
     }
 
     public void numberedListItem_()
     {
-        itemFlag--;
         write( "</li>" );
     }
 
@@ -356,19 +350,18 @@
     public void definition()
     {
         write( "<dd>" );
-
-        itemFlag++;
+        itemFlag = true;
+        // What follows is at least a paragraph.
     }
 
     public void definition_()
     {
-        itemFlag--;
         write( "</dd>" );
     }
 
     public void paragraph()
     {
-        if ( itemFlag == 0 )
+        if ( !itemFlag )
         {
             write( "<p>" );
         }
@@ -376,17 +369,13 @@
 
     public void paragraph_()
     {
-        if ( itemFlag == 0 )
+        if ( itemFlag )
         {
-            write( "</p>" );
+            itemFlag = false;
         }
         else
         {
-            itemFlag--;
-            if ( itemFlag < 0 )
-            {
-                itemFlag = 0;
-            }
+            write( "</p>" );
         }
     }
 



Re: svn commit: r426618 - in /maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module: xdoc/XdocSink.java xhtml/XhtmlSink.java

Posted by Vincent Siveton <vi...@gmail.com>.
Hmm, it seems to work for me. I will review it.

Thanks,

Vincent

2006/7/28, Trygve Laugstøl <tr...@apache.org>:
> Vincent Siveton wrote:
> > 2006/7/28, Trygve Laugstøl <tr...@apache.org>:
> >> vsiveton@apache.org wrote:
> >> > Author: vsiveton
> >> > Date: Fri Jul 28 10:55:37 2006
> >> > New Revision: 426618
> >> >
> >> > URL: http://svn.apache.org/viewvc?rev=426618&view=rev
> >> > Log:
> >> > o Changed itemFlag type to boolean instead of int thus no need to
> >> throw a RuntimeException
> >>
> >> Are you sure this will work? What happens when it's nesting items?
> >
> > I'm not sure what you mean.
> >
> > BTW here is a small example, hope this helps
> > http://people.apache.org/~vsiveton/MSITE-153/
>
> Sorry, I don't understand the relation here. Isn't the itemFlag supposed
> to be incremented and decremented when you nest more item lists? Like this:
>
> <ol>
>   <li>
>     <ol>
>       <li></li>
>       <li></li>
>     </ol>
>   </li>
>   <li>
>     <ol>
>       <li></li>
>       <li></li>
>     </ol>
>   </li>
> </old>
>
> --
> Trygve
>

Re: svn commit: r426618 - in /maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module: xdoc/XdocSink.java xhtml/XhtmlSink.java

Posted by Trygve Laugstøl <tr...@apache.org>.
Vincent Siveton wrote:
> 2006/7/28, Trygve Laugstøl <tr...@apache.org>:
>> vsiveton@apache.org wrote:
>> > Author: vsiveton
>> > Date: Fri Jul 28 10:55:37 2006
>> > New Revision: 426618
>> >
>> > URL: http://svn.apache.org/viewvc?rev=426618&view=rev
>> > Log:
>> > o Changed itemFlag type to boolean instead of int thus no need to 
>> throw a RuntimeException
>>
>> Are you sure this will work? What happens when it's nesting items?
> 
> I'm not sure what you mean.
> 
> BTW here is a small example, hope this helps
> http://people.apache.org/~vsiveton/MSITE-153/

Sorry, I don't understand the relation here. Isn't the itemFlag supposed 
to be incremented and decremented when you nest more item lists? Like this:

<ol>
   <li>
     <ol>
       <li></li>
       <li></li>
     </ol>
   </li>
   <li>
     <ol>
       <li></li>
       <li></li>
     </ol>
   </li>
</old>

--
Trygve

Re: svn commit: r426618 - in /maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module: xdoc/XdocSink.java xhtml/XhtmlSink.java

Posted by Vincent Siveton <vi...@gmail.com>.
2006/7/28, Trygve Laugstøl <tr...@apache.org>:
> vsiveton@apache.org wrote:
> > Author: vsiveton
> > Date: Fri Jul 28 10:55:37 2006
> > New Revision: 426618
> >
> > URL: http://svn.apache.org/viewvc?rev=426618&view=rev
> > Log:
> > o Changed itemFlag type to boolean instead of int thus no need to throw a RuntimeException
>
> Are you sure this will work? What happens when it's nesting items?

I'm not sure what you mean.

BTW here is a small example, hope this helps
http://people.apache.org/~vsiveton/MSITE-153/

Cheers,

Vincent

Re: svn commit: r426618 - in /maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module: xdoc/XdocSink.java xhtml/XhtmlSink.java

Posted by Trygve Laugstøl <tr...@apache.org>.
vsiveton@apache.org wrote:
> Author: vsiveton
> Date: Fri Jul 28 10:55:37 2006
> New Revision: 426618
> 
> URL: http://svn.apache.org/viewvc?rev=426618&view=rev
> Log:
> o Changed itemFlag type to boolean instead of int thus no need to throw a RuntimeException

Are you sure this will work? What happens when it's nesting items?

--
Trygve