Author: kkolinko
Date: Wed May  5 20:13:30 2010
New Revision: 941463

URL: http://svn.apache.org/viewvc?rev=941463&view=rev
Log:
More anchor handling improvements:
1) escape '#' character as well as spaces. See virtual-hosting-howto.html for 
an example.
2) allow to explicitly specify anchor name, using anchor="" attribute on a 
(sub)section. See default-servlet.html for an example.

Modified:
    tomcat/trunk/webapps/docs/default-servlet.xml
    tomcat/trunk/webapps/docs/tomcat-docs.xsl

Modified: tomcat/trunk/webapps/docs/default-servlet.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/default-servlet.xml?rev=941463&r1=941462&r2=941463&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/default-servlet.xml (original)
+++ tomcat/trunk/webapps/docs/default-servlet.xml Wed May  5 20:13:30 2010
@@ -33,15 +33,13 @@
 <toc/>
 </section>
 
-<section name="What is the DefaultServlet">
-<a name="what"></a>
+<section anchor="what" name="What is the DefaultServlet">
 The default servlet is the servlet which serves static resources as well
 as serves the directory listings (if directory listings are enabled).
 
 </section>
 
-<section name="Where is it declared?">
-<a name="where"></a>
+<section anchor="where" name="Where is it declared?">
 It is declared globally in <i>$CATALINA_BASE/conf/web.xml</i>.
 By default here is it's declaration:
 <source>
@@ -74,8 +72,7 @@ So by default, the default servlet is lo
 directory listings are enabled and debugging is turned off.
 </section>
 
-<section name="What can I change?">
-<a name="change"></a>
+<section anchor="change" name="What can I change?">
 The DefaultServlet allows the following initParamters:
 
 <table border="1">
@@ -194,8 +191,7 @@ The DefaultServlet allows the following 
 </table>
 </section>
 
-<section name="How do I customize directory listings?">
-<a name="dir"></a>
+<section anchor="dir" name="How do I customize directory listings?">
 <p>You can override DefaultServlet with you own implementation and use that
 in your web.xml declaration. If you
 can understand what was just said, we will assume you can read the code
@@ -313,8 +309,7 @@ The following is a sample xsl file which
 
 </section>
 
-<section name="How do I secure directory listings?">
-<a name="secure"></a>
+<section anchor="secure" name="How do I secure directory listings?">
 Use web.xml in each individual webapp. See the security section of the
 Servlet specification.
 

Modified: tomcat/trunk/webapps/docs/tomcat-docs.xsl
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/tomcat-docs.xsl?rev=941463&r1=941462&r2=941463&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/tomcat-docs.xsl (original)
+++ tomcat/trunk/webapps/docs/tomcat-docs.xsl Wed May  5 20:13:30 2010
@@ -187,10 +187,17 @@
   <!-- Process a documentation section -->
   <xsl:template match="section">
     <xsl:variable name="name">
-      <xsl:value-of select="@name"/>
+      <xsl:choose>
+        <xsl:when test="@anchor">
+          <xsl:value-of select="@anchor" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="name2">
-      <xsl:value-of select="translate($name, ' ', '_')"/>
+      <xsl:value-of select="translate($name, ' #', '__')"/>
     </xsl:variable>
     <table border="0" cellspacing="0" cellpadding="2">
       <!-- Section heading -->
@@ -223,15 +230,22 @@
   <!-- Process a documentation subsection -->
   <xsl:template match="subsection">
     <xsl:variable name="name">
-      <xsl:if test="
-          count(//*[(local-name()='section' or local-name()='subsection') and 
@name=current()/@name]) &gt; 1
-          ">
-        <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
-      </xsl:if>
-      <xsl:value-of select="@name"/>
+      <xsl:choose>
+        <xsl:when test="@anchor">
+          <xsl:value-of select="@anchor" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="
+              count(//*[(local-name()='section' or local-name()='subsection') 
and @name=current()/@name]) &gt; 1
+              ">
+            <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
+          </xsl:if>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="name2">
-      <xsl:value-of select="translate($name, ' ', '_')"/>
+      <xsl:value-of select="translate($name, ' #', '__')"/>
     </xsl:variable>
     <table border="0" cellspacing="0" cellpadding="2">
       <!-- Subsection heading -->
@@ -256,15 +270,22 @@
 
   <xsl:template mode="toc" match="section|subsection">
     <xsl:variable name="name">
-      <xsl:if test="local-name()='subsection' and 
-          count(//*[(local-name()='section' or local-name()='subsection') and 
@name=current()/@name]) &gt; 1
-          ">
-        <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
-      </xsl:if>
-      <xsl:value-of select="@name"/>
+      <xsl:choose>
+        <xsl:when test="@anchor">
+          <xsl:value-of select="@anchor" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="local-name()='subsection' and 
+              count(//*[(local-name()='section' or local-name()='subsection') 
and @name=current()/@name]) &gt; 1
+              ">
+            <xsl:value-of select="concat(ancestor::section/@name, '/')"/>
+          </xsl:if>
+          <xsl:value-of select="@name"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:variable>
     <xsl:variable name="name2">
-      <xsl:value-of select="translate($name, ' ', '_')"/>
+      <xsl:value-of select="translate($name, ' #', '__')"/>
     </xsl:variable>
     <li><a href="#{$name2}"><xsl:value-of select="@name"/></a>
     <xsl:if test="subsection">



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

Reply via email to