This is the historical archive of the now-inactive 'grubstreet' list.
Discussion on OpenGuides development
has now moved to OpenGuides-Dev.
Discussion on The Open Guide to
London now takes place on OpenGuides-London.
[grubstreet] Index patch for Wikibeta: double pipe links
[prev] [thread] [next] [lurker] [Date index for 2002/12/18]
From: Ivor Williams
Subject: [grubstreet] Index patch for Wikibeta: double pipe links
Date: 00:31 on 18 Dec 2002
Subject: [grubstreet] Index patch for Wikibeta: double pipe links
Date: 00:31 on 18 Dec 2002
------=_NextPart_000_002C_01C2A62C.CFD96D20
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Here is the latest embedded indexing patch. This allows you to name the =
entry in the index as well as the entry on the page:
Example (the most general case):
Page blah1
...
text for page blah1
...
#INDEX [[foo]]
Page blah2
...
...
Index Links: [[+foo|bar|baz]]
What this means is that page blah1 has an index on it called foo. Foo =
here can be the same as blah1, but is an internal identifier which never =
appears on the page.
Page blah2 is entered into the index foo because of its plus link. This =
link appears on page blah2 as bar, and in the index foo as baz.
Kake, please can you apply it.
__PATCH FOLLOWS__
832c832
< $name =3D $id;
---
> $name =3D $prefix . $id;
851c851
< return &GetPageLinkText($id, $prefix.$name);
---
> return &GetPageLinkText($id, $name);
1207c1207
< =
s/\[\[(\+)?$FreeLinkPattern\|([^\]]+)\]\]/&StorePageOrEditLink($2, $3, =
$1)/geo;
---
> =
s/\[\[(\+)?$FreeLinkPattern\|([^|\]]+)(|[^\]]+)?\]\]/&StorePageOrEditLink=
($2, $3, $1)/geo;
2921,2922c2921,2922
< my @PageList=3D&PageIndex(FreeToNormal($id));
< foreach (@PageList) {
---
> my %PageList=3D&PageIndex(FreeToNormal($id));
> foreach (sort keys %PageList) {
2925c2925
< my $depth =3D @{[/\+/g]};
---
> my $depth =3D @{[/\+/g]} + 1;
2927c2927,2928
< $outstr .=3D '*' x $depth . "[[$pagename]]\n";
---
> my $alias =3D $PageList{$_} || '';
> $outstr .=3D '*' x $depth . "[[$pagename$alias]]\n";
3449c3450,3452
< foreach my $refer ($txt =3D~ /\[\+(.+?)[|\]]/g) {
---
> while ($txt =3D~ /\[\[\+([^|\]]+)(\|[^|\]]+(\|[^\]]+)?)?\]/g) {
> my $refer =3D $1;
> my $alias =3D $3;
3452c3455
< push @{$appearsOn{$refer}},$name;
---
> push @{$appearsOn{$refer}},[$name,$alias];
3454,3455c3457
< $found{$name}++ if !$string=20
< || $name eq $string
---
> $found{$name} =3D $alias if !$string=20
3470c3472,3473
< foreach my $child (@{$appears->{$parent}}) {
---
> foreach my $chcell (@{$appears->{$parent}}) {
> my ($child,$chalias) =3D @$chcell;
3472,3473c3475,3476
< next if $results->{$_.'+'.$child};
< $results->{$_.'+'.$child} =3D 1;
---
> next if exists $results->{$_.'+'.$child};
> $results->{$_.'+'.$child} =3D $chalias;
3483c3486
< sort keys %$results;
---
> map {$_,$results->{$_}} keys %$results;
__END OF PATCH__
------=_NextPart_000_002C_01C2A62C.CFD96D20
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><BR></DIV>
<DIV><FONT size=3D2>Here is the latest embedded indexing patch. This =
allows you to=20
name the entry in the index as well as the entry on the =
page:</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Example (the most general case):</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Page blah1</FONT></DIV>
<DIV><FONT size=3D2>...</FONT></DIV>
<DIV><FONT size=3D2>text for page blah1</FONT></DIV>
<DIV><FONT size=3D2>...</FONT></DIV>
<DIV><FONT size=3D2>#INDEX [[foo]]</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Page blah2</FONT></DIV>
<DIV><FONT size=3D2>...</FONT></DIV>
<DIV><FONT size=3D2>...</FONT></DIV>
<DIV><FONT size=3D2>Index Links: [[+foo|bar|baz]]</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>What this means is that page blah1 has an index on =
it called=20
foo. Foo here can be the same as blah1, but is an internal identifier =
which=20
never appears on the page.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Page blah2 is entered into the index foo because of =
its plus=20
link. This link appears on page blah2 as bar, and in the index foo as=20
baz.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Kake, please can you apply it.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>__PATCH FOLLOWS__</FONT></DIV>
<DIV><FONT size=3D2>832c832<BR>< $name =3D=20
$id;<BR>---<BR>> $name =3D $prefix .=20
$id;<BR>851c851<BR>< return =
&GetPageLinkText($id,=20
$prefix.$name);<BR>---<BR>> return=20
&GetPageLinkText($id,=20
$name);<BR>1207c1207<BR>< =20
s/\[\[(\+)?$FreeLinkPattern\|([^\]]+)\]\]/&StorePageOrEditLink($2, =
$3,=20
$1)/geo;<BR>---<BR>> =20
s/\[\[(\+)?$FreeLinkPattern\|([^|\]]+)(|[^\]]+)?\]\]/&StorePageOrEdit=
Link($2,=20
$3, $1)/geo;<BR>2921,2922c2921,2922<BR>< my=20
@PageList=3D&PageIndex(FreeToNormal($id));<BR>< =
foreach=20
(@PageList) {<BR>---<BR>> my=20
%PageList=3D&PageIndex(FreeToNormal($id));<BR>> =
foreach (sort=20
keys %PageList) {<BR>2925c2925<BR>< my $depth =3D=20
@{[/\+/g]};<BR>---<BR>> my $depth =3D @{[/\+/g]} +=20
1;<BR>2927c2927,2928<BR>< $outstr .=3D '*' x $depth .=20
"[[$pagename]]\n";<BR>---<BR>> my $alias =3D $PageList{$_} || =
'';<BR>>=20
$outstr .=3D '*' x $depth .=20
"[[$pagename$alias]]\n";<BR>3449c3450,3452<BR>< foreach my =
$refer ($txt=20
=3D~ /\[\+(.+?)[|\]]/g) {<BR>---<BR>> while ($txt =3D~=20
/\[\[\+([^|\]]+)(\|[^|\]]+(\|[^\]]+)?)?\]/g) {<BR>> my =
$refer =3D=20
$1;<BR>> my $alias =3D $3;<BR>3452c3455<BR>< =
push=20
@{$appearsOn{$refer}},$name;<BR>---<BR>> push=20
@{$appearsOn{$refer}},[$name,$alias];<BR>3454,3455c3457<BR><=20
$found{$name}++ if !$string <BR>< =
||=20
$name eq $string<BR>---<BR>> $found{$name} =3D $alias if =
!$string=20
<BR>3470c3472,3473<BR>< foreach my $child=20
(@{$appears->{$parent}}) {<BR>---<BR>> foreach my =
$chcell=20
(@{$appears->{$parent}}) {<BR>> my ($child,$chalias) =
=3D=20
@$chcell;<BR>3472,3473c3475,3476<BR>< next if=20
$results->{$_.'+'.$child};<BR>< =
$results->{$_.'+'.$child} =3D=20
1;<BR>---<BR>> next if exists=20
$results->{$_.'+'.$child};<BR>> =
$results->{$_.'+'.$child} =3D=20
$chalias;<BR>3483c3486<BR>< sort keys=20
%$results;<BR>---<BR>> map {$_,$results->{$_}} keys=20
%$results;<BR>__END OF PATCH__</FONT></DIV></BODY></HTML>
------=_NextPart_000_002C_01C2A62C.CFD96D20--
--
grubstreet mailing list
http://london.openguides.org/old-list-archives/
-
[grubstreet] Index patch for Wikibeta: double pipe links
Ivor Williams 00:31 on 18 Dec 2002
Content-Type: text/plain;-
Re: [grubstreet] Index patch for Wikibeta: double pipe links
Kate L Pugh 03:34 on 18 Dec 2002
I think it would probably make more sense if you get an account on the- too deep to show
-
RE: [grubstreet] Index patch for Wikibeta: double pipe links
Ivor Williams 09:31 on 18 Dec 2002
wrote:- too deep to show
-
Re: [grubstreet] Index patch for Wikibeta: double pipe links
Kate L Pugh 03:34 on 18 Dec 2002
