List of pre-formatted line support. Real image conversion to figure support.

This commit is contained in:
Ian Gulliver
2014-07-02 09:57:45 -07:00
parent fc5dc49e72
commit d37ef27e8a
3 changed files with 66 additions and 11 deletions

13
test.js
View File

@@ -34,7 +34,8 @@ QUnit.test('Base', function(assert) {
': But blockquotes are easy',
':: Even larger ones',
'::::: And really huge ones',
' This line is pre-formatted and <del>not interpolated</del>'
' This line is pre-formatted and <del>not interpolated</del>',
' This line is also pre-formatted'
].join('\n');
var expected = [
@@ -55,8 +56,8 @@ QUnit.test('Base', function(assert) {
"<def>I don't really understand what a definition is</def><blockquote>",
'But blockquotes are easy</blockquote><blockquote2>Even larger ones',
'</blockquote2><blockquote5>And really huge ones</blockquote5><pre>This ',
'line is pre-formatted and &lt;del&gt;not interpolated&lt;/del&gt;',
'</pre></p>'
'line is pre-formatted and &lt;del&gt;not interpolated&lt;/del&gt;\nThis ',
'line is also pre-formatted\n</pre></p>'
].join('');
assert.equal(mediawiki.parseFromString(content).innerHTML, expected);
@@ -91,15 +92,15 @@ QUnit.test('Link', function(assert) {
assert.equal(mediawiki.parseFromString(content).innerHTML, expected);
});
QUnit.test('Image', function(assert) {
QUnit.test('Figure', function(assert) {
assert.expect(1);
var content = [
"[[File:http://www.example.com/foo|Test image ''with formatting'']]"
].join('\n');
var expected = [
'<p><imgtemp><src>http://www.example.com/foo</src>',
'<caption>Test image <i>with formatting</i></caption></imgtemp></p>'
'<p><figure><img src=\"http://www.example.com/foo\"><figcaption>Test ',
'image <i>with formatting</i></figcaption></figure></p>'
].join('');
assert.equal(mediawiki.parseFromString(content).innerHTML, expected);