maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r441960 - /maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
Date Sun, 10 Sep 2006 15:09:11 GMT
Author: vsiveton
Date: Sun Sep 10 08:09:10 2006
New Revision: 441960

URL: http://svn.apache.org/viewvc?view=rev&rev=441960
Log:
o the #faq.id link should be encoded in the summary part in agreement with anchor link
o writeAnswerWithSource() should hold attributes

Modified:
    maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java

Modified: maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java?view=diff&rev=441960&r1=441959&r2=441960
==============================================================================
--- maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
(original)
+++ maven/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
Sun Sep 10 08:09:10 2006
@@ -278,7 +278,10 @@
         sink.anchor_();
         sink.sectionTitle1_();
 
+        // ----------------------------------------------------------------------
         // Write summary
+        // ----------------------------------------------------------------------
+
         for ( Iterator partIterator = faqs.getParts().iterator(); partIterator.hasNext();
)
         {
             Part part = (Part) partIterator.next();
@@ -296,7 +299,7 @@
             {
                 Faq faq = (Faq) faqIterator.next();
                 sink.numberedListItem();
-                sink.link( "#" + faq.getId() );
+                sink.link( "#" + HtmlTools.encodeId( faq.getId() ) );
                 sink.rawText( faq.getQuestion() );
                 sink.link_();
                 sink.numberedListItem_();
@@ -305,7 +308,10 @@
         }
         sink.section1_();
 
+        // ----------------------------------------------------------------------
         // Write content
+        // ----------------------------------------------------------------------
+
         for ( Iterator partIterator = faqs.getParts().iterator(); partIterator.hasNext();
)
         {
             Part part = (Part) partIterator.next();
@@ -428,7 +434,29 @@
                     }
                     else
                     {
-                        sink.rawText( "<" + parser.getName() + ">" );
+                        StringBuffer buffer = new StringBuffer();
+                        buffer.append( "<" + parser.getName() );
+
+                        int count = parser.getAttributeCount();
+
+                        for ( int i = 0; i < count; i++ )
+                        {
+                            buffer.append( " " );
+
+                            buffer.append( parser.getAttributeName( i ) );
+
+                            buffer.append( "=" );
+
+                            buffer.append( "\"" );
+
+                            buffer.append( HtmlTools.escapeHTML( parser.getAttributeValue(
i ) ) );
+
+                            buffer.append( "\"" );
+                        }
+
+                        buffer.append( ">" );
+
+                        sink.rawText( buffer.toString() );
                     }
                 }
             }



Mime
View raw message