[pmwiki-users] Special handling of links (Was: Default styling of links to ..
christian.ridderstrom at gmail.com
christian.ridderstrom at gmail.com
Sun May 28 15:31:06 CDT 2006
Still going through my old stuff... this one has a bit of an update
though. It's related to my work on a version of (:attachlist:) where you
can write something like
(:attachlist uploads:<path>:)
and you will get a listing of the files at the prefix + <path>.
In order to complete that work, I need to be able to associate intermap
prefixes with filepaths.
The post below is about letting attachment links check for the existance
of a file in general, which also requires the very same association.
Should I simply PITSify this for now, so that we don't forget about it?
/Christian
On Fri, 27 Jan 2006, Patrick R. Michaud wrote:
> On Fri, Jan 27, 2006 at 10:41:15PM +0100, christian.ridderstrom at gmail.com wrote:
>>
>> 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.
>
> My primary thought is that "in general" it's very difficult to establish
> a good correspondence between url paths and the filesystem. It's
> super-difficult even in PmWiki's limited cases, the general case is
> likely to be much more difficult.
>
> That said, we could potentially come up with a new version of LinkIMap
> that in addition to holding urls for each scheme could optionally hold
> filesystem locations to check for file existence, and an alternate
> format to use if the file doesn't exist. Thus, we'd have something like
>
> $IMapFilesystem['uploads:'] = '/path/to/uploads/$1';
>
> and then when formatting a link, it checks for the existence of the
> corresponding file in the filesystem and chooses a different format
> string (from another array) if it doesn't exist.
>
> But keep in mind that this still gets really tricky, or at least a
> little ad-hocish. For example, given an InterMap-link to another field
> on the same server
>
> OtherField:Main/HomePage
>
> there's not a "Main/HomePage" file that we can accurately test. (There's
> a "Main.HomePage" file, but not "Main/HomePage".)
>
> Still, it's quite a good idea. I like the fact that it would be a
> generalized form of what the uploads code is doing now (i.e., it's not
> really "more" code, it's just a refactoring of existing code).
The way I indend to use files and links to them, this won't be a problem.
PmWiki by default associates files with the group from which it's linked.
I on the other hand store all uploaded files in a separate (hierarchical)
structure that is common to all the fields. For simplicity I require all
paths to be absolute.
/Christian
--
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list