Tidying up after ACREP-32.
authorMike Taylor <mike@indexdata.com>
Tue, 30 Jun 2015 10:10:47 +0000 (11:10 +0100)
committerMike Taylor <mike@indexdata.com>
Tue, 30 Jun 2015 10:10:47 +0000 (11:10 +0100)
Remove another extraneous warning from URL analysis.
Warn when seeing a so-called link that is not a valid URL.

src/mkws-widget-main.js

index e539e6d..f1b13e0 100644 (file)
@@ -140,12 +140,13 @@ mkws.registerWidgetType('records', function() {
         }
 
         var urls = hit['md-electronic-url'];
         }
 
         var urls = hit['md-electronic-url'];
-        that.warn("urls = " + mkws.$.toJSON(urls));
         var bestLink = null;
         var otherLinks = [];
         for (var j = 0; j < urls.length; j++) {
           var url = urls[j];
         var bestLink = null;
         var otherLinks = [];
         for (var j = 0; j < urls.length; j++) {
           var url = urls[j];
-          if (!bestLink && url.match(/^(https?:)?\/\//)) {
+          if (!url.match(/^(https?:)?\/\//)) {
+            that.warn("link '" + url + "' is not a valid URL");
+          } else if (!bestLink) {
             bestLink = url;
           } else {
             otherLinks.push(url);
             bestLink = url;
           } else {
             otherLinks.push(url);