You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by is...@cocoondev.org on 2005/01/05 22:22:05 UTC

[JIRA] Commented: (FOR-411) Section numbering in HTML output

The following comment has been added to this issue:

     Author: Mike Cornell
    Created: Wed, 5 Jan 2005 3:21 PM
       Body:
I am quite interested in this issue, as I am generating documents from XML based configuration rules for clients.  This would make it much easier as I would be able to avoid having to gen a pdf in order to get the nice features.
---------------------------------------------------------------------
View this comment:
  http://issues.cocoondev.org//browse/FOR-411?page=comments#action_11962

---------------------------------------------------------------------
View the issue:
  http://issues.cocoondev.org//browse/FOR-411

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: FOR-411
    Summary: Section numbering in HTML output
       Type: Improvement

     Status: Unassigned
   Priority: Major

    Project: Forrest
 Components: 
             Core operations
   Versions:
             0.6

   Assignee: 
   Reporter: Olivier Jacques

    Created: Wed, 8 Dec 2004 11:18 AM
    Updated: Wed, 5 Jan 2005 3:21 PM

Description:
Section numbering is enabled for document rendered in PDF, but not for HTML (tigris skin).
I would like to get auto-numbering for section headers:
1. Section1
    1.1 Section1.1
    1.2 Section1.2
2. Section2

Here is a partial solution (on top of 0.6):

- First, modification of skinconf.xml to have numbers in the TOC (new attribute: 'with-numbers'):
  <!-- Configure the TOC, i.e. the Table of Contents.
  @max-depth
   how many "section" levels need to be included in the
   generated Table of Contents (TOC). 
  @min-sections
   Minimum required to create a TOC.
  @location ("page","menu","page,menu", "none")
   Where to show the TOC.
  @with-numbers
   Wether to enable TOC auto-numbering
  -->
  <toc max-depth="3" min-sections="1" location="page" with-numbers="true"/>

- Numbers in the TOC is handled in site2xhtml.xsl:
$ diff -bruN site2xhtml.xsl.orig site2xhtml.xsl
--- site2xhtml.xsl.orig 2004-10-10 14:04:50.000000000 +0200
+++ site2xhtml.xsl      2004-12-08 15:35:52.309861500 +0100
@@ -294,6 +294,9 @@
         <xsl:for-each select="$tocroot/tocitem">
           <li>
             <a href="{@href}">
+              <xsl:if test="contains($config/toc/@with-numbers,'true')">
+                <xsl:number count="tocitem" format="1.1.1.1.1.1.1" level="multiple" />.
+              </xsl:if>
               <xsl:value-of select="@title"/>
             </a>
             <xsl:if test="@level&lt;//skinconfig/toc/@max-depth+1">

- Numbers in the document itself is handled in document2html.xsl. Unfortunately, I was unable to retrieve a configuration value (like a did for site2xhtml) from within document2html.xsl. The idea I had was to add an attribute in skinconf's <headings type="boxed" />. Here is an "hardcoded" version anyway:

$ diff -bruN document2html.xsl.orig document2html.xsl
--- document2html.xsl.orig      2004-10-10 14:05:04.000000000 +0200
+++ document2html.xsl   2004-12-08 16:50:17.974008600 +0100
@@ -129,13 +131,20 @@
     <xsl:choose>
       <xsl:when test="$level=1">
        <div class="h3">
-        <h3><xsl:value-of select="title"/></h3>
+
+        <h3>
+          <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />.
+          <xsl:value-of select="title"/>
+        </h3>
         <xsl:apply-templates/>
       </div>
       </xsl:when>
       <xsl:when test="$level=2">
        <div class="h4">
-        <h4><xsl:value-of select="title"/></h4>
+        <h4>
+          <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />.
+          <xsl:value-of select="title"/>
+        </h4>
         <xsl:apply-templates select="*[not(self::title)]"/>
       </div>

@@ -149,13 +158,19 @@
         </div>
       </xsl:when>
       <xsl:when test="$level=3">
-        <h4><xsl:value-of select="title"/></h4>
+        <h4>
+          <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />.
+          <xsl:value-of select="title"/>
+        </h4>
         <xsl:apply-templates select="*[not(self::title)]"/>

       </xsl:when>

       <xsl:otherwise>
-        <h5><xsl:value-of select="title"/></h5>
+        <h5>
+          <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />.
+          <xsl:value-of select="title"/>
+        </h5>
         <xsl:apply-templates select="*[not(self::title)]"/>
       </xsl:otherwise>


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.cocoondev.org//secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira