mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +00:00
improve treatment of lists at start of line
In the parser, '*', '#', ';' and ':' can actually become nested lists (<ul>, <ol>, <dt> and <dd>) in any possible combinations. This patch does not yet support the `; dt : dd` syntax. This patch also fixes the 'Unknown highlighting tag undefined' warning. Bug: T184272 Bug: T170042 Change-Id: I13cc55fadbc9b03fd7c70eab123f7e378d52898d
This commit is contained in:
parent
1a038072b4
commit
b4e762bd99
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 &
|
||||
stream.next();
|
||||
return this.eatHtmlEntity( stream );
|
||||
return this.eatHtmlEntity( stream, '' );
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -782,8 +782,9 @@ class CodeMirrorModeMediaWiki {
|
|||
break;
|
||||
case '*':
|
||||
case '#':
|
||||
case ';':
|
||||
// Just consume all nested list and indention syntax when there is more
|
||||
stream.match( /^[*#]*:*/ );
|
||||
stream.match( /^[*#;:]*/ );
|
||||
return modeConfig.tags.list;
|
||||
case ':':
|
||||
// Highlight indented tables :{|, bug T108454
|
||||
|
@ -792,7 +793,7 @@ class CodeMirrorModeMediaWiki {
|
|||
state.tokenize = this.eatStartTable.bind( this );
|
||||
}
|
||||
// Just consume all nested list and indention syntax when there is more
|
||||
stream.match( /^:*[*#]*/ );
|
||||
stream.match( /^[*#;:]*/ );
|
||||
return modeConfig.tags.indenting;
|
||||
case ' ':
|
||||
// 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',
|
||||
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',
|
||||
input: '[[Link title|\'\'\'bold link\'\'\']]',
|
||||
|
|
Loading…
Reference in a new issue