|
Cookbook /
AtLinksSummary: Alternative linking scheme with @ prefix (@Page)
Version: 5 Feb. 2005
Status: Stable
Prerequisites: pmwiki-2
Maintainer: PRZ
Votes:
GoalProvide an alternative solution to build links by prefixing the page names with an @ SolutionSet in the file local/config.php the following lines:
function CHX($x,$y) { if ($y=='') return NULL; return $y; }
## @"target | text" or @'target|text' or @'target;tex't or @"target, tx"
Markup('@_','links',
"/@([\\x22\\x27])([^|,;]+?)(?:[|,;](.*?))*\\1($SuffixPattern)/e",
"Keep(MakeLink(\$pagename,PSS('$2'),CHX(PSS('$2'),PSS('$3')),'$4'),'L')");
## @link (after a non alphanum char)
Markup('@','<wikilink',
"/(?<![[:alnum:]])@([[:alnum:]\\.\\/\\-_]+[[:alnum:]])/e",
"Keep(MakeLink(\$pagename,PSS('$1'),NULL,NULL),'L')");
## @link @"text -> target"
Markup('@->','<@_',
"/@(\\x22)([^\\x22]+?)\\s*-+>\\s*(\\S[^\\x22]+?)\\x22/e",
"Keep(MakeLink(\$pagename,PSS('$3'),PSS('$2'),NULL),'L')");
This work in addition to existing linking, the usual linking stuff remains active. Usage
This is quite flexible, you can use as text separator | or , or ;
Though the notation See an example here : http://www.rouzeau.net/w3/pmwiki.php?pagename=Main.HomePage RestrictionsThat don't work in PmWiki/WikiTrails DiscussionThe risk is to break standards, if you wish to exchange pages with others wiki. This can also be studied as exchange to double brackets when posting, with ROSPatterns function, but it will lost a part of the interest, which is a better readability than double brackets markup. See alsoThis is based on suggestion done on the mailing list by Fred Chittenden - see http://www.pmichaud.com/pipermail/pmwiki-users/2004-October/006906.html History
CommentsIs it possible to activate it on the page ? Done 31-Jan-2005. I haven't tested it. --Pm
Thanks, that works ! PRZ
ContributorsSandboxOld stuff - still active on this page
function CHX($x,$y) { if ($y=='') return NULL; return $y; }
## @"target | text" or @'target | text' or @'target ; tex't or @"target, tx"
Markup('@_','links',"/@([\\x22\\x27])([^|,;]+?)(?:[|,;](.*?))*\\1($SuffixPattern)/e",
"Keep(MakeLink(\$pagename,PSS('$2'),CHX(PSS('$2'),PSS('$3')),'$4'),'L')");
## @link (after a non alphanum char)
Markup('@','>urllink',"/(?<![[:alnum:]])@([^\\x22\\x27](?:-?[[:alnum:]\\/]+)*)/e",
"Keep(MakeLink(\$pagename,PSS('$1'),NULL,NULL),'L')");
|