[pmwiki-users] Interpretation of inter-map links and spaces

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Sat Apr 8 11:18:15 CDT 2006


I'd like to suggest adding some kind of option to the definition of 
intermap prefixes, allowing them to behave differently.

!! Motivation

I wanted to create a prefix for wiki pages in another wiki (another wiki
field). However, links to wiki pages are interpreted differently from
prefixed links. Particularly when it comes to how spaces are interpreted.
For this kind of prefix, it'd be much better if the interpretation of link
targets was more similar to how normal links are interpreted.

For testing purposes I modifed Site/InterMap and added the prefix
TestPrefix: which simply goes to http://pmwiki.org/wiki/Test/$1. So now we 
can write TestPrefix:InterMapLinks which links to

	http://pmwiki.org/wiki/Test/InterMapLinks

That page also contains several test cases, see there for reference.

These two items link to the same target:
* [[InterMapLinks]]
* [[TestPrefix:Test/InterMapLinks]]

To get the link texts equal, you can use () and write:
* [[(TestPrefix:Test/)InterMapLinks]]

I'm fine with using () to hide stuff from the link text. But what if I
want to insert spaces in the link text? If I'm careless, I simply write

* [[(TestPrefix:)InterMap links]]

and expect it to link to the same target as [[InterMap links]], but it 
doesn't. Instead, the resulting link is: 
	http://pmwiki.org/wiki/Test/InterMap%20links

PmWiki is rather impressive here though as it gracefully accepts this and 
redirects you to InterMapLinks anyway. I hope this is behaviour is there 
by design and not accident :-)

Anyway, in some cases it might be important to do have the link target not 
contain spaces. For instance if you care about your browser correctly 
identifying which pages you've actually been to.


!! Suggestion

What if we could add an option to the definition of the link prefixes 
which made them behave differently? Here's how it could look like on 
Site.InterMap:

TestPrefix:	http://pmwiki.org/wiki/Test/$1	syntax=wiki-page

where 'syntax=wiki-page' would change how the name of the target is
generated from the target text (i.e. "InterMap links" would be converted 
to "InterMapLinks" rather than "InterMap%20links").


Thoughts?

/Christian

PS. Along similar lines, we could have some kind of option for link
prefixes that link to files on the server:

Uploads:  /uploads/{$Group}/$1	file=/srv/uploads/{$Group}/$1 

where 'file=/srv/uploads/{$Group}/$1' indicates that this is a link prefix
to a local file. The right side contains the file path to the local file,
and is used to render the output differently if the file doesn't exist.  
Perhaps by appending something like "(not found)" if the file doesn't
exist.

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






More information about the pmwiki-users mailing list