[Pmwiki-users] Re: PmWiki 2 questions

John Rankin john.rankin
Mon Sep 20 17:13:02 CDT 2004


On Tuesday, 21 September 2004 2:27 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>
>> 3. Is there a preferred method for extending the LinkPage and 
>> LinkIMap functions?
>
>Yes, but I'll answer the other sub-questions first...
>
>> Specifically, I want to provide a different rendering for links 
>> that refer to the current page (self-references) [...]
>
>This is coming as a built-in feature in the distribution (I'm still working
>out the details)

I uploaded a new version of markup extensions script with a sample of how 
this might look -- perhaps you could enable it?

http://www.pmwiki.org/pmwiki2/pmwiki.php/Cookbook/MarkupExtensions

(it includes some other minor enhancements)

>
>> and a tooltip on links to pages that start with ! or : ... : markup. 
>> This can be done, as long as one traps cases where MakeLink has been 
>> called with a $fmt set, for example to return the $PageName
>or $LinkText.
>
>Rather than creating a custom MakeLink for this, I'd suggest recognizing
>! and : ... : containing pagenames as custom markup entries.

I don't think I explained very well. Suppose SomePage starts with

!!!Welcome to Spring in Wellington

Then any links to SomePage, say from HomePage, will gain a tool tip
that reads 'Welcome to Spring in Wellington'. 

I couldn't think of an easy way to do this without a custom LinkPage 
function.

>
...
>> 6. Is there a plan to support inline markups in link text?
>Should there be?
>
>There's not a plan yet.  Perhaps there should be -- I hadn't really
>thought about it much yet.  Inline markups in link text is just a 
>pain because of all of the aliasing that takes place.
>
>> How do I invoke processing of selected markups on link text
>in PmWiki 2?
>
>I don't know if this will work, but perhaps you can change the sequence
>of the selected markups so they occur before link processing.
>So, for the '' markup, do
>
>    Markup("''",'<links',"/''(.*?)''/",'<em>$1</em>');
>
>which says you want the '' markup to be performed before any
>link processing.
>
>If this is really important we can see about coming up with a generic
>method for handling this.

I can't think of a way to do a page table of contents without doing 
/something/ with inline markups (even if we only remove them). And
if one is going to go to the trouble of finding and removing them, 
one may as well process them. The problem is that one wants to 
generate markup of the form [[#anchor | text]] where 'text' is
pulled from (say) a heading line on the current page. As such, an
author could have used a variety of markups that aren't currently
allowed in link text.

It seems to me that there are 2 possible approaches:
- process the required inline Markup calls before processing links
- process designated Markup calls on the link text itself, as part
  of MakeLink

In some ways, the second option might be safer, as it reduces the
risk of unexpected side effects. For example, perhaps one might
write:

    Markup("''",'inline,linktext',"/''(.*?)''/",'<em>$1</em>');

The first part gives the precedence, as now; the ',linktext'
says also apply to link text. But it's a bit messy.

Or perhaps $LinkTextMarkups = array("''","'''", ...); which
lists the markups to apply to link text. Again, the order comes
from Markup. This seems fairly simple and safe to do. Since every
Markup has a unique identifier, it's just processing an array
of keys, isn't it?
>
>Pm
>


-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list