Josip Rodin wrote: > > > > 3. it doesn't work with multiline questions, which I also > > > > find important since not all of use like 150 chars per line. > > > > > > This can be fixed :) > > > > Great. Please do. > > You already have the code, why not show it, and then I'll integrate it into > the toc template.
Oh, this way. Please see below. <define-tag small_Q whitespace=delete> [EN:Q:] [AR:Q:] [CA:P:] [DA:Sp:] [DE:F:] [EL:Q:] [EO:Q:] [ES:P:] [FI:K:] [FR:Q:] [HR:Q:] [HU:Q:] [ID:Q:] [IT:Q:] [JA:Q:] [KO:Q:] [LT:Q:] [NL:Q:] [NO:Q:] [PL:Q:] [PT:P:] [RO:Q:] [RU:Q:] [SV:F:] [TR:S:] [ZH:Q:] </define-tag> <: $item_count = 0; :> <define-tag topic endtag=required> <preserve id> <set-var %attributes> <if <not <get-var id>> <set-var id="<:=++$item_count:>"> > <p><em><a name="<get-var id>"><strong><small_Q>: %body</strong></a></em></p> <restore id> </define-tag> <define-tag maketoc> <ol> <: $numid = 0; if (open (F, $WML_SRC_FILENAME)) { $state = 0; while (<F>) { if ($state == 0 && m,[<]topic(.*),) { $state = 1; if (m,[<]topic[>](.*)[<]/topic[>],) { $id = ++$numid; $topic = $1; $state = 2; } elsif (m,[<]topic\s+id="?([^">]*)"?[>](.*)[<]/topic[>],) { $id = $1; $topic = $2; $state = 2; } elsif (m,[<]topic[>](.*),) { $id = ++$numid; $topic = $1; $state = 1; } elsif (m,[<]topic\s+id="?([^">]*)"?[>](.*),) { $id = $1; $topic = $2; $state = 1; } else { } } elsif ($state == 1) { if (m,\s*(.*)[<]/topic[>],) { $topic .= " " . $1; $state = 2; } elsif (m,\s*(.*),) { $topic .= " " . $1; } } # else just skip it if ($state == 2) { printf "<li> <a href=\"#%s\">%s</a>\n", $id, $topic; $state = 0; } } close (F); } :> </ol> </define-tag> Regards, Joey -- There are lies, statistics and benchmarks. Please always Cc to me when replying to me on the lists.