mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-03-20 10:26:57 +00:00
lint: single quote -> double
This commit is contained in:
parent
9b46d7153a
commit
f4d7095a33
@ -11,7 +11,7 @@ Tests the backlinks mechanism.
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
describe('Backlinks tests', function() {
|
||||
describe("Backlinks tests", function() {
|
||||
function setupWiki(wikiOptions) {
|
||||
wikiOptions = wikiOptions || {};
|
||||
// Create a wiki
|
||||
@ -19,34 +19,35 @@ describe('Backlinks tests', function() {
|
||||
wiki.addIndexersToWiki();
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestIncoming',
|
||||
text: '',
|
||||
title: "TestIncoming",
|
||||
text: "",
|
||||
});
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing',
|
||||
text: 'A link to [[TestIncoming]]',
|
||||
title: "TestOutgoing",
|
||||
text: "A link to [[TestIncoming]]",
|
||||
});
|
||||
return wiki;
|
||||
}
|
||||
|
||||
describe('a tiddler with no links to it', function() {
|
||||
describe("a tiddler with no links to it", function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestIncoming',
|
||||
text: ''});
|
||||
title: "TestIncoming",
|
||||
text: ""});
|
||||
|
||||
it('should have no backlinks', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('');
|
||||
it("should have no backlinks", function() {
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler added to the wiki with a link to it', function() {
|
||||
describe("A tiddler added to the wiki with a link to it", function() {
|
||||
var wiki = setupWiki();
|
||||
|
||||
it('should have a backlink', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestOutgoing');
|
||||
it("should have a backlink", function() {
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestOutgoing");
|
||||
});
|
||||
|
||||
it("should have a backlink to block mark", function() {
|
||||
wiki.addTiddler({
|
||||
@ -61,94 +62,94 @@ describe('Backlinks tests', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler that has a link added to it later', function() {
|
||||
it('should have an additional backlink', function() {
|
||||
describe("A tiddler that has a link added to it later", function() {
|
||||
it("should have an additional backlink", function() {
|
||||
var wiki = setupWiki();
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing2',
|
||||
text: 'Nothing yet!'});
|
||||
title: "TestOutgoing2",
|
||||
text: "Nothing yet!"});
|
||||
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestOutgoing');
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestOutgoing");
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing2',
|
||||
text: 'Updated with link to [[TestIncoming]]'});
|
||||
title: "TestOutgoing2",
|
||||
text: "Updated with link to [[TestIncoming]]"});
|
||||
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestOutgoing,TestOutgoing2');
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestOutgoing,TestOutgoing2");
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler that has a link remove from it later', function() {
|
||||
describe("A tiddler that has a link remove from it later", function() {
|
||||
var wiki = setupWiki();
|
||||
|
||||
it('should have one fewer backlink', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestOutgoing');
|
||||
it("should have one fewer backlink", function() {
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestOutgoing");
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing',
|
||||
text: 'No link to ~TestIncoming'});
|
||||
title: "TestOutgoing",
|
||||
text: "No link to ~TestIncoming"});
|
||||
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('');
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler linking to another that gets renamed', function() {
|
||||
describe("A tiddler linking to another that gets renamed", function() {
|
||||
var wiki = setupWiki();
|
||||
|
||||
it('should have its name changed in the backlinks', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestOutgoing');
|
||||
it("should have its name changed in the backlinks", function() {
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestOutgoing");
|
||||
|
||||
wiki.renameTiddler('TestOutgoing', 'TestExtroverted');
|
||||
wiki.renameTiddler("TestOutgoing", "TestExtroverted");
|
||||
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestExtroverted');
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestExtroverted");
|
||||
});
|
||||
});
|
||||
|
||||
describe('A tiddler linking to another that gets deleted', function() {
|
||||
describe("A tiddler linking to another that gets deleted", function() {
|
||||
var wiki = setupWiki();
|
||||
|
||||
it('should be removed from backlinks', function() {
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('TestOutgoing');
|
||||
it("should be removed from backlinks", function() {
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("TestOutgoing");
|
||||
|
||||
wiki.deleteTiddler('TestOutgoing');
|
||||
wiki.deleteTiddler("TestOutgoing");
|
||||
|
||||
expect(wiki.filterTiddlers('TestIncoming +[backlinks[]]').join(',')).toBe('');
|
||||
expect(wiki.filterTiddlers("TestIncoming +[backlinks[]]").join(",")).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe('Binary tiddlers should not be parsed', function() {
|
||||
describe("Binary tiddlers should not be parsed", function() {
|
||||
var wiki = setupWiki();
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestDoc.doc',
|
||||
text: 'A link to [[TestOutgoing]]',
|
||||
type: 'application/msword'
|
||||
title: "TestDoc.doc",
|
||||
text: "A link to [[TestOutgoing]]",
|
||||
type: "application/msword"
|
||||
});
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestExcel.xls',
|
||||
text: 'A link to [[TestOutgoing]]',
|
||||
type: 'application/excel'
|
||||
title: "TestExcel.xls",
|
||||
text: "A link to [[TestOutgoing]]",
|
||||
type: "application/excel"
|
||||
});
|
||||
|
||||
wiki.addTiddler({
|
||||
title: 'TestOutgoing',
|
||||
text: 'Some links to [[TestDoc.doc]] and [[TestExcel.xls]].'
|
||||
title: "TestOutgoing",
|
||||
text: "Some links to [[TestDoc.doc]] and [[TestExcel.xls]]."
|
||||
});
|
||||
|
||||
it('should ignore office files', function() {
|
||||
expect(wiki.getIndexer("BackIndexer").subIndexers.link._getTarget(wiki.getTiddler('TestExcel.xls'))).toEqual([]);
|
||||
it("should ignore office files", function() {
|
||||
expect(wiki.getIndexer("BackIndexer").subIndexers.link._getTarget(wiki.getTiddler("TestExcel.xls"))).toEqual([]);
|
||||
|
||||
expect(wiki.filterTiddlers('[all[]] +[backlinks[]]').join(',')).toBe('TestOutgoing');
|
||||
expect(wiki.filterTiddlers("[all[]] +[backlinks[]]").join(",")).toBe("TestOutgoing");
|
||||
|
||||
// make it tw5 tiddler
|
||||
wiki.addTiddler({
|
||||
title: 'TestExcel.xls',
|
||||
text: 'A link to [[TestOutgoing]]'
|
||||
title: "TestExcel.xls",
|
||||
text: "A link to [[TestOutgoing]]"
|
||||
});
|
||||
|
||||
expect(wiki.filterTiddlers('[all[]] +[backlinks[]]').join(',')).toBe('TestOutgoing,TestExcel.xls');
|
||||
expect(wiki.filterTiddlers("[all[]] +[backlinks[]]").join(",")).toBe("TestOutgoing,TestExcel.xls");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -26,87 +26,87 @@ describe("WikiText parser tests", function() {
|
||||
it("should parse tags", function() {
|
||||
expect(parse("<br>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 4, children : [ { type : 'element', tag : 'br', start : 0, end : 4, openTagStart: 0, openTagEnd: 4, rule: 'html', isBlock : false, attributes : { }, orderedAttributes: [ ] } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 4, children : [ { type : "element", tag : "br", start : 0, end : 4, openTagStart: 0, openTagEnd: 4, rule: "html", isBlock : false, attributes : { }, orderedAttributes: [ ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("</br>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 5, children : [ { type : 'text', text : '</br>', start : 0, end : 5 } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 5, children : [ { type : "text", text : "</br>", start : 0, end : 5 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 5, children : [ { type : 'element', tag : 'div', start : 0, end : 5, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 5, rule: 'html', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ] } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 5, children : [ { type : "element", tag : "div", start : 0, end : 5, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 5, rule: "html", isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div/>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 6, children : [ { type : 'element', tag : 'div', isSelfClosing : true, isBlock : false, attributes : { }, orderedAttributes: [ ], start : 0, end : 6, rule: 'html' } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 6, children : [ { type : "element", tag : "div", isSelfClosing : true, isBlock : false, attributes : { }, orderedAttributes: [ ], start : 0, end : 6, rule: "html" } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 11, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ], start : 0, end : 11, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 11, rule: 'html' } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 11, children : [ { type : "element", tag : "div", isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ ], start : 0, end : 11, openTagStart: 0, openTagEnd: 5, closeTagStart: 5, closeTagEnd: 11, rule: "html" } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div>some text</div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 20, children : [ { type : 'element', tag : 'div', openTagStart: 0, openTagEnd: 5, closeTagStart: 14, closeTagEnd: 20, rule: 'html', isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ { type : 'text', text : 'some text', start : 5, end : 14 } ], start : 0, end : 20 } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 20, children : [ { type : "element", tag : "div", openTagStart: 0, openTagEnd: 5, closeTagStart: 14, closeTagEnd: 20, rule: "html", isBlock : false, attributes : { }, orderedAttributes: [ ], children : [ { type : "text", text : "some text", start : 5, end : 14 } ], start : 0, end : 20 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute>some text</div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 30, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { attribute : { type : 'string', value : 'true', start : 4, end : 14, name: 'attribute' } }, orderedAttributes: [ { type : 'string', value : 'true', start : 4, end : 14, name: 'attribute' } ], children : [ { type : 'text', text : 'some text', start : 15, end : 24 } ], start : 0, end : 30, openTagStart: 0, openTagEnd: 15, closeTagStart: 24, closeTagEnd: 30, rule: 'html' } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 30, children : [ { type : "element", tag : "div", isBlock : false, attributes : { attribute : { type : "string", value : "true", start : 4, end : 14, name: "attribute" } }, orderedAttributes: [ { type : "string", value : "true", start : 4, end : 14, name: "attribute" } ], children : [ { type : "text", text : "some text", start : 15, end : 24 } ], start : 0, end : 30, openTagStart: 0, openTagEnd: 15, closeTagStart: 24, closeTagEnd: 30, rule: "html" } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute='value'>some text</div>")).toEqual(
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 38, children : [ { type : 'element', tag : 'div', openTagStart: 0, openTagEnd: 23, closeTagStart: 32, closeTagEnd: 38, rule: 'html', isBlock : false, attributes : { attribute : { type : 'string', name: 'attribute', value : 'value', start: 4, end: 22 } }, orderedAttributes: [ { type: 'string', name: 'attribute', value : 'value', start: 4, end: 22 } ], children : [ { type : 'text', text : 'some text', start : 23, end : 32 } ], start : 0, end : 38 } ] } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 38, children : [ { type : "element", tag : "div", openTagStart: 0, openTagEnd: 23, closeTagStart: 32, closeTagEnd: 38, rule: "html", isBlock : false, attributes : { attribute : { type : "string", name: "attribute", value : "value", start: 4, end: 22 } }, orderedAttributes: [ { type: "string", name: "attribute", value : "value", start: 4, end: 22 } ], children : [ { type : "text", text : "some text", start : 23, end : 32 } ], start : 0, end : 38 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute={{TiddlerTitle}}>some text</div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 47, children : [ { type : 'element', tag : 'div', isBlock : false, attributes : { attribute : { type : 'indirect', name: 'attribute', textReference : 'TiddlerTitle', start : 4, end : 31 } }, orderedAttributes: [ { type : 'indirect', name: 'attribute', textReference : 'TiddlerTitle', start : 4, end : 31 } ], children : [ { type : 'text', text : 'some text', start : 32, end : 41 } ], start : 0, end : 47, openTagStart: 0, openTagEnd: 32, closeTagStart: 41, closeTagEnd: 47, rule: 'html' } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 47, children : [ { type : "element", tag : "div", isBlock : false, attributes : { attribute : { type : "indirect", name: "attribute", textReference : "TiddlerTitle", start : 4, end : 31 } }, orderedAttributes: [ { type : "indirect", name: "attribute", textReference : "TiddlerTitle", start : 4, end : 31 } ], children : [ { type : "text", text : "some text", start : 32, end : 41 } ], start : 0, end : 47, openTagStart: 0, openTagEnd: 32, closeTagStart: 41, closeTagEnd: 47, rule: "html" } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<$reveal state='$:/temp/search' type='nomatch' text=''>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 55, children : [ { type : 'reveal', tag: '$reveal', rule: 'html', attributes : { state : { start : 8, name : 'state', type : 'string', value : '$:/temp/search', end : 31 }, type : { start : 31, name : 'type', type : 'string', value : 'nomatch', end : 46 }, text : { start : 46, name : 'text', type : 'string', value : '', end : 54 } }, orderedAttributes: [ { start : 8, name : 'state', type : 'string', value : '$:/temp/search', end : 31 }, { start : 31, name : 'type', type : 'string', value : 'nomatch', end : 46 }, { start : 46, name : 'text', type : 'string', value : '', end : 54 } ], start: 0, end : 55, openTagStart: 0, openTagEnd: 55, closeTagStart: 55, closeTagEnd: 55, isBlock : false, children : [ ] } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 55, children : [ { type : "reveal", tag: "$reveal", rule: "html", attributes : { state : { start : 8, name : "state", type : "string", value : "$:/temp/search", end : 31 }, type : { start : 31, name : "type", type : "string", value : "nomatch", end : 46 }, text : { start : 46, name : "text", type : "string", value : "", end : 54 } }, orderedAttributes: [ { start : 8, name : "state", type : "string", value : "$:/temp/search", end : 31 }, { start : 31, name : "type", type : "string", value : "nomatch", end : 46 }, { start : 46, name : "text", type : "string", value : "", end : 54 } ], start: 0, end : 55, openTagStart: 0, openTagEnd: 55, closeTagStart: 55, closeTagEnd: 55, isBlock : false, children : [ ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute={{TiddlerTitle!!field}}>some text</div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 54, children : [ { type : 'element', tag : 'div', rule: 'html', isBlock : false, attributes : { attribute : { type : 'indirect', name : 'attribute', textReference : 'TiddlerTitle!!field', start : 4, end : 38 } }, orderedAttributes: [ { type : 'indirect', name : 'attribute', textReference : 'TiddlerTitle!!field', start : 4, end : 38 } ], children : [ { type : 'text', text : 'some text', start : 39, end : 48 } ], start : 0, end : 54, openTagStart: 0, openTagEnd: 39, closeTagStart: 48, closeTagEnd: 54 } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 54, children : [ { type : "element", tag : "div", rule: "html", isBlock : false, attributes : { attribute : { type : "indirect", name : "attribute", textReference : "TiddlerTitle!!field", start : 4, end : 38 } }, orderedAttributes: [ { type : "indirect", name : "attribute", textReference : "TiddlerTitle!!field", start : 4, end : 38 } ], children : [ { type : "text", text : "some text", start : 39, end : 48 } ], start : 0, end : 54, openTagStart: 0, openTagEnd: 39, closeTagStart: 48, closeTagEnd: 54 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute={{Tiddler Title!!field}}>some text</div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 55, children : [ { type : 'element', tag : 'div', rule: 'html', isBlock : false, attributes : { attribute : { type : 'indirect', name : 'attribute', textReference : 'Tiddler Title!!field', start : 4, end : 39 } }, orderedAttributes: [ { type : 'indirect', name : 'attribute', textReference : 'Tiddler Title!!field', start : 4, end : 39 } ], children : [ { type : 'text', text : 'some text', start : 40, end : 49 } ], start : 0, end : 55, openTagStart: 0, openTagEnd: 40, closeTagStart: 49, closeTagEnd: 55 } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 55, children : [ { type : "element", tag : "div", rule: "html", isBlock : false, attributes : { attribute : { type : "indirect", name : "attribute", textReference : "Tiddler Title!!field", start : 4, end : 39 } }, orderedAttributes: [ { type : "indirect", name : "attribute", textReference : "Tiddler Title!!field", start : 4, end : 39 } ], children : [ { type : "text", text : "some text", start : 40, end : 49 } ], start : 0, end : 55, openTagStart: 0, openTagEnd: 40, closeTagStart: 49, closeTagEnd: 55 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div attribute={{TiddlerTitle!!field}}>\n\nsome text</div>")).toEqual(
|
||||
|
||||
[ { type : 'element', start : 0, attributes : { attribute : { start : 4, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 38 } }, orderedAttributes: [ { start : 4, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 38 } ], tag : 'div', rule: 'html', end : 56, openTagStart: 0, openTagEnd: 39, closeTagStart: 50, closeTagEnd: 56, isBlock : true, children : [ { type : 'element', tag : 'p', start : 41, end : 50, children : [ { type : 'text', text : 'some text', start : 41, end : 50 } ] } ] } ]
|
||||
[ { type : "element", start : 0, attributes : { attribute : { start : 4, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 38 } }, orderedAttributes: [ { start : 4, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 38 } ], tag : "div", rule: "html", end : 56, openTagStart: 0, openTagEnd: 39, closeTagStart: 50, closeTagEnd: 56, isBlock : true, children : [ { type : "element", tag : "p", start : 41, end : 50, children : [ { type : "text", text : "some text", start : 41, end : 50 } ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n\nsome text</div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 67, children : [ { type : 'element', start : 0, end: 67, openTagStart: 0, openTagEnd: 5, closeTagStart: 61, closeTagEnd: 67, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { attribute : { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } }, orderedAttributes: [ { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } ], tag : 'div', end : 61, openTagStart: 5, openTagEnd: 44, closeTagStart: 55, closeTagEnd: 61, rule: 'html', isBlock : true, children : [ { type : 'element', tag : 'p', start : 46, end : 55, children : [ { type : 'text', text : 'some text', start : 46, end : 55 } ] } ] } ] } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 67, children : [ { type : "element", start : 0, end: 67, openTagStart: 0, openTagEnd: 5, closeTagStart: 61, closeTagEnd: 67, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { attribute : { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } }, orderedAttributes: [ { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } ], tag : "div", end : 61, openTagStart: 5, openTagEnd: 44, closeTagStart: 55, closeTagEnd: 61, rule: "html", isBlock : true, children : [ { type : "element", tag : "p", start : 46, end : 55, children : [ { type : "text", text : "some text", start : 46, end : 55 } ] } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n\n!some heading</div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 71, children : [ { type : 'element', start : 0, end: 71, openTagStart: 0, openTagEnd: 5, closeTagStart: 71, closeTagEnd: 71, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { attribute : { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } }, orderedAttributes: [ { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } ], tag : 'div', end : 71, openTagStart: 5, openTagEnd: 44, closeTagStart: 71, closeTagEnd: 71, rule: 'html', isBlock : true, children : [ { type : 'element', tag : 'h1', start: 46, end: 71, rule: 'heading', attributes : { class : { type : 'string', value : '', start: 47, end: 47 } }, children : [ { type : 'text', text : 'some heading</div></div>', start : 47, end : 71 } ] } ] } ] } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 71, children : [ { type : "element", start : 0, end: 71, openTagStart: 0, openTagEnd: 5, closeTagStart: 71, closeTagEnd: 71, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { attribute : { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } }, orderedAttributes: [ { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } ], tag : "div", end : 71, openTagStart: 5, openTagEnd: 44, closeTagStart: 71, closeTagEnd: 71, rule: "html", isBlock : true, children : [ { type : "element", tag : "h1", start: 46, end: 71, rule: "heading", attributes : { class : { type : "string", value : "", start: 47, end: 47 } }, children : [ { type : "text", text : "some heading</div></div>", start : 47, end : 71 } ] } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<div><div attribute={{TiddlerTitle!!field}}>\n!some heading</div></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 70, children : [ { type : 'element', start : 0, end: 70, openTagStart: 0, openTagEnd: 5, closeTagStart: 64, closeTagEnd: 70, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { attribute : { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } }, orderedAttributes: [ { start : 9, name : 'attribute', type : 'indirect', textReference : 'TiddlerTitle!!field', end : 43 } ], tag : 'div', end : 64, openTagStart: 5, openTagEnd: 44, closeTagStart: 58, closeTagEnd: 64, rule: 'html', isBlock : false, children : [ { type : 'text', text : '\n!some heading', start : 44, end : 58 } ] } ] } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 70, children : [ { type : "element", start : 0, end: 70, openTagStart: 0, openTagEnd: 5, closeTagStart: 64, closeTagEnd: 70, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { attribute : { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } }, orderedAttributes: [ { start : 9, name : "attribute", type : "indirect", textReference : "TiddlerTitle!!field", end : 43 } ], tag : "div", end : 64, openTagStart: 5, openTagEnd: 44, closeTagStart: 58, closeTagEnd: 64, rule: "html", isBlock : false, children : [ { type : "text", text : "\n!some heading", start : 44, end : 58 } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
// Regression test for issue (#3306)
|
||||
expect(parse("<div><span><span>\n\nSome text</span></span></div>")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start: 0, end: 48, children : [ { type : 'element', start : 0, end: 48, openTagStart: 0, openTagEnd: 5, closeTagStart: 42, closeTagEnd: 48, attributes : { }, orderedAttributes: [ ], tag : 'div', rule: 'html', isBlock : false, children : [ { type : 'element', start : 5, attributes : { }, orderedAttributes: [ ], tag : 'span', end : 42, openTagStart: 5, openTagEnd: 11, closeTagStart: 35, closeTagEnd: 42, rule: 'html', isBlock : false, children : [ { type : 'element', start : 11, attributes : { }, orderedAttributes: [ ], tag : 'span', end : 35, openTagStart: 11, openTagEnd: 17, closeTagStart: 28, closeTagEnd: 35, rule: 'html', isBlock : true, children : [ { type : 'element', tag : 'p', start : 19, end : 28, children : [ { type : 'text', text : 'Some text', start : 19, end : 28 } ] } ] } ] } ] } ] } ]
|
||||
[ { type : "element", tag : "p", start: 0, end: 48, children : [ { type : "element", start : 0, end: 48, openTagStart: 0, openTagEnd: 5, closeTagStart: 42, closeTagEnd: 48, attributes : { }, orderedAttributes: [ ], tag : "div", rule: "html", isBlock : false, children : [ { type : "element", start : 5, attributes : { }, orderedAttributes: [ ], tag : "span", end : 42, openTagStart: 5, openTagEnd: 11, closeTagStart: 35, closeTagEnd: 42, rule: "html", isBlock : false, children : [ { type : "element", start : 11, attributes : { }, orderedAttributes: [ ], tag : "span", end : 35, openTagStart: 11, openTagEnd: 17, closeTagStart: 28, closeTagEnd: 35, rule: "html", isBlock : true, children : [ { type : "element", tag : "p", start : 19, end : 28, children : [ { type : "text", text : "Some text", start : 19, end : 28 } ] } ] } ] } ] } ] } ]
|
||||
|
||||
);
|
||||
});
|
||||
@ -193,12 +193,12 @@ describe("WikiText parser tests", function() {
|
||||
it("should block mode filtered transclusions", function() {
|
||||
expect(parse("{{{ filter }}}")).toEqual(
|
||||
|
||||
[ { type: 'list', attributes: { filter: { type: 'string', value: ' filter ', start: 3, end: 11 } }, isBlock: true, start: 0, end: 14, rule: "filteredtranscludeblock" } ]
|
||||
[ { type: "list", attributes: { filter: { type: "string", value: " filter ", start: 3, end: 11 } }, isBlock: true, start: 0, end: 14, rule: "filteredtranscludeblock" } ]
|
||||
|
||||
);
|
||||
expect(parse("{{{ fil\nter }}}")).toEqual(
|
||||
|
||||
[ { type: 'list', attributes: { filter: { type: 'string', value: ' fil\nter ', start: 3, end: 12 } }, isBlock: true, start: 0, end: 15, rule: "filteredtranscludeblock" } ]
|
||||
[ { type: "list", attributes: { filter: { type: "string", value: " fil\nter ", start: 3, end: 12 } }, isBlock: true, start: 0, end: 15, rule: "filteredtranscludeblock" } ]
|
||||
|
||||
);
|
||||
});
|
||||
@ -246,7 +246,7 @@ describe("WikiText parser tests", function() {
|
||||
it("should parse block macro calls", function() {
|
||||
expect(parse("<<john>>\n<<paul>>\r\n<<george>>\n<<ringo>>")).toEqual(
|
||||
|
||||
[ { type: 'transclude', start: 0, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "john" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "john" }], end: 8, isBlock: true }, { type: 'transclude', start: 9, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "paul" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "paul" }], end: 17, isBlock: true }, { type: 'transclude', start: 19, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "george" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "george" }], end: 29, isBlock: true }, { type: 'transclude', start: 30, rule: 'macrocallblock', attributes: { $variable: { name: "$variable", type: "string", value: "ringo" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "ringo" }], end: 39, isBlock: true } ]
|
||||
[ { type: "transclude", start: 0, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "john" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "john" }], end: 8, isBlock: true }, { type: "transclude", start: 9, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "paul" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "paul" }], end: 17, isBlock: true }, { type: "transclude", start: 19, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "george" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "george" }], end: 29, isBlock: true }, { type: "transclude", start: 30, rule: "macrocallblock", attributes: { $variable: { name: "$variable", type: "string", value: "ringo" }}, orderedAttributes: [ { name: "$variable", type: "string", value: "ringo" }], end: 39, isBlock: true } ]
|
||||
|
||||
);
|
||||
expect(parse("<<john one:val1 two: 'val \"2\"' three: \"val '3'\" four: \"\"\"val 4\"5'\"\"\" five: [[val 5]] >>")).toEqual(
|
||||
@ -256,17 +256,17 @@ describe("WikiText parser tests", function() {
|
||||
);
|
||||
expect(parse("<< carrots\n\n<<john>>")).toEqual(
|
||||
|
||||
[ { type: 'element', tag: 'p', start : 0, end : 10, children: [ { type: 'text', text: '<< carrots', start : 0, end : 10 } ] }, { type: 'transclude', start: 12, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 20, isBlock: true } ]
|
||||
[ { type: "element", tag: "p", start : 0, end : 10, children: [ { type: "text", text: "<< carrots", start : 0, end : 10 } ] }, { type: "transclude", start: 12, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 20, isBlock: true } ]
|
||||
|
||||
);
|
||||
expect(parse("before\n\n<<john>>")).toEqual(
|
||||
|
||||
[ { type: 'element', tag: 'p', start : 0, end : 6, children: [ { type: 'text', text: 'before', start : 0, end : 6 } ] }, { type: 'transclude', start: 8, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 16, isBlock: true } ]
|
||||
[ { type: "element", tag: "p", start : 0, end : 6, children: [ { type: "text", text: "before", start : 0, end : 6 } ] }, { type: "transclude", start: 8, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 16, isBlock: true } ]
|
||||
|
||||
);
|
||||
expect(parse("<<john>>\nafter")).toEqual(
|
||||
|
||||
[ { type: 'transclude', start: 0, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 8, isBlock: true }, { type: 'element', tag: 'p', start: 9, end: 14, children: [ { type: 'text', text: 'after', start: 9, end: 14 } ] } ]
|
||||
[ { type: "transclude", start: 0, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "john"} }, orderedAttributes: [ {name: "$variable", type:"string", value: "john"} ], end: 8, isBlock: true }, { type: "element", tag: "p", start: 9, end: 14, children: [ { type: "text", text: "after", start: 9, end: 14 } ] } ]
|
||||
|
||||
);
|
||||
expect(parse("<<multiline arg:\"\"\"\n\nwikitext\n\"\"\" >>")).toEqual(
|
||||
@ -276,7 +276,7 @@ describe("WikiText parser tests", function() {
|
||||
);
|
||||
expect(parse("<<outie one:'my <<innie>>' >>")).toEqual(
|
||||
|
||||
[ { type: 'transclude', start: 0, rule: 'macrocallblock', attributes: { $variable: {name: "$variable", type:"string", value: "outie"}, one: {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} }, orderedAttributes: [ {name: "$variable", type:"string", value: "outie"}, {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} ], end: 29, isBlock: true } ]
|
||||
[ { type: "transclude", start: 0, rule: "macrocallblock", attributes: { $variable: {name: "$variable", type:"string", value: "outie"}, one: {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} }, orderedAttributes: [ {name: "$variable", type:"string", value: "outie"}, {name: "one", type:"string", value: "my <<innie>>", start: 7, end: 26} ], end: 29, isBlock: true } ]
|
||||
|
||||
);
|
||||
});
|
||||
@ -309,7 +309,7 @@ describe("WikiText parser tests", function() {
|
||||
it("should parse horizontal rules", function() {
|
||||
expect(parse("---Not a rule\n\n----\n\nBetween\n\n---")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', start : 0, end : 13, children : [ { type : 'entity', entity : '—', start: 0, end: 3, rule: 'dash' }, { type : 'text', text : 'Not a rule', start : 3, end : 13 } ] }, { type : 'element', tag : 'hr', start: 15, end: 20, rule: 'horizrule' }, { type : 'element', tag : 'p', start : 21, end : 28, children : [ { type : 'text', text : 'Between', start : 21, end : 28 } ] }, { type : 'element', tag : 'hr', start: 30, end: 33, rule: 'horizrule' } ]
|
||||
[ { type : "element", tag : "p", start : 0, end : 13, children : [ { type : "entity", entity : "—", start: 0, end: 3, rule: "dash" }, { type : "text", text : "Not a rule", start : 3, end : 13 } ] }, { type : "element", tag : "hr", start: 15, end: 20, rule: "horizrule" }, { type : "element", tag : "p", start : 21, end : 28, children : [ { type : "text", text : "Between", start : 21, end : 28 } ] }, { type : "element", tag : "hr", start: 30, end: 33, rule: "horizrule" } ]
|
||||
|
||||
);
|
||||
|
||||
@ -318,99 +318,99 @@ describe("WikiText parser tests", function() {
|
||||
it("should parse hard linebreak areas", function() {
|
||||
expect(parse("\"\"\"Something\nin the\nway she moves\n\"\"\"\n\n")).toEqual(
|
||||
|
||||
[ { type : 'element', tag : 'p', children : [ { type : 'text', text : 'Something', start : 3, end : 12, rule: 'hardlinebreaks' }, { type : 'element', tag : 'br', rule: 'hardlinebreaks', start: 12, end: 13 }, { type : 'text', text : 'in the', start : 13, end : 19, rule: 'hardlinebreaks' }, { type : 'element', tag : 'br', rule: 'hardlinebreaks', start: 19, end: 20 }, { type : 'text', text : 'way she moves', start : 20, end : 33, rule: 'hardlinebreaks' }, { type : 'element', tag : 'br', rule: 'hardlinebreaks', start: 33, end: 34 } ], start : 0, end : 37 } ]
|
||||
[ { type : "element", tag : "p", children : [ { type : "text", text : "Something", start : 3, end : 12, rule: "hardlinebreaks" }, { type : "element", tag : "br", rule: "hardlinebreaks", start: 12, end: 13 }, { type : "text", text : "in the", start : 13, end : 19, rule: "hardlinebreaks" }, { type : "element", tag : "br", rule: "hardlinebreaks", start: 19, end: 20 }, { type : "text", text : "way she moves", start : 20, end : 33, rule: "hardlinebreaks" }, { type : "element", tag : "br", rule: "hardlinebreaks", start: 33, end: 34 } ], start : 0, end : 37 } ]
|
||||
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it("should parse tables", function() {
|
||||
let wikitext = `
|
||||
|!Cell1 |!Cell2 |
|
||||
|Cell3 |Cell4 |`.trim();
|
||||
it("should parse tables", function() {
|
||||
var wikitext =
|
||||
"|!Cell1 |!Cell2 |\n" +
|
||||
"|Cell3 |Cell4 |".trim();
|
||||
|
||||
let expectedParseTree = [{
|
||||
type: 'element',
|
||||
tag: 'table',
|
||||
var expectedParseTree = [{
|
||||
type: "element",
|
||||
tag: "table",
|
||||
start: 0,
|
||||
end: 33,
|
||||
rule: 'table',
|
||||
rule: "table",
|
||||
children: [{
|
||||
type: 'element',
|
||||
tag: 'tbody',
|
||||
type: "element",
|
||||
tag: "tbody",
|
||||
start: 0,
|
||||
end: 33,
|
||||
children: [{
|
||||
type: 'element',
|
||||
tag: 'tr',
|
||||
type: "element",
|
||||
tag: "tr",
|
||||
attributes: {
|
||||
'class': { name: 'class', type: 'string', value: 'evenRow' },
|
||||
"class": { name: "class", type: "string", value: "evenRow" },
|
||||
},
|
||||
orderedAttributes: [
|
||||
{ name: 'class', type: 'string', value: 'evenRow' },
|
||||
{ name: "class", type: "string", value: "evenRow" },
|
||||
],
|
||||
start: 0,
|
||||
end: 18,
|
||||
children: [{
|
||||
type: 'element',
|
||||
tag: 'th',
|
||||
type: "element",
|
||||
tag: "th",
|
||||
attributes: {
|
||||
'align': { name: 'align', type: 'string', value: 'left' },
|
||||
"align": { name: "align", type: "string", value: "left" },
|
||||
},
|
||||
orderedAttributes: [
|
||||
{ name: 'align', type: 'string', value: 'left' },
|
||||
{ name: "align", type: "string", value: "left" },
|
||||
],
|
||||
start: 1,
|
||||
end: 8,
|
||||
children: [{type: 'text', text: 'Cell1', start: 2, end: 7}],
|
||||
children: [{type: "text", text: "Cell1", start: 2, end: 7}],
|
||||
}, {
|
||||
type: 'element',
|
||||
tag: 'th',
|
||||
type: "element",
|
||||
tag: "th",
|
||||
attributes: {
|
||||
'align': { name: 'align', type: 'string', value: 'left' },
|
||||
"align": { name: "align", type: "string", value: "left" },
|
||||
},
|
||||
orderedAttributes: [
|
||||
{ name: 'align', type: 'string', value: 'left' },
|
||||
{ name: "align", type: "string", value: "left" },
|
||||
],
|
||||
start: 9,
|
||||
end: 16,
|
||||
children: [{type: 'text', text: 'Cell2', start: 10, end: 15}],
|
||||
children: [{type: "text", text: "Cell2", start: 10, end: 15}],
|
||||
}],
|
||||
}, {
|
||||
type: 'element',
|
||||
tag: 'tr',
|
||||
type: "element",
|
||||
tag: "tr",
|
||||
attributes: {
|
||||
'class': { name: 'class', type: 'string', value: 'oddRow' },
|
||||
"class": { name: "class", type: "string", value: "oddRow" },
|
||||
},
|
||||
orderedAttributes: [
|
||||
{ name: 'class', type: 'string', value: 'oddRow' },
|
||||
{ name: "class", type: "string", value: "oddRow" },
|
||||
],
|
||||
start: 18,
|
||||
end: 33,
|
||||
children: [{
|
||||
type: 'element',
|
||||
tag: 'td',
|
||||
type: "element",
|
||||
tag: "td",
|
||||
attributes: {
|
||||
'align': { name: 'align', type: 'string', value: 'left' },
|
||||
"align": { name: "align", type: "string", value: "left" },
|
||||
},
|
||||
orderedAttributes: [
|
||||
{ name: 'align', type: 'string', value: 'left' },
|
||||
{ name: "align", type: "string", value: "left" },
|
||||
],
|
||||
start: 19,
|
||||
end: 25,
|
||||
children: [{type: 'text', text: 'Cell3', start: 19, end: 24}],
|
||||
children: [{type: "text", text: "Cell3", start: 19, end: 24}],
|
||||
}, {
|
||||
type: 'element',
|
||||
tag: 'td',
|
||||
type: "element",
|
||||
tag: "td",
|
||||
attributes: {
|
||||
'align': { name: 'align', type: 'string', value: 'left' },
|
||||
"align": { name: "align", type: "string", value: "left" },
|
||||
},
|
||||
orderedAttributes: [
|
||||
{ name: 'align', type: 'string', value: 'left' },
|
||||
{ name: "align", type: "string", value: "left" },
|
||||
],
|
||||
start: 26,
|
||||
end: 32,
|
||||
children: [{type: 'text', text: 'Cell4', start: 26, end: 31}],
|
||||
children: [{type: "text", text: "Cell4", start: 26, end: 31}],
|
||||
}],
|
||||
}],
|
||||
}],
|
||||
@ -420,32 +420,32 @@ describe("WikiText parser tests", function() {
|
||||
});
|
||||
|
||||
|
||||
it('should parse section marks', function () {
|
||||
it("should parse section marks", function () {
|
||||
expect(
|
||||
parse(
|
||||
"There is a block id that is invisible, but you can find it using developer tool's inspect element feature. ^BlockLevelLinksID1"
|
||||
)
|
||||
).toEqual([
|
||||
{
|
||||
type: 'element',
|
||||
tag: 'p',
|
||||
type: "element",
|
||||
tag: "p",
|
||||
children: [
|
||||
{
|
||||
type: 'text',
|
||||
type: "text",
|
||||
text: "There is a block id that is invisible, but you can find it using developer tool's inspect element feature.",
|
||||
start: 0,
|
||||
end: 106,
|
||||
},
|
||||
{
|
||||
type: 'blockmark',
|
||||
type: "blockmark",
|
||||
attributes: {
|
||||
id: { type: 'string', value: 'BlockLevelLinksID1', start: 126, end: 144 },
|
||||
previousSibling: { type: 'string', value: '' },
|
||||
id: { type: "string", value: "BlockLevelLinksID1", start: 126, end: 144 },
|
||||
previousSibling: { type: "string", value: "" },
|
||||
},
|
||||
children: [],
|
||||
start: 106,
|
||||
end: 126,
|
||||
rule: 'blockmark',
|
||||
rule: "blockmark",
|
||||
},
|
||||
],
|
||||
start: 0,
|
||||
@ -455,22 +455,22 @@ describe("WikiText parser tests", function() {
|
||||
});
|
||||
|
||||
|
||||
it('should parse link to section marks', function () {
|
||||
expect(parse('[[Link to BlockLevelLinksID1|Block Level Links in WikiText^BlockLevelLinksID1]]')).toEqual([
|
||||
it("should parse link to section marks", function () {
|
||||
expect(parse("[[Link to BlockLevelLinksID1|Block Level Links in WikiText^BlockLevelLinksID1]]")).toEqual([
|
||||
{
|
||||
type: 'element',
|
||||
tag: 'p',
|
||||
type: "element",
|
||||
tag: "p",
|
||||
children: [
|
||||
{
|
||||
type: 'link',
|
||||
type: "link",
|
||||
attributes: {
|
||||
to: { type: 'string', value: 'Block Level Links in WikiText', start: 29, end: 58 },
|
||||
toBlockMark: { type: 'string', value: 'BlockLevelLinksID1', start: 59, end: 77 },
|
||||
to: { type: "string", value: "Block Level Links in WikiText", start: 29, end: 58 },
|
||||
toBlockMark: { type: "string", value: "BlockLevelLinksID1", start: 59, end: 77 },
|
||||
},
|
||||
children: [{ type: 'text', text: 'Link to BlockLevelLinksID1', start: 2, end: 28 }],
|
||||
children: [{ type: "text", text: "Link to BlockLevelLinksID1", start: 2, end: 28 }],
|
||||
start: 0,
|
||||
end: 79,
|
||||
rule: 'prettylink',
|
||||
rule: "prettylink",
|
||||
},
|
||||
],
|
||||
start: 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user