- From: Silli, L. H. <hyperlekken@lenk.no>
- Date: Tue, 11 Aug 2009 03:31:36 +0200
- To: "www-amaya@w3.org" <www-amaya@w3.org>
The Create book feature looks at the current document (from now on referred to as the "create book" file) and replaces all anchor element links (as long as they have a rel="chapter" or rel="subdocument" attribute) with the destination resource. Drawback: since the TOC links are _replaced_ the TOC is also lost during the book creation process. To circumvent this, one may place the TOC in a separate "TOC file". And then, in the "create book" file, insert an anchor element that links to that that TOC file. Then you avoid destroying the TOC that is used to build the book. So far so good. But the resulting content of the "create book" file still doesn't contain any TOC for the book. All the links in the "TOC file" was replaced with whatever they linked to during creation. So how do I also get a TOC into the resulting "create book" file content? So, in order to workaround these gotchas, you must have two TOC files (and two links in the "create book" files - one for each version of the TOC). One TOC file where each link has a rel="chapter" - these links will be replaced. And in the other TOC file, you must *not* have rel="chapter", so as to prevent that the links get replaced with the book content. Which is backwards: One must avoid using rel="chapter" in order to get it right ... (That said, it seems if you add rel="chapter next", then Amaya gets confused - it skip such anchors during book creation. I guess one could call this a feature, perhaps ...) If you want to have a TOC for the content of each chapter file, then you must create the TOC within that chapter file - at least if you want to use Amaya's excellent TOC creating tool. But then you stumble upon something: If the chapter begins with a H1 element, then the H1 element will be excluded from the TOC of that file. Amaya excludes all H1 element when it creates TOC. And that is why, having created a "book", you cannot use that book to create a TOC, since all the H1 elements will be excluded. Where to start ... * I think that Amaya should leave the question of whether to include H1 in the TOC to the authors. For simplicity, Amaya should include it in the TOC. It is simple to delete the link to the H1 element(s) if need be. This is really the crux in the above. If only it had included the H1 in the TOC, then I could have first created the entire book, and thereafter I could used the resulting book content to build a new TOC. * It would have been nice if the Create Book feature use <link rel="chapter" href=""> instead of - or as alternative to - <a rel="chapter" href="">. If it did, then the "create book" _file_ could be reused over and over. Example: <head><title>create book file</title> <link rel="first chapter" href="chapter-1" /> <link rev="chapter-1" rel="chapter" href="chapter-2" /> <link rev="chapter-2" rel="chapter" href="chapter-3" /> <link rev="chapter-3" rel="chapter" href="chapter-4" /> </head> <body><!-- book can be built here --></body> I don't know if the rev="" attributes are needed - but they could be used to verify the order, as seen above. (If nothing else, it can be a good tip for authors to actually use <link> the way I propose above, as it will allow you to easily rebuild the TOC ... ) Leif Halvard Silli
Received on Tuesday, 11 August 2009 01:32:17 UTC