אונטערשייד צווישן ווערסיעס פון "מעדיעוויקי:Gadget-Checkty.js"

כצ"ל
(נאכנישט)
(כצ"ל)
שורה 141: שורה 141:
     },
     },
     {
     {
// notes: at least 2 numbers  - avoid chess notation replacement, English links - full link to avoid |
        // notes: at least 2 numbers  - avoid chess notation replacement, English links - full link to avoid |
from: /( [בלמהוכ])(?:- |)(\[\[[A-Za-z0-9 ]*\]\]|[A-Za-z]|(?:\[\[)?[0-9]{2,})/g,
        from: /( [בלמהוכ])(?:- |)(\[\[[A-Za-z0-9 ]*\]\]|[A-Za-z]|(?:\[\[)?[0-9]{2,})/g,
to: '$1־$2',
        to: '$1־$2',
comment: 'מיקוף למספרים ולעז'
        comment: 'מיקוף למספרים ולעז'
     },
     },
     { // move , suffix outside links
     { // move , suffix outside links
שורה 335: שורה 335:
             this.rawLinks();
             this.rawLinks();
         }
         }
         //this.rabbiLinks();
         this.rabbiLinks();
         this.overlinkify();
         this.overlinkify();
         this.nakedLinks();
         this.nakedLinks();
שורה 1,249: שורה 1,249:
             }).click(function () {
             }).click(function () {
                 // insert interlink
                 // insert interlink
            var inter = prompt('שטעלט אריין דעם נאמען פון ערך אויף המכלול העברי');
                var inter = prompt('שטעלט אריין דעם נאמען פון ערך אויף המכלול העברי');
            if (inter) {
                if (inter) {
                chectTyTool.textbox.value += '\n[' + '[he:' + inter + ']]';
                    chectTyTool.textbox.value += '\n[' + '[he:' + inter + ']]';
                chectTyTool.addSummary('צוגעלייגט אינטערשפראך לינק');
                    chectTyTool.addSummary('צוגעלייגט אינטערשפראך לינק');
            }
                }
                 return false;
                 return false;
             }));
             }));
שורה 1,325: שורה 1,325:
         // Check if the second part equals the concatenation of the first and third parts
         // Check if the second part equals the concatenation of the first and third parts
         // רבי [[רבי שלמה|שלמה]] = [[רבי שלמה]]
         // רבי [[רבי שלמה|שלמה]] = [[רבי שלמה]]
         var pattern = /\[\[([^|\]]+)\|([^|\]]+)\]\]/g;
        // Define the regular expression pattern with the global flag
         function replaceMatch(match, opening, firstPart, separator, thirdPart, closing) {
         var pattern = /(\S+)\s*\[\[([^\]]+\|[^\]]+)\]\]/g;
        console.log("match =", match, "opening =", opening, "firstPart =", firstPart, "separator=", separator, "thirdPart=", thirdPart, "closing=", closing);
 
             // Check if the second part equals the concatenation of the first and third parts
        // Define a function to be used as a replacement
             if (firstPart + thirdPart === secondPart) {
         function replaceMatch(match, precedingWord, enclosedString) {
                 return '[[' + secondPart + ']]';
            var parts = enclosedString.split('|');
            var validPrefixes = ['רבי', 'הרב', 'הר"ר', 'ר\''];
             // Check if the parts are equivalent
             if (parts[0] === 'רבי ' + parts[1] || parts[0] === 'הרב ' + parts[1]) {
                 if (validPrefixes.includes(precedingWord)) {
                    // Delete redundant title before link
                    return '[[' + parts[0] + ']]';
                } else {
                    // Word before is something else
                    return precedingWord + ' [[' + parts[0] + ']]';
                }
             } else {
             } else {
                 // If not, return the original match
                 // If not, return the original match
שורה 1,339: שורה 1,349:
         if (wikitext != this.textbox.value) {
         if (wikitext != this.textbox.value) {
             this.textbox.value = wikitext;
             this.textbox.value = wikitext;
             chectTyTool.addSummary('אויסגעגליכן אינערליכע לינקס');
             chectTyTool.addSummary('פארראכטן רבי לינקס');
         }
         }
     },
     },