Monday, December 29, 2008, 9:32:05 PM, noskule wrote: > I made an example: http://www.pmwiki.org/wiki/Test/IncludeAndAnchor > the behavior is: > * if a block of a page is included, the first include creates an > anchor with the name of the included page
If an anchored section is specified within the (:include :) markup, then PmWiki will add an anchor of the same name above it. > * pmwiki seams to take care that an anchor name apears only ones, > so if an anchor with the same name exists bevore, no anchor gets created. > * if a anchor (manualy set) exists after, it gets deleted PmWiki tracks anchor names used, so repeats are automatically avoided. > I don't no what the reasons of this anchors are and normally they > don't affect anything, but in I using includes mainly for > templateing. And there, it puts anchors between thead/tbody and bevore > headers. The addition of an anchor for an included anchored section is hardcoded as far as I can see, in function IncludeText (which gets called by the (:include:) markup directive), ca line 1239 in pmwiki.php: $itext = TextSection($itext, $v, array('anchors' => 1)); changing this slightly to $itext = TextSection($itext, $v, array('anchors' => 0)); will avoid the addition of the anchor to an included section. But I do not recommend changing pmwiki.php other than temporarily for testing and gaining better understanding. Obviously for your desired purpose you want an include directive which does not add anchors. So perhaps you should create a custom include markup and a custom IncludeText function which has the array('anchors' = 0) as argument in the call to TextSection. Let's call the new markup (:includex ...:) ## (:includex:) markup('include', '>if', '/\\(:includex\\s+(\\S.*?):\\)/ei', "PRR(IncludeTextX(\$pagename, PSS('$1')))"); function IncludeTextX($pagename, $inclspec) { global $MaxIncludes, $IncludeOpt, $InclCount; SDV($MaxIncludes,50); SDVA($IncludeOpt, array('self'=>1)); $npat = '[[:alpha:]][-\\w]*'; if ($InclCount++>=$MaxIncludes) return Keep($inclspec); $args = array_merge($IncludeOpt, ParseArgs($inclspec)); while (count($args['#'])>0) { $k = array_shift($args['#']); $v = array_shift($args['#']); if ($k=='') { if ($v{0} != '#') { if (isset($itext)) continue; $iname = MakePageName($pagename, $v); if (!$args['self'] && $iname == $pagename) continue; $ipage = RetrieveAuthPage($iname, 'read', false, READPAGE_CURRENT); $itext = @$ipage['text']; } $itext = TextSection($itext, $v, array('anchors' => 0)); continue; } if (preg_match('/^(?:line|para)s?$/', $k)) { preg_match('/^(\\d*)(\\.\\.(\\d*))?$/', $v, $match); @list($x, $a, $dots, $b) = $match; $upat = ($k{0} == 'p') ? ".*?(\n\\s*\n|$)" : "[^\n]*(?:\n|$)"; if (!$dots) { $b=$a; $a=0; } if ($a>0) $a--; $itext=preg_replace("/^(($upat){0,$b}).*$/s",'$1',$itext,1); $itext=preg_replace("/^($upat){0,$a}/s",'',$itext,1); continue; } } $basepage = isset($args['basepage']) ? MakePageName($pagename, $args['basepage']) : $iname; if ($basepage) $itext = Qualify(@$basepage, @$itext); return FmtTemplateVars(PVSE($itext), $args); } You see, the only difference in the function is the use of anchors = 0 instead of anchors = 1 ~Hans _______________________________________________ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users