On 08/11/11 09:19, Loďc ¨Paillotin wrote:
Hello,

As you probably know (since it is in the BUGS file) there is a bug in the TOC
generation for html backends when using multi part documents: the lvl0 titles
are not taken into account correctly.
Well it turns out that I'm working on a multi part book and that really bothered
me (the workaround, using a2x to generate the html via docbook is both slower
and uglier in my opinion).
So I looked at the JS that generates the TOC:

       function tocEntries(el, toclevels) {
         var result = new Array;
         var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');


Changing this to

       function tocEntries(el, toclevels) {
         var result = new Array;
         var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');


Fixes the problem (well there is still an indentation problem, with lvl0 toc
elements and lvl1 toc elements being at the same level but I suck completely at
JS so I didn't figure out why yet.

Hi Loďc

The current HTML multi-part book TOC omits book part headings because they are out of sequence h1 tags whereas all top level headings in all other documents are h2. Your fix will include part heading but they are assigned the unused CSS class toclevel0. The real problem is that the other top level sections (prefaced, index etc) use h2 and so do chapter headings which are one level down and there is no easy way to distinguish the two from the JavaScript TOC generator.

I think the best compromise is to apply your patch and style toclevel0 the same as toclevel1. It won't have any effect in other document types because h1 tags are not used in the section bodies of other doc types. The result is that book part headings will be included in as TOC top level entries.

I've committed this to the trunk and cc'ed the in the AsciiDoc discussion group.
http://code.google.com/p/asciidoc/source/detail?r=3033b4c9c08eeb96bbe6fcc3ff8fb3f2abf30c3a


Cheers, Stuart



Well anyways, thank you for an awesome software.
--
Loďc Paillotin
http://www.carnetsdeseattle.fr
http://www.linkedin.com/in/loicpaillotin

--
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

Reply via email to