MediaWiki:Gadget-sk.js: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
Beau (dyskusja | edycje)
nowa wersja
Beau (dyskusja | edycje)
poprawka dla wikicytatów
Linia 43:
}
window.wp_sk = new Object();
wp_sk.version = '2.7.23';
 
/* =====================================================
Linia 382:
wp_sk.cleanerWikiVaria = function (str)
{
if ( mw.config.get( 'wp-sk-fix-wikipedia-sections', true ) ) {
// unifikacja nagłówkowa
str = str.replace(/[ \n\t]*\n'''? *(Zobacz|Patrz) (też|także|również):* *'''?[ \t]*\n[ \t\n]*/gi, '\n\n== Zobacz też ==\n');
str = str.replace(/[ \n\t]*\n'''? *(Zobacz|Patrz) (też|także|również):* *'''?[ \t]*(.+)\n[ \t\n]*/gi, function(a,'\n\n== w1,Zobacz w2,też linki==\n');
str = str.replace(/[ \n\t]*\n'''? *(Zobacz|Patrz) (też|także|również):* *'''?[ \t]*(.+)/gi, function(a, w1, w2, linki)
{
if (linki.indexOf('[')!=-1)
{
if (linki.indexOf('[')!=-1)
// add first list el.
linki = '* ' + linki;
// next?
if (linki.indexOf(',')!=-1)
{
// escapeadd in-linkfirst andlist in-tpl commael.
linki = '* ' + linki;
var escape_fun = function(a){ return a.replace(/,/g,'<<<#>>>') };
// next?
linki = linki.replace(/\[\[[^\[\]]+\]\]/g, escape_fun);
linki =if (linki.replaceindexOf(/\{\{[^\{\}]+\}\}/g', escape_fun')!=-1);
// split{
// escape in-link and in-tpl comma
linki = linki.replace(/,[ \t]*/g, '\n* ');
var escape_fun = function(a){ return a.replace(/,/g,'<<<#>>>') };
// unescape
linki = linki.replace(/<<<#>>>\[\[[^\[\]]+\]\]/g,',' escape_fun);
linki = linki.replace(/\[{\[{[^\[{\]}]+\]}\]}/g, escape_fun);
// split
linki = linki.replace(/,[ \t]*/g, '\n* ');
// unescape
linki = linki.replace(/<<<#>>>/g,',');
}
}
return '\n\n== Zobacz też ==\n'+linki;
}
});
return '\n\n== Zobacz też ==\n'+linki;
str = str.replace(/[ \n\t]*\n'''?(=+) *(Zobacz|Patrz) (też|także|również):* *'''?=+[ \t]*\n[ \t\n]*/gi, '\n\n==$1 Zobacz też ==$1\n');
});
str = str.replace(/[ \n\t]*\n(=+)'''? *(Zobacz|Patrz)(Zewnętrzn[ey] )?(teżLinki?|takżeŁącza|równieżStron[ay]|Zobacz w (internecie|sieci))( zewn[eę]trzn[aey])?):* *=+'''?[ \n\t]*/gi, '\n\n$1== ZobaczLinki teżzewnętrzne $1==\n');
str = str.replace(/[ \n\t]*\n'''?(=+) *((Zewnętrzn[ey] )?(Linki?|Łącza|Stron[ay]|Zobacz w (internecie|sieci))( zewn[eę]trzn[aey])?):* *'''?=+[ \n\t]*/gi, '\n\n==$1 Linki zewnętrzne ==$1\n');
str = str.replace(/[ \n\t]*\n(=+) *((Zewnętrzn[eyŹŻZ] )?(Linki?|Łącza|Stronr[ayóo]|Zobacz w (internecie|sieci))( zewnd[łl]trzn[aey])?a):* *=+[ \n\t]*/gi, '\n\n$1 Linki zewnętrzneŹródła $1\n');
{}
str = str.replace(/[ \n\t]*\n(=+) *([ŹŻZ]r[óo]d[łl]a):* *=+[ \n\t]*/gi, '\n\n$1 Źródła $1\n');
 
// nagłówki
Linia 414 ⟶ 416:
str = str.replace(/(^|\n)(=+[^=\n]+=+)[\n]{2,}/g, '$1$2\n'); // jeden \n
 
if ( mw.config.get( 'wp-sk-fix-wikipedia-sections', true ) ) {
// przypisy - szablon
str = str.replace(/\n== Przypisy ==[ \t\n]+<references ?\/>/g, '\n{{Przypisy}}');
str = str.replace(/\n(={3,})= Przypisy \1==[ \t\n]+<references ?\/>/g, '\n{{Przypisy|stopień= $1}}');
str = str.replace(/\n(={\{3,}) Przypisy \|stopień==1[ \t\n]+<references ?\/>/g, '\n{{Przypisy|stopień= =$1}}');
str = str.replace(/\n== {\{Przypisy \|stopień==[ \t\n]+<references ?\/>/g, '\n{{Przypisy}}|stopień= =');
}
 
// przypisy - przyprzątnięcia
str = str.replace(/<(ref[^<>\/]*?)[ ]*><\/ref>/g, "<$1 />"); // puste na pojedynczy