1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Merge pull request #2190 from buggyj/issue2189

fix for 2189
This commit is contained in:
Jeremy Ruston 2016-01-07 22:19:04 +00:00
commit e71bff0110

View File

@ -56,18 +56,25 @@ var WikiTextParser = function(type,text,options) {
this.source = text; this.source = text;
this.nextMatch = 0; this.nextMatch = 0;
this.children = []; this.children = [];
//this.children.push({type: "text",text:"hello to the queen"});
this.tree =[]; this.tree =[];
this.output = null; this.output = null;
this.subWikify(this.children); this.subWikify(this.children);
var parser = $tw.wiki.old_parseTiddler("$:/plugins/tiddlywiki/tw2parser/macrodefs",{parseAsInline:false}); // prepend tw2 macros locally to the content
var parser = $tw.wiki.parseTiddler("$:/plugins/tiddlywiki/tw2parser/macrodefs",{parseAsInline:false});
this.tree = [{ this.tree = [{
type: "element", type: "element",
tag: "div", tag: "div",
children:this.children children:this.children
}]; }];
Array.prototype.push.apply(parser.tree,this.tree); // clone the output of parser
this.tree = parser.tree; var root = JSON.parse(JSON.stringify(parser.tree));
// macros are defined in a linear tree; walk down the tree and append the source's parsed content
var baseroot = root;
while (root[0] && root[0].children && root[0].children.length !== 0 ){
root = root[0].children;
}
root[0].children[0] = this.tree[0];
this.tree = baseroot;
}; };