Quantcast

-a toc2 implementation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

-a toc2 implementation

snowolfe
I am not sure if this is supposed to mimic the AsciiDoc implementation which puts the toc in the left frame, using Javascript to generate it - if it is, then it doesn't :-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: -a toc2 implementation

mojavelinux
Administrator
All that's left to do to fully mimic the AsciiDoc implementation is to add these styles to the default stylesheet. The way it works in AsciiDoc is that AsciiDoc includes an extra stylesheet, toc2.css. I took a more standard approach by simply adding the "toc2" class to the toc. That way, we can include the styles for both toc layouts in the default stylesheet (and any of the themes).

I have a prototype of the styles on the Golo theme, as you can see here (select Golo from the menu).


Those are pretty generic styles, so it's just a matter of porting them over. Can you file an issue for tracking this enhancement?

-Dan

p.s. Asciidoctor doesn't use JavaScript to generate the toc because it doesn't have to. It has access to the structure of the document during the rendering phase. That's why Asciidoctor makes a reified toc and AsciiDoc does it after the fact.



On Thu, Apr 25, 2013 at 11:23 PM, snowolfe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I am not sure if this is supposed to mimic the AsciiDoc implementation which puts the toc in the left frame, using Javascript to generate it - if it is, then it doesn't :-)


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/a-toc2-implementation-tp164.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: -a toc2 implementation

mojavelinux
Administrator
In reply to this post by snowolfe
Btw, I also added some other goodies to the toc. You can use the following attributes to customize the toc:

toc-title:: The heading text above the toc
toc-class:: The CSS class that is added to the toc container div
toclevels:: The depth of the toc (between 1 and 5, default 2)

Those are primarily for configuring the built-in toc in the header. You can also put a toc anywhere in the document and customize it like any other block.

[[mytoc]]
[role="mytoc"]
.My TOC
toc::[levels=3]

That inserts a toc like:

<div id="mytoc" class="mytoc">
  <div class="title">My TOC</div>
  <ul>
    ...up to 3 levels
  </ul>
</div>

(You guessed it, these features need to be documented :))

-Dan
 


On Thu, Apr 25, 2013 at 11:48 PM, Dan Allen <[hidden email]> wrote:
All that's left to do to fully mimic the AsciiDoc implementation is to add these styles to the default stylesheet. The way it works in AsciiDoc is that AsciiDoc includes an extra stylesheet, toc2.css. I took a more standard approach by simply adding the "toc2" class to the toc. That way, we can include the styles for both toc layouts in the default stylesheet (and any of the themes).

I have a prototype of the styles on the Golo theme, as you can see here (select Golo from the menu).


Those are pretty generic styles, so it's just a matter of porting them over. Can you file an issue for tracking this enhancement?

-Dan

p.s. Asciidoctor doesn't use JavaScript to generate the toc because it doesn't have to. It has access to the structure of the document during the rendering phase. That's why Asciidoctor makes a reified toc and AsciiDoc does it after the fact.



On Thu, Apr 25, 2013 at 11:23 PM, snowolfe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I am not sure if this is supposed to mimic the AsciiDoc implementation which puts the toc in the left frame, using Javascript to generate it - if it is, then it doesn't :-)


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/a-toc2-implementation-tp164.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597




--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: -a toc2 implementation

mojavelinux
Administrator
In reply to this post by snowolfe
...btw, the toc macro requires setting the toc attribute. To disable the built-in toc, unset the toc-placement attribute (e.g., -a toc-placement!)

-Dan


On Fri, Apr 26, 2013 at 12:32 AM, Dan Allen <[hidden email]> wrote:
Btw, I also added some other goodies to the toc. You can use the following attributes to customize the toc:

toc-title:: The heading text above the toc
toc-class:: The CSS class that is added to the toc container div
toclevels:: The depth of the toc (between 1 and 5, default 2)

Those are primarily for configuring the built-in toc in the header. You can also put a toc anywhere in the document and customize it like any other block.

[[mytoc]]
[role="mytoc"]
.My TOC
toc::[levels=3]

That inserts a toc like:

<div id="mytoc" class="mytoc">
  <div class="title">My TOC</div>
  <ul>
    ...up to 3 levels
  </ul>
</div>

(You guessed it, these features need to be documented :))

-Dan
 


On Thu, Apr 25, 2013 at 11:48 PM, Dan Allen <[hidden email]> wrote:
All that's left to do to fully mimic the AsciiDoc implementation is to add these styles to the default stylesheet. The way it works in AsciiDoc is that AsciiDoc includes an extra stylesheet, toc2.css. I took a more standard approach by simply adding the "toc2" class to the toc. That way, we can include the styles for both toc layouts in the default stylesheet (and any of the themes).

I have a prototype of the styles on the Golo theme, as you can see here (select Golo from the menu).


Those are pretty generic styles, so it's just a matter of porting them over. Can you file an issue for tracking this enhancement?

-Dan

p.s. Asciidoctor doesn't use JavaScript to generate the toc because it doesn't have to. It has access to the structure of the document during the rendering phase. That's why Asciidoctor makes a reified toc and AsciiDoc does it after the fact.



On Thu, Apr 25, 2013 at 11:23 PM, snowolfe [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I am not sure if this is supposed to mimic the AsciiDoc implementation which puts the toc in the left frame, using Javascript to generate it - if it is, then it doesn't :-)


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/a-toc2-implementation-tp164.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597




--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597




--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: -a toc2 implementation

snowolfe
In reply to this post by mojavelinux
Loading...