On Tue, Aug 27, 2002 at 12:08:59PM +0200, Martin Schulze wrote: > Denis Barbier wrote: > > There is a consensus that your version is much better (and could certainly > > benefit to other pages as well), so please commit it, and we will try later > > to reuse existing code. > > Ok. Will do. I'll rename the identifiers first so a conversion to > ::toc at a later date will work without much changes in the .wml files.
Very nice. Here is a patch against faq.inc, please check that there is no feature loss on your side. If it's okay, we could then put changes into wml::debian::toc in order to get rid of faq.inc. Denis
Index: faq.inc =================================================================== RCS file: /cvs/webwml/webwml/english/security/faq.inc,v retrieving revision 1.1 diff -u -u -r1.1 faq.inc --- faq.inc 27 Aug 2002 10:56:27 -0000 1.1 +++ faq.inc 27 Aug 2002 13:37:43 -0000 @@ -1,3 +1,5 @@ +#use wml::debian::toc + <define-tag small_Q whitespace=delete> [EN:Q:] [AR:Q:] @@ -27,70 +29,14 @@ [ZH:Q:] </define-tag> -<: - $item_count = 0; -:> - -<define-tag toc-add-entry endtag=required> -<preserve name> -<set-var %attributes> - -<if <not <get-var name>> - <set-var name="<:=++$item_count:>"> -> - -<p><em><a name="<get-var name>"><small_Q>: %body</a></em></p> - -<restore name> +<define-tag toc-title-formatting endtag="required"> +<p><em><small_Q>: %body</em></p> </define-tag> <define-tag maketoc> <ol> -<: - $numid = 0; - if (open (F, $WML_SRC_FILENAME)) { - $state = 0; - while (<F>) { - if ($state == 0 && m,[<]toc-add-entry(.*),) { - $state = 1; - - if (m,[<]toc-add-entry[>](.*)[<]/toc-add-entry[>],) { - $id = ++$numid; - $topic = $1; - $state = 2; - } elsif (m,[<]toc-add-entry\s+name="?([^">]*)"?[>](.*)[<]/toc-add-entry[>],) { - $id = $1; - $topic = $2; - $state = 2; - } elsif (m,[<]toc-add-entry[>](.*),) { - $id = ++$numid; - $topic = $1; - $state = 1; - } elsif (m,[<]toc-add-entry\s+name="?([^">]*)"?[>](.*),) { - $id = $1; - $topic = $2; - $state = 1; - } else { - } - - } elsif ($state == 1) { - if (m,\s*(.*)[<]/toc-add-entry[>],) { - $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); - } -:> +{#ToC_questions#} </ol> </define-tag>