[pmwiki-users] Markup

a.steenveld at id.umcn.nl a.steenveld at id.umcn.nl
Fri Mar 3 06:04:29 CST 2006

> From: Patrick R. Michaud [mailto:pmichaud at pobox.com]
> On Fri, Mar 03, 2006 at 12:27:46AM +0100, 
> a.steenveld at id.umcn.nl wrote:
> > I noticed two things:
> >  - In general InterMap shortcuts will not work when used 'naked' 
> >    (such as in TOP:)
> Yes, this is to continue to allow words to have colons after them.
> we don't want the "PmWiki:" suddenly turning into a link.

Except when we have:
   $LinkWikiWords = 1;

Is it an idea to get something like:
   $LinkLonelyInterMap = 1;

Not that I care that much, your suggestion to use Markup() is much better suited for what I want.

> I think you really want a custom markup.  My suggestion would be
> to redefine "[top]" as a shortcut:
>     Markup('[top]', '<links',
>       '/(?<!\\[)\\[top\\]/', 
>       '[[#top | top]]');
>     Markup('[top]', '<links',
>       '/(?<!\\[)\\[top\\]/', 
>       '[[#wikitext | top]]');

I don't think you have to escape the closing square brase (\\]), It has no special meaning atached to it since the opening one is already escaped.
After fooling around a bit I came up with the following set of Markups:

# fixed pair of references
Markup('[*^]', '<links', '/(?<!\\[)\\[\\*\\^]/', '[[#top]]');
Markup('[*_]', '<links', '/(?<!\\[)\\[\\*_]/',   '[[#bottom]]');

# jump (with a fixed name) to a reference, fixed label.
Markup('[^]',  '<links', '/(?<!\\[)\\[\\^]/',    '[[#top | top]]');
Markup('[_]',  '<links', '/(?<!\\[)\\[_]/',      '[[#bottom | bottom]]');

# jump (with a fixed name) to a reference, free style label.
Markup('[^x]', '<links', '/(?<!\\[)\\[\\^([a-zA-Z0-9]+?)]/', "[[#top | $1]]");
Markup('[_x]', '<links', '/(?<!\\[)\\[_([a-zA-Z0-9]+?)]/',   "[[#bottom | $1]]");

# general reference and jump.
Markup('[*x]', '<links', '/(?<!\\[)\\[\\*([a-zA-Z0-9]+?)]/', "[[#$1]]");
Markup('[x]',  '<links', '/(?<!\\[)\\[([a-zA-Z0-9]+?)]/',    "[[#$1 | $1]]");

They work fine and are not too hard to memorise. Of cause, you can misuse the names and place the 'top' reference at te bottom of your document. It's a free world.

Thanks for the idea and your time.

-- Andre Steenveld.

More information about the pmwiki-users mailing list