[Pmwiki-users] http references with : in the link

John Rankin john.rankin at affinity.co.nz
Wed Apr 9 17:29:13 CDT 2003

> > I have been wondering if it would be possible to have a set of =
variables for formatting URLs similar to the 3 for formatting wiki links. =
This would make it easier for me to do 2 things:
> > - cause links to other web sites to render differently, eg with an <a =
class=3D'www'...> that changes the colour
> > - change how such links render on a Printable Version to make visible =
the URL of [[...]] markup
> > ...
> > I have been testing some extra DoubleBracket statements and am tying =
myself in knots trying to deal with all the different cases. I think there =
may be 6 cases:

Also, in answer to your first comment--yes, it'd definitely be possible to
devise a set of variables for formatting URLs, simnilar to the variables
used to format wiki links.  I'd just need some idea of what the variables
should be.


Let me summarise the requirements I have been asked to meet and the =
approach I have been taking.

1. Distinguish links that are local to the encyclopedia from those that =
will take a visitor elsewhere, preferably by using a different link colour.=
 This should happen automatically -- the author focuses on content, the =
style sheet takes care of presentation.

I envisage doing this in the same way I have dealt with links to non-=
existent pages. I add a class=3D'nonexistent' to the <a ... >?</a> and =
would ideally like to add a class=3D'url' to external links. One problem =
is ensuring intermap references that use ThisPage, ThisGroup and ThisWiki =
are treated as local, while other intermap references are treated as =
external. Also if the author uses an image with a link behind it, there is =
no obvious way to show this is local or external, so it's restricted to =
text-based links.

What about the following variables:


It would have to handle http:... intermap:... [[http or intermap]] [[http =
or intermap text]] [[http or intermap image]].

2. Provide a Printable Version of a page that spells out the URL of any =
double bracketed external links, preferably as a list of endnotes at the =
foot of the page.

I use an action=3Dprint, and have experimented with a $DoubleBrackets =
entry that's only defined when $action=3D=3D'print', looks for [[http or =
intermap text or image]] and turns it into ''text or image'' [http or =
intermap]. In other words it puts the text into italics and makes a bare =
link in square brackets, which with 1 above would display in the alternate =

A better method would be to redefine $URLExternalLinkFmt and $=
URLExternalImgFmt whenever $action=3D=3D'print'.

Displaying the references as a list of endnotes is in my 'gratuitous =
features' box at the moment -- it would be nice, but it's hardly =
compelling. Not to mention that it's a lot more than the one line of code =
to spell out references in-line.

3. The encyclopedia makes much use of [[ThisGroup:PageName#name name]] (=
for example [[ThisGroup:F-I#F-I-2-3 F-I-2-3]]) which the Printable Version =
could just leave as F-I-2-3.

I wonder if [[PageName#name name]] isn't a more natural markup... Then it =
may be reasonable just to have 2 url format variables:


In this scenario, all intermap references would be treated as external =
links, including This... entries. See http://www.pmichaud.com/wiki/Main/=
WikiSandbox for how it might look.

Hope this clarifies. And let me say that once again I was impressed by how =
easy it was to add a local 'Printable Version' function. Another tribute =
to the power and simplicity of the PmWiki engine.


More information about the pmwiki-users mailing list