[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 21 May 2004 20:01:16 -0000


www		Fri May 21 16:01:16 2004 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  Bug #154: multiword_keywords_work_now
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.167 loncom/publisher/lonpublisher.pm:1.168
--- loncom/publisher/lonpublisher.pm:1.167	Fri May 21 15:27:02 2004
+++ loncom/publisher/lonpublisher.pm	Fri May 21 16:01:15 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.167 2004/05/21 19:27:02 albertel Exp $
+# $Id: lonpublisher.pm,v 1.168 2004/05/21 20:01:15 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1102,8 +1102,13 @@
     }
 
             
-    foreach (split(/\W+/,$metadatafields{'keywords'})) {
-	$keywords{$_}=1;
+    foreach my $addkey (split(/[\"\'\,\;]/,$metadatafields{'keywords'})) {
+	$addkey=~s/\s+/ /g;
+	$addkey=~s/^\s//;
+	$addkey=~s/\s$//;
+	if ($addkey=~/\w/) {
+	    $keywords{$addkey}=1;
+	}
     }
 # --------------------------------------------------- Now we also have keywords
 # =============================================================================
@@ -1373,8 +1378,11 @@
             $allkeywords .= ','.$ENV{'form.keywords'};
         }
     }
-    $allkeywords=~s/\W+/\,/;
-    $allkeywords=~s/^\,//;
+    $allkeywords=~s/[\;\,]/\,/;
+    $allkeywords=~s/[\"\']//g;
+    $allkeywords=~s/\s+/ /g;
+    $allkeywords=~s/^[ \,]//;
+    $allkeywords=~s/[ \,]$//;
     $metadatafields{'keywords'}=$allkeywords;
     
 # check if custom distribution file is specified