-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathveAutocorrect-pl-extras.js
More file actions
64 lines (59 loc) · 1.67 KB
/
veAutocorrect-pl-extras.js
File metadata and controls
64 lines (59 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* NAC sequences specific for Polish Wikipedia.
*
* See also: https://github.com/Eccenux/veAutocorrect/blob/master/DEV.md#inserting-stuff-to-ve-surface
*/
mw.hook('userjs.veNuxAutocorrect.ready').add(function (nac, helpers) {
nac.add({from:'(c)', to:'©'});
const refsList = helpers.refsList();
const notesList = helpers.tpl({
target: {
href: 'Szablon:Uwagi',
wt: 'Uwagi',
},
}, true);
const blankList = helpers.list();
// helper mapping
const h2 = helpers.h2;
// extra
nac.add({start:'=zob', to:[h2('Zobacz też', true), blankList].flat()});
nac.add({start:'=zt', to:[h2('Zobacz też', true), blankList].flat()});
nac.add({start:'=u', to:[h2('Uwagi', true), notesList].flat()});
nac.add({start:'=p', to:[h2('Przypisy', true), refsList].flat()});
nac.add({start:'=b', to:[h2('Bibliografia', true), blankList].flat()});
nac.add({start:'=lz', to:[h2('Linki zewnętrzne', true), blankList].flat()});
nac.add({start:'=lnk', to:[h2('Linki zewnętrzne', true), blankList].flat()});
// '{p' -> {{Przypisy}}
/**
nac.add({
from: '{p',
to: tpl({
target: {
href: 'Szablon:Przypisy',
wt: 'Przypisy'
},
//params: {}
})
});
/**/
nac.add({
from: '{p',
to: refsList,
});
// '=z+' -> Sekcyjne comobo
nac.add({
start:'=z+',
to: [
h2('Zobacz też', true),
blankList,
h2('Uwagi', true),
notesList,
h2('Przypisy', true),
refsList,
h2('Bibliografia', true),
blankList,
h2('Linki zewnętrzne', true),
blankList,
].flat(), // Uwaga! Funkcja flat spłaszcza tablicę, czyli z tablicy tablic elementów ([[a],[b]]) robi tablicę elementów ([a,b]).
});
});