Hi Stuart,<br><br>sorry for the lag in answering, I know that you're awaiting feedback for the final release...<br><br><div class="gmail_quote">2010/10/19 Stuart Rackham<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Arnaud<br>
<br>
I successfully compiled all the docs in svn://<a href="http://svn.debian.org/nut/branches/AsciiDoc" target="_blank">svn.debian.org/nut/branches/AsciiDoc</a> using the current AsciiDoc trunk, and yes, the chunked manual only has a single toc. But there was the added problem of the article sections not being chunked by default, the chunk.section.depth parameter was set to 0 by default (for chapter level chunking in books), this has been fixed in the trunk:<br>
<br>
<a href="http://code.google.com/p/asciidoc/source/detail?r=fe13fddfacafe60cc07674aff77a12850dfbde6b" target="_blank">http://code.google.com/p/asciidoc/source/detail?r=fe13fddfacafe60cc07674aff77a12850dfbde6b</a><br></blockquote>
<div><br>excellent, thanks a lot! <br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
The real problem is the inability to specify section level TOCS. Due to some myopic thinking on my part, the TOC control is effectively hardwired in ./docbook-xsl/common.xsl. I've fixed this so that the TOCs can now be controlled via the various DocBook XSL Stylesheets TOC parameters (see <a href="http://www.sagehill.net/docbookxsl/TOCcontrol.html" target="_blank">http://www.sagehill.net/docbookxsl/TOCcontrol.html</a>) generate.section.toc.level, toc.section.depth and toc.max.depth:<br>
<br>
<a href="http://code.google.com/p/asciidoc/source/detail?r=a40a136d131225d042536c781082181f06024c33" target="_blank">http://code.google.com/p/asciidoc/source/detail?r=a40a136d131225d042536c781082181f06024c33</a><br>
<br>
I can now generate a TOC in each section of the user-manual by setting the generate.section.toc.level to 1 e.g.<br>
<br>
a2x -v --attribute icons --attribute localdate=`TZ=UTC date +%Y-%m-%d` --attribute localtime=`TZ=UTC date +%H:%M:%S` --attribute iconsdir=./icons --attribute=badges --attribute=external_title -a toc -a numbered --destination-dir=. --format=chunked --xsltproc-opts "--stringparam generate.section.toc.level 1" user-manual.txt<br>
<br>
Use the toc.section.depth to increase the depth e.g.<br>
<br>
a2x -v --attribute icons --attribute localdate=`TZ=UTC date +%Y-%m-%d` --attribute localtime=`TZ=UTC date +%H:%M:%S` --attribute iconsdir=./icons --attribute=badges --attribute=external_title -a toc -a numbered --destination-dir=. --format=chunked --xsltproc-opts "--stringparam generate.section.toc.level 1 --stringparam toc.section.depth 3" user-manual.txt<br>
<br>
I also tried generating the user-manual using the 'book' doctype, this picked up an (unrelated) problem -- I got the following error:<br>
<br>
a2x: finding resources in: /home/srackham/tmp/AsciiDoc/docs/user-manual.chunked/ch03.html<br>
Traceback (most recent call last):<br>
File "/home/srackham/bin/a2x", line 814, in <module><br>
a2x.execute()<br>
File "/home/srackham/bin/a2x", line 343, in execute<br>
self.__getattribute__('to_'+self.format)()<br>
File "/home/srackham/bin/a2x", line 625, in to_chunked<br>
self.copy_resources(html_files, src_dir, dst_dir)<br>
File "/home/srackham/bin/a2x", line 509, in copy_resources<br>
lambda attrs: attrs.get('type') == 'text/css')<br>
File "/home/srackham/bin/a2x", line 240, in find_resources<br>
parser.feed(open(f).read())<br>
File "/usr/lib/python2.6/HTMLParser.py", line 108, in feed<br>
self.goahead(0)<br>
File "/usr/lib/python2.6/HTMLParser.py", line 148, in goahead<br>
k = self.parse_starttag(i)<br>
File "/usr/lib/python2.6/HTMLParser.py", line 249, in parse_starttag<br>
attrvalue = self.unescape(attrvalue)<br>
File "/usr/lib/python2.6/HTMLParser.py", line 387, in unescape<br>
return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s)<br>
File "/usr/lib/python2.6/re.py", line 151, in sub<br>
return _compile(pattern, 0).sub(repl, string, count)<br>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 6: ordinal not in range(128)<br>
<br>
This error is due to a limitation in the Python HTMLParser module, see:<br>
<a href="http://bugs.python.org/issue3932" target="_blank">http://bugs.python.org/issue3932</a><br>
<br>
I resolved it by assuming UTF-8 input (this assumption is not always going be correct but it will be correct more often that not doing anything and assuming an ascii encoding:<br>
<a href="http://code.google.com/p/asciidoc/source/detail?r=c9656a70e1303022b041646ef99bef205e6e7f9e" target="_blank">http://code.google.com/p/asciidoc/source/detail?r=c9656a70e1303022b041646ef99bef205e6e7f9e</a><br>
<br>
So, to to get section level TOCs you need to run from the trunk and pass TOC XSL Stylesheets parameters to a2x using the --xsltproc-opts option.<br>
<br>
Could you please test and report back.<br></blockquote><div><br>AFAICT, everything is working as expected ^_^<br>thanks again for your action on the NUT specific issues, and more generally for this "holy grail" you brought us!<br>
<br>I'll now get back on the final NUT completion. Once done and available on <a href="http://www.networkupstools.org">www.networkupstools.org</a> (it's currently only on new.n.o), I'll ping you back for a reference in the "Documents written using AsciiDoc" section.<br>
<br>cheers,<br>Arnaud<br></div></div>