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

Patrick R. Michaud pmichaud at sci.tamucc.edu
Wed Apr 9 18:45:48 CDT 2003


Followup to my previous message...

I found a slight potential bug in my ThisWiki code--it should be

    $EnableThisWiki = 0;		# to avoid including thiswiki.php 
    $LinkPatterns["\\bThisWiki:($UrlPagePattern)"] = 
      "<a href='$ScriptUrl/\$1'>\$0</a>";
    $LinkPatterns["\\bThisPage:($UrlPagePattern)"] =
      FmtPageName("<a href='\$PageUrl/\$1'>\$0</a>",$pagename);
    $LinkPatterns["\\bThisGroup:($UrlPagePattern)"] =
      FmtPageName("<a href='\$ScriptUrl/\$Group/\$1'>\$0</a>",$pagename);

This is the same as before but adding word breaks ("\\b") at the
beginning of the patterns.

Also, the backslashes in front of $1 and $0 might be optional--use
whichever one works.

Pm




On Wed, 9 Apr 2003, Patrick R. Michaud wrote:

> On 10 Apr 2003, John Rankin wrote:
> 
> > 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.
> > [...]
> 
> Okay.  I can think of several ways to do what you're wanting to do, so
> let me propose one way and we'll see where it leads.  It may require several
> iterations to get there so let's just take it one step at a time.
> 
> First, I've made a couple of minor modifications to PmWiki and released
> it as 0.4.9.  This new version introduces two new variables:  $UrlLinkFmt and
> $UrlImgFmt which determine how URLs should be formatted by the FmtUrlLink
> function (roughly analogous to $WikiPageExistsFmt for the FmtWikiLink
> function).  
> 
> So, if you want to have external links appear with a special style sheet,
> you can just set $UrlLinkFmt to be 
>    "<a href='\$Url' class='url'>\$LinkText</a>"
> and all URL references will come out with a class attribute set.
> 
> As to the problem with ThisPage, ThisGroup, and ThisWiki, they're currently
> implemented as InterMap links but they're also local customizations.  And they
> don't have to be implemented via InterMap--there are other ways to do that.
> So, to have these links not be treated as external links, simply do:
> 
>    $EnableThisWiki = 0;		# to avoid including thiswiki.php 
>    $LinkPatterns["ThisWiki:($UrlPagePattern)"] = 
>      "<a href='$ScriptUrl/\$1'>\$0</a>";
>    $LinkPatterns["ThisPage:($UrlPagePattern)"] =
>      FmtPageName("<a href='\$PageUrl/\$1'>\$0</a>",$pagename);
>    $LinkPatterns["ThisGroup:($UrlPagePattern)"] =
>      FmtPageName("<a href='\$ScriptUrl/\$Group/\$1'>\$0</a>",$pagename);
> 
> This does direct HTML substitutions for the ThisWiki/ThisPage/ThisGroup
> links and bypasses the FmtUrlLink function altogether.  So, these references
> won't be treated as external URL links (or InterMap links).
> 
> This should work with all of the permutations of links and their double-bracket
> counterparts.  It does assume that ThisWiki:, ThisPage:, and ThisGroup: are
> never used as image references; i.e., "ThisWiki:path/to/image.gif" won't work.
> 
> I'm going to skip the "display external references as endnotes" feature for 
> a moment--I think that's also doable, but I want to tackle this one in
> baby steps if we can.
> 
> So, does this approach address what you're trying to achieve?  What parts
> other than endnotes does it leave out?
> 
> Pm
> 
> 
> _______________________________________________
> Pmwiki-users mailing list
> Pmwiki-users at pmichaud.com
> http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com
> 





More information about the pmwiki-users mailing list