[ic] Usertag Alias function and hyphens

Josh Lavin josh at perusion.com
Thu Dec 19 20:54:41 UTC 2013


I found that when trying to create an Alias like this:

UserTag edisplay Alias error auto=1 class="list-unstyled alert alert-danger"

... that the end result would turn the hyphens into underscores, thus
breaking the class I intended to use.

The problem is the transliteration operator below, which was originally
added to allow aliases like [shipping-description] to work. However, I
believe we should apply the patch below so the tr/// only happens on the
first word, which would be the actual tag alias value, and skip the
tr/// on the remaining parts.

If this looks OK to apply, I can do so, but I wanted to get some
opinions first.

--- lib/Vend/Parse.pm   2012-12-24 15:20:40.935256293 -0800
+++ /tmp/Parse.pm       2013-12-19 12:49:16.717592996 -0800
@@ -647,7 +647,10 @@
                if(defined $Alias{$tag}) {
                        $aliasname = $tag;
                        my $alias = $Alias{$tag};
-                       $alias =~ tr/-/_/;
+                       my @parts = split /\s+/, $alias;
+                       $alias = shift @parts;
+                       $alias =~ tr/-/_/;   # don't want to run this on the extra parts
+                       $alias .= ' ' . join ' ', @parts;
                        $tag =~ s/_/[-_]/g;
 #::logDebug("origtext: $origtext tag=$tag alias=$alias");
                        $origtext =~ s/$tag/$alias/i

-- 
Josh Lavin
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
... ask me about job opportunities ...



More information about the interchange-users mailing list