[Pmwiki-users] Free link questions

John Rankin john.rankin at affinity.co.nz
Mon Mar 17 21:59:23 CST 2003


On Tuesday, 18 March 2003 2:41 PM, Patrick R. Michaud <pmichaud at sci.tamucc.=
edu> wrote:
> --
> Um, no; I had misunderstood $Tlink. What I need is a reference that is $=
Title for a WikiWord and {{$Title}} for a free link. In fact I'm now having=
 a hard time understanding what {{$Title_}} does, 'cos it's not a valid =
free link reference... (I assume it's fine if the space replace character =
is '').

Sorry, in my previous message I totally misdescribed what $Tlink does
(because I mis-read my own code).  I think it in fact does almost what
you want--it's "$Title_" for a WikiWord and "{{$Title_}}" for a non-=
WikiWord.
Thus a page named "WikiWord" becomes "WikiWord", a page named "Pagename"
becomes "{{Pagename}}".

$Tlink uses $Title_ (and not $Title) because otherwise it doesn't
work properly with $PageNameSpace set to null (the default).

Given the following page names:

   page name        $Tlink using $Title_       $Tlink using $Title

   WikiWord         WikiWord      # ok         WikiWord        # ok
   Freelink         {{Freelink}}  # ok         {{Freelink}}    # ok
   Wiki_Word        {{Wiki_Word}} # ok         {{Wiki Word}}   # wrong!
   Free_link        {{Free_link}} # ok         {{Free link}}   # wrong!

Note that the last two examples are wrong if $PageNameSpace is null, =
because
{{Wiki Word}} and {{Free link}} become links to a pages named "WikiWord"
and "FreeLink" (not "Wiki_Word" and "Free_link").

All of which serves to show just how much I hate underscores and how=20
they mess things up.  1/2 :-)  If we didn't have the possibility of
underscores in pagenames, then $Tlink using $Title would work just fine,
and $Title_ wouldn't be needed.

Pm
----
I am confused now.

At the moment, the free link pattern doesn't allow '_' as part of the link.=
 If I choose the space replace character to be '_' then in your last 2 =
examples {{Wiki_Word}} is wrong and {{Wiki Word}} is right. If on the =
other hand I choose the space replace character to be '', then {{Wiki Word}=
} results in a page name called WikiWord. It's not possible to create a =
page called Wiki_Word, because {{Wiki_Word}} in not a valid free link.

So I see the table like this. Assume the existing free link pattern.

author writes    page with ''    page with '_'    $Tlink with $Title_   $=
Tlink with $Title  =20

WikiWord         WikiWord        WikiWord         WikiWord     # ok     Wik=
iWord      # ok
{{freelink}}     Freelink        Freelink         {{Freelink}} # ok     {{=
Freelink}}  # ok
{{wiki word}}    WikiWord        Wiki_Word        {{Wiki_Word}}# wrong  {{=
Wiki Word}} # ok
{{free link}}    FreeLink        Free_Link        {{Free_link}}# wrong  {{=
Free link}} # ok
{{free_link}}    not allowed by pattern

Of course, if the administrator changes the free link pattern to allow '_',=
 then you are correct.

I think PmWiki needs another variable, to support 4 possible scenarios.

                      spacerepl ''           spacerepl '_'

{{...}} allows _      $Tlink with $Title_    $Tlink with $Title_  (case A)

{{...}} disallows _   $Tlink with $Title     $Tlink with $Title   (case B)

Can I suggest $Tlink_ uses $Title_ and $Tlink uses $Title.

I probably agree that '_' is to be deprecated, but since it's a lot easier =
to change the space replace character than to change the free link pattern,=
 it should probably support case B.

JR






More information about the pmwiki-users mailing list