Author: kkolinko
Date: Tue Mar  2 15:23:06 2010
New Revision: 918073

URL: http://svn.apache.org/viewvc?rev=918073&view=rev
Log:
Implement support for automatic generation of Table of Contents.
It is triggered by <toc/> element.
Section header is not included into generation, so the complete code fragment 
to add will be
<section name="Table of Contents">
<toc/>
</section>
The html-manager-howto.xml provides a usage example for this.
Also corrected minor issues with tags nesting, reported by w3c validator.

Modified:
    tomcat/trunk/webapps/docs/html-manager-howto.xml
    tomcat/trunk/webapps/docs/tomcat-docs.xsl

Modified: tomcat/trunk/webapps/docs/html-manager-howto.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/html-manager-howto.xml?rev=918073&r1=918072&r2=918073&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/html-manager-howto.xml (original)
+++ tomcat/trunk/webapps/docs/html-manager-howto.xml Tue Mar  2 15:23:06 2010
@@ -29,6 +29,10 @@
 
 <body>
 
+<section name="Table of Contents">
+<toc/>
+</section>
+
 <section name="Introduction">
 
 <p>In many production environments it is very useful to have the capability
@@ -36,7 +40,7 @@
 Tomcat.  This document is for the HTML web interface to the web application
 <a href="manager-howto.html">manager</a>.</p>
 
-<p>The interface is divided into six sections:
+<p>The interface is divided into six sections:</p>
 <ul>
   <li><strong>Message</strong> - Displays success and failure messages.</li>
   <li><strong>Manager</strong> - General manager operations like list and
@@ -48,7 +52,6 @@
   <li><strong>Server Information</strong> - Information about the Tomcat
       server.</li>
 </ul>
-</p>
 
 </section>
 
@@ -68,7 +71,7 @@
 
 <section name="Manager">
 
-<p>The Manager section has three links:
+<p>The Manager section has three links:</p>
 <ul>
   <li><strong>List Applications</strong> - Redisplay a list of web
       applications.</li>
@@ -76,7 +79,6 @@
   <li><strong>Manager Help</strong> - A link to the comprehensive Manager
       App HOW TO.</li>
 </ul>
-</p>
 
 </section>
 
@@ -84,7 +86,7 @@
 
 <p>The Applications section lists information about all the installed web
 applications and provides links for managing them. For each web application
-the following is displayed:
+the following is displayed:</p>
 <ul>
   <li><strong>Path</strong> - The web application context path.</li>
   <li><strong>Display Name</strong> - The display name for the web application
@@ -113,7 +115,6 @@
       </ul>
   </li>
 </ul>
-</p>
 
 <subsection name="Start">
 
@@ -129,7 +130,7 @@
 </source>
 
 <p>Otherwise, the Message will start with <code>FAIL</code> and include an
-error message.  Possible causes for problems include:
+error message.  Possible causes for problems include:</p>
 <ul>
 <li><em>Encountered exception</em>
     <blockquote>             
@@ -152,7 +153,6 @@
     The <code>path</code> parameter is required.
     </blockquote></li>       
 </ul>
-</p>
 
 </subsection>
 
@@ -162,14 +162,14 @@
 deployed.  Any request that comes in while an application is
 stopped will see an HTTP error 404, and this application will show as
 "stopped" on a list applications command.</p>
-                             
+
 <p>If this command succeeds, you will see a Message like this:</p>
 <source>
 OK - Stopped application at context path /examples
 </source>
-                             
+
 <p>Otherwise, the Message will start with <code>FAIL</code> and include an
-error message.  Possible causes for problems include:
+error message.  Possible causes for problems include:</p>
 <ul>                         
 <li><em>Encountered exception</em>
     <blockquote>             
@@ -192,7 +192,6 @@
     The <code>path</code> parameter is required.
     </blockquote></li>       
 </ul>
-</p>
 
 </subsection>
 
@@ -217,7 +216,7 @@
 </source>
 
 <p>Otherwise, the Message will start with <code>FAIL</code> and include an
-error message.  Possible causes for problems include:
+error message.  Possible causes for problems include:</p>
 <ul>
 <li><em>Encountered exception</em>
     <blockquote>             
@@ -250,7 +249,6 @@
     the application again to pick up your changes.
     </blockquote></li>       
 </ul>
-</p>
 
 </subsection>
 
@@ -268,14 +266,14 @@
 reuse later).  This command is the logical opposite of the
 <code>/deploy</code> Ant command, and the related deploy features available 
 in the HTML manager.</p>
-                             
+
 <p>If this command succeeds, you will see a Message like this:</p>
 <source>
 OK - Undeployed application at context path /examples
 </source>
-                             
+
 <p>Otherwise, the Message will start with <code>FAIL</code> and include an
-error message.  Possible causes for problems include:
+error message.  Possible causes for problems include:</p>
 <ul>                         
 <li><em>Encountered exception</em>
     <blockquote>             
@@ -298,7 +296,6 @@
     The <code>path</code> parameter is required.
     </blockquote></li>       
 </ul>
-</p>
 
 </subsection>
 
@@ -335,22 +332,22 @@
 
 <p>In this example the web application located in the directory
 <code>C:\path\to\foo</code> on the Tomcat server (running on Windows)
-is deployed as the web application context named <code>/footoo</code>.
+is deployed as the web application context named <code>/footoo</code>.</p>
 <source>
 Context Path: /footoo
 WAR or Directory URL: file:C:/path/to/foo
 </source>
-</p>
+
 
 <p>In this example the ".war" file <code>/path/to/bar.war</code> on the
 Tomcat server (running on Unix) is deployed as the web application
 context named <code>/bar</code>. Notice that there is no <code>path</code>
 parameter so the context path defaults to the name of the web application
-archive file without the ".war" extension.
+archive file without the ".war" extension.</p>
 <source>
 WAR or Directory URL: jar:file:/path/to/bar.war!/
 </source>
-</p>
+
 
 <h3>Deploy a Directory or War from the Host appBase</h3>
 
@@ -362,20 +359,20 @@
 <code>foo</code> in the Host appBase directory of the Tomcat server is
 deployed as the web application context named <code>/foo</code>. Notice
 that there is no <code>path</code> parameter so the context path defaults
-to the name of the web application directory.
+to the name of the web application directory.</p>
 <source>
 WAR or Directory URL: foo
 </source>
-</p>
+
 
 <p>In this example the ".war" file <code>bar.war</code> located in your
 Host appBase directory on the Tomcat server is deployed as the web
-application context named <code>/bartoo</code>.
+application context named <code>/bartoo</code>.</p>
 <source>
 Context Path: /bartoo
 WAR or Directory URL: bar.war
 </source>
-</p>
+
 
 <h3>Deploy using a Context configuration ".xml" file</h3>
 
@@ -388,7 +385,7 @@
 <p>A Context configuration ".xml" file can contain valid XML for a
 web application Context just as if it were configured in your
 Tomcat <code>server.xml</code> configuration file. Here is an
-example for Tomcat running on Windows:
+example for Tomcat running on Windows:</p>
 <source>
 &lt;Context path="/foobar" docBase="C:\path\to\application\foobar"
          debug="0"&gt;
@@ -399,27 +396,27 @@
 
 &lt;/Context&gt;
 </source>
-</p>
+
 
 <p>Use of the <i>WAR or Directory URL</i> is optional. When used
 to select a web application ".war" file or directory it overrides any
 docBase configured in the context configuration ".xml" file.</p>
 
 <p>Here is an example of installing an application using a Context
-configuration ".xml" file for Tomcat running on Windows.
+configuration ".xml" file for Tomcat running on Windows.</p>
 <source>
 XML Configuration file URL: file:C:/path/to/context.xml
 </source>
-</p>
+
 
 <p>Here is an example of installing an application using a Context
 configuration ".xml" file and a web application ".war" file located
-on the server (Tomcat running on Unix).
+on the server (Tomcat running on Unix).</p>
 <source>
 XML Configuration file URL: file:/path/to/context.xml
 WAR or Directory URL: jar:file:/path/to/bar.war!/
 </source>
-</p>
+
 
 </subsection>
 

Modified: tomcat/trunk/webapps/docs/tomcat-docs.xsl
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/tomcat-docs.xsl?rev=918073&r1=918072&r2=918073&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/tomcat-docs.xsl (original)
+++ tomcat/trunk/webapps/docs/tomcat-docs.xsl Tue Mar  2 15:23:06 2010
@@ -106,9 +106,7 @@
         </xsl:if>
         </td>
         <td>
-          <font face="arial,helvetica,sanserif">
-            <h1><xsl:value-of select="$project/title"/></h1>
-          </font>
+          <h1><font face="arial,helvetica,sanserif"><xsl:value-of 
select="$project/title"/></font></h1>
         </td>
         <td>
           <xsl:comment>APACHE LOGO</xsl:comment>
@@ -134,7 +132,7 @@
       <tr>
 
         <xsl:comment>LEFT SIDE NAVIGATION</xsl:comment>
-        <td width="20%" valign="top" nowrap="true" class="noPrint">
+        <td width="20%" valign="top" nowrap="nowrap" class="noPrint">
           <xsl:apply-templates select="project/body/menu"/>
         </td>
 
@@ -238,6 +236,23 @@
   </xsl:template>
 
 
+  <!-- Generate table of contents -->
+  <xsl:template match="toc">
+    <ul><xsl:apply-templates mode="toc" select="following::section"/></ul>
+  </xsl:template>
+
+  <xsl:template mode="toc" match="section|subsection">
+    <xsl:variable name="name">
+      <xsl:value-of select="@name"/>
+    </xsl:variable>
+    <li><a href="#{$name}"><xsl:value-of select="@name"/></a>
+    <xsl:if test="subsection">
+      <ol><xsl:apply-templates mode="toc" select="subsection"/></ol>
+    </xsl:if>
+    </li>
+  </xsl:template>
+
+
   <!-- Process a source code example -->
   <xsl:template match="source">
     <xsl:variable name="void">
@@ -247,35 +262,35 @@
       <table cellspacing="4" cellpadding="0" border="0">
         <tr>
           <td bgcolor="{$source-color}" width="1" height="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
           <td bgcolor="{$source-color}" height="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
           <td bgcolor="{$source-color}" width="1" height="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
         </tr>
         <tr>
           <td bgcolor="{$source-color}" width="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
           <td bgcolor="#ffffff" height="1"><pre>
             <xsl:value-of select="."/>
           </pre></td>
           <td bgcolor="{$source-color}" width="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
         </tr>
         <tr>
           <td bgcolor="{$source-color}" width="1" height="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
           <td bgcolor="{$source-color}" height="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
           <td bgcolor="{$source-color}" width="1" height="1">
-            <img src="{$void}" width="1" height="1" vspace="0" hspace="0" 
border="0"/>
+            <img src="{$void}" alt="" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
           </td>
         </tr>
       </table>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to