Re: [pmwiki-users] page include without anchor in html source

2008-12-30 Thread noskule

 Original-Nachricht 
 Datum: Mon, 29 Dec 2008 22:55:45 +
 Von: Hans desi...@softflow.co.uk
 An: noskule nosk...@gmx.net
 CC: PmWiki Users pmwiki-users@pmichaud.com
 Betreff: Re: [pmwiki-users] page include without anchor in html source

 
 PS: the anchor is added by function TextSection,
 where the 'anchors' argument is checked, and if found,
 the anchor is added.
 
 
 
   ~Hans

thank very much that saved my day
grz nos
-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] page include without anchor in html source

2008-12-29 Thread Hans
Monday, December 29, 2008, 5:50:20 PM, noskule wrote:

 Is it somehow possible to supress the anchors which pmwiki creates in the html
 source. It would be nice if it could be set by an option in the include
 markup.

What anchors are you referring to? Can you give an example?


  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] page include without anchor in html source

2008-12-29 Thread noskule
  Is it somehow possible to supress the anchors which pmwiki creates in
 the html
  source. It would be nice if it could be set by an option in the include
  markup.
 
 What anchors are you referring to? Can you give an example?
 
 
   ~Hans

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 
* 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

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.



-- 
Pt! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] page include without anchor in html source

2008-12-29 Thread Hans
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 ($a0) $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


Re: [pmwiki-users] page include without anchor in html source

2008-12-29 Thread Hans

PS: the anchor is added by function TextSection,
where the 'anchors' argument is checked, and if found,
the anchor is added.



  ~Hans


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users