Content deleted Content added
m -no more useful code |
changes in regex |
||
Line 78:
var autolinkRegexCorrectNs;
// For {{tl}}▼
autolinkRegexTemplate = /(
autolinkRegexSubstTemplate
autolinkRegexURL = /((?:[^"\[]|[^=]")(?:<span class="diffchange">)?)((?:https?|ftps?):\/\/[\w._\/\\~%\-+&#?!=()@:]+?)(?=(?:<\/span>)?[\s|)\]}'"])/g;
// External links (no wikicode)▼
if (autolinkCrono || autolinkEdit) {
autolinkRegexSubstinWcodeWoLabel = '$1<a class="external autolink" style="color:' + autolinkColor + '" href="$2">$2</a>
autolinkRegexSubstinWcodeWithLabel = '$1<a class="external autolink" style="color:' + autolinkColor + '" href="$2">$3
autolinkRegexTemplate = /((?:[^{]|^)\{{2}\s*(?:[Ss][Uu][Bb][Ss][Tt]:|[Mm][Ss][Gg]:|[Mm][Ss][Gg][Nn][Ww]:)?\s*)([^[\]{}|<>\n]+)(\||}{2})/gm;
autolinkRegexSubstTemplate
// Templates in history pages
} else {
Line 93 ⟶ 109:
autolinkColor = 'inherit'; // Link color in other pages
autolinkRegexURLinWcodeWoLabel = /(\[{1}\s*(?:<\/span>)?\s*(?:<span class="diffchange">)?\s*)((?:https?|ftps?):\/\/[\w._\/\\~%\-+&#?!=()@:]+)((?:<\/span>)?(?:<span class="diffchange">)?)([\w._\
autolinkRegexSubstinWcodeWoLabel = '$1<a class="external autolink" style="color:'
// External links in other pages, wikicode without label
autolinkRegexURLinWcodeWithLabel =
autolinkRegexSubstinWcodeWithLabel = autolinkRegexSubstinWcodeWoLabel;
// External links in other pages, wikicode with label
}
autolinkRegexSubstWlink = '$1<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/$2$4$6">$2</a>$3<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/$2$4$6">$4</a>$5<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/$2$4$6">$6</a>$7';
▲ // External links (no wikicode)
// Wikilinks
autolinkRegexInternalURL = /([^
▲ autolinkRegexTl = /({{[Tt]l\|)([^\{\}\|<>]+)/g;
▲ // For {{tl}}
▲ autolinkRegexTemplate = /(\<span class\="diffchange"\>|)([^\{]|\{{2}|^)(\<\/span\>|)(\<span class\="diffchange"\>|)\{{2}(\<\/span\>|)(\<span class\="diffchange"\>|)([Ss][Uu][Bb][Ss][Tt]\:|[Mm][Ss][Gg]\:|[Mm][Ss][Gg][Nn][Ww]\:|)(\<\/span\>|)([^\{\}\:\&\|<>\n]*?)(\<span class\="diffchange"\>|)([^\{\}\:\&\|<>\n]*?)(\<\/span\>|)([^\{\}\:\&\|<>\n]*?)(?=\s*(?:(?:\:|\|)|\}{2}))/gm;
▲ // Templates
▲ autolinkRegexInternalURL = /([^\=])('|"|\s)((?:\/?w\/index\.php\?|\/?wiki\/)[\w-\/\.\:\?\=&;%~]+)\2/g;
// External links (no wikicode, under wgServer)
autolinkRegexImportScript = /([Ii]mport[Ss]cript(?:
// ImportScript
autolinkRegexCorrectNs = /(href
// Correct link to Template:Namespace
Line 148 ⟶ 155:
autolinkContent = autolinkContent.replace(autolinkRegexURLinWcodeWoLabel,
autolinkRegexSubstinWcodeWoLabel);
▲ '$1<a class="external autolink" style="color:' + autolinkColor + '" href="$2">$2</a>$3');
// Make external links in wikicode without label into links
autolinkContent = autolinkContent.replace(autolinkRegexURLinWcodeWithLabel,
autolinkRegexSubstinWcodeWithLabel);
▲ '$1<a class="external autolink" style="color:' + autolinkColor + '" href="$2">$3$4</a>$5');
// Make external links in wikicode with label into links
autolinkContent = autolinkContent.replace(autolinkRegexURL,
'$1<a class="external autolink" style="color:' + autolinkColor + '" href="$2">$2</a>
// Parse inactive external links (no wikicode)
autolinkContent = autolinkContent.replace(autolinkRegexWlink,
autolinkRegexSubstWlink);
▲ '$1[[$2<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/$3$5$7">$3$4$5$6$7$8</a>$9]]$10');
// Make wikilink code into links
▲ '$1$2$3$4{{$5$6<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Help:$7">$7</a>$8<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/$10$12$14$16">$9$10$11$12$13$14$15$16</a>');
autolinkContent = autolinkContent.replace(autolinkRegexTemplate,
autolinkRegexSubstTemplate);
▲ '$1$2$3$4{{$5$6<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Help:$7">$7</a>$8<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Template:$9$11$13">$9$10$11$12$13</a>');
autolinkContent = autolinkContent.replace(/href\="\/wiki\/Template\:#/g, 'href="/wiki/Help:');
// Make template code into links
|