[Pmwiki-users] page tree link syntax

chr@home.se chr
Wed Oct 20 14:08:38 CDT 2004


On Tue, 19 Oct 2004, Patrick R. Michaud wrote:

> On Wed, Oct 20, 2004 at 12:10:38AM +0200, chr at home.se wrote:
> > On Tue, 19 Oct 2004, Patrick R. Michaud wrote:
> > 
> > Bah... I just realized an "obvious" reason for why you want a hiearchy.
> > 
> > With a hierarchy, you can introduce the ability to navigate it... going 
> > up, down or laterally, all based on the inherent hierarchical structure.
> 
> ...but only if you have some sort of clear ability for creating relative 
> links between pages, which continues to be the main stumbling block for this.

Here's a suggestion for a syntax, based on this example page tree:
  "/"			http://pmwiki.org/		<- root page
    |-- A		http://pmwiki.org/A		
    |-- A/A1		http://pmwiki.org/A/A1
    |-- A/A2		http://pmwiki.org/A/A2	
    '-- B		http://pmwiki.org/B		<- parent page
        |-- C		http://pmwiki.org/B/C		<- current page
        |   '-- D	http://pmwiki.org/B/CurPage/C	<- child page
	'-- E		http://pmwiki.org/B/E		<- sibling page

where the current page is /B/C, which means that
	ThisWiki = http://pmwiki.org
	ThisPage = http://pmwiki.org/B/CurPage

I've made the assumption that the destination of URI doesn't change if you 
for instance replace all occurences of '/../'. Similarly, I assume that 
each occurence of '/<URI-component>/../' can be replaced with '/' 
without changing the destination.

With these assumptions, I define these link rules:

* Absolute links
      [[/<anything>]]		-> ThisWiki:/<anything>

* Relative link
      [[<not-slash><anything>]]	-> ThisPage:/<not-slash><anything>


The absolute links should be quite straight forward. Here are some
examples of how the relative links work (remember that the current page is
/B/C).

* Sibling links
      [[<Letter><anything>]]	-> ThisPage:/../<Letter><anything>
  Ex: [[E]]	-> /B/E

* Child page
      [[./<anything>]]	-> ThisPage:/./<anything>
  Ex: [[./D]]   -> /B/C/D

* Parent page (and its siblings)
      [[../<anything>]]	-> ThisPage:/../<anything>
  Ex: [[../]]	-> /B
      [[../B]]	-> /B
      [[../A]]  -> /A

Note: In another post I suggesting forbidding that a child page has the 
same name as a parent page. If we allow this, we can let a child page 
refer to its parent page simply by using its name.

Note: I think it might also be good to allow something like [[Parent:]] as 
a link to the parent page.

/Christian

-- 
Christian Ridderstr?m, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list