import { StreamParser } from '@codemirror/language';
import { Tag } from '@lezer/highlight';
import CodeMirror from '../../src/codemirror.js';
import mediaWikiLang from '../../src/codemirror.mode.mediawiki.js';
import { mwModeConfig } from '../../src/codemirror.mode.mediawiki.config.js';
// NOTE: each test case should have a space before the closing
// This is to avoid interactive UI components from showing up in the test output.
const testCases = [
{
title: 'p tags, extra closing tag',
input: 'this is
content',
output: '
this is <p><div>content</p></p>
'
},
{
title: 'HTML tag attributes',
input: '
',
output: '
<span title="a<b"><b title="a>b"></b></span>
'
},
{
title: 'ref tag attributes',
input: '
',
output: '
<ref name="a<b"/>
'
},
{
title: 'indented table with caption and inline headings',
input: ' ::{| class="wikitable"\n |+ Caption\n |-\n ! Uno !! Dos\n |-\n | Foo || Bar\n |}',
output: '
::{| class="wikitable"
|+ Caption
|-
! Uno !! Dos
|-
| Foo || Bar
|}
'
},
{
title: 'apostrophe before italic',
input: 'plain l\'\'\'italic\'\'plain',
output: '
plain l\'\'\'italic\'\'plain
'
},
{
title: 'free external links',
input: 'https://wikimedia.org [ftp://foo.bar FOO] //archive.org',
output: '
https://wikimedia.org [ftp://foo.bar FOO] //archive.org
'
},
{
title: 'not free external links',
input: 'news: foo news:bar [news: baz]',
output: '
news: foo news:bar [news: baz]
'
},
{
title: 'void tags',
input: 'a
bc a
b
c
d',
output: '
a<br>b</br>c a<div>b<br>c</div>d
'
},
{
title: 'magic words',
input: '__NOTOC__',
output: '
__NOTOC__
'
},
{
title: 'nowiki',
input: '
{{foo}}
{{{\n