Commits

Boris Nagaev committed f45c1ef

fix_plain_anchors() do not apply skip_re to external anchors

Comments (0)

Files changed (2)

     s << "      if (a.attr('href') && !a.attr('onclick')) {";
     s << "        var external = a[0].hostname.replace(/^www\\./, '') !=";
     s << "          location.hostname.replace(/^www\\./, '');";
-    if (!skip_re.empty()) {
-        s << "        if (!a.attr('href').match(" << skip_re << ")) {";
-    }
     s << "        if (!a.attr('href').match(/^mailto\\:/) && external) {";
     if (external_blank) {
         s << "          a.attr('target','_blank');";
     }
     s << "        } else if (!external) {";
+    if (!skip_re.empty()) {
+        s << "        if (!a.attr('href').match(" << skip_re << ")) {";
+    }
     s << "          a.attr('onclick','return false;');";
     s << "          a.click(function(e) { $.fix_plain_anchors(a[0], e); });";
-    s << "        }";
     if (!skip_re.empty()) {
         s << "        }";
     }
+    s << "        }";
     s << "      }";
     s << "    });";
     s << "  }, " << interval_ms << ");";
 
 If external_blank, then all external anchors will get target=_blank.
 
-If skip_re is not empty, then it is used as regular expression for anchors
-that will not be changed. For example, this can be used to treat .html files.
+If skip_re is not empty, then it is used as regular expression for internal
+anchors that will not be changed. For example, to treat .html files.
 
 This function is safe to be called multiple times.