Author: jvanzyl Date: Sat Mar 17 07:45:55 2007 New Revision: 519329 URL: http://svn.apache.org/viewvc?view=rev&rev=519329 Log: o creating a separate module for FML
Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/ maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml (with props) maven/doxia/trunk/doxia-modules/doxia-module-fml/src/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java (with props) maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java (with props) maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java (with props) maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java (with props) maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java (with props) maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java (with props) Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml Sat Mar 17 07:45:55 2007 @@ -0,0 +1,21 @@ +<?xml version="1.0"?><project> + <parent> + <artifactId>doxia-modules</artifactId> + <groupId>org.apache.maven.doxia</groupId> + <version>1.0-alpha-9-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.doxia</groupId> + <artifactId>doxia-module-fml</artifactId> + <name>doxia-module-fml</name> + <version>1.0-SNAPSHOT</version> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java Sat Mar 17 07:45:55 2007 @@ -0,0 +1,509 @@ +package org.apache.maven.doxia.module.fml; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.Reader; +import java.io.StringReader; +import java.util.Iterator; + +import org.apache.maven.doxia.module.HtmlTools; +import org.apache.maven.doxia.module.fml.model.Faq; +import org.apache.maven.doxia.module.fml.model.Faqs; +import org.apache.maven.doxia.module.fml.model.Part; +import org.apache.maven.doxia.parser.ParseException; +import org.apache.maven.doxia.parser.Parser; +import org.apache.maven.doxia.sink.Sink; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.pull.MXParser; +import org.codehaus.plexus.util.xml.pull.XmlPullParser; + +/** + * Parse a fml model and emit events into the specified doxia Sink. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Venisse</a> + * @version $Id:FmlParser.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $ + * @plexus.component role-hint="fml" + */ +public class FmlParser + implements Parser +{ + /** + * @see org.apache.maven.doxia.parser.Parser#parse(java.io.Reader, org.apache.maven.doxia.sink.Sink) + */ + public void parse( Reader reader, Sink sink ) + throws ParseException + { + Faqs faqs; + try + { + XmlPullParser parser = new MXParser(); + + parser.setInput( reader ); + + faqs = parseFml( parser, sink ); + } + catch ( Exception ex ) + { + throw new ParseException( "Error parsing the model: " + ex.getMessage(), ex ); + } + + try + { + createSink( faqs, sink ); + } + catch ( Exception e ) + { + throw new ParseException( "Error creating sink: " + e.getMessage(), e ); + } + } + + /** + * @param parser + * @param sink + * @return Faqs + * @throws Exception + */ + public Faqs parseFml( XmlPullParser parser, Sink sink ) + throws Exception + { + Faqs faqs = new Faqs(); + + Part currentPart = null; + + Faq currentFaq = null; + + boolean inFaq = false; + + boolean inPart = false; + + boolean inQuestion = false; + + boolean inAnswer = false; + + StringBuffer buffer = null; + + int eventType = parser.getEventType(); + + while ( eventType != XmlPullParser.END_DOCUMENT ) + { + if ( eventType == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "faqs" ) ) + { + String title = parser.getAttributeValue( null, "title" ); + + if ( title != null ) + { + faqs.setTitle( title ); + } + + String toplink = parser.getAttributeValue( null, "toplink" ); + + if ( toplink != null ) + { + if ( toplink.equalsIgnoreCase( "true" ) ) + { + faqs.setToplink( true ); + } + else + { + faqs.setToplink( false ); + } + } + } + else if ( parser.getName().equals( "part" ) ) + { + inPart = true; + currentPart = new Part(); + currentPart.setId( parser.getAttributeValue( null, "id" ) ); + } + else if ( parser.getName().equals( "title" ) ) + { + currentPart.setTitle( parser.nextText().trim() ); + } + else if ( parser.getName().equals( "faq" ) ) + { + inFaq = true; + currentFaq = new Faq(); + currentFaq.setId( parser.getAttributeValue( null, "id" ) ); + } + if ( parser.getName().equals( "question" ) ) + { + buffer = new StringBuffer(); + inQuestion = true; + } + else if ( parser.getName().equals( "answer" ) ) + { + buffer = new StringBuffer(); + inAnswer = true; + } + else if ( inQuestion || inAnswer ) + { + buffer.append( "<" ); + + 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( ">" ); + } + } + else if ( eventType == XmlPullParser.END_TAG ) + { + if ( parser.getName().equals( "faqs" ) ) + { + // Do nothing + } + else if ( parser.getName().equals( "part" ) ) + { + faqs.addPart( currentPart ); + + currentPart = null; + + inPart = false; + } + else if ( parser.getName().equals( "faq" ) ) + { + currentPart.addFaq( currentFaq ); + + currentFaq = null; + + inFaq = false; + } + if ( parser.getName().equals( "question" ) ) + { + currentFaq.setQuestion( buffer.toString() ); + + inQuestion = false; + } + else if ( parser.getName().equals( "answer" ) ) + { + currentFaq.setAnswer( buffer.toString() ); + + inAnswer = false; + } + else if ( inQuestion || inAnswer ) + { + if ( buffer.charAt( buffer.length() - 1 ) == ' ' ) + { + buffer.deleteCharAt( buffer.length() - 1 ); + } + + buffer.append( "</" ); + + buffer.append( parser.getName() ); + + buffer.append( ">" ); + } + } + else if ( eventType == XmlPullParser.CDSECT ) + { + if ( buffer != null && parser.getText() != null ) + { + buffer.append( "<![CDATA[" ); + buffer.append( parser.getText() ); + buffer.append( "]]>" ); + } + } + else if ( eventType == XmlPullParser.TEXT ) + { + if ( buffer != null && parser.getText() != null ) + { + buffer.append( parser.getText() ); + } + } + else if ( eventType == XmlPullParser.ENTITY_REF ) + { + if ( buffer != null && parser.getText() != null ) + { + buffer.append( HtmlTools.escapeHTML( parser.getText() ) ); + } + } + + eventType = parser.nextToken(); + } + + return faqs; + } + + /** + * @param faqs + * @param sink + * @throws Exception + */ + private void createSink( Faqs faqs, Sink sink ) + throws Exception + { + sink.head(); + sink.title(); + sink.text( faqs.getTitle() ); + sink.title_(); + sink.head_(); + + sink.body(); + sink.section1(); + sink.sectionTitle1(); + sink.anchor( "top" ); + sink.text( faqs.getTitle() ); + sink.anchor_(); + sink.sectionTitle1_(); + + // ---------------------------------------------------------------------- + // Write summary + // ---------------------------------------------------------------------- + + for ( Iterator partIterator = faqs.getParts().iterator(); partIterator.hasNext(); ) + { + Part part = (Part) partIterator.next(); + if ( StringUtils.isNotEmpty( part.getTitle() ) ) + { + sink.paragraph(); + sink.bold(); + sink.text( part.getTitle() ); + sink.bold_(); + sink.paragraph_(); + } + + sink.numberedList( Sink.NUMBERING_DECIMAL ); + for ( Iterator faqIterator = part.getFaqs().iterator(); faqIterator.hasNext(); ) + { + Faq faq = (Faq) faqIterator.next(); + sink.numberedListItem(); + sink.link( "#" + HtmlTools.encodeId( faq.getId() ) ); + sink.rawText( faq.getQuestion() ); + sink.link_(); + sink.numberedListItem_(); + } + sink.numberedList_(); + } + sink.section1_(); + + // ---------------------------------------------------------------------- + // Write content + // ---------------------------------------------------------------------- + + for ( Iterator partIterator = faqs.getParts().iterator(); partIterator.hasNext(); ) + { + Part part = (Part) partIterator.next(); + if ( StringUtils.isNotEmpty( part.getTitle() ) ) + { + sink.section1(); + sink.sectionTitle1(); + sink.text( part.getTitle() ); + sink.sectionTitle1_(); + } + + sink.definitionList(); + for ( Iterator faqIterator = part.getFaqs().iterator(); faqIterator.hasNext(); ) + { + Faq faq = (Faq) faqIterator.next(); + sink.definedTerm(); + sink.anchor( faq.getId() ); + sink.rawText( faq.getQuestion() ); + sink.anchor_(); + sink.definedTerm_(); + sink.definition(); + sink.paragraph(); + writeAnswer( sink, faq.getAnswer() ); + sink.paragraph_(); + + if ( faqs.isToplink() ) + { + writeTopLink( sink ); + } + + if ( faqIterator.hasNext() ) + { + sink.horizontalRule(); + } + sink.definition_(); + } + sink.definitionList_(); + + if ( StringUtils.isNotEmpty( part.getTitle() ) ) + { + sink.section1_(); + } + } + + sink.body_(); + } + + /** + * @param sink + * @param answer + * @throws Exception + */ + private void writeAnswer( Sink sink, String answer ) + throws Exception + { + int startSource = answer.indexOf( "<source>" ); + if ( startSource != -1 ) + { + writeAnswerWithSource( sink, answer ); + } + else + { + sink.rawText( answer ); + } + } + + /** + * @param sink + */ + private void writeTopLink( Sink sink ) + { + sink.rawText( "<table border=\"0\">" ); + sink.rawText( "<tr><td align=\"right\">" ); + + sink.link( "#top" ); + sink.text( "[top]" ); + sink.link_(); + + sink.rawText( "</td></tr>" ); + sink.rawText( "</table>" ); + } + + /** + * @param sink + * @param answer + * @throws Exception + */ + private void writeAnswerWithSource( Sink sink, String answer ) + throws Exception + { + XmlPullParser parser = new MXParser(); + parser.setInput( new StringReader( "<answer>" + answer + "</answer>" ) ); + + int countSource = 0; + int eventType = parser.getEventType(); + + while ( eventType != XmlPullParser.END_DOCUMENT ) + { + if ( eventType == XmlPullParser.START_TAG ) + { + if ( parser.getName().equals( "source" ) && countSource == 0 ) + { + sink.verbatim( true ); + countSource++; + } + else if ( parser.getName().equals( "source" ) ) + { + sink.rawText( HtmlTools.escapeHTML( "<" + parser.getName() + ">" ) ); + countSource++; + } + else if ( parser.getName().equals( "answer" ) ) + { + // nop + } + else + { + if ( countSource > 0 ) + { + sink.rawText( HtmlTools.escapeHTML( "<" + parser.getName() + ">" ) ); + } + else + { + 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() ); + } + } + } + else if ( eventType == XmlPullParser.END_TAG ) + { + if ( parser.getName().equals( "source" ) && countSource == 1 ) + { + countSource--; + sink.verbatim_(); + } + else if ( parser.getName().equals( "source" ) ) + { + sink.rawText( HtmlTools.escapeHTML( "</" + parser.getName() + ">" ) ); + countSource--; + } + else if ( parser.getName().equals( "answer" ) ) + { + // nop + } + else + { + if ( countSource > 0 ) + { + sink.rawText( HtmlTools.escapeHTML( "</" + parser.getName() + ">" ) ); + } + else + { + sink.rawText( "</" + parser.getName() + ">" ); + } + } + } + else if ( eventType == XmlPullParser.CDSECT ) + { + sink.rawText( HtmlTools.escapeHTML( parser.getText() ) ); + } + else if ( eventType == XmlPullParser.TEXT ) + { + sink.rawText( HtmlTools.escapeHTML( parser.getText() ) ); + } + else if ( eventType == XmlPullParser.ENTITY_REF ) + { + sink.rawText( HtmlTools.escapeHTML( parser.getText() ) ); + } + + eventType = parser.nextToken(); + } + } +} Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java Sat Mar 17 07:45:55 2007 @@ -0,0 +1,48 @@ +package org.apache.maven.doxia.module.fml; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.doxia.site.module.AbstractSiteModule; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Emmanuel Venisse</a> + * @version $Id:FmlSiteModule.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $ + * @plexus.component role-hint="fml" + */ +public class FmlSiteModule + extends AbstractSiteModule +{ + + public String getSourceDirectory() + { + return "fml"; + } + + public String getExtension() + { + return "fml"; + } + + public String getParserId() + { + return "fml"; + } + +} Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlSiteModule.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java Sat Mar 17 07:45:55 2007 @@ -0,0 +1,59 @@ +package org.apache.maven.doxia.module.fml.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class Faq +{ + private String id; + + private String question; + + private String answer; + + public String getId() + { + return id; + } + + public void setId( String id ) + { + this.id = id; + } + + public String getAnswer() + { + return answer; + } + + public void setAnswer( String answer ) + { + this.answer = answer; + } + + public String getQuestion() + { + return question; + } + + public void setQuestion( String question ) + { + this.question = question; + } +} Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faq.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java Sat Mar 17 07:45:55 2007 @@ -0,0 +1,72 @@ +package org.apache.maven.doxia.module.fml.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +public class Faqs +{ + private boolean toplink = true; + + private String title = "FAQ"; + + private List parts; + + public List getParts() + { + return parts; + } + + public void setParts( List parts ) + { + this.parts = parts; + } + + public void addPart( Part part ) + { + if ( parts == null ) + { + parts = new ArrayList(); + } + + parts.add( part ); + } + + public String getTitle() + { + return title; + } + + public void setTitle( String title ) + { + this.title = title; + } + + public void setToplink( boolean toplink ) + { + this.toplink = toplink; + } + + public boolean isToplink() + { + return toplink; + } +} Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Faqs.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java Sat Mar 17 07:45:55 2007 @@ -0,0 +1,72 @@ +package org.apache.maven.doxia.module.fml.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +public class Part +{ + private String id; + + private String title; + + private List faqs; + + public void addFaq( Faq faq ) + { + if ( faqs == null ) + { + faqs = new ArrayList(); + } + + faqs.add( faq ); + } + + public List getFaqs() + { + return faqs; + } + + public void setFaqs( List faqs ) + { + this.faqs = faqs; + } + + public String getId() + { + return this.id; + } + + public void setId( String id ) + { + this.id = id; + } + + public String getTitle() + { + return title; + } + + public void setTitle( String title ) + { + this.title = title; + } +} Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/model/Part.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java?view=auto&rev=519329 ============================================================================== --- maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java (added) +++ maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java Sat Mar 17 07:45:55 2007 @@ -0,0 +1,42 @@ +package org.apache.maven.doxia.module.fml; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.doxia.module.fml.FmlParser; +import org.apache.maven.doxia.parser.AbstractParserTestCase; +import org.apache.maven.doxia.parser.Parser; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> + * @version $Id:FmlParserTest.java 348605 2005-11-24 12:02:44 +1100 (Thu, 24 Nov 2005) brett $ + */ +public class FmlParserTest + extends AbstractParserTestCase +{ + protected Parser getParser() + { + return new FmlParser(); + } + + protected String getDocument() + { + return "src/test/site/fml/faq.fml"; + } +} Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/doxia/trunk/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"