mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Merge "improve treatment of lists at start of line"
This commit is contained in:
commit
84d88b1f4e
2
resources/dist/main.js
vendored
2
resources/dist/main.js
vendored
File diff suppressed because one or more lines are too long
2
resources/dist/main.js.map.json
vendored
2
resources/dist/main.js.map.json
vendored
File diff suppressed because one or more lines are too long
|
@ -513,7 +513,7 @@ class CodeMirrorModeMediaWiki {
|
||||||
}
|
}
|
||||||
// eat &
|
// eat &
|
||||||
stream.next();
|
stream.next();
|
||||||
return this.eatHtmlEntity( stream );
|
return this.eatHtmlEntity( stream, '' );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,8 +782,9 @@ class CodeMirrorModeMediaWiki {
|
||||||
break;
|
break;
|
||||||
case '*':
|
case '*':
|
||||||
case '#':
|
case '#':
|
||||||
|
case ';':
|
||||||
// Just consume all nested list and indention syntax when there is more
|
// Just consume all nested list and indention syntax when there is more
|
||||||
stream.match( /^[*#]*:*/ );
|
stream.match( /^[*#;:]*/ );
|
||||||
return modeConfig.tags.list;
|
return modeConfig.tags.list;
|
||||||
case ':':
|
case ':':
|
||||||
// Highlight indented tables :{|, bug T108454
|
// Highlight indented tables :{|, bug T108454
|
||||||
|
@ -792,7 +793,7 @@ class CodeMirrorModeMediaWiki {
|
||||||
state.tokenize = this.eatStartTable.bind( this );
|
state.tokenize = this.eatStartTable.bind( this );
|
||||||
}
|
}
|
||||||
// Just consume all nested list and indention syntax when there is more
|
// Just consume all nested list and indention syntax when there is more
|
||||||
stream.match( /^:*[*#]*/ );
|
stream.match( /^[*#;:]*/ );
|
||||||
return modeConfig.tags.indenting;
|
return modeConfig.tags.indenting;
|
||||||
case ' ':
|
case ' ':
|
||||||
// Leading spaces is valid syntax for tables, bug T108454
|
// Leading spaces is valid syntax for tables, bug T108454
|
||||||
|
|
|
@ -88,6 +88,11 @@ const testCases = [
|
||||||
input: '* bullet A\n* bullet B\n# one\n # two',
|
input: '* bullet A\n* bullet B\n# one\n # two',
|
||||||
output: '<div class="cm-line"><span class="cm-mw-list">*</span> bullet A</div><div class="cm-line"><span class="cm-mw-list">*</span> bullet B</div><div class="cm-line"><span class="cm-mw-list">#</span> one</div><div class="cm-line"><span class="cm-mw-skipformatting"> </span># two</div>'
|
output: '<div class="cm-line"><span class="cm-mw-list">*</span> bullet A</div><div class="cm-line"><span class="cm-mw-list">*</span> bullet B</div><div class="cm-line"><span class="cm-mw-list">#</span> one</div><div class="cm-line"><span class="cm-mw-skipformatting"> </span># two</div>'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'nested ordered, unordered and definition lists',
|
||||||
|
input: '*#;: item A\n#;:* item B\n;:*# item C\n:*#; item D',
|
||||||
|
output: '<div class="cm-line"><span class="cm-mw-list">*#;:</span> item A</div><div class="cm-line"><span class="cm-mw-list">#;:*</span> item B</div><div class="cm-line"><span class="cm-mw-list">;:*#</span> item C</div><div class="cm-line"><span class="cm-mw-indenting">:*#;</span> item D</div>'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'link with bold text',
|
title: 'link with bold text',
|
||||||
input: '[[Link title|\'\'\'bold link\'\'\']]',
|
input: '[[Link title|\'\'\'bold link\'\'\']]',
|
||||||
|
|
Loading…
Reference in a new issue