brett       2004/06/25 20:10:23

  Modified:    faq      plugin.jelly
               faq/xdocs changes.xml
  Added:       faq/src/plugin-resources faq.jsl
  Log:
  PR: MPFAQ-13
  fix CDATA handling
  
  Revision  Changes    Path
  1.19      +8 -57     maven-plugins/faq/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/faq/plugin.jelly,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- plugin.jelly      12 Jun 2004 02:48:26 -0000      1.18
  +++ plugin.jelly      26 Jun 2004 03:10:23 -0000      1.19
  @@ -66,8 +66,6 @@
             </ant:fileset>
           </ant:fileScanner>
   
  -        <j:set var="outputencoding" value="${maven.docs.outputencoding}"/>
  -
           <!-- loop each found .fml file and produce output .xml xdocs file -->
           <j:forEach var="faqFile" items="${faqFilenames.iterator()}">
             <!-- first, create the relative output-dir into the destdir -->
  @@ -82,62 +80,15 @@
   
             <echo>Generating ${outFile} from ${faqFile}</echo>
   
  -          <!-- xml-parse .fml faq file -->
  -          <x:parse var="doc" xml="${faqFile}"/>
  -          <x:set var="root" select="$doc/*"/>
  -
             <!-- produce a output xdoc xml file from parsed .fml source -->
  -          <j:file name="${outFile}" encoding="${outputencoding}" outputMode="xml" 
escapeText="true">
  -  <document>
  -
  -    <properties>
  -      <x:element name="title"><x:expr select="$root/@title"/></x:element>
  -    </properties>
  -    <body>
  -      <x:element name="section">
  -        <x:attribute name="name"><x:expr select="$root/@title"/></x:attribute>
  -
  -        <x:forEach select="$root/part">
  -          <p>
  -            <strong><x:expr select="title"/></strong>
  -          </p>
  -          <ol>
  -            <x:forEach select="faq">
  -            <li>
  -              <x:element name="a">
  -                <j:set var="_id"><x:expr select="@id"/></j:set>
  -                <x:attribute name="href">#<doc:escapeNameToken 
value="${_id}"/></x:attribute>
  -                <x:copyOf select="question/node()"/>
  -              </x:element>
  -            </li>
  -            </x:forEach>
  -          </ol>
  -        </x:forEach>
  -      </x:element>
  -
  -      <x:forEach select="$root/part">
  -        <x:element name="section">
  -          <x:attribute name="name"><x:expr select="title"/></x:attribute>
  -
  -          <x:forEach select="faq">
  -            <dl>
  -              <dt>
  -                <x:element name="a">
  -                  <j:set var="_id"><x:expr select="@id"/></j:set>
  -                  <x:attribute name="name"><doc:escapeNameToken 
value="${_id}"/></x:attribute>
  -                  <x:copyOf select="question/node()"/>
  -                </x:element>
  -              </dt>
  -              <dd>
  -                  <x:copyOf select="answer/node()"/>
  -              </dd>
  -            </dl>
  -          </x:forEach>
  -        </x:element>
  -      </x:forEach>
  -    </body>
  -  </document>
  -          </j:file>
  +          <doc:jslFile
  +            input="${faqFile}"
  +            output="${outFile}"
  +            stylesheet="${plugin.resources}/faq.jsl"
  +            outputMode="xml"
  +            omitXmlDeclaration="false"
  +            prettyPrint="false"
  +          />
           </j:forEach>
         </util:available>        
       </define:tag>
  
  
  
  1.1                  maven-plugins/faq/src/plugin-resources/faq.jsl
  
  Index: faq.jsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
   * ========================================================================
   *
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed 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.
   *
   * ========================================================================
  -->
  <!-- stylesheet to be used -->
  <jsl:stylesheet select="$doc"
    xmlns:j="jelly:core"
    xmlns:jsl="jelly:jsl"
    xmlns:x="jelly:xml"
    xmlns:doc="doc"
    xmlns="dummy"
    trim="true">
    <jsl:template match="faqs" trim="false">
      <j:set var="title"><x:expr select="@title" /></j:set>
      <document>
        <properties>
          <title>${title}</title>
        </properties>
        <body>
          <section name="${title}">
            <x:forEach select="part">
              <p>
                <strong><x:expr select="title"/></strong>
              </p>
              <ol>
                <x:forEach select="faq">
                <li>
                  <j:set var="_id"><x:expr select="@id"/></j:set>
                  <j:set var="_id">#<doc:escapeNameToken value="${_id}"/></j:set>
                  <a href="${_id}">
                    <x:copyOf select="question/node()"/>
                  </a>
                </li>
                </x:forEach>
              </ol>
            </x:forEach>
          </section>
  
          <jsl:applyTemplates trim="true" />
        </body>
      </document>
    </jsl:template>
  
    <jsl:template match="part">
      <j:set var="name"><x:expr select="title" /></j:set>
      <section name="${name}">
        <jsl:applyTemplates trim="true" />
      </section>
    </jsl:template>
  
    <jsl:template match="faq">
      <dl>
        <jsl:applyTemplates trim="true" />
      </dl>
    </jsl:template>
  
    <jsl:template match="question">
      <dt>
        <j:set var="_id"><x:expr select="../@id"/></j:set>
        <j:set var="_id"><doc:escapeNameToken value="${_id}"/></j:set>
        <a name="${_id}">
          <jsl:applyTemplates trim="true" />
        </a>
      </dt>
    </jsl:template>
  
    <jsl:template match="answer">
      <dd>
        <jsl:applyTemplates trim="true" />
      </dd>
    </jsl:template> 
  
    <!-- copy any other elements through -->
    <jsl:template match="*" trim="false"><jsl:copy trim="true"><jsl:applyTemplates 
trim="true"/></jsl:copy></jsl:template>
  
    <!-- element values don't pass through as text -->
    <jsl:template match="@*"/>
  
    <!-- CDATA and text nodes pass-thru -->
    <jsl:template match="text()"><x:expr select="."/></jsl:template>
  
  </jsl:stylesheet>
  
  
  
  
  1.15      +1 -0      maven-plugins/faq/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/faq/xdocs/changes.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- changes.xml       12 Jun 2004 02:48:26 -0000      1.14
  +++ changes.xml       26 Jun 2004 03:10:23 -0000      1.15
  @@ -25,6 +25,7 @@
     </properties>
     <body>
       <release version="1.4-SNAPSHOT" date="in CVS">
  +      <action dev="brett" type="fix" issue="MPFAQ-13">Correctly pass through CDATA 
content</action>
         <action dev="brett" type="fix" issue="MPFAQ-12">Make sure maven.faq.src 
exists to avoid exceptions</action>
       </release>
       <release version="1.3" date="2004-05-15">
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to