On Thu, Aug 07, 2003 at 10:15:37AM +0200, Gerfried Fuchs wrote:
>  Please find attached my current working version for the splitted users
> page. I've found out about how the devel/todo page does insert only one
> entry, and tried to apply it. There is just one problem:
> 
>  The <toc-add-entry> tag gets executed before the diversion takes effect
> and thus the entry is added twice to the toc list....
> 
>  I'm out of ideas here, help would be appreciated quite well.

Hmm, the idea is simple. Also add the same diversion magic to toc.wml
Patch attached but note that it is most likely not "backwards"
compatible, so I saved it in a different file. Patches for split.pl
and index-splitted.include also attached.

>  There is one more smaller problem, the thing with the url doesn't work:
> If I leave it the current way the href doesn't appear anywhere, if I
> remove the space before the <when like it is in the
> template/debian/toc.wml for the title-formatting tag the href and url
> gets added _inside_ the name tag, like
> <a name="Bond href="http://www.bond.edu.au/"";> ....   Stupid thing, is
> this buggy or is this "feature" documented somewhere?

I don't really understand what happens, but you can just leave the check
out. The toc templates realizes if you provide a empty url. Patch
for index-splitted.include included in the other patch.

Gruesse,
-- 
Frank Lichtenheld <[EMAIL PROTECTED]>
www: http://www.djpig.de/
--- index-splitted.include.bak  2003-09-10 15:43:16.000000000 +0200
+++ index-splitted.include      2003-09-10 15:57:09.000000000 +0200
@@ -7,7 +7,7 @@
 <set-var %attributes />
 
 {#!TODO<subst-in-string <get-var id /> "([^a-zA-Z0-9_])" "_" >OUT#:
-<toc-add-entry$(TOCNAME) name="<get-var id />" href="<get-var url />"><get-var 
description /></toc-add-entry$(TOCNAME)>
+<toc-add-entry$(TOCNAME) uniqid="<subst-in-string <get-var id /> 
"([^a-zA-Z0-9_])" "_" >" name="<get-var id />" href="<get-var url />"><get-var 
description /></toc-add-entry$(TOCNAME)>
 %body
 :#TODO<subst-in-string <get-var id /> "([^a-zA-Z0-9_])" "_" >OUT#}
 
--- split.pl.bak        2003-09-10 16:16:27.000000000 +0200
+++ split.pl    2003-09-10 16:11:37.000000000 +0200
@@ -24,10 +24,10 @@
 while (<R>) {
     if ( m|#include "\$\(ENGLISHDIR\)/users/index\.include"| ) {
         print W <<"EOF";
-#include wml::debian::toc TOCNAME=EDU
-#include wml::debian::toc TOCNAME=COM
-#include wml::debian::toc TOCNAME=ORG
-#include wml::debian::toc TOCNAME=GOV
+#include wml::debian::uniq-toc TOCNAME=EDU
+#include wml::debian::uniq-toc TOCNAME=COM
+#include wml::debian::uniq-toc TOCNAME=ORG
+#include wml::debian::uniq-toc TOCNAME=GOV
 #include "\$(ENGLISHDIR)/users/index-splitted.include" TOCNAME=EDU
 #include "\$(ENGLISHDIR)/users/index-splitted.include" TOCNAME=COM
 #include "\$(ENGLISHDIR)/users/index-splitted.include" TOCNAME=ORG
--- toc.wml     2003-09-10 16:14:04.000000000 +0200
+++ uniq-toc.wml        2003-09-10 16:09:36.000000000 +0200
@@ -6,15 +6,22 @@
 
 <define-tag toc-add-entry$(TOCNAME) endtag="required">
 <preserve name />
-<preserve href />
+<preserve href uniqid />
 <set-var %attributes />
 <ifeq <get-var name /> "" "<increment toc:_cnt />
   <set-var name="l<get-var toc:_cnt />" />" />
 <toc-title-formatting$(TOCNAME)><a name="<get-var name/>"<when <get-var href 
/>> href="<get-var href />"</when>>%body</a></toc-title-formatting$(TOCNAME)>
-{#ToC_questions$(TOCNAME)#:  <toc-item-formatting$(TOCNAME)><a href="#<get-var 
name/>">%body</a></toc-item-formatting$(TOCNAME)>
+{#!ToC_questionsitem<get-var uniqid />$(TOCNAME)#: 
+<toc-item-formatting$(TOCNAME)><a href="#<get-var 
name/>">%body</a></toc-item-formatting$(TOCNAME)>
 :##}
+{#ToC_questions$(TOCNAME)#: 
+<when <not <get-var tocitem:$(TOCNAME)<get-var uniqid />/>/>>
+{#ToC_questionsitem<get-var uniqid />$(TOCNAME)#} 
+<set-var tocitem:$(TOCNAME)<get-var uniqid />=1 />
+</when>
+:##}
+<restore href uniqid />
 <restore name />
-<restore href />
 </define-tag>
 
 #   May be locally redefined

Reply via email to