[Pmwiki-users] Re: Re: Include doesn't work in SideBar

Christian Ridderström chr
Mon Mar 22 15:52:44 CST 2004


On Mon, 22 Mar 2004, Patrick R. Michaud wrote:

> On Mon, Mar 22, 2004 at 08:11:46PM +0100, Christian Ridderstr?m wrote:
> > On Mon, 22 Mar 2004, Patrick R. Michaud wrote:
> > 
> > > Feature.  The only place that [[include:]] and its sisters ([[redirect:]],
> > > etc.) work is in the main body of the text.  This also has impacts
> > > on the diff and other outputs.
> > 
> > IMHO it's a bug, at least sometimes.
> 
> It's primarily a function of how PmWiki was originally put together.
> It wasn't convenient to put the [[include:]] directive into the PrintText
> routine, so it was placed in HandleBrowse.  After that it was moved to
> ProcessTextDirectives so that it could be used by other modules (e.g.,
> page preview).
> 
> It's one thing to just say that "[[include:]] should always just work",
> but there are other dependencies involved as well.

In order to a bit more constructive, let me give an example of why/when
I'd like [[include:]] to work. Let's assume that I (as an author, not an
admin) wants to give several groups a common groupheader/footer -- or just
want to add a common piece of code. This could for instance be links to 
groups that have something in common.

At the moment, you manually have to keep the pages looking alike. However,
if [[include:]] worked, the common part could be kept in a single page.

Let me now give a real example. At http://wiki.lyx.org, the sidebars in
(all?) the groups contain these parts:

	1.  Navigation and introduction links
	    (this part is common to all sidebars)
	2a. Listing of the major categories (meta-groups), that also
	    indicates which major category the current group belongs to.
	2b. Listing of the groups in the current group category
	    (Both 2a. and 2b. are common to a set of groups)
	3.  Common global links
	    (this part is common to all sidebars)

I'm aware that this could be implemented as a local customization, but I 
want normal users to be able to modify this structure as well as the 
content.


> Should [[include:]] be processed before or after including the group
> header pages? Currently it's before, so that an include file can specify
> [[nogroupheader]], [[nogroupfooter]], [[notitle]], etc., to disable some
> headers and footers.

IMO, a [[notitle]] etc found in an included page should have an effect.

> If we move [[include:]] processing to after those sections then it
> changes the dynamics of the page rendering quite a bit.
> 
> We could do [[include:]] processing multiple times, but that gets confusing.
> ("Q: I included a file that specifies [[nogroupheader]] and it did't get
> processed--how come?" "A: Well, your file got processed by the second-pass
> of [[include:]], which comes after the group header/footer processing
> so it doesn't count.")

I think it should be solvable without multiple passes. At the moment, IIRC 
the "problem" is that something like 'wiki:SomePage' doesn't support 
[[include:]]. An alternative to making it support [[include:]] is to 
introduce e.g. 'include:SomePage' which would support [[include:]].

> And there are some times that we just don't want [[include:]] and
> [[noheader]] processing performed, such as when displaying page revision
> output.

So basically a global flag or parameter would be needed to indicate if 
[[include:]] should be honoured or not?

> Or, put another way, if someone puts "[[notitle]]" or "[[redirect:]]" in
> the sidebar, should it be honored?

I think [[notitle]] should be honoured. As for [[redirect:]] I'm not
sure... if it's in the sidebar, the effect wouldn't the effect be
identical to an [[include:]]? If it is, it could simply be interpreted as 
an [[include:]] in this case.

>  What if the sidebar page does "[[include:]]" of another page that
> contains "[[notitle]]" or "[[redirect:]]"?
> 
> Is there a consistent rule that one can come up with for all of the
> various directives that take place?

How about this. [[notitle]] is always honoured when it's found, and 
[[redirect:]] is interpreted as [[include:]] with the exception of when 
it's found as the first and only statement in the "main" wiki page.

An alternative would be to introduce two versions of the 'wiki:SomePage' 
that can be found in the template. One that treats [[redirect:]] as today 
(or ignores it?), and one that treats [[redirect:]] as an [[include:]].

/Christian

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list