[OpenLayers-Trac] [OpenLayers] #3459: OpenLayers.Style.addPropertyStyles should use OpenLayers.String.tokenRegEx for matching

OpenLayers trac-20090302 at openlayers.org
Wed Aug 10 09:44:02 EDT 2011


#3459: OpenLayers.Style.addPropertyStyles should use OpenLayers.String.tokenRegEx
for matching
-----------------------+----------------------------------------------------
 Reporter:  jdillmann  |       Owner:  ahocevar    
     Type:  feature    |      Status:  new         
 Priority:  minor      |   Milestone:  2.12 Release
Component:  Style      |     Version:  2.11 RC2    
 Keywords:             |       State:              
-----------------------+----------------------------------------------------
 OpenLayers.Style is using OpenLayers.String.format() to replace attributes
 like ${name}.
 Unfortunately in OpenLayers.Style.addPropertyStyles() where it is
 determined if placeholders are in the style string, it is using a custom
 regexp to match them.

 It would be better to use OpenLayers.String.tokenRegEx which is used later
 to make the actual replacement for the matching in addPropertyStyles.

 At the moment one can use OpenLayers.String.format() to replace nested
 lists ${a.b} => [a][b]. But this is not working in styles, because the
 regexp in OpenLayers.Style won't match a ".".

 Another Problem occurs if someone wants to extend the token matching, for
 example to match something like: ${addr:street}
 This would be really simple if OpenLayers.Style would use the tokenRegEx

 While this is no major bug, it is really simple to fix (see patch).

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3459>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list