01388: The Link to the TrailIndexPage#start#end in a trail is marked as not allowed by W3C-Validator

Summary: The Link to the TrailIndexPage#start#end in a trail is marked as not allowed by W3C-Validator
Created: 2016-06-04 08:01
Status: Closed, fixed for 2.2.88
Category: Bug
From: mfwolff
Assigned:
Priority: 2
Version: 2.2.86
OS:

Description: The TrailIndexPage#start#end-part of the trail-markup appears in a Link to the TrailIndexPage. But such a link with two anchors in it is marked as not allowed by the W3C-Validator. If one omits the #end-part, the trail is broken. That happens for example in the trail in the documentation index of PmWiki.

Is it possible to cut off any second anchor from $trailname if present, before $trailname is inserted in the return-value in functions MakeTrailStop, MakeTrailStopB and MakeTrailPath in trails.php? It then looks like TrailIndexPage#start or TrailIndexPage#. Both is ok for the validator.

The following seems to work fine:

  if (preg_match('/(#[^#]*)(#[^|\])+]*)/',$trailname, $m) && $m[2] != '') $trailname = str_replace($m[2],'',$trailname);

Maybe, there is a more elegant way. I assumed, that there are always two anchors, unless the author made a mistake. So the replacement takes place only when a second anchor was found.

But

Because the anchors #trailstart and #trailend are positioned in a paragraph near the top of the page in the output (why?), where I didn't set them in the markup, it doesn't seem to be necessary to bother about the first anchor :-|

If so, any anchor could be removed so the pure pagename is left over (probably the easiest way), though the link then points to the top of the page, what might not be intended in some cases.

June 04, 2016, at 08:05 AM

Thanks, fixed in LinkPage() for the next version (now available in Subversion). --Petko June 05, 2016, at 05:53 AM

I guessed, there is a better place to handle it. Thank you, Petko. ~mfwolff