Skip to content

Commit 37d84f3

Browse files
committed
Add mediawiki mode
1 parent 2d611a0 commit 37d84f3

File tree

9 files changed

+917
-0
lines changed

9 files changed

+917
-0
lines changed

mode/mediawiki/README.salvus

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This is from https://github.com/wikimedia/mediawiki-extensions-CodeMirror
2+
3+
1. However, note I fixed a bug in their code:
4+
5+
@@ -684,7 +684,7 @@ CodeMirror.defineMode( 'mediawiki', function( config/*, parserConfig */ ) {
6+
var tagname = stream.match( /[^>\/\s\u00a0\.\*\,\[\]\{\}\$\^\+\?\|\/\\'`~<=!@#%&\(\)-]+/ );
7+
if ( tagname ) {
8+
tagname = tagname[0].toLowerCase();
9+
- if ( tagname in config.mwextTags ) { // Parser function
10+
+ if ( config.mwextTags && tagname in config.mwextTags ) { // Parser function
11+
if ( isCloseTag === true ) {
12+
// @todo message
13+
return 'error';
14+
15+
16+
2. Note the comment about "evil BS" in the css file.

mode/mediawiki/img/black4.png

87 Bytes
Loading

mode/mediawiki/img/ext2.png

86 Bytes
Loading

mode/mediawiki/img/ext4.png

86 Bytes
Loading

mode/mediawiki/img/link4.png

86 Bytes
Loading

mode/mediawiki/img/template4.png

86 Bytes
Loading

mode/mediawiki/img/template8.png

86 Bytes
Loading

mode/mediawiki/mediawiki.css

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/* WTF: What kind of evil BS is this?! -- commented out.
2+
3+
.CodeMirror {
4+
border: 1px solid #CCC;
5+
font-size: medium;
6+
line-height: 1.5em;
7+
}
8+
9+
.CodeMirrorIE {
10+
font-size: small;
11+
}
12+
*/
13+
14+
.cm-mw-pagename { text-decoration: underline; }
15+
16+
.cm-mw-matching {background-color: gold;}
17+
18+
.cm-mw-skipformatting { background-color: #adf; }
19+
.cm-mw-list {color: #08f; font-weight: bold; background-color: #eee;}
20+
.cm-mw-signature,
21+
.cm-mw-hr { color: #08f; font-weight: bold; background-color: #eee; }
22+
.cm-mw-indenting {color: #08f; font-weight: bold; background-color: #ddd;}
23+
.cm-mw-mnemonic {color: #090;}
24+
.cm-mw-comment {color: #aaa; font-weight: normal;}
25+
.cm-mw-apostrophes {color: #08f;}
26+
27+
pre.cm-mw-section-1 {font-weight: bold;}
28+
pre.cm-mw-section-2 {font-weight: bold;}
29+
pre.cm-mw-section-3 {font-weight: bold;}
30+
pre.cm-mw-section-4 {font-weight: bold;}
31+
pre.cm-mw-section-5 {font-weight: bold;}
32+
pre.cm-mw-section-6 {font-weight: bold;}
33+
.cm-mw-section-header {color: #08f; font-weight: normal;}
34+
35+
.cm-mw-template {color: #a11; font-weight: normal;}
36+
.cm-mw-template-name {color: #a11; font-weight: bold;}
37+
.cm-mw-template-name-mnemonic {font-weight: normal;}
38+
.cm-mw-template-argument-name {color: #a11; font-weight: bold;}
39+
.cm-mw-template-delimiter {color: #a11; font-weight: bold;}
40+
.cm-mw-template-bracket {color: #a11; font-weight: bold;}
41+
42+
.cm-mw-templatevariable {color: #f50; font-weight: normal;}
43+
.cm-mw-templatevariable-name {color: #f50; font-weight: bold;}
44+
.cm-mw-templatevariable-bracket {color: #f50; font-weight: normal;}
45+
.cm-mw-templatevariable-delimiter {color: #f50; font-weight: bold;}
46+
47+
.cm-mw-parserfunction {font-weight: normal;}
48+
.cm-mw-parserfunction-name {color: #70a; font-weight: bold;}
49+
.cm-mw-parserfunction-bracket {color: #70a; font-weight: bold;}
50+
.cm-mw-parserfunction-delimiter {color: #70a; font-weight: bold;}
51+
52+
pre.cm-mw-exttag {background-image: url(img/ext2.png);}
53+
.cm-mw-exttag {background-image: url(img/ext4.png);}
54+
.cm-mw-exttag-name {color: #70a; font-weight: bold;}
55+
.cm-mw-exttag-bracket {color: #70a; font-weight: normal;}
56+
.cm-mw-exttag-attribute {color: #70a; font-weight: normal;}
57+
58+
.cm-mw-htmltag-name {color: #170; font-weight: bold;}
59+
.cm-mw-htmltag-bracket {color: #170; font-weight: normal;}
60+
.cm-mw-htmltag-attribute {color: #170; font-weight: normal;}
61+
62+
pre.cm-mw-tag-pre, .cm-mw-tag-pre {background-image: url(img/black4.png);}
63+
pre.cm-mw-tag-nowiki, .cm-mw-tag-nowiki {background-image: url(img/black4.png);}
64+
65+
.cm-mw-link-pagename {color: #219; font-weight: normal;}
66+
.cm-mw-link-tosection {color: #08f; font-weight: normal;}
67+
.cm-mw-link-bracket {color: #219; font-weight: normal;}
68+
.cm-mw-link-text {}
69+
.cm-mw-link-delimiter {color: #219; font-weight: normal;}
70+
71+
.cm-mw-extlink {color: #219; font-weight: normal;}
72+
.cm-mw-extlink-protocol {color: #219; font-weight: bold;}
73+
.cm-mw-extlink-text {}
74+
.cm-mw-extlink-bracket {color: #219; font-weight: bold;}
75+
76+
.cm-mw-table-bracket {color: #e0e; font-weight: bold;}
77+
.cm-mw-table-delimiter {color: #e0e; font-weight: bold;}
78+
.cm-mw-table-definition {color: #e0e; font-weight: normal;}
79+
80+
.cm-mw-template-ground {}
81+
.cm-mw-template2-ground {background-image: url(img/template4.png);}
82+
.cm-mw-template3-ground {background-image: url(img/template8.png);}
83+
.cm-mw-template-ext-ground {background-image: url(img/ext4.png);}
84+
.cm-mw-template-ext2-ground {background-image: url(img/ext4.png),url(img/ext4.png);}
85+
.cm-mw-template-ext3-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);}
86+
.cm-mw-template-link-ground {background-image: url(img/link4.png);}
87+
.cm-mw-template-ext-link-ground {background-image: url(img/ext4.png),url(img/link4.png);}
88+
.cm-mw-template-ext2-link-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
89+
.cm-mw-template-ext3-link-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
90+
.cm-mw-template2-ext-ground {background-image: url(img/template4.png),url(img/ext4.png);}
91+
.cm-mw-template2-ext2-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png);}
92+
.cm-mw-template2-ext3-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);}
93+
.cm-mw-template2-link-ground {background-image: url(img/template4.png),url(img/link4.png);}
94+
.cm-mw-template2-ext-link-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/link4.png);}
95+
.cm-mw-template2-ext2-link-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
96+
.cm-mw-template2-ext3-link-ground {background-image: url(img/template4.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
97+
.cm-mw-template3-ext-ground {background-image: url(img/template8.png),url(img/ext4.png);}
98+
.cm-mw-template3-ext2-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png);}
99+
.cm-mw-template3-ext3-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);}
100+
.cm-mw-template3-link-ground {background-image: url(img/template8.png),url(img/link4.png);}
101+
.cm-mw-template3-ext-link-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/link4.png);}
102+
.cm-mw-template3-ext2-link-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
103+
.cm-mw-template3-ext3-link-ground {background-image: url(img/template8.png),url(img/ext4.png),url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
104+
.cm-mw-ext-ground {background-image: url(img/ext4.png)}
105+
.cm-mw-ext2-ground {background-image: url(img/ext4.png),url(img/ext4.png);}
106+
.cm-mw-ext3-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/ext4.png);}
107+
.cm-mw-ext-link-ground {background-image: url(img/link4.png);}
108+
.cm-mw-ext2-link-ground {background-image: url(img/ext4.png),url(img/link4.png);}
109+
.cm-mw-ext3-link-ground {background-image: url(img/ext4.png),url(img/ext4.png),url(img/link4.png);}
110+
.cm-mw-link-ground {background-image: url(img/link4.png);}

0 commit comments

Comments
 (0)