User:Lenore/autolink.js: Difference between revisions

Content deleted Content added
New version
m italic in comments; link to {{DEFAULTSORT: and similar
Line 109:
// Other pages included in diff pages
autolinkRegexTemplate = /((?:[^{]|^)\{{2}\s*(?:<\/span>)?\s*(?:<span class="diffchange">)?\s*(?:(?:[Ss][Uu][Bb][Ss][Tt]|[Mm][Ss][Gg]|[Mm][Ss][Gg][Nn][Ww])\s*:)?\s*(?:<\/span>)?\s*(?:<span class="diffchange">)?)([^[\]{}|<>\n]+)((?:<\/span>)?(?:<span class="diffchange">)?)([^[\]{}|<>\n]*)((?:<\/span>)?(?:<span class="diffchange">)?)([^[\]{}|<>\n]*)(\||}{2}|:)/gm;
autolinkRegexSubstTemplate = '$1<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Template:$2$4$6">$2</a>$3<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Template:$2$4$6">$4</a>$5<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Template:$2$4$6">$6</a>$7';
// Templates in diff pages
Line 136:
// Other pages included in comments or code sections
autolinkRegexTemplate = /((?:[^{]|^)\{{2}\s*(?:(?:[Ss][Uu][Bb][Ss][Tt]|[Mm][Ss][Gg]|[Mm][Ss][Gg][Nn][Ww])\s*:)?\s*)([^[\]{}|<>\n]+)(\||}{2}|:)/gm;
autolinkRegexSubstTemplate = '$1<a class="autolink" style="color:' + autolinkColor + '" href="/wiki/Template:$2">$2</a>$3';
// Templates in comments or code sections
Line 217:
autolinkContent = autolinkContent.replace(/([^']|^)'{2}(.+?)'{2}([^']|$)/gm, '$1<i>$2</i>$3');
if (autolinkCrono || autolinkEdit)
autolinkContent = autolinkContent.replace(/<i>(.*?)<\/i>/g, '<span title="italic" style="border: 1px solid silver; padding: 2px;">$1</span>');
// I'm in a comment field (italic)
 
}