[pmwiki-users] Special handling of links (Was: Default styling of links to ..

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Fri Jan 27 15:41:15 CST 2006


On Fri, 27 Jan 2006, Patrick R. Michaud wrote:

> default styling of links to non-existent pages, but could use feedback.

There is a feature that I thought of today, but to explain why I'd like 
it, I first need to describe the background.

At wiki.lyx.org, a separate file manager is used for uploading and
managing files in a directory structure. This directory structure is more
complicated than what is compatible with the normal version of 'Attach:'.  
I've therefore disabled 'Attach:' and defined the intermap link 'uploads:'
instead as follows:

	uploads:	http://wiki.lyx.org/uploads

The typical case is that a user uploads a file, e.g. example1.lyx, to some
directory '.../Examples/LargeTables/'. Then the user wants to create a 
link and adds the following markup:

	uploads:/Examples/LargeTables/example1.lyx

The problem her is that if the use inadvertently writes e.g.

	uploads:/Examples/LargeTables/example.lyx

the link will look just fine on the wiki page, but in reality it doesn't
go anywhere. This can right now only be tested by the user actually 
clicking on the link to see that it works...

For that reason I'm in the process of hacking a script that just like the
code for 'Attach:' shows when the target of the link doesn't exist.

I've actually got this working, but I'm not happy with the solution.. it
doesn't feel quite right doing a separate solution for just my 'uploads:'.  
Basically I think that I'm not happy with how the code is factored and
"where" it's implemented.

In addition to the example above, there are other situations where I'd
like special handling of "external links". With external link I really
just mean a link that doesn't go to a wiki page in the same field. An
external link could simply be something like 'Cookbook:SomePage'.  
Wouldn't it be nice if the result of 'Cookbook:SomePage' would indicate if
that page doesn't exist?

Now, in the general case it's probably not realistic to expect pmwiki.php 
to go to an arbitrary URI and check if a page exists. There are however 
some cases where it'd be very useful:

* The link goes to an uploaded file (e.g. similar to Attach:)
* The link goes to a local file (e.g. file:...:)
* The link goes to a wiki page in a different field on the same server

I have some thoughts on how this can be handled (and perhaps implemented), 
but first I'd like some thoughts on this in general. 

As for the code I've done for 'uploads:', I'll post that as a cookbook 
page or send it to the list if anyone is interested.

regards
/Christian

Here's an even more advanced case... At work I'm using PmWiki to keep
links to various documents - reference manuals etc. This documentation
resides on the server, but since some files are rather big, it's much
neater to be able to access a local copy. What if we could have some
really clever version of an intermap link that adds an extra link whenever
there is a local copy? In case I'm being unclear here, let me illustrate
with an example. Files are normally stored on the server in
'http://server/doc' and the local copy should reside in say 'file:///doc'.
The intermap link 'doc:' should now check if it knows that there exists a 
local version of this file, and in that case produce an extral link to the 
local copy. This might of course assume that the server knows which files 
are available in the local copy.

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






More information about the pmwiki-users mailing list