From: Micki K. <mic...@co...> - 2004-02-25 00:21:56
|
What if we approached it differently: 1. The plugin is an include of the basepage, but only the headings. Each is formatted with an anchor href, according to a nomenclature to be decided (like perhaps h-1, h-11, h-111, h-2, h-22, h-23, h-3, h-4, etc.). Since one recursive include is allowed, this should be possible (except for TextFormattingRules). 2. The page belowis rendered as usual, but the presence of the AutoToc modifies the display so that the sections are rendered out with invisible anchor tags, named using the exact same nomenclature as in 1. This way you don't need two passes, or jscript. A known limitation: any !'s above the plugin declaration would perhaps not have anchors, since they'd be rendered before the appearance of the declaration. What do you think? Micki >Message: 9 >Date: Wed, 25 Feb 2004 00:53:29 +0100 >From: Reini Urban <ru...@x-...> >To: php...@li... >Subject: Re: [Phpwiki-talk] feature idea - TOC (de facto IncludeHeadings) > >Micki Kaufman schrieb: > > I frequently have use for a bunch of named links - to function like an > > online table of contents. > > > > For an example, see the beginning of the latest build's > > PhpWikiAdministration. > ><?plugin AutoToc jscript_hide=1 headers=1,2,3 ?> > >Yes, MoinMoin (I think) has a cool jscript based heading navigator. >The only problem is that such targets must provide the appropriate ><a name=""> tags and gyriations as in PhpWikiAdministration. > > > Would be great to be able to insert a code like %%TOC%% or the > > equivalent, and have a series of links display based on heading 1, 2 and > > 3. Named links aren't as important here, because one can use the desired > > text for the headings themselves. >-- >Reini Urban >http://xarch.tu-graz.ac.at/home/rurban/ -- Micki mailto:mic...@co... |
From: Reini U. <ru...@x-...> - 2004-02-25 00:44:25
|
I would do it this way: ! any page content <?plugin AnyPlugin ?> ! more headers <?plugin AutoToc ?> nothing really important here at the footer AutoToc sees the HTML tree from the previous plugin's and page content, and modifies it accordingly by recursively stepping through the tree. This seems to be fun to code and the most painless solution. (I am a former lisp programmer :) Micki Kaufman schrieb: > What if we approached it differently: > > 1. The plugin is an include of the basepage, but only the headings. Each > is formatted with an anchor href, according to a nomenclature to be > decided (like perhaps h-1, h-11, h-111, h-2, h-22, h-23, h-3, h-4, > etc.). Since one recursive include is allowed, this should be possible > (except for TextFormattingRules). > > 2. The page belowis rendered as usual, but the presence of the AutoToc > modifies the display so that the sections are rendered out with > invisible anchor tags, named using the exact same nomenclature as in 1. > > This way you don't need two passes, or jscript. > > A known limitation: any !'s above the plugin declaration would perhaps > not have anchors, since they'd be rendered before the appearance of the > declaration. > > What do you think? > Micki > >> Message: 9 >> Date: Wed, 25 Feb 2004 00:53:29 +0100 >> From: Reini Urban <ru...@x-...> >> To: php...@li... >> Subject: Re: [Phpwiki-talk] feature idea - TOC (de facto IncludeHeadings) >> >> Micki Kaufman schrieb: >> > I frequently have use for a bunch of named links - to function like an >> > online table of contents. >> > >> > For an example, see the beginning of the latest build's >> > PhpWikiAdministration. >> >> <?plugin AutoToc jscript_hide=1 headers=1,2,3 ?> >> >> Yes, MoinMoin (I think) has a cool jscript based heading navigator. >> The only problem is that such targets must provide the appropriate >> <a name=""> tags and gyriations as in PhpWikiAdministration. >> >> > Would be great to be able to insert a code like %%TOC%% or the >> > equivalent, and have a series of links display based on heading 1, >> 2 and >> > 3. Named links aren't as important here, because one can use the >> desired >> > text for the headings themselves. >> -- >> Reini Urban >> http://xarch.tu-graz.ac.at/home/rurban/ > > > -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Joby W. <joby@u.washington.edu> - 2004-03-01 15:58:28
|
I implemented a table of contents in my fork of Phpwiki as a function of using headings ('!'). So if in your page you have: !!! Major Section !! minor section ! sub section ! another sub section !! another minor Section ! sub section !!! Last major Section The following TOC would be generated: * Major Section * minor section * sub section * another sub section * another minor section * Last major section I used unordered lists so that we can control the numbering, but it would be easy to change it to an ordered list. jbw Reini Urban wrote: > I would do it this way: > > ! any page content > <?plugin AnyPlugin ?> > ! more headers > <?plugin AutoToc ?> > nothing really important here at the footer > > AutoToc sees the HTML tree from the previous plugin's and page content, > and modifies it accordingly by recursively stepping through the tree. > > This seems to be fun to code and the most painless solution. > (I am a former lisp programmer :) > > Micki Kaufman schrieb: > >> What if we approached it differently: >> >> 1. The plugin is an include of the basepage, but only the headings. >> Each is formatted with an anchor href, according to a nomenclature to >> be decided (like perhaps h-1, h-11, h-111, h-2, h-22, h-23, h-3, h-4, >> etc.). Since one recursive include is allowed, this should be possible >> (except for TextFormattingRules). >> >> 2. The page belowis rendered as usual, but the presence of the AutoToc >> modifies the display so that the sections are rendered out with >> invisible anchor tags, named using the exact same nomenclature as in 1. >> >> This way you don't need two passes, or jscript. >> >> A known limitation: any !'s above the plugin declaration would perhaps >> not have anchors, since they'd be rendered before the appearance of >> the declaration. >> >> What do you think? >> Micki >> >>> Message: 9 >>> Date: Wed, 25 Feb 2004 00:53:29 +0100 >>> From: Reini Urban <ru...@x-...> >>> To: php...@li... >>> Subject: Re: [Phpwiki-talk] feature idea - TOC (de facto >>> IncludeHeadings) >>> >>> Micki Kaufman schrieb: >>> > I frequently have use for a bunch of named links - to function >>> like an >>> > online table of contents. >>> > >>> > For an example, see the beginning of the latest build's >>> > PhpWikiAdministration. >>> >>> <?plugin AutoToc jscript_hide=1 headers=1,2,3 ?> >>> >>> Yes, MoinMoin (I think) has a cool jscript based heading navigator. >>> The only problem is that such targets must provide the appropriate >>> <a name=""> tags and gyriations as in PhpWikiAdministration. >>> >>> > Would be great to be able to insert a code like %%TOC%% or the >>> > equivalent, and have a series of links display based on heading 1, >>> 2 and >>> > 3. Named links aren't as important here, because one can use the >>> desired >>> > text for the headings themselves. >>> -- >>> Reini Urban >>> http://xarch.tu-graz.ac.at/home/rurban/ >> >> >> >> > > |
From: Reini U. <ru...@x-...> - 2004-03-01 18:24:05
|
Joby Walker schrieb: > I implemented a table of contents in my fork of Phpwiki as a function of > using headings ('!'). So if in your page you have: Like the CreateToc plugin I just checked in :) Can I see your source? For now I didn't change the pagecache, so there are no anchors (a name) for the links. > !!! Major Section > !! minor section > ! sub section > ! another sub section > !! another minor Section > ! sub section > !!! Last major Section > > The following TOC would be generated: > > * Major Section > * minor section > * sub section > * another sub section > * another minor section > * Last major section > > I used unordered lists so that we can control the numbering, but it > would be easy to change it to an ordered list. > > jbw > > Reini Urban wrote: > >> I would do it this way: >> >> ! any page content >> <?plugin AnyPlugin ?> >> ! more headers >> <?plugin AutoToc ?> >> nothing really important here at the footer >> >> AutoToc sees the HTML tree from the previous plugin's and page >> content, and modifies it accordingly by recursively stepping through >> the tree. >> >> This seems to be fun to code and the most painless solution. >> (I am a former lisp programmer :) >> >> Micki Kaufman schrieb: >> >>> What if we approached it differently: >>> >>> 1. The plugin is an include of the basepage, but only the headings. >>> Each is formatted with an anchor href, according to a nomenclature to >>> be decided (like perhaps h-1, h-11, h-111, h-2, h-22, h-23, h-3, h-4, >>> etc.). Since one recursive include is allowed, this should be >>> possible (except for TextFormattingRules). >>> >>> 2. The page belowis rendered as usual, but the presence of the >>> AutoToc modifies the display so that the sections are rendered out >>> with invisible anchor tags, named using the exact same nomenclature >>> as in 1. >>> >>> This way you don't need two passes, or jscript. >>> >>> A known limitation: any !'s above the plugin declaration would >>> perhaps not have anchors, since they'd be rendered before the >>> appearance of the declaration. >>> >>> What do you think? >>> Micki >>> >>>> Message: 9 >>>> Date: Wed, 25 Feb 2004 00:53:29 +0100 >>>> From: Reini Urban <ru...@x-...> >>>> To: php...@li... >>>> Subject: Re: [Phpwiki-talk] feature idea - TOC (de facto >>>> IncludeHeadings) >>>> >>>> Micki Kaufman schrieb: >>>> > I frequently have use for a bunch of named links - to function >>>> like an >>>> > online table of contents. >>>> > >>>> > For an example, see the beginning of the latest build's >>>> > PhpWikiAdministration. >>>> >>>> <?plugin AutoToc jscript_hide=1 headers=1,2,3 ?> >>>> >>>> Yes, MoinMoin (I think) has a cool jscript based heading navigator. >>>> The only problem is that such targets must provide the appropriate >>>> <a name=""> tags and gyriations as in PhpWikiAdministration. >>>> >>>> > Would be great to be able to insert a code like %%TOC%% or the >>>> > equivalent, and have a series of links display based on heading >>>> 1, 2 and >>>> > 3. Named links aren't as important here, because one can use the >>>> desired >>>> > text for the headings themselves. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Joby W. <joby@u.washington.edu> - 2004-03-01 18:44:56
|
Looks much more elegant than my pretty brutal hack. On the anchors one thing that was a requirement was a link back to the table of contents -- so I turned the heading into an anchor and link back to the TOC. One thing to consider is how will this interact with the IncludePage Plugin. jbw Reini Urban wrote: > Joby Walker schrieb: > >> I implemented a table of contents in my fork of Phpwiki as a function >> of using headings ('!'). So if in your page you have: > > > Like the CreateToc plugin I just checked in :) > Can I see your source? > For now I didn't change the pagecache, so there are no anchors (a name) > for the links. > >> !!! Major Section >> !! minor section >> ! sub section >> ! another sub section >> !! another minor Section >> ! sub section >> !!! Last major Section >> >> The following TOC would be generated: >> >> * Major Section >> * minor section >> * sub section >> * another sub section >> * another minor section >> * Last major section >> >> I used unordered lists so that we can control the numbering, but it >> would be easy to change it to an ordered list. >> >> jbw >> >> Reini Urban wrote: >> >>> I would do it this way: >>> >>> ! any page content >>> <?plugin AnyPlugin ?> >>> ! more headers >>> <?plugin AutoToc ?> >>> nothing really important here at the footer >>> >>> AutoToc sees the HTML tree from the previous plugin's and page >>> content, and modifies it accordingly by recursively stepping through >>> the tree. >>> >>> This seems to be fun to code and the most painless solution. >>> (I am a former lisp programmer :) >>> >>> Micki Kaufman schrieb: >>> >>>> What if we approached it differently: >>>> >>>> 1. The plugin is an include of the basepage, but only the headings. >>>> Each is formatted with an anchor href, according to a nomenclature >>>> to be decided (like perhaps h-1, h-11, h-111, h-2, h-22, h-23, h-3, >>>> h-4, etc.). Since one recursive include is allowed, this should be >>>> possible (except for TextFormattingRules). >>>> >>>> 2. The page belowis rendered as usual, but the presence of the >>>> AutoToc modifies the display so that the sections are rendered out >>>> with invisible anchor tags, named using the exact same nomenclature >>>> as in 1. >>>> >>>> This way you don't need two passes, or jscript. >>>> >>>> A known limitation: any !'s above the plugin declaration would >>>> perhaps not have anchors, since they'd be rendered before the >>>> appearance of the declaration. >>>> >>>> What do you think? >>>> Micki >>>> >>>>> Message: 9 >>>>> Date: Wed, 25 Feb 2004 00:53:29 +0100 >>>>> From: Reini Urban <ru...@x-...> >>>>> To: php...@li... >>>>> Subject: Re: [Phpwiki-talk] feature idea - TOC (de facto >>>>> IncludeHeadings) >>>>> >>>>> Micki Kaufman schrieb: >>>>> > I frequently have use for a bunch of named links - to function >>>>> like an >>>>> > online table of contents. >>>>> > >>>>> > For an example, see the beginning of the latest build's >>>>> > PhpWikiAdministration. >>>>> >>>>> <?plugin AutoToc jscript_hide=1 headers=1,2,3 ?> >>>>> >>>>> Yes, MoinMoin (I think) has a cool jscript based heading navigator. >>>>> The only problem is that such targets must provide the appropriate >>>>> <a name=""> tags and gyriations as in PhpWikiAdministration. >>>>> >>>>> > Would be great to be able to insert a code like %%TOC%% or the >>>>> > equivalent, and have a series of links display based on heading >>>>> 1, 2 and >>>>> > 3. Named links aren't as important here, because one can use the >>>>> desired >>>>> > text for the headings themselves. |