Vikimənbə
azwikisource
https://az.wikisource.org/wiki/Ana_s%C9%99hif%C9%99
MediaWiki 1.48.0-wmf.1
first-letter
Media
Xüsusi
Müzakirə
İstifadəçi
İstifadəçi müzakirəsi
Vikimənbə
Vikimənbə müzakirəsi
Fayl
Fayl müzakirəsi
MediaViki
MediaViki müzakirəsi
Şablon
Şablon müzakirəsi
Kömək
Kömək müzakirəsi
Kateqoriya
Kateqoriya müzakirəsi
Portal
Portal müzakirəsi
Müəllif
Müəllif müzakirəsi
Səhifə
Səhifə müzakirəsi
İndeks
İndeks müzakirəsi
TimedText
TimedText talk
Modul
Modul müzakirəsi
Tədbir
Tədbir müzakirəsi
Şairin ölümünə
0
10645
97435
84433
2026-11-03T07:42:08Z
~2026-58479-99
12936
97435
wikitext
text/x-wiki
{{Başlıq
| başlıq = Şairin ölümünə
| müəllif = Mixail Lermontov
| keçidsiz müəllif =
| tərcüməçi = Mikayıl Müşfiq
| keçidsiz tərcüməçi =
| bölmə =
| əvvəlki =
| növbəti =
| il =
| qeydlər =
}}
<poem>
Şair öldürüldü, şair vuruldu,
O namus aşiqi düşərək şərə,
Sinəsində qurşun, intiqam odu
Qürurlu başını endirdi yerə.
Dözmədi şairin, dözmədi qəlbi
Ufaq təhqirlərin incikliyinə.
Öldü, zidd gedərək əvvəlki kibi
Kübar aləminin hər bir rəyinə.
Öldürüldü, artıq hədər əməkdir,
Bu tə'riflər xoru, bu hönkürtülər.
Bəraət fikri də nəyə gərəkdir?
Artıq öz hökmünü vermişdir qədər
Onun ötgün, azad iste'dadını
Siz deyilmidiniz acıqla güdən
Siz deyilmidiniz gizli yanğını
Bir zövq alardınız görükləməkdən.
Qoy olsun, sevinin, gülün bir daha!
Dözülməz iztirab onu apardı.
Söndü çıraq kibi böyük bir daha,
Ehtişam çələnki soldu, sarardı.
Soyuqqanlılıqla qatil yamanca
Vurdu zərbəsini. Qurtuluş yoxdur.
Əlində əsməyir onun tapanca.
Duyğusuz bir ürək müntəzəm vurur.
O, na qəribdir ki, bizə uzaqdan
– Uğursuz taleyin hökmü var kimi-
Bir az qapsın deyə səadət, nişan
Atılmış yüzlərcə qaçqınlar kimi.
Ona yabançıydı bizim bu torpaq.
Edib adətinə, dilinə nifrət,
O bizim tərəfə vermədi fürsət,
Əlini qaldırıb bu qanlı çağda,
Kimə qıydığını bilmədi ancaq.
Şair öldürüldü, gömüldü artıq,
Tərənnüm etdiyi haman qısqanclıq
Qurbanı, mehriban nəğməkar kimi.
O nəzərdən uzaq, bəstəkar kimi.
Özü də tərk edib getdi cahanı
Amansız bir əlin oldu qurbanı.
Şirin lətafətli, sakit havalı
Dostlar dünyasından düşüb aralı.
Dünyaya sığmayan, azad, atəşin,
Ehtirasla dolu o ürək neçin
Kübar aləminə meylini verdi,
O boğuq, o paxıl mühitə girdi?
O ki, insanları gənclik çağından
Yaxşı tanıyırdı, yaxşı bilirdi.
Fitnələr çıxaran, hiylələr quran,
İftiraçılara neçin əl verdi?
Neçin o hər sözə uydu boş yerə
İnandı yalançı nəvazişlərə?
Əvvəlki çələnki alıb başından,
Qoydular başına güyəmdən çələnk.
Lakin saf alnına batırdı hər an
Kizlş tikanlarla hörülən çələnk.
Zəhərləndi onun axır çağları,
Gülünc ümidlərin minlərcə hiylə
Doğuran, fitnəkar pıçıltısiylə,
Hədər ümidlərin gizli dağları
Çəkilməz arları ucundan o da
İitiqam deyərək atıldı oda.
Füsunkar nəğmələr kəsildi gerçək,
Bir də o nəğmələr səslənməyəcək.
Nəğməkarın yerp qəmlidir, dardır,
Dodaqlarında da bir damğa vardır.
Siz ey həyatında föhşo dadanmış,
Məşhur rəzalətlə şöhrət qazanmış
Xain atalardan nişan xələflər!
Taleyin qurduğu əylənçələrə,
İncik nəsilləri, işgəncələrlə
Qul kimi tapdayıb aşan xələflər!
Ey taxt ətrafıpda üşüşən yığın,
Şərəfin, dəhanın və azadlığın
Qəddar cəlladları enin, enin siz!
Qanun arxasında pərdələrin siz!
Sussun qarşınızda qanun, ədalət,
Sussun qarşınızda bu qara dəhşət.
Fəqət ey rəngbərəng əxlağsızlığın
Qarşısında gedən şərəfsiz yığın,
Bilin ki, tanrının məhkəməsi var,
O dəhşətli hakim sizi qarşılar.
Altun cingiltisi uzaqdır ondan,
O hər fikri, işi əvvəldən bilir.
Yapdığınız işə sizin o zaman
Nifrət yağdırmanız hədər bir işdir,
O sizə bir kömək etməyəcəkdir.
Şairin günahsız qanını hey siz,
Qara qanınızla təmizləsəniz,
Na qədər yusapız, getməyəcəkdir.
</poem>
[[Kateqoriya:Tərcümələr]]
[[Kateqoriya:1837-ci ilin şeirləri]]
[[Kateqoriya:Ölüm haqqında əsərlər]]
n5xtdxd5si3s4n0jt9jge4yobfhjsqn
MediaViki:Gadget-refToolbarBase.js
8
25494
97433
66874
2026-11-02T23:04:01Z
Maintenance script
3168
Use thumb.wikimedia.org for thumbnails ([[phab:T427465]], Operator: Ladsgroup)
97433
javascript
text/javascript
/* jshint asi: true */
/* global mw, $, CiteTB, citeTemplate, citeErrorCheck */
if ( window.CiteTB === undefined ) {
window.CiteTB = {
"Templates" : {}, // All templates
"Options" : {}, // Global options
"UserOptions" : {}, // User options
"DefaultOptions" : {}, // Script defaults
"ErrorChecks" : {} // Error check functions
};
}
if (typeof mw.usability == 'undefined') {
mw.usability = {};
mw.usability.getMsg = function(m) { return mw.messages.get(m); }
mw.usability.addMessages = function(msgs) { mw.messages.set(msgs); };
}
// Object for cite templates
window.citeTemplate = function (templatename, shortform, basicfields, expandedfields) {
// Properties
this.templatename = templatename; // The template name - "cite web", "cite book", etc.
this.shortform = shortform; // A short form, used for the dropdown box
this.basic = basicfields; // Basic fields - author, title, publisher...
// Less common - quote, archiveurl - should be everything the template supports minus the basic ones
this.extra = expandedfields;
this.incrementables = {};
// Add it to the list
CiteTB.Templates[this.templatename] = this;
// Methods
this.makeFormInner = function(fields, incrsetup) {
var i=0;
var trs = [];
var autofills = []
for (i=0; i<fields.length; i++) {
var fieldobj = fields[i];
var field = labelfield = fieldobj.field;
var ad = false;
if (incrsetup && fieldobj.increment_group) {
field = fieldobj.field.replace('<N>', '1');
labelfield = fieldobj.field.replace('<N>', '');
if (this.incrementables[fieldobj.increment_group] && !this.incrementables[fieldobj.increment_group].setup) {
// The object has been created, but not fully initialized
this.incrementables[fieldobj.increment_group]['fields'].push(fieldobj)
} else if (!this.incrementables[fieldobj.increment_group]) {
// Object not yet created
this.incrementables[fieldobj.increment_group] = {
'fields': [fieldobj],
'val':1,
'setup': false
};
} else if (this.incrementables[fieldobj.increment_group] && this.incrementables[fieldobj.increment_group].setup) {
// Fully initialized from a previous invocation of this function, just resetting the number
this.incrementables[fieldobj.increment_group].val = 1
}
} else if (fieldobj.increment_group) {
// Adding a new row
incrval = this.incrementables[fieldobj.increment_group].val;
field = fieldobj.field.replace('<N>', incrval.toString());
labelfield = fieldobj.field.replace('<N>', '');
}
if ($.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) {
im = $('<img />').attr('src', '//thumb.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png');
im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date'));
var ad = $('<a />').attr('href', '#');
ad.append(im);
ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field);
$( document ).on( 'click', '#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field, CiteTB.fillAccessdate );
}
if (fieldobj.autofillid) {
var autotype = fieldobj.autofillid;
im = $('<img />').attr('src', '//thumb.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png');
im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt'));
var ad = $('<a />').attr('href', '#');
ad.append(im);
ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype);
autofills.push('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype);
}
if (fieldobj.increment_button) {
var incrtype = fieldobj.increment_group;
im = $('<img />').attr('src', '//thumb.wikimedia.org/wikipedia/commons/thumb/b/b9/Nuvola_action_edit_add.svg/20px-Nuvola_action_edit_add.svg.png');
im.attr('alt', mw.usability.getMsg('cite-increment-alt')).attr('title', mw.usability.getMsg('cite-increment-alt'));
var ad = $('<a />').attr('href', '#');
ad.append(im);
ad.attr('id', 'cite-incr-'+CiteTB.escStr(this.shortform)+'-'+incrtype);
}
var display = mw.usability.getMsg('cite-'+labelfield+'-label');
if (typeof display !== 'string') {
if (fieldobj.label) {
display = CiteTB.fixStr(fieldobj.label);
} else {
display = CiteTB.fixStr(labelfield)
}
}
var tooltip = fieldobj.tooltip ? $('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).html('<sup>?</sup>') : false;
var input = '';
if (ad) {
input = $('<input tabindex="1" style="width:85%" type="text" />');
} else {
input = $('<input tabindex="1" style="width:100%" type="text" />');
}
input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field);
if (fieldobj.autofillprop) {
classname = 'cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop
if (fieldobj.increment_group) {
input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-incr-'+fieldobj.increment_group);
classname+='-'+this.incrementables[fieldobj.increment_group].val.toString();
}
input.addClass(classname);
}
var label = $('<label />');
label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display);
if (tooltip) {
label.append(tooltip);
}
var style = 'text-align:right; width:20%;';
if (i%2 == 1) {
style += ' padding-left:1em;';
} else {
var tr = $('<tr />');
}
var td1 = $('<td class="cite-form-td" />').attr('style', style);
td1.append(label);
tr.append(td1);
var td2 = $('<td class="cite-form-td" style="width:30%" />');
td2.append(input);
if (ad) {
td2.append(ad);
}
tr.append(td2);
if (i%2 == 0) {
trs.push(tr);
}
}
var needsetup = false;
for (g in this.incrementables) {
if (!this.incrementables[g].setup) {
needsetup = true;
$( document ).on( 'click', '#cite-incr-'+CiteTB.escStr(this.shortform)+'-'+g, CiteTB.incrementFields );
this.incrementables[g].setup = true;
}
}
if (needsetup || $.isEmptyObject(this.incrementables)) {
for(i=0; i<autofills.length; i++) {
$( document ).on( 'click', autofills[i], CiteTB.initAutofill );
}
}
return trs;
}
// gives a little bit of HTML so the open form can be identified
this.getInitial = function() {
var hidden = '<input type="hidden" class="cite-template" value="' + this.templatename + '"/>';
return hidden;
}
// makes the form used in the dialog boxes
this.getForm = function() {
var main = $("<div class='cite-form-container' />");
var form1 = $('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />');
var i=0;
var trs = this.makeFormInner(this.basic, true);
for (var i=0; i<trs.length; i++) {
form1.append(trs[i]);
}
var form2 = $('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">');
trs = this.makeFormInner(this.extra, true);
for (var i=0; i<trs.length; i++) {
form2.append(trs[i]);
}
main.append(form1).append(form2);
var form3 = $('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">');
var tr = $('<tr />');
var td1 = $('<td class="cite-form-td" style="text-align:right; width:20%" />');
var label1 = $('<label />');
label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label'));
td1.append(label1);
var td2 = $('<td class="cite-form-td" style="width:30%" />');
var input1 = $('<input tabindex="1" style="width:100%" type="text" />');
input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name');
td2.append(input1);
var td3 = $('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">');
var label2 = $('<label />');
label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label'));
td3.append(label2);
var td4 = $('<td class="cite-form-td" style="width:30%" />');
var input2 = $('<input tabindex="1" style="width:100%" type="text" />');
input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group');
td4.append(input2);
tr.append(td1).append(td2).append(td3).append(td4);
form3.append(tr);
main.append(form3);
var extras = $('<div />');
extras.append('<input type="hidden" class="cite-form-status" value="closed" />');
var hidden = $('<input type="hidden" class="cite-template" />');
hidden.val(this.templatename);
extras.append(hidden);
var span1 = $('<span class="cite-preview-label" style="display:none;" />');
span1.text(mw.usability.getMsg('cite-raw-preview'));
extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />');
var span2 = $('<span class="cite-prev-parsed-label" style="display:none;" />');
span2.text(mw.usability.getMsg('cite-parsed-label'));
extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />');
var link = $('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');
link.text(mw.usability.getMsg('cite-form-parse'));
extras.append(link);
main.append(extras);
return main;
}
}
/* Class for error checks
FIXME: DOCS OUT OF DATE
type - type of error check - current options:
* 'refcheck' - apply a function on each ref individually
* function should accept a ref object, return a string
* 'reflist' - apply a function on the entire ref list
* function should accept an array of ref objects, return an array of strings
* 'search' - apply a function ro the page text
* function should accept the page text as a string, return an array of strings
The strings returned by the function should be valid HTML
func - The function described above
testname - Name of the error check, must not contain spaces
desc - A short description of the test
*/
window.citeErrorCheck = function (obj) {
this.obj = obj
CiteTB.ErrorChecks[this.obj.testname] = this;
this.run = function() {
var errors = [];
switch(this.obj['type']) {
case "refcheck":
CiteTB.loadRefs();
for(var i=0; i<CiteTB.mainRefList.length; i++) {
var e = this.obj.func(CiteTB.mainRefList[i]);
if (e) {
errors.push(e);
}
}
break;
case "reflist":
CiteTB.loadRefs();
errors = this.obj.func(CiteTB.mainRefList);
break;
case "search":
var func = this.obj.func
CiteTB.getPageText(function(text) {
errors = func(text);
});
break;
}
return errors;
}
this.getRow = function() {
var row = $("<li />");
var check = $("<input type='checkbox' name='cite-err-test' />");
check.attr('value', this.obj.testname);
var label = $("<label />").html(mw.usability.getMsg(this.obj.desc));
label.attr('for', this.obj.testname);
row.append(check).append(' – ').append(label);
return row;
}
}
$('head').trigger('reftoolbarbase');
kdju8pm2fcdxm36w9h7pn0ady5s2w2w
MediaViki:Gadget-codePrettifier.js
8
29654
97432
84532
2026-11-02T23:04:00Z
Maintenance script
3168
Use thumb.wikimedia.org for thumbnails ([[phab:T427465]], Operator: Ladsgroup)
97432
javascript
text/javascript
// See the docs at https://meta.wikimedia.org/wiki/User:Jack_who_built_the_house/Code_Prettifier
// <nowiki>
(function () {
var pageIsProbablyTemplate = [2, 10].includes(mw.config.get('wgNamespaceNumber'));
function alignTemplateParameters(settings) {
settings = settings || {};
var askOptions = settings.askOptions;
var hardMode = settings.hardMode;
var templateExpanderMode = settings.templateExpanderMode;
var codeStylerMode = settings.codeStylerMode;
var txt = '';
var hidden = [];
var $textbox = $('#wpTextbox1');
var $CodeMirrorVscrollbar = $('.CodeMirror-vscrollbar');
var winScroll = document.documentElement.scrollTop;
var i;
var selectionMode = false;
if (typeof cpMaxWidth === 'undefined') window.cpMaxWidth = 30;
if (typeof cpPreserveBasicSpacing === 'undefined') window.cpPreserveBasicSpacing = true;
if (typeof cpPreserveParameterSpacing === 'undefined') window.cpPreserveParameterSpacing = true;
if (typeof cpStandardExternalLeftSpacing === 'undefined') window.cpStandardExternalLeftSpacing = 0;
if (typeof cpStandardInternalLeftSpacing === 'undefined') window.cpStandardInternalLeftSpacing = 1;
if (typeof cpParserFunctionExternalLeftSpacing === 'undefined') window.cpParserFunctionExternalLeftSpacing = 0;
if (typeof cpParserFunctionInternalLeftSpacing === 'undefined') window.cpParserFunctionInternalLeftSpacing = 1;
if (typeof cpAutoSummary === 'undefined') window.cpAutoSummary = false;
if (cpParserFunctionExternalLeftSpacing > 1) cpParserFunctionExternalLeftSpacing = 1;
if (cpParserFunctionInternalLeftSpacing > 1) cpParserFunctionInternalLeftSpacing = 1;
if (cpStandardExternalLeftSpacing > 1) cpStandardExternalLeftSpacing = 1;
if (cpStandardInternalLeftSpacing > 1) cpStandardInternalLeftSpacing = 1;
function isMultiline(s) {
return s.includes('\n');
}
function r(r1, r2) {
txt = txt.replace(r1, r2);
}
function hide(re) {
r(re, function (s) {
return '\x01' + (isMultiline(s) ? '_' : '') + hidden.push(s) + '\x02';
});
}
function hideTag(tag) {
hide(new RegExp('<' + tag + '( [^>]+)?>[\\s\\S]+?<\\/' + tag + '>', 'gi'));
}
function prettifyTemplates() {
function prettifyTemplate() {
function localR(r1, r2) {
newTpl = newTpl.replace(r1, r2);
}
function localHide(re) {
localR(re, function (s) {
return '\x03' + localHidden.push(s) + '\x04';
});
}
function localUnhide() {
while (newTpl.match(/\x03\d+\x04/)) {
newTpl = newTpl.replace(/\x03(\d+)\x04/g, function (s, num) {
return localHidden[num - 1];
});
}
}
function isNamed(param) {
return param.includes('=');
}
function removeEndingNewlines(s) {
return s.replace(/\n+([ \t]*)$/, '');
}
function generateSpaces(num) {
return ' '.repeat(Math.max(0, num));
}
function lcFirst(s) {
if (!s) return s;
return s[0].toLowerCase() + s.substr(1);
}
function calculateOneValueDominance(arr) {
var spread = arr.reduce((obj, item) => {
obj[item] = (obj[item] || 0) + 1;
return obj;
}, {});
var topValueCount = Object.entries(spread)
.map(([, value]) => value)
.sort((a, b) => b - a)[0];
return topValueCount / arr.length;
}
var newTpl = tpl;
var multiline = isMultiline(newTpl);
newTpl = newTpl.replace(/^\{\{\s+(?!\x01)/, '{{');
// For example, {{fullurl:...|action=edit}}
if (!newTpl.match(/\{\{[a-zA-Z][^\|]*:/)) {
newTpl = newTpl.replace(/^([^\|]+?)\s+\}\}$/, '$1}}');
}
if (!multiline && !cpCodeStyler && !cpTemplateExpander) return newTpl;
var re, m, m2, tplName, start;
var isParserFunction = false;
var anythingBeforeTplName = '(\\x01\\d+\\x02|(?:<includeonly>)?(?:safe)?subst:(?:<\\/includeonly>|<(?:includeonly|noinclude) ?\\/>))?';
re = new RegExp('^\\{\\{' + anythingBeforeTplName + '(#\\w*)?:[ \\t]*(?=(\\n?))');
m = newTpl.match(re);
tplName = m && m[2];
if (tplName) {
isParserFunction = true;
if (codeStylerMode && tplName !== '#invoke') {
newTpl = newTpl.replace(re, '{{' + (m[1] || '') + tplName + ':' + (m[3] ? '' : ' '));
}
} else {
if (!multiline && !cpTemplateExpander) {
return newTpl;
}
m = newTpl.match(/^\{\{([^|}\n]+)/);
tplName = m && m[1].trim();
}
var localHidden = [];
var params;
if (isParserFunction && cpCodeStyler && codeStylerMode) {
localHide(/\[\[[^\]]+\]\]/g); // [[Вики-ссылки]]
params = newTpl.split('|');
params[0] = params[0].replace(/^\{\{/, '');
params[params.length - 1] = params[params.length - 1].replace(/\}\}$/, '');
// Unsafe to space out parameters when there are unnamed ones.
var safeToSpace = false;
var unnamedCount = 0;
if (tplName === '#invoke' && codeStylerMode === 'newlines') {
safeToSpace = true;
for (i = 2; i < params.length; i++) {
if (!isNamed(params[i])) {
safeToSpace = false;
break;
}
}
}
// Make #if, #ifexpr, #ifeq, #ifexist, #iferror multiline only if both arguments are non-empty, or if
// it contains nested templates / parser functions
var makeIfMultiline = codeStylerMode === 'newlines' &&
(tplName.substr(0, 3) === '#if' &&
params[1] !== undefined &&
(isMultiline(params[1]) ||
tplName === '#ifeq' ||
(params[2] !== undefined &&
isMultiline(params[2])
) ||
((params[1].trim() !== '' &&
params[2] !== undefined &&
params[2].trim() !== ''
) ||
params[1].includes('\x01_') ||
(params[2] !== undefined &&
params[2].includes('\x01_')
)
)
)
);
var isMultipleAlternativesSwitch = false;
var isOneOfSwitchAlternatives;
// FIXME: this should be refactored, of course. Above, apparently, safeToSpace must be able
// to become true not only when `codeStylerMode === 'newlines'`.
if (params.length > 1) {
for (i = 1; i < params.length; i++) {
// FIXME: bizarre, yes, that previous parameter is analyzed, but that's connected to the
// logic below.
if (tplName === '#switch' && i - 1 !== 0 && !params[i - 1].includes('=')) {
isMultipleAlternativesSwitch = true;
isOneOfSwitchAlternatives = true;
} else {
isOneOfSwitchAlternatives = false;
}
if (tplName === '#switch' ||
(tplName === '#invoke' &&
(safeToSpace ||
params[i].match(/\n[ \t]*$/) &&
params[i - 1].match(/\n[ \t]*$/)
)
)
) {
params[i] = params[i].replace(/([ \t]*)=[ \t]*/, function (s, m1) {
var sp;
if (tplName === '#invoke' &&
codeStylerMode === 'newlines' &&
!isMultipleAlternativesSwitch
) {
sp = generateSpaces(i);
} else if (m1.length < 1 ||
codeStylerMode === 'newlines-collapse' ||
!(params[i].match(/\n[ \t]*$/) &&
params[i - 1].match(/\n[ \t]*$/)
) ||
isMultipleAlternativesSwitch
) {
sp = ' ';
} else {
sp = m1;
}
return sp + '= ';
});
} else if (tplName === '#invoke') {
params[i] = params[i]
.replace(/[ \t]+=/, ' =')
.replace(/=[ \t]+/, '= ');
}
if (codeStylerMode === 'newlines-collapse' && !(tplName === '#invoke' && !multiline)) {
params[i - 1] = params[i - 1].replace(/\s*$/, ' ');
// {{#if: smth |\nsmth\n}}
params[i] = params[i].replace(/^[ \t]*(?=(\n)?)/, function (s, m1) {
return m1 ? '' : ' ';
});
if (i === params.length - 1) {
params[i] = params[i].replace(/\s*$/, ' ');
}
} else if (!isMultiline(params[i - 1]) ||
params[i - 1].match(/\S[ \t]*$/) ||
(tplName === '#switch' && isOneOfSwitchAlternatives)
) {
if (codeStylerMode === 'newlines' &&
((tplName.substr(0, 3) === '#if' && makeIfMultiline) ||
(tplName === '#switch' && !isOneOfSwitchAlternatives) ||
(tplName === '#invoke' && safeToSpace && i !== 1)
)
) {
params[i - 1] = params[i - 1].replace(/[ \t]*$/, '\n');
multiline = true;
} else if (tplName === '#switch' && isOneOfSwitchAlternatives) {
params[i - 1] = ' ' + params[i - 1].trim() + ' ';
} else {
if (!(tplName === '#invoke' && !safeToSpace)) {
params[i - 1] = params[i - 1].replace(/[ \t]*$/, ' ');
} else if (isNamed(params[i - 1]) || i - 1 <= 1) {
params[i - 1] = params[i - 1].replace(/[ \t]+$/, ' ');
}
}
if (!(tplName === '#invoke' && !safeToSpace)) {
// {{#if: smth |\nsmth\n}}
params[i] = params[i].replace(/^[ \t]*(?=(\n)?)/, function (s, m1) {
return m1 ? '' : ' ';
});
} else if (isNamed(params[i]) || i === 1) {
params[i] = params[i].replace(/^[ \t]+/, ' ');
}
if (i === params.length - 1) {
if (!(tplName === '#invoke' && !safeToSpace)) {
params[i] = params[i].replace(/(\S)[ \t]*$/, '$1 ');
} else if (isNamed(params[i])) {
params[i] = params[i].replace(/(\S)[ \t]+$/, '$1 ');
}
}
}
}
} else {
params[0] = params[0].replace(/\s*$/, ' ');
}
if (tplName === '#expr' || tplName === '#ifexpr') {
params[0] = params[0]
// Don't touch cases like `+30 * -7`
.replace(/: /, ':')
.replace(/[ \t]*(\+|-|\*|\/|\^|<>|!=|>=|<=|>|<|=)[ \t]*/g, ' $1 ')
.replace(/([+\-*/^=<>:])[ \t]*(\+|-) /g, '$1 $2')
.replace(/:[ \t]*/, ': ');
}
newTpl = '{{' + params.join('|') + '}}';
if (params.length > 1) {
if (tplName !== '#invoke') {
newTpl = newTpl.replace(/\|[ \t]\}\}/, '}}');
}
if (tplName === '#invoke' && (safeToSpace || codeStylerMode === 'newlines-collapse')) {
newTpl = newTpl.replace(
new RegExp('^\\{\\{' + anythingBeforeTplName + '#invoke:[ \\t]*'),
'{{$1#invoke: '
);
} else {
newTpl = newTpl.replace(
new RegExp('^\\{\\{' + anythingBeforeTplName + '#invoke:[ \\t]+'),
'{{$1#invoke: '
);
}
if (tplName !== '#switch') {
newTpl = newTpl.replace(/\| ?\|/g, '||');
}
}
localUnhide();
//console.log(newTpl);
if (!multiline) {
return newTpl;
}
}
if (!isParserFunction && cpTemplateExpander && templateExpanderMode) {
localHide(/\[\[[^\]]+\]\]/g); // [[Вики-ссылки]]
params = newTpl.split('|');
params[0] = params[0].replace(/^\{\{/, '');
params[params.length - 1] = params[params.length - 1].replace(/\}\}$/, '');
var namedCount = 0;
var unnamedCount = 0;
var hasCollapsed = false;
var isFullyCollapsible = true;
for (i = 1; i < params.length; i++) {
if (isNamed(params[i])) {
namedCount++;
if (!isMultiline(params[i - 1])) {
hasCollapsed = true;
}
} else {
unnamedCount++;
}
if ((isNamed(params[i]) &&
isMultiline(params[i].trim())
) ||
(!isNamed(params[i]) &&
isMultiline(params[i]) &&
params[i + 1] &&
!isNamed(params[i + 1]) &&
isMultiline(params[i + 1])
)
) {
// Is it OK to collapse the template into a one-liner
isFullyCollapsible = false;
}
}
if (namedCount > 1 && !(templateExpanderMode === 'expand' && !hasCollapsed)) {
if (templateExpanderMode === 'expand') {
for (i = 0; i < params.length; i++) {
if (i === 0) {
params[i] = params[i].replace(/\s*$/, '');
}
if ((params[i + 1] &&
isNamed(params[i + 1])
) ||
(i === 0 &&
(params[i + 1] &&
params[i + 2] &&
!isNamed(params[i + 1]) &&
!isNamed(params[i + 2]) &&
isMultiline(params[i + 1])
)
) ||
(i !== 0 &&
(isNamed(params[i]) ||
lcFirst(tplName) === 'публикация'
)
)
) {
if (isNamed(params[i]) || lcFirst(tplName) === 'публикация') {
params[i] = params[i].replace(/\s*$/, '');
} else {
params[i] = removeEndingNewlines(params[i]);
}
params[i] = params[i] + '\n' + generateSpaces(stack.length * 2 + selectionSpacing) +
' ';
if (unnamedCount <= 1 && params[i + 1] && isNamed(params[i + 1])) {
params[i + 1] = ' ' + params[i + 1].trim();
}
if (i !== 0) {
// For subsequent alignment
params[i] = params[i].replace('=', generateSpaces(i) + '=');
}
}
}
hasCollapsed = false;
} else if (templateExpanderMode === 'collapse') {
for (i = 0; i < params.length; i++) {
if (i === 0 ||
isNamed(params[i]) ||
(params[i + 1] &&
(isNamed(params[i + 1]) ||
!isMultiline(params[i + 1])
)
) ||
(i === params.length - 1 &&
isFullyCollapsible
)
) {
if (i === 0 || isNamed(params[i])) {
if (isFullyCollapsible ||
(i !== params.length - 1 &&
!(params[i + 1] &&
!isNamed(params[i + 1]) &&
isMultiline(params[i + 1]) &&
params[i + 2] &&
!isNamed(params[i + 2]) &&
isMultiline(params[i + 2])
)
)
) {
params[i] = params[i].trim();
} else {
params[i] = params[i]
.replace(/^\s*/, '')
.replace(/\s*?(\n*)$/, '$1');
}
} else if (i !== 0 && !isNamed(params[i]) && isMultiline(params[i]) &&
(isFullyCollapsible ||
params[i + 1] &&
(isNamed(params[i + 1]) ||
!isMultiline(params[i + 1])
) &&
(i === 1 ||
isNamed(params[i - 1]) ||
!isMultiline(params[i - 1])
)
)
) {
// Sometimes unnamed parameters are stretched out into a stack
params[i] = removeEndingNewlines(params[i]);
}
}
if (i !== 0) {
params[i] = params[i].replace(/[ \t]*=[ \t]*/, '=');
}
if (!pageIsProbablyTemplate &&
(!unnamedCount &&
isNamed(params[Math.max(1, i)]) ||
(lcFirst(tplName) === 'публикация')
) // && i !== params.length - 1
) {
params[i] = params[i].replace(/ *$/, ' ');
}
}
hasCollapsed = true;
}
newTpl = '{{' + params.join('|') + '}}';
}
localUnhide();
//console.log(newTpl);
if (hasCollapsed) {
return newTpl;
}
}
m = newTpl.match(/^(\{\{[\s\S]*?\n\s*)(\||\}\})/);
if (!m) return newTpl;
start = m[1];
if (!templateExpanderMode) {
start = start.trim();
} else {
start = removeEndingNewlines(start);
}
var indentSpaces = ' '.repeat(basicLevel);
if (!refTagBefore) {
// Insert a number of spaces depending on the level of nesting
if (isParserFunction) {
indentSpaces += generateSpaces(stack.length); // Character "|"
indentSpaces += generateSpaces(stack.length * cpParserFunctionExternalLeftSpacing);
indentSpaces += generateSpaces(stack.length * cpParserFunctionInternalLeftSpacing);
} else {
indentSpaces += generateSpaces(stack.length * 2);
}
indentSpaces += generateSpaces(selectionSpacing);
}
var noEndingBrackets = false;
if (!newTpl.includes('}}', newTpl.length - 2)) {
newTpl += '}}';
noEndingBrackets = true;
}
if (tplName === '#switch') {
// For correct alignment of `=` in `| a | b | c = value`
re = /\n([ \t]*)\|([ \t]*)(?:([^=\n]+?)([ \t]*)=([ \t]*))?([\s\S]*?)(?=(\n[ \t]*\||\}\}))/g;
} else {
re = /\n([ \t]*)\|([ \t]*)(?:([^=|\n]+?)([ \t]*)=([ \t]*))?([\s\S]*?)(?=(\n[ \t]*\||\}\}))/g;
}
params = [];
var longestParameterLength = 0;
var standardWidth = 0;
var length;
var basicExternalLeftSpacing;
var basicInternalLeftSpacing;
var oneSpaceCount = 0;
var zeroSpacesCount = 0;
var paramLeftLengths = [];
var namedParametersCount = 0;
i = 0;
while ((m = re.exec(newTpl))) {
i++;
if (i === 1) {
basicExternalLeftSpacing = isParserFunction
? generateSpaces(indentSpaces.length + cpParserFunctionExternalLeftSpacing)
: m[1];
basicInternalLeftSpacing = isParserFunction
? generateSpaces(cpParserFunctionInternalLeftSpacing)
: m[2];
}
if (thisPreserveBasicSpacing) {
/*
This code ensures that:
1) the outer left padding will not be multiplied in nested templates,
2) there will be no lines with a smaller outer left padding than the first line,
3) there will be no outer left padding of more than one space out of the blue.
*/
if (i === 1) {
m[1] = '';
} else {
// Cases when the parameters are spaced out relative to the base level by editors on
// purpose. But all parser function arguments have the same indentation.
if (isParserFunction || !thisPreserveParameterSpacing) {
m[1] = '';
} else if (thisPreserveParameterSpacing) {
m[1] = generateSpaces(m[1].length - basicExternalLeftSpacing.length);
}
}
if (basicExternalLeftSpacing.length > indentSpaces.length) {
m[1] += ' ';
}
} else {
if (isParserFunction) {
m[1] = '';
// FIXME: bizarre that the standard padding of parser functions is formed via
// `basicExternalLeftSpacing` and not directly via
// `cpParserFunctionExternalLeftSpacing` (also above).
if (basicExternalLeftSpacing.length > indentSpaces.length) {
m[1] += ' ';
}
} else if (thisPreserveParameterSpacing) {
m[1] = generateSpaces(
cpStandardExternalLeftSpacing + m[1].length - basicExternalLeftSpacing.length
);
} else {
m[1] = generateSpaces(cpStandardExternalLeftSpacing);
}
}
if (thisPreserveBasicSpacing) {
// The same for the inner left padding
if (i === 1) {
m[2] = '';
} else {
if (isParserFunction || !thisPreserveParameterSpacing) {
m[2] = '';
} else if (thisPreserveParameterSpacing) {
m[2] = generateSpaces(m[2].length - basicInternalLeftSpacing.length);
}
}
if (basicInternalLeftSpacing.length > 0) {
m[2] += ' ';
}
} else {
if (thisPreserveParameterSpacing) {
m[2] = generateSpaces(
cpStandardInternalLeftSpacing + m[2].length - basicInternalLeftSpacing.length
);
} else {
m[2] = generateSpaces(cpStandardInternalLeftSpacing);
}
}
if (!hardMode || codeStylerMode || templateExpanderMode) {
paramLeftLengths.push((m[1] + m[2] + m[3] + m[4]).length);
if (m[4] === ' ') {
oneSpaceCount++;
}
if (m[4] === '' && m[5] === '') {
zeroSpacesCount++;
}
}
if (m[3] !== undefined) {
length = m[1].length + m[2].length + m[3].length;
if (length > longestParameterLength) {
longestParameterLength = length;
}
if (!hardMode || codeStylerMode || templateExpanderMode) {
namedParametersCount++;
}
}
if (m[3] === undefined && m[6].match(/^[ \t]*\n/)) {
m[6] = m[6].replace(/^\n\s*\x01/, '\x01');
}
m[6] = m[6]
.replace(/\n\s*\n\s*$/, '\n') // 3+ newlines in total
.replace(/^[ \t]+$/, ''); // Empty parameter (but can't trim if there are newlines there)
if (m[3] !== undefined) {
m[6] = m[6]
// Trailing spaces in all terminating (space-only) lines
.replace(/[ \t]*(\n?)[ \t]*$/, '$1')
// A trailing space in parameters `lat_*`, `lon_*`, etc.
.replace(/(\|.*=)(\n?)$/, '$1 $2');
}
params.push([m[1], m[2], m[3], m[6]]);
}
if (!params[0]) {
return newTpl;
}
standardWidth = Math.min(thisMaxWidth, longestParameterLength);
if (!hardMode || codeStylerMode || templateExpanderMode) {
if (namedParametersCount !== 0 && calculateOneValueDominance(paramLeftLengths) <= 0.75) {
if (oneSpaceCount / namedParametersCount > 0.75) {
standardWidth = 0;
}
if (zeroSpacesCount / namedParametersCount > 0.75) {
standardWidth = -1;
}
}
}
newTpl = '';
if (isMultiline(trailingSpaceBefore)) {
m = trailingSpaceBefore.match(/ *$/);
var trailingNormalSpacesLength = m ? m[0].length : 0;
if (trailingNormalSpacesLength < indentSpaces.length) {
newTpl += generateSpaces(indentSpaces.length - trailingNormalSpacesLength);
} else {
newLeft -= trailingNormalSpacesLength - indentSpaces.length;
}
}
newTpl += start + '\n';
//console.log(params);
if (params.length !== 1 && params[params.length - 1][2] && params[params.length - 1][3]) {
params[params.length - 1][3] = params[params.length - 1][3]
.replace(/\s*$/, '')
// Again a trailing space in parameters `lat_*`, `lon_*`, etc.
.replace(/(\|.*=)(\n?)$/, '$1 $2');
} else if (isParserFunction) {
params[params.length - 1][3] = params[params.length - 1][3].replace(/\s*$/, '');
} else {
params[params.length - 1][3] = removeEndingNewlines(params[params.length - 1][3]);
}
var line;
// Not all numbered params are listed: only those that are part of the main block where
// ordered elements are located. For example, `image1` and `image2` are not listed because
// they appear separately from the main block; they are not related to `label1` and `label2`.
var NUMBERED_PARAMS = [
// Infobox
'header', 'заголовок',
'label', 'метка',
'data', 'текст',
'class', 'класс',
'rowclass',
'rowstyle',
'rowcellstyle',
'класс_заголовка', 'класс заголовка',
'класс_метки', 'класс метки',
'класс_текста', 'класс текста',
'стиль_заголовка', 'стиль заголовка',
'стиль_метки', 'стиль метки',
'стиль_текста', 'стиль текста',
'викиданные',
// Infobox3cols
'dataa', 'datab', 'datac', 'текст_а', 'текст_б', 'текст_в',
'datastylea', 'datastyleb', 'datastylec', 'стиль_текста_а', 'стиль_текста_б', 'стиль_текста_в',
'classa', 'classb', 'classc',
'стиль_колонки_а', 'стиль_колонки_б', 'стиль_колонки_в',
// Navbox
'group', 'группа', 'блок',
'list', 'список',
'listclass', 'класс_списка', 'класс списка',
'groupstyle', 'стиль_группы', 'стиль группы',
'liststyle', 'стиль_списка', 'стиль списка',
'abbr', 'имя_блока', 'имя блока',
'col', 'колонка',
'colheader', 'заголовок_колонки', 'заголовок колонки',
'colfooter', 'низ_колонки', 'низ колонки',
'colwidth', 'ширина_колонки', 'ширина колонки',
'colstyle', 'стиль_колонки', 'стиль колонки',
'colheaderstyle', 'стиль_заголовка_колонки', 'стиль заголовка колонки',
'colfooterstyle', 'стиль_низа_колонки', 'стиль низа колонки',
'colheadercolspan', 'отступ_заголовка_колонки', 'отступ заголовка колонки',
'colfootercolspan', 'отступ_низа_колонки', 'отступ низа колонки',
// Sidebar
'headingclass',
'headingclass',
'contentclass',
'contentstyle',
];
var paramName, numberMatches, number, numberedParamCurrent, numberedParamCounter, paramNameCount,
paramGroupDuplicatesCount, isDuplicate;
var paramNamesMet = [];
var paramGroupDuplicateNumbersMet = [];
for (i = 0; i < params.length; i++) {
if (params[i][2]) {
paramName = params[i][2];
if (!NUMBERED_PARAMS.includes(paramName) &&
NUMBERED_PARAMS.includes(paramName.replace(/\d+/, ''))
) {
numberMatches = paramName.match(/\d+/);
number = Number(numberMatches[0]);
isDuplicate = paramNamesMet.includes(paramName);
if (isDuplicate) {
paramNameCount = paramNamesMet.filter(function (value) {
return value === paramName;
}).length;
paramGroupDuplicatesCount = paramGroupDuplicateNumbersMet.filter(function (value) {
return value === number;
}).length;
}
if (numberedParamCurrent === undefined) {
numberedParamCounter = 1;
} else if (
// `numberedParamCurrent` has the previous number.
number !== numberedParamCurrent ||
// This condition makes it possible to adequately parse numerous duplicates of
// parameter names. It identifies cases where a certain parameter is repeated more
// times than there are already groups for that number in order to increase the
// counter by 1.
(isDuplicate && paramNameCount > paramGroupDuplicatesCount)
) {
numberedParamCounter++;
if (isDuplicate) {
paramGroupDuplicateNumbersMet.push(number);
}
}
numberedParamCurrent = number;
paramNamesMet.push(paramName);
paramName = paramName.replace(/\d+/, numberedParamCounter);
params[i][2] = paramName;
}
}
line = indentSpaces + params[i][0] + '|' + params[i][1] + (params[i][2] || '');
if (params[i][2]) {
if (!params[i][2].match(/^(lat|lon)_/) || !params[i][3].includes('|')) {
line += generateSpaces(
standardWidth - (params[i][2].length + params[i][0].length + params[i][1].length)
);
}
if (standardWidth !== -1) {
line += ' ';
}
line += '=';
if (standardWidth !== -1 && (!params[i][3].match(/^\n(?!<!--)/) || params[i][3].trim() === '')) {
line += ' ';
}
}
line += params[i][3] + '\n';
newTpl += line;
}
if (!noEndingBrackets) {
newTpl += indentSpaces + '}}';
}
return newTpl;
}
var initialTxt = txt;
var thisMaxWidth, thisPreserveBasicSpacing, thisPreserveParameterSpacing;
var selectionSpacing = 0;
var basicLevel = 0;
if (askOptions) {
if (!templateExpanderMode && !codeStylerMode) {
if (selectionMode) {
selectionSpacing = parseInt(prompt('Basic spacing of parameter values:', '0'));
if (isNaN(selectionSpacing)) {
selectionSpacing = 0;
}
}
thisMaxWidth = parseInt(prompt('The maximum allowed standard width of the column consisting of parameter names, in characters. (The default value for this setting can be specified in your common.js in the cpMaxWidth variable.)', cpMaxWidth));
if (isNaN(thisMaxWidth)) {
thisMaxWidth = cpMaxWidth;
}
thisPreserveBasicSpacing = confirm('Keep the spacing around the "|" character at the beginning of the line? (The default value for this setting [true/false, now ' + cpPreserveBasicSpacing + '] can be specified in your common.js in the cpPreserveBasicSpacing variable.)');
thisPreserveParameterSpacing = confirm('Keep the spacing around the "|" character at the beginning of the line at the individual parameters relative to the basic level (the parameters of some templates are visually grouped this way)? (The default value for this setting [true/false, now ' + cpPreserveParameterSpacing + '] can be specified in your common.js in the cpPreserveParameterSpacing variable.)');
} else {
thisMaxWidth = cpMaxWidth;
thisPreserveBasicSpacing = cpPreserveBasicSpacing;
thisPreserveParameterSpacing = cpPreserveParameterSpacing;
}
basicLevel = parseInt(prompt('Basic spacing of lines', '0'));
if (isNaN(basicLevel) || basicLevel < 0) {
basicLevel = 0;
}
} else {
thisMaxWidth = cpMaxWidth;
thisPreserveBasicSpacing = cpPreserveBasicSpacing;
thisPreserveParameterSpacing = cpPreserveParameterSpacing;
}
// Template blanks
if (!pageIsProbablyTemplate) {
hideTag('pre');
}
hideTag('nowiki');
hideTag('source');
hideTag('syntaxhighlight');
hideTag('templatedata');
hideTag('code');
hideTag('kbd');
hideTag('tt');
hideTag('graph');
hideTag('hiero');
hideTag('math');
hideTag('timeline');
hideTag('chem');
hideTag('score');
hideTag('categorytree');
hide(/<!--[\s\S]*?-->/g);
if (cpCodeStyler && codeStylerMode) {
r(/^;(?=[^ ])/mg, '; ');
r(/(\sstyle=)([\'"])([^<>\2]+?)\2([^<>]*?)/g, function (s, m1, m2, m3, m4) {
if (/\{\{ *#/.test(s)) {
return s;
}
m3 = m3
.replace(/;+/g, ';')
.replace(/; */g, '; ')
.replace(/ *$/, '')
.replace(/([^;}])$/, '$1;')
.replace(/#[0-9A-F]{6}/, function (m) {
return m.toLowerCase();
})
.replace(/#[0-9A-F]{3}/, function (m) {
return m.toLowerCase();
});
return m1 + '"' + m3 + '"' + m4;
});
}
var tpl;
var left;
var right;
var trailingSpaceBefore;
var refTagBefore;
var leftM;
var lastStackBrackets;
var stackElem;
var newLeft;
var stack = [];
// Take into account `{{{{{|subst:}}}template}}`, `{{{!}}` (expanding to `{|`). Sacrifice the
// fact that `{{{!}}}` will be parsed as `{ + {{!}} + }`.
var leftRe = /\{\{(?:\{(?!\{|!)|(?!\{!))/g;
var bracketsLength = 0;
while (true) {
lastStackBrackets = stack.length && stack[stack.length - 1][1] === 3 ? '}}}' : '}}';
right = txt.indexOf(lastStackBrackets, leftRe.lastIndex);
leftM = leftRe.exec(txt);
if (leftM) {
bracketsLength = leftM[0].length;
left = leftM.index;
} else {
left = -1;
}
if (left === -1 && right === -1 && !stack.length) {
break;
}
if (left !== -1 && (left < right || right === -1)) {
stack.push([left, bracketsLength]);
} else {
stackElem = stack.pop();
if (stackElem) {
left = stackElem[0];
bracketsLength = stackElem[1];
} else {
if (right === -1) {
continue;
} else {
left = 0;
bracketsLength = 2;
}
}
if (right === -1) {
right = txt.length;
}
right += bracketsLength;
tpl = txt.substring(left, right);
trailingSpaceBefore = '';
if (isMultiline(tpl) || templateExpanderMode) {
var m = txt.substring(0, left).match(/(\S)\s*$/);
if (m && m[1] === '=') {
trailingSpaceBefore = m[0].substr(1);
}
refTagBefore = txt.substring(0, left).match(/\n<ref( [\w ]+?=[^<>]+?| *\/?)>\s*$/);
}
newLeft = left;
var index;
var isParserFunction = false;
var isMultilineTemplate = isMultiline(tpl);
if (bracketsLength === 2) {
isParserFunction = /^\{\{\s*#/.test(tpl);
index = hidden.push(prettifyTemplate());
} else {
index = hidden.push(
tpl.replace(/^\{\{\{\s*([^}|]*?)\s*(?:\|\s*([^}]*?)\s*)?\}\}\}$/, function (s, m1, m2) {
return '{{{' + m1 + (m2 === undefined ? '' : '|' + m2) + '}}}';
})
);
}
// Add "_" to the indexes of templates that should be taken into account when determining the
// makeIfMultiline variable value.
txt = txt.substring(0, newLeft) + '\x01' + (isParserFunction || isMultilineTemplate ? '_' : '') +
index + '\x02' + txt.substr(right);
leftRe.lastIndex = right - tpl.length;
}
}
//console.log(hidden);
while (txt.match(/\x01_?\d+\x02/)) {
txt = txt.replace(/\x01_?(\d+)\x02/g, function (s, num) {
return hidden[num - 1];
});
}
if (cpAutoSummary && txt !== initialTxt) {
var summaryValue = $('#wpSummary').val();
if (!/prettify code/.test(summaryValue)) {
var commaOrNot = (/[^,; \/]$/.test(summaryValue) ? ', ' : '');
var metaPrefixOrNot = location.hostname === 'meta.wikimedia.org' ? '' : 'meta:';
$('#wpSummary').val(summaryValue + commaOrNot + 'prettify code using a [[' + metaPrefixOrNot + 'User:JWBTH/CP|script]]');
}
}
}
function processAllText() {
if (templateExpanderMode && !selectionMode) {
var expandOrCollapseText = templateExpanderMode === 'expand' ? 'expand' : 'collapse';
if (!confirm('Səhifədəki bütün şablonları dəyişmək istədiyinizdən əminsinizmi? Əgər müəyyən şablonları düzəltmək istəyirsinizsə, onları seçdikdən sonra bu əməliyyatı yerinə yetirin.')) return;
}
txt = $textbox.textSelection('getContents').replace(/^\s+/, '');
prettifyTemplates();
// 2017 wikitext editor adds an empty line to the end with every text replacement. Remove
// the following block when [[phab:T198010]] is fixed.
if (window.ve && ve.init && ve.init.target && ve.init.target.active) {
r(/[\n\r]+$/, '');
}
$textbox.textSelection('setContents', txt);
if (caretPosition) {
$textbox.textSelection('setSelection', {
start: caretPosition[0] > txt.length ? txt.length : caretPosition[0]
});
}
}
$textbox.focus();
var caretPosition = $textbox.textSelection('getCaretPosition', { startAndEnd: true });
if (caretPosition) {
var textScroll = ($CodeMirrorVscrollbar.length ? $CodeMirrorVscrollbar : $textbox).scrollTop();
if (caretPosition[0] === caretPosition[1]) {
processAllText();
} else {
txt = $textbox.textSelection('getSelection');
prettifyTemplates();
$textbox
.textSelection('replaceSelection', txt)
.textSelection('setSelection', {
start: caretPosition[0],
end: caretPosition[0] + txt.length
});
}
($CodeMirrorVscrollbar.length ? $CodeMirrorVscrollbar : $textbox).scrollTop(textScroll);
// If something went wrong
} else if (confirm('The script will process ALL text on this page. Proceed?')) {
processAllText();
}
// scroll back, for 2017 wikitext editor, IE, Opera
document.documentElement.scrollTop = winScroll;
}
$.when(
mw.loader.getScript('https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-registerTool.js&action=raw&ctype=text/javascript'),
mw.loader.using(['jquery.textSelection'])
).done(function () {
if (typeof cpTemplateExpander === 'undefined') window.cpTemplateExpander = true;
if (typeof cpCodeStyler === 'undefined') window.cpCodeStyler = true;
registerTool({
name: 'cpAlignTemplateParameters',
position: 150,
title: 'Şablon parametrlərini səliqəyə sal',
label: 'Şablon parametrlərini səliqəyə sal. Bunun üçün müvafiq şablonu seçmək kifayətdir. "Ctrl+click" vasitəsilə də bunu icra etmək mümkündür.',
callback: function () {},
classic: {
icon: '//upload.wikimedia.org/wikipedia/commons/5/59/AlignTemplateParameters.js_icon.png',
addCallback: function () {
$('.tool-button[rel="cpAlignTemplateParameters"]')
.off('click')
.on('click', function (e) {
alignTemplateParameters({
askOptions: e.altKey,
hardMode: e.ctrlKey || e.metaKey,
});
e.preventDefault();
});
},
},
visual: {
icon: '//thumb.wikimedia.org/wikipedia/commons/thumb/1/14/AlignTemplateParameters.js_VE_icon.svg/20px-AlignTemplateParameters.js_VE_icon.svg.png',
modes: ['source'],
callback: alignTemplateParameters,
},
});
if (cpTemplateExpander) {
if (typeof cpSwapExpandCollapseTemplates === 'undefined') window.cpSwapExpandCollapseTemplates = false;
registerTool({
name: 'cpTemplateExpander',
position: 151,
label: !cpSwapExpandCollapseTemplates
? 'Şablon parametrlərini alt-alta göstər. Yalnız zəruri hallarda istifadə edin. "Shift+click" vasitəsilə də icra edilə bilər.'
: 'Collapse templates into a one-liner and make the spacing of their parameters consistent. Shift+click to expand',
icon: '//upload.wikimedia.org/wikipedia/commons/8/8b/AlignTemplateParameters.js_templateExpander.png',
callback: function () {},
classic: {
addCallback: function () {
$('.tool-button[rel="cpTemplateExpander"]')
.off('click')
.on('click', function (e) {
alignTemplateParameters({
askOptions: e.altKey,
templateExpanderMode: e.shiftKey === cpSwapExpandCollapseTemplates ? 'expand' : 'collapse',
});
e.preventDefault();
});
},
},
});
}
if (cpCodeStyler) {
registerTool({
name: 'cpCodeStyler',
position: 152,
label: 'Şablonlar kodlarındakı parametrləri səliqəyə sal. "Ctrl+click" vasitəsilə onları bir neçə sətirə keçirmək mümkündür.',
icon: '//upload.wikimedia.org/wikipedia/commons/6/68/AlignTemplateParameters.js_codeStyler.png',
callback: function () {},
classic: {
addCallback: function () {
$('.tool-button[rel="cpCodeStyler"]')
.off('click')
.on('click', function (e) {
alignTemplateParameters({
askOptions: e.altKey,
codeStylerMode: (e.ctrlKey || e.metaKey) ? (e.shiftKey ? 'newlines-collapse' : 'newlines') : 'spaces',
});
e.preventDefault();
});
},
},
});
}
});
}());
// </nowiki>
8jcpx7nv58m77690bdib90j0i13iznx
Kateqoriya:Məhəmmədin ailəsi
14
34139
97434
2026-11-03T06:36:09Z
Araz Yaquboglu
734
Səhifə "[[Kateqoriya:Haşimilər]] [[Kateqoriya:Məhəmmədin həyatı|ailəsi]] [[Kateqoriya:Şəxslərə görə ailələr]] [[Kateqoriya:Müsəlman dini liderlər]] [[Kateqoriya:Dövlət başçısı olan ailələr]]" məzmunu ilə yaradıldı
97434
wikitext
text/x-wiki
[[Kateqoriya:Haşimilər]]
[[Kateqoriya:Məhəmmədin həyatı|ailəsi]]
[[Kateqoriya:Şəxslərə görə ailələr]]
[[Kateqoriya:Müsəlman dini liderlər]]
[[Kateqoriya:Dövlət başçısı olan ailələr]]
o1isornnp1qj4t8wvq4zau07zq57vtq