mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 00:50:28 +00:00
Fixed super minor issue with import pragma (#5521)
This commit is contained in:
parent
8fbf52e419
commit
61714cbda3
@ -36,7 +36,7 @@ exports.parse = function() {
|
||||
// Move past the pragma invocation
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
// Parse the filter terminated by a line break
|
||||
var reMatch = /(.*)(\r?\n)|$/mg;
|
||||
var reMatch = /(.*)(?:$|\r?\n)/mg;
|
||||
reMatch.lastIndex = this.parser.pos;
|
||||
var match = reMatch.exec(this.parser.source);
|
||||
this.parser.pos = reMatch.lastIndex;
|
||||
|
@ -702,6 +702,19 @@ describe("Widget module", function() {
|
||||
expect(wrapper.innerHTML).toBe("<p>Don't forget me.</p>");
|
||||
});
|
||||
|
||||
/** Special case. \import should parse correctly, even if it's
|
||||
* the only line in the tiddler. Technically doesn't cause a
|
||||
* visual difference, but may affect plugins if it doesn't.
|
||||
*/
|
||||
it("should work when import pragma is standalone", function() {
|
||||
var wiki = new $tw.Wiki();
|
||||
var text = "\\import [prefix[XXX]]";
|
||||
var parseTreeNode = parseText(text,wiki);
|
||||
// Test the resulting parse tree node, since there is no
|
||||
// rendering which may expose a problem.
|
||||
expect(parseTreeNode.children[0].attributes.filter.value).toBe('[prefix[XXX]]');
|
||||
});
|
||||
|
||||
/** This test reproduces issue #4504.
|
||||
*
|
||||
* The importvariable widget was creating redundant copies into
|
||||
|
Loading…
Reference in New Issue
Block a user