Using the <toc /> tag in a template

8 views
Skip to first unread message

iani

unread,
Mar 25, 2011, 12:22:17 PM3/25/11
to Webby, zan...@gmail.com
Hello,

Studying the manual at http://webby.rubyforge.org/user-manual/
I read:

" The table of contents is inserted into the page at the location of
the <toc /> tag. "

I tried inserting the text <toc /> in the example file at the top as
follows:

---
title: Orgmode Parser
created_at: 2009-12-21
status: Under development
filter:
- erb
- org
- outline
tags:
- orgmode
- ruby
---
<%= @page.title %>

Status: <%= @page.status %>

<toc />

* Description

[... etc]

But it did not create a TOC. Should I place the tag in a template? I
also tried inside the body of default.html right after body:


<body>
<toc />

This did not work either. Is there an example of using <toc /> with
the outline filter?

Thanks

Iannis Zannos

Tim Pease

unread,
Mar 25, 2011, 12:29:26 PM3/25/11
to webby...@googlegroups.com

On Mar 25, 2011, at 10:22 AM, iani wrote:

> Hello,
>
> Studying the manual at http://webby.rubyforge.org/user-manual/
> I read:
>

Take a look at the user manual content file itself.

https://github.com/TwP/webby/blob/master/examples/webby/content/user-manual/index.txt

That page uses the outline filter and the <toc /> tag.

Blessings,
TwP

iani

unread,
Mar 25, 2011, 2:00:31 PM3/25/11
to Webby

Thanks, but in the meanwhile I experimented with examples provided in
the webby release directory, and I found
out that the cause is the use of the org filter.

I am using org as a filter and not textile, because I want to
translate a file written in emacs org mode
(http://orgmode.org/)

After some tests, it seems to me that the only way to do that is to
use ERB to embed the original
call to outline/toc. However I am not able to find how that call
should look like. I am a beginner in Ruby.
Therefore I would be helpful for any hints.

Iannis Zannos

On Mar 25, 6:29 pm, Tim Pease <tim.pe...@gmail.com> wrote:
> On Mar 25, 2011, at 10:22 AM, iani wrote:
>
> > Hello,
>
> > Studying the manual athttp://webby.rubyforge.org/user-manual/
> > I read:
>
> Take a look at the user manual content file itself.
>
> https://github.com/TwP/webby/blob/master/examples/webby/content/user-...

Tim Pease

unread,
Mar 29, 2011, 10:52:19 AM3/29/11
to webby...@googlegroups.com

On Mar 25, 2011, at 12:00 PM, iani wrote:

>
> Thanks, but in the meanwhile I experimented with examples provided in
> the webby release directory, and I found
> out that the cause is the use of the org filter.
>
> I am using org as a filter and not textile, because I want to
> translate a file written in emacs org mode
> (http://orgmode.org/)
>
> After some tests, it seems to me that the only way to do that is to
> use ERB to embed the original
> call to outline/toc. However I am not able to find how that call
> should look like. I am a beginner in Ruby.
> Therefore I would be helpful for any hints.
>

I'm not too sure that calling the outline filter manually via an ERb block would work. In your page, the ERb filter will be applied first and then the orgmode filter. The problem is that the outline filter needs a valid HTML document; it parses the heading tags (h1, h2, h3, ...) and generates a table of contents from those tags.

Is the orgmode filter generating header tags? If not, then the outline filter will not find anything from which it can generate a table of contents.

In order for the outline filter to work, the orgmode filter needs to output valid HTML that contains header tags.

I'm sorry that I cannot be much more help.

Blessings,
TwP

Reply all
Reply to author
Forward
0 new messages