replace non-alphanumeric with - instead of (non-replacement|underscore)
authorTony Cook <tony@develop-help.com>
Wed, 14 Aug 2013 22:36:11 +0000 (08:36 +1000)
committerTony Cook <tony@develop-help.com>
Sun, 25 Aug 2013 00:44:03 +0000 (10:44 +1000)
site/cgi-bin/modules/Article.pm
site/cgi-bin/modules/BSE/Edit/Article.pm
site/cgi-bin/modules/BSE/Edit/Product.pm

index 99e2ea9f64f23bdd56907b694a434d683ee341e1..403a3203bd3975ab94baf464abd4c188e28ad9a8 100644 (file)
@@ -8,7 +8,7 @@ use vars qw/@ISA/;
 @ISA = qw/Squirrel::Row BSE::TB::SiteCommon BSE::TB::TagOwner/;
 use Carp 'confess';
 
-our $VERSION = "1.021";
+our $VERSION = "1.022";
 
 =head1 NAME
 
@@ -462,7 +462,7 @@ sub link {
   }
   if ($cfg->entry('basic', 'alias_suffix', 1)) {
     my $title = $self->{title};
-    $title =~ tr/a-zA-Z0-9/_/cs;
+    $title =~ tr/a-zA-Z0-9/-/cs;
     $link .= '/' . $title;
   }
   return $link;
index b500bb04035255b7e633419ad54878ee7dae80a5..d0222e71c43ef35321c14074ea4c5cdffa81f00f 100644 (file)
@@ -16,7 +16,7 @@ use List::Util qw(first);
 use constant MAX_FILE_DISPLAYNAME_LENGTH => 255;
 use constant ARTICLE_CUSTOM_FIELDS_CFG => "article custom fields";
 
-our $VERSION = "1.040";
+our $VERSION = "1.041";
 
 =head1 NAME
 
@@ -1718,14 +1718,15 @@ sub make_link {
 
   my $title = $article->title;
   if ($article->is_dynamic) {
-    return "/cgi-bin/page.pl?page=$article->{id}&title=".escape_uri($title);
+    (my $extra = $title) =~ tr/A-Za-z0-9/-/sc;
+    return "/cgi-bin/page.pl?page=$article->{id}&title=".escape_uri($extra);
   }
 
   my $article_uri = $self->link_path($article);
   my $link = "$article_uri/$article->{id}.html";
   my $link_titles = $self->{cfg}->entryBool('basic', 'link_titles', 0);
   if ($link_titles) {
-    (my $extra = $title) =~ tr/a-z0-9/_/sc;
+    (my $extra = $title) =~ tr/A-Za-z0-9/-/sc;
     $link .= "/" . $extra . "_html";
   }
 
index 90033334f8f0e40c868cb980d7b671b0a5a24700..e097ae935d70b499b445ce11f3fb2e1b3cb137ee 100644 (file)
@@ -10,7 +10,7 @@ use BSE::CfgInfo 'product_options';
 use BSE::Util::Tags qw(tag_hash tag_article);
 use constant PRODUCT_CUSTOM_FIELDS_CFG => "product custom fields";
 
-our $VERSION = "1.011";
+our $VERSION = "1.012";
 
 =head1 NAME
 
@@ -521,7 +521,8 @@ sub make_link {
 # end adrian
 
   if ($article->is_dynamic) {
-    return "$urlbase/cgi-bin/page.pl?page=$article->{id}&title=".escape_uri($article->{title});
+    (my $extra = $article->title) =~ tr/A-Za-z0-9/-/sc;
+    return "$urlbase/cgi-bin/page.pl?page=$article->{id}&title=".escape_uri($extra);
   }
 
   my $shop_uri = $self->link_path($article);