Merge "improve treatment of lists at start of line"

This commit is contained in:
jenkins-bot 2024-01-19 00:42:52 +00:00 committed by Gerrit Code Review
commit 84d88b1f4e
4 changed files with 11 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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

View file

@ -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\'\'\']]',