[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: toc for <h1> only?

On Thu, 30 Dec 1999, Werner Heuser wrote:

> Hi Denis,
> thank you for your fast and detailed response. I guess I have
> catched the idea of <toc_hN> now.
> Still I would like to use a ToC which contains <h1> headers only.
> As I can see from your example above, WML knows about different
> <hN> levels and uses it for the indentation of the ToC. Can
> someone tell me how I can use this feature or another
> mechanism to build a smaller ToC?

I did not think about it. One solution is to write headers with a
starred form, e.g. <h2*>Section 2</h2*>, starred tags are
not interpreted by WML.

An alternative is to redefine how headers are written into ToC.
You may try
  #use wml::std::toc
  <define-container toc_section whitespace=delete>
  <when <lt %0 2>>
  #  Below is the original replacement text of toc_section

  <h1>Chapter 1</h1>
  <h2>Section 1</h2>
  <h2>Section 1</h2>
  <h1>Chapter 2</h1>
  <h2>Section 1</h2>
  <h2>Section 1</h2>

But there are unwanted newlines. To remove them, you may write

When you render ToC with another style, e.g. style=ol, you have to
adjust the definition of toc_section. Use <function-def toc_section>
to print its definition and paste it into the newer one.

Looks ugly :-(
I will try to improve it in future releases.

Denis Barbier
WML Maintainer

Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com