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

Patrick R. Michaud pmichaud at sci.tamucc.edu
Thu Apr 10 20:54:54 CDT 2003

> From john.rankin at affinity.co.nz Thu Apr 10 19:44:15 2003
> ...
> Note the addition of \ in ThisWiki and removal of / in ThisPage. 
> Mostly, I have tested ThisPage and found the following problem.
> The wiki calendar has [[ThisPage:?logdate=200303 March 2003]] - 
> [[ThisPage:?logdate=200305 May 2003]] to give next month/previous 
> month navigation. The first link is correct. The second link 
> renders as May 2003 but the <a href=... shows in the HTML source 
> as ?logdate=200303 -- it's picking up the first reference again. 

Ah, a PmWiki bug (now fixed, released as 0.4.10).  The same problem 
would have occurred for multiple mailto: links in double brackets in 
a page (also now fixed).

> And in the printable version I have set it to:
>    "<cite>\$LinkText</cite> [<a href='\$Url' class='url'>\$Url</a>]"
> But, links of the form http://www... render in the printable version as:
> http://... [http://www...]
> Is there a need for a Fmt variable used when $LinkText == $Url:
>    $UrlPlainFmt =  <a href='\$Url' class='url'>\$Url</a>;

I've taken a slightly different approach.  $UrlLinkFmt works as before, but
I've also defined a $UrlLinkTextFmt which is the replacement text to be
used whenever [[http://... text]] is given.  If not set, $UrlLinkTextFmt
is the same as $UrlLinkFmt.

Thus, for your application, I'd set:

  $UrlLinkFmt = "<a href='\$Url' class='url'>\$LinkText</a>";
  $UrlLinkTextFmt = 
    "<cite>\$LinkText</cite> [<a href='\$Url' class='url'>\$Url</a>]";

I'm pretty sure I don't want to explore analogues for the $WikiPageExistsFmt
variables (e.g., stuff like $WikiPageExistsTextFmt), at least not yet.  
The whole thing is getting a bit hairy as it is and before doing that
I might want to refactor my whole approach to how links are rendered.


Also, I have a few ideas for URL footnotes, but before I get into those 
(may take me a few days with my current schedule) let me just comment 
that it's possible for a WikiAdministrator to completely redefine the 
link formatting routines.  I.e., if someone doesn't like the way that 
FmtUrlLink currently works, then just write a new function for the 
desired behavior and set the $FmtUrlLink variable to the name of 
the function.  

The subroutine is ultimately called as $FmtUrlLink($pat,$ref,$txt), 
where $pat is the LinkPattern that caused the function to be called, 
$ref is the (url) portion of the wiki markup that matched $ref, 
and $txt is NULL if the link was a "bare" link or the anchor 
text specified from a double-brackets markup.

Thus, since the link-formatting subroutine can be redefined, it's also
possible to use this routine to save a list of all of the URL references
encountered while generating the page.  This list could then be placed
in the document somewhere, or even added to the output of $PageFooterFmt.
But depending on how pressing your needs are, you might want to wait on 
this a week or so because I've got a few ideas about improving the 
overall header/footer processing provided by pmwiki.php...


More information about the pmwiki-users mailing list