PmWiki/emenu2/emenu2Diff.txt

39c39
< $RecipeInfo['ExpandingMenu2']['Version'] = '2012-01-08';
---
> $RecipeInfo['ExpandingMenu2']['Version'] = '2007-08-04';
49,51d48
< # styles for links depending on {0=before,           1=on,               2=after} current page
< SDV($Emenu2Style,          array('%bgcolor=#ffc0c0%','%bgcolor=#ffff40%','%bgcolor=#c0ffc0%'));
< 
89c86
<   global $eMenuExpand, $pagename;
---
>   global $eMenuExpand;
91,92c88,89
<     $fn=analyseLink($link, $pagename);
<     $fn=$fn[1]; /* find fullname */
---
>     $pn=ResolvePageName($link); /* resolve them */
>     $fn=PageVar($pn,'$FullName'); /* find fullname */
101c98
< function eMenuParseLinks($code,$pagename) {
---
> function eMenuParseLinks($code,$group) {
106,107c103
<     if ($link[0][1]>$pos) /* add skipped non-link part to result */
<       array_push($ret,array(substr($code,$pos,$link[0][1]-$pos),NULL,NULL)); 
---
>     if ($link[0][1]>$pos) array_push($ret,array(substr($code,$pos,$link[0][1]-$pos),NULL,NULL)); /* add skipped non-link part to result */
109c105,120
<     array_push($ret, analyseLink($link[1][0], $pagename));
---
>     $view=$link[1][0];
>     $l=str_replace("~","Profile/",$view); /* handle [[~name]] links */
>     $l=str_replace("!","Category/",$l); /* handle [[!category]] links */
>     $l=str_replace("(","",$l); /* handle [[(foo.)bar]] links */
>     $l=str_replace(")","",$l); 
>     $l=str_replace(" ","",$l); /* remove spaces */
>     preg_match("/^([^\\.:\\/]*?:)?(?:([^\\.:\\/]*?)([\\.\\/]))?([^\\.:\\/]*?)(?:\\|(.*))?\$/",$l,$lmatch); /* parse link (1:map, 2:group, 3:separator, 4:page, 5:view) */
>     if ($lmatch[3]=='/' && $lmatch[1]=='') $view=$lmatch[4];
>     $view=preg_replace("/\\(.*?\\)/","",$view); /* remove ( ) from view */
>     if ($lmatch[5]!='') $view=$lmatch[5];
>     if ($lmatch[1]=='') {
>       if ($lmatch[2]=='') $lmatch[2]=$group;
>       array_push($ret,array($link[0][0],$lmatch[2].'.'.$lmatch[4],$view));
>     } else {
>       array_push($ret,array($link[0][0],$lmatch[1].$lmatch[2].'.'.$lmatch[4],$view));
>     }
111,112c122
<   if (strlen($code)>$pos) /* add final non-link part */
<     array_push($ret,array(substr($code,$pos),NULL,NULL)); 
---
>   if (strlen($code)>$pos) array_push($ret,array(substr($code,$pos),NULL,NULL)); /* add final non-link part */
116,129d125
< # analyse a link = "m:g.p|v" ==> ([[m:g.p|v]], group.name, view)
< function analyseLink($link,$pagename) {
<     $l=str_replace("~","Profile/",$link); /* handle [[~name]] links */
<     $l=str_replace("^!","Category/",$l); /* handle [[!category]] links */
<     preg_match("/^([^\\.:\\/]*?:)?(?:([^\\.:\\/]*?)([\\.\\/]))?([^\\.:\\/]*?)(?:\\|(.*))?\$/",$l,$lmatch); /* parse link (1:map, 2:group, 3:separator, 4:page, 5:view) */
<     if ($lmatch[5] == '') {
<         $view = ($lmatch[3]=='/' && $lmatch[1]=='') ? $lmatch[4] : $link;
<         $view = preg_replace("/\\(.*?\\)/","",$view); /* remove ( ) from view */
<     } else {
<         $view = $lmatch[5];
<     }
<     return array("[[$link]]", MakePageName($pagename, $lmatch[2].'.'.$lmatch[4]),$view);
< }
< 
154c150
<   global $eMenuExpand,$eMenuCurrentExpanded, $Emenu2Style;
---
>   global $eMenuExpand,$eMenuCurrentExpanded;
168d163
<     $parsed=eMenuParseLinks($lind, $pagename); /* parse entry itself */
170,174c165,168
<     if (count($parsed) > 0 ) { /* around include we may get empty $parsed ==> if we use them as parent all children disappear without a link to click! */ 
<       $tree[$parent][3]=1; /* out parent has child now */
<       $mapje[$level]=$pos; /* we can become ancestor */
<       $maxlev=$level;
<     }
---
>     $tree[$parent][3]=1; /* out parent has child now */
>     $mapje[$level]=$pos; /* we can become ancestor */
>     $maxlev=$level;
>     $parsed=eMenuParseLinks($lind,$group); /* parse entry itself */
178d171
<         $tree[$pos][6] = 1; /* mark current page */
190d182
<   $styleX = 0; /* styleX {0=before, 1=on, 2=after} current page */
197,198c189
<       $styleX = (isset($line[6]) && $line[6] == 1) ? 1 : ($styleX >= 1 ? 2 : 0); 
<       $ret .= $Emenu2Style[$styleX] . ($one = eMenuGenLine($line[0],$pre)) . "\n"; /* generate menu line */ 
---
>       $ret .= eMenuGenLine($line[0],$pre)."\n"; /* generate menu line */