Author: kkolinko Date: Sun May 9 10:17:51 2010 New Revision: 942517 URL: http://svn.apache.org/viewvc?rev=942517&view=rev Log: CTR: documentation It is backport of r941463 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/tc5.5.x/trunk/container/webapps/docs/default-servlet.xml tomcat/tc5.5.x/trunk/container/webapps/docs/tomcat-docs.xsl Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/default-servlet.xml URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/default-servlet.xml?rev=942517&r1=942516&r2=942517&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/webapps/docs/default-servlet.xml (original) +++ tomcat/tc5.5.x/trunk/container/webapps/docs/default-servlet.xml Sun May 9 10:17:51 2010 @@ -33,19 +33,13 @@ <toc/> </section> -<section name="Introduction"> -This discusses different ways to manipulate the default servlet. -</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_HOME/conf/web.xml</i>. By default here is it's declaration: <source> @@ -78,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"> @@ -184,8 +177,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 @@ -303,8 +295,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/tc5.5.x/trunk/container/webapps/docs/tomcat-docs.xsl URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/tomcat-docs.xsl?rev=942517&r1=942516&r2=942517&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/webapps/docs/tomcat-docs.xsl (original) +++ tomcat/tc5.5.x/trunk/container/webapps/docs/tomcat-docs.xsl Sun May 9 10:17:51 2010 @@ -190,10 +190,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 --> @@ -226,15 +233,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]) > 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]) > 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 --> @@ -259,15 +273,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]) > 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]) > 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