01285: include does not use the same definition of an anchor token as does the code that parses links and anchors

Summary: include does not use the same definition of an anchor token as does the code that parses links and anchors
Created: 2012-04-08 17:35
Status: Closed, added for 2.2.37
Category: Bug
From: simon
Assigned:
Priority: 5
Version: 2.2.35
OS:

Description: Example: Test.IncludeAndAnchor

PmWiki correctly creates anchors, and correctly links to them. (ie [[#sec1.2]] and [[#sec1.2 | 1.2]]) (Honouring the syntax as defined in http://www.w3.org/TR/html4/types.html#type-name - "ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").").

The include directive does not correctly accept anchor names with periods in them.

From the mailing list, by PM

The problem appears to be the definition of $npat on line 1266 of pwmiki.php:

   $npat = '[[:alpha:]][-\\w*]*';

Note that simply adding a dot to the [-\\w]* part of the expression won't work, as a pair of dots are used to indicate ranges. It probably needs to be something that can recognize a single dot in the identifier pattern (i.e., a dot followed by something other than another dot).

Also, I suspect the '*' immediately the \\w in the original is a typo. And there's an extraneous definition of $npat on line 1311 in the IncludeText() function, probably left over from a previous factoring of text includes.

Should work now on PmWiki.org and in the latest Subversion, feel free to test it. --Petko April 23, 2012, at 12:56 AM