Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: users

Allow hyphens in CodeDef patch

 

 

Interchange users RSS feed   Index | Next | Previous | View Threaded


richard at endpoint

Jul 2, 2009, 3:02 PM

Post #1 of 2 (491 views)
Permalink
Allow hyphens in CodeDef patch

I ran across an issue where I wanted to use a hyphen in an ActionMap for SEO reasons but couldn't do it as long as my ActionMap used a CodeDef to define the routine to call. If I inlined the code in the ActionMap it worked just fine. What I found was that any name after CodeDef had the hyphens converted to underscores and then checked to make sure it didn't have any non-word characters in it. In knowing how nice hyphens are for SEO reasons and how nice it is to have your ActionMap routines in perl modules for syntax checking etc, I figured it would be handy to change it so that just hyphen, underscore and non-word characters were allowed.

To test this change I created both ActionMaps and Filters named test-123 and test_123 tested them using ITL, [perl] ,[calc] and inside a global perl module and didn't have any issues with errors or loss of functionality.



--- a/interchange/lib/Vend/Config.pm
+++ b/interchange/lib/Vend/Config.pm
@@ -4936,8 +4936,7 @@ sub parse_mapped_code {
# Canonicalize
$p = $tagCanon{lc $p} || ''
or ::logDebug("bizarre mapped code line '$value'");
- $tag =~ tr/-/_/;
- $tag =~ s/\W//g
+ $tag =~ s/[^-_\w]+//g
and config_warn("Bad characters removed from '%s'.", $tag);

my $repos = $C ? ($C->{CodeDef} ||= {}) : ($Global::CodeDef ||= {});

--

Richard Templet
End Point Corp.
(919) 300-7303


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


gert at 3edge

Jul 3, 2009, 12:14 AM

Post #2 of 2 (429 views)
Permalink
Re: Allow hyphens in CodeDef patch [In reply to]

> -----Original Message-----
> From: interchange-users-bounces [at] icdevgroup [mailto:interchange-
> users-bounces [at] icdevgroup] On Behalf Of Richard Templet
> Sent: Friday, July 03, 2009 1:02 AM
> To: interchange-users [at] icdevgroup
> Subject: [ic] Allow hyphens in CodeDef patch
>
> I ran across an issue where I wanted to use a hyphen in an ActionMap
> for SEO reasons but couldn't do it as long as my ActionMap used a
> CodeDef to define the routine to call. If I inlined the code in the
> ActionMap it worked just fine. What I found was that any name after
> CodeDef had the hyphens converted to underscores and then checked to
> make sure it didn't have any non-word characters in it. In knowing
> how nice hyphens are for SEO reasons and how nice it is to have your
> ActionMap routines in perl modules for syntax checking etc, I figured
> it would be handy to change it so that just hyphen, underscore and non-
> word characters were allowed.
>
> To test this change I created both ActionMaps and Filters named test-
> 123 and test_123 tested them using ITL, [perl] ,[calc] and inside a
> global perl module and didn't have any issues with errors or loss of
> functionality.
>
>
>
> --- a/interchange/lib/Vend/Config.pm
> +++ b/interchange/lib/Vend/Config.pm
> @@ -4936,8 +4936,7 @@ sub parse_mapped_code {
> # Canonicalize
> $p = $tagCanon{lc $p} || ''
> or ::logDebug("bizarre mapped code line '$value'");
> - $tag =~ tr/-/_/;
> - $tag =~ s/\W//g
> + $tag =~ s/[^-_\w]+//g
> and config_warn("Bad characters removed from '%s'.",
> $tag);
>
> my $repos = $C ? ($C->{CodeDef} ||= {}) : ($Global::CodeDef ||=
> {});

Hi Richard,

Thanks for the patch. As we'd like some more people to have a look at it and
test it we have for now created a ticket in RT for it to track this patch:
http://rt.icdevgroup.org/Ticket/Display.html?id=290

As _ is already part of \w the following should probably suffice:
+ $tag =~ s/[^-\w]+//g

CU,

Gert










_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users

Interchange users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.