[dokuwiki] Re: handling of certain schemes within external link
- From: ytrewq1 <ytrewq1@xxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Thu, 28 Jul 2005 22:10:32 +0800
On 7/28/05, Andreas Gohr <andi@xxxxxxxxxxxxxx> wrote:
> ytrewq1 writes:
>
> > On Mac OS X 10.4 there is a scheme named 'x-man-page'.
> > With the 2005-07-13 version of DokuWiki, these don't show
> > up appropriately in external links.
>
> hmm.. can someone have a look at the apropriate RFC? Is this a valid
> URL-scheme?
RFC 1738 states:
In general, URLs are written as follows:
<scheme>:<scheme-specific-part>
A URL contains the name of the scheme being used (<scheme>) followed
by a colon and then a string (the <scheme-specific-part>) whose
interpretation depends on the scheme.
Scheme names consist of a sequence of characters. The lower case
letters "a"--"z", digits, and the characters plus ("+"), period
("."), and hyphen ("-") are allowed.
So, if you're wondering about whether '-' is allowed, I think the answer is
(or at least used to be) 'yes'.
If you meant about whether 'x-man-page' specifically was valid, I found
the following in RFC 1738:
4. REGISTRATION OF NEW SCHEMES
A new scheme may be introduced by defining a mapping onto a
conforming URL syntax, using a new prefix. URLs for experimental
schemes may be used by mutual agreement between parties.
Scheme names starting with the characters "x-" are reserved for
experimental purposes.
It may be that the following contains more up-to-date information:
http://www.faqs.org/rfcs/rfc3986.html
Specifically sections 3.1 mentions schemes. There appear to be
other possibly relevant RFCs too, but I'm not familiar with these
more recent ones (including 3986).
> The interwiki shortcut 'man' would maybe be the better way anyway (if
> someone accesses the wiki without OS-X. Eg:
>
> [[man>vi]] for the manpage of vi
Sure.
> > I tried changing line 413 of my inc/parser/handler.php as
> > follows:
> >
> > }elseif ( preg_match('#^([a-z0-9-]+?)://#i',$link[0]) ) {
>
> I think the - should be escaped, just to be sure:
>
> }elseif ( preg_match('#^([a-z0-9\-]+?)://#i',$link[0]) ) {
Ah, you mean in case someone decides to put something
after the '-'? Sounds like a worthy precaution.
> > (just added a '-' to the regular expression) and now the
> > 'x-man-page' links appear to show up ok. Is this an
> > appropriate way to handle this issue? Also, in general if
> > there are custom schemes that don't appear to be handled
> > by DokuWiki, is modifying this regular expression an
> > appropriate way to cope (and sufficient)?
>
> Yes - how else?
Not really being familiar with the source for DokuWiki,
I thought I'd ask because it wasn't clear to me. FWIW, I
did find a different source file that explicitly listed schemes
but it didn't seem necessary to change anything there.
I didn't understand whether the approach in DokuWiki is to:
1) Specify an explicit list of schemes to allow
2) Specify an explicit list of schemes to deny
3) Some combination of the above
4) Describe purely by pattern some kind of legal syntax
5) Something else
From a brief examination of the code and testing, it
feels like 4.
FWIW, as I understand it, in Mac OS X (and perhaps other
operating systems), it's not unheard of for applications to
let the OS know that they handle custom schemes so if
the approach really is 4, then as long as the custom schemes
match the pattern it seems ok.
The reason this has come up for me is that I'm helping
a bit with fixing some upgrade breakage (there's actually
a couple of schemes that used to work -- sorry, I don't
know what version of DokuWiki that was the case for --
but a recent upgrade caused these to stop working and
the schemes happen to contain the '-' character). I was
thinking it'd be nice for this to not happen in the future
or at least understanding what might be necessary when
doing a new set-up or upgrade so getting clarification
on the approach (i.e. which of 1-5) seemed like a good
idea.
> And submitting a bugreport or ask at the list, as you did,
> is a good idea as well :-)
That's good to hear :-)
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: handling of certain schemes within external link
- From: Andreas Gohr
- References:
- [dokuwiki] handling of certain schemes within external link
- From: ytrewq1
- [dokuwiki] Re: handling of certain schemes within external link
- From: Andreas Gohr
Other related posts:
- » [dokuwiki] handling of certain schemes within external link
- » [dokuwiki] Re: handling of certain schemes within external link
- » [dokuwiki] Re: handling of certain schemes within external link
- » [dokuwiki] Re: handling of certain schemes within external link
- [dokuwiki] Re: handling of certain schemes within external link
- From: Andreas Gohr
- [dokuwiki] handling of certain schemes within external link
- From: ytrewq1
- [dokuwiki] Re: handling of certain schemes within external link
- From: Andreas Gohr