mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
c670344851
This is more or less a exact port of the old stream parser, with the big notable change being that all configuration-related code lives in a separate class, CodeMirrorModeMediaWikiConfig. A smaller change is that closing HTML tags that are marked as errors now have the ending '>' character highlighted red, when it didn't before. Integration with other extensions and modes is saved for a future patch (T348684). This means <nowiki>, <ref> and other extension-supplied markup is not yet highlighted. The entry point for WikiEditor integration is now at ext.CodeMirror.v6.WikiEditor.init.js, which needs to first require the virtual file set via the DataScript (PHP) class. This can't be integrated into the CM6 code because it needs to be precompiled before ResourceLoader can use it (T281781). Known issues, to be addressed separately: * No support for TagModes / PluginModes (T348684) * Identical adjacent tokens produce excess markup (T352917) * Section headings do not have line-level styling (T351686) Bug: T348019 Change-Id: I8f8a81f362bed60dea14ecde9487a2b0c89225e8
167 lines
6 KiB
Plaintext
167 lines
6 KiB
Plaintext
@comment-color: #72777d;
|
|
@error-color: #f00;
|
|
@link-color: #000aaa;
|
|
@parser-function-color: #d33;
|
|
@table-color: #d08;
|
|
@template-color: #80c;
|
|
@template-variable-color: #ac6600;
|
|
@wikitext-formatting-color: #0076dd;
|
|
@xml-tag-color: #14866d;
|
|
|
|
@template-background-color: #a11;
|
|
@ext-background-color: #70a;
|
|
@link-background-color: #219;
|
|
|
|
.ground( @template: 0, @ext: 0, @link: 0 ) {
|
|
@template-shade: fade( @template-background-color, 4% * @template );
|
|
@ext-shade: fade( @ext-background-color, 4% * @ext );
|
|
@link-shade: fade( @link-background-color, 4% * @link );
|
|
background-color: average( average( @template-shade, @ext-shade ), @link-shade );
|
|
}
|
|
|
|
/* stylelint-disable
|
|
declaration-block-single-line-max-declarations,
|
|
stylistic/block-closing-brace-space-after,
|
|
stylistic/block-opening-brace-newline-after,
|
|
stylistic/block-opening-brace-newline-before,
|
|
stylistic/declaration-block-semicolon-newline-after,
|
|
stylistic/selector-list-comma-newline-after
|
|
*/
|
|
|
|
.cm-mw-pagename { text-decoration: underline; }
|
|
|
|
// TODO: It appears like this was never used. Remove?
|
|
.cm-mw-matching { background-color: #ffd700; }
|
|
|
|
.cm-mw-skipformatting { background-color: #adf; }
|
|
.cm-mw-list,
|
|
.cm-mw-indenting { color: @wikitext-formatting-color; font-weight: bold; }
|
|
// FIXME: Remove camelCase variant after CM6 upgrade is complete (also check Global Search)
|
|
.cm-mw-doubleUnderscore,
|
|
.cm-mw-double-underscore,
|
|
.cm-mw-signature, .cm-mw-hr { color: @wikitext-formatting-color; font-weight: bold; background-color: #eee; }
|
|
.cm-mw-mnemonic { color: @xml-tag-color; }
|
|
.cm-mw-comment { color: @comment-color; font-weight: normal; }
|
|
.cm-mw-apostrophes-bold, .cm-mw-apostrophes-italic { color: @wikitext-formatting-color; }
|
|
.cm-mw-strong { font-weight: bold; }
|
|
|
|
// FIXME: Remove .CodeMirror-line rules after CM6 upgrade
|
|
pre.CodeMirror-line.cm-mw-section-1,
|
|
pre.CodeMirror-line-like.cm-mw-section-1 {
|
|
font-size: 1.8em;
|
|
line-height: 1.2em;
|
|
}
|
|
pre.CodeMirror-line.cm-mw-section-2,
|
|
pre.CodeMirror-line-like.cm-mw-section-2 {
|
|
font-size: 1.5em;
|
|
line-height: 1.2em;
|
|
}
|
|
pre.CodeMirror-line.cm-mw-section-3,
|
|
pre.CodeMirror-line-like.cm-mw-section-3,
|
|
pre.CodeMirror-line.cm-mw-section-4,
|
|
pre.CodeMirror-line-like.cm-mw-section-4,
|
|
pre.CodeMirror-line.cm-mw-section-5,
|
|
pre.CodeMirror-line-like.cm-mw-section-5,
|
|
pre.CodeMirror-line.cm-mw-section-6,
|
|
pre.CodeMirror-line-like.cm-mw-section-6 {
|
|
font-weight: bold;
|
|
}
|
|
|
|
.cm-mw-template { color: @template-color; font-weight: normal; }
|
|
.cm-mw-template-name-mnemonic { font-weight: normal; }
|
|
.cm-mw-template-name,
|
|
.cm-mw-template-argument-name,
|
|
.cm-mw-template-delimiter,
|
|
.cm-mw-template-bracket { color: @template-color; font-weight: bold; }
|
|
|
|
.cm-mw-templatevariable,
|
|
.cm-mw-templatevariable-bracket { color: @template-variable-color; font-weight: normal; }
|
|
.cm-mw-templatevariable-name,
|
|
.cm-mw-templatevariable-delimiter { color: @template-variable-color; font-weight: bold; }
|
|
|
|
.cm-mw-parserfunction { font-weight: normal; }
|
|
.cm-mw-parserfunction-name,
|
|
.cm-mw-parserfunction-bracket,
|
|
.cm-mw-parserfunction-delimiter { color: @parser-function-color; font-weight: bold; }
|
|
|
|
pre.CodeMirror-line.cm-mw-exttag,
|
|
pre.CodeMirror-line-like.cm-mw-exttag {
|
|
.ground( @ext: 0.5 );
|
|
}
|
|
.cm-mw-exttag { .ground( @ext: 1 ); }
|
|
.cm-mw-exttag-name,
|
|
.cm-mw-htmltag-name { color: @xml-tag-color; font-weight: bold; }
|
|
.cm-mw-exttag-bracket,
|
|
.cm-mw-exttag-attribute,
|
|
.cm-mw-htmltag-bracket,
|
|
.cm-mw-htmltag-attribute { color: @xml-tag-color; font-weight: normal; }
|
|
|
|
pre.CodeMirror-line.cm-mw-tag-pre,
|
|
pre.CodeMirror-line-like.cm-mw-tag-pre,
|
|
.cm-mw-tag-pre,
|
|
pre.CodeMirror-line.cm-mw-tag-nowiki,
|
|
pre.CodeMirror-line-like.cm-mw-tag-nowiki,
|
|
.cm-mw-tag-nowiki {
|
|
background-color: rgba( 0, 0, 0, 0.04 );
|
|
}
|
|
|
|
.cm-mw-link,
|
|
.cm-mw-link-tosection,
|
|
.cm-mw-section-header { color: @wikitext-formatting-color; font-weight: normal; }
|
|
.cm-mw-link-pagename,
|
|
.cm-mw-link-bracket,
|
|
.cm-mw-link-delimiter,
|
|
.cm-mw-extlink,
|
|
.cm-mw-free-extlink { color: @link-color; font-weight: normal; }
|
|
.cm-mw-extlink-protocol,
|
|
.cm-mw-free-extlink-protocol,
|
|
.cm-mw-extlink-bracket { color: @link-color; font-weight: bold; }
|
|
|
|
.cm-mw-table-bracket,
|
|
.cm-mw-table-delimiter { color: @table-color; font-weight: bold; }
|
|
.cm-mw-table-definition { color: @table-color; font-weight: normal; }
|
|
.cm-mw-table-caption { font-weight: bold; }
|
|
|
|
.cm-mw-template2-ground { .ground( @template: 1 ); }
|
|
.cm-mw-template3-ground { .ground( @template: 2 ); }
|
|
.cm-mw-ext-ground,
|
|
.cm-mw-template-ext-ground { .ground( @ext: 1 ); }
|
|
.cm-mw-ext2-ground,
|
|
.cm-mw-template-ext2-ground { .ground( @ext: 2 ); }
|
|
.cm-mw-ext3-ground,
|
|
.cm-mw-template-ext3-ground { .ground( @ext: 3 ); }
|
|
.cm-mw-link-ground,
|
|
.cm-mw-ext-link-ground,
|
|
.cm-mw-template-link-ground { .ground( @link: 1 ); }
|
|
.cm-mw-ext2-link-ground,
|
|
.cm-mw-template-ext-link-ground { .ground( @ext: 1, @link: 1 ); }
|
|
.cm-mw-ext3-link-ground,
|
|
.cm-mw-template-ext2-link-ground { .ground( @ext: 2, @link: 1 ); }
|
|
.cm-mw-template-ext3-link-ground { .ground( @ext: 3, @link: 1 ); }
|
|
|
|
.cm-mw-template2-ext-ground { .ground( @template: 1, @ext: 1 ); }
|
|
.cm-mw-template2-ext2-ground { .ground( @template: 1, @ext: 2 ); }
|
|
.cm-mw-template2-ext3-ground { .ground( @template: 1, @ext: 3 ); }
|
|
.cm-mw-template2-link-ground { .ground( @template: 1, @link: 1 ); }
|
|
.cm-mw-template2-ext-link-ground { .ground( @template: 1, @ext: 1, @link: 1 ); }
|
|
.cm-mw-template2-ext2-link-ground { .ground( @template: 1, @ext: 2, @link: 1 ); }
|
|
.cm-mw-template2-ext3-link-ground { .ground( @template: 1, @ext: 3, @link: 1 ); }
|
|
|
|
.cm-mw-template3-ext-ground { .ground( @template: 2, @ext: 1 ); }
|
|
.cm-mw-template3-ext2-ground { .ground( @template: 2, @ext: 2 ); }
|
|
.cm-mw-template3-ext3-ground { .ground( @template: 2, @ext: 3 ); }
|
|
.cm-mw-template3-link-ground { .ground( @template: 2, @link: 1 ); }
|
|
.cm-mw-template3-ext-link-ground { .ground( @template: 2, @ext: 1, @link: 1 ); }
|
|
.cm-mw-template3-ext2-link-ground { .ground( @template: 2, @ext: 2, @link: 1 ); }
|
|
.cm-mw-template3-ext3-link-ground { .ground( @template: 2, @ext: 3, @link: 1 ); }
|
|
|
|
.cm-mw-error { color: @error-color; }
|
|
|
|
.cm-mw-em { font-style: italic; }
|
|
|
|
.cm-mw-matchingbracket {
|
|
background-color: #eee;
|
|
box-shadow: inset 0 0 1px 1px #999;
|
|
font-weight: bold;
|
|
}
|