[pmwiki-users] Parentheses in links

Patrick R. Michaud pmichaud at pobox.com
Mon Jan 15 10:16:07 CST 2007


On Sun, Jan 14, 2007 at 04:23:25PM +0100, christian.ridderstrom at gmail.com wrote:
> On Sun, 14 Jan 2007, kirpi at kirpi.it wrote:
> 
> >I just added a link to the
> >http://en.wikipedia.org/wiki/ABC_(musical_notation) into the "See
> >Also" section of http://www.pmwiki.org/wiki/Cookbook/AbcMusic in case
> >somebody is curious to know more about it.
> >
> >I noted, though, that parentheses () in the url are "cleaned", somehow.
> >By chance, the result is an useful url anyway.
> 
> That is on purpose. The idea is that you can create a link like this:
> 	[[ (http://www.pmwiki.org/wiki/Main/)SomePage(Hidden) ]]
> and the link text becomes
> 	SomePage
> 
> It's quite nifty although annoying with URIs that use (). 

At the time we created this particular markup, there weren't
many uris that used parenthesis.  Even today, MediaWiki/Wikipedia
is the only place I know that uses them regularly (not that
those are at all insignificant).

> >I wonder if this behaviour is "normal" and, if so, it has to be kept.
> 
> Don't know... might be possible to disable it, Patrick?

It's not easily disabled at the moment.  The problem is that if
we turn off the "parens suppress text" behavior, then any
parens in existing links suddenly become significant and
part of the link (thus breaking the link).

> A better approach might be to use a '{}' instead of '()', althought maybe 
> that would crash with some other markup. I don't know if this can be 
> changed either.

At this point I'm not sure it's a good idea for a change in the
core -- it could break links containing parens on a lot of 
existing sites.  But yes, had I known that Wikipedia would end
up using parens in uris as much as they do, then I would've
likely chosen curlies instead of parens to do the text suppression.

Also, just for the record, John Rankin and I discussed the possibility
of using curlies for an "add text to link" marker -- i.e., to
insert text in a link that wasn't part of the link target itself.
This would work like the existing "suffix" markup, except it would
allow text to be inserted anywhere in the link, as well as the
ability to add text containing spaces and punctuation and not just at
the end.  So we'd have things like

    ## existing suffix form, text is "Categories"
    [[Categor(y)]]ies

    ## using {inserted text} instead of suffix form
    [[Categor(y){ies}]]

    ## link text is "Category links", but still links to "Category"
    [[Category{ links}]]

    ## link text can go at beginning
    ## link to Category but displays as "My cool Categories"
    [[{My cool }Categor(y){ies}]]

The idea is that parens identify part of the link target
that aren't to be displayed in the link text, while curlies 
identify things that display in the link text but aren't
part of the target.

At the moment I'm simply holding this idea in reserve,
until I decide it's sufficiently useful/appropriate to
add it (PmWikiPhilosophy #3).

Pm




More information about the pmwiki-users mailing list