mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-01 12:07:13 +00:00
Introduced new Dependency() class to encapsulate dependency handling logic
Note that the format is now slightly different; see js/Dependencies.js for details
This commit is contained in:
@@ -33,6 +33,7 @@ HTML nodes look like this:
|
||||
|
||||
var WikiTextRules = require("./WikiTextRules.js"),
|
||||
WikiTextParseTree = require("./WikiTextParseTree.js").WikiTextParseTree,
|
||||
Dependencies = require("./Dependencies.js").Dependencies,
|
||||
Renderer = require("./Renderer.js").Renderer,
|
||||
utils = require("./Utils.js"),
|
||||
util = require("util");
|
||||
@@ -67,7 +68,7 @@ WikiTextParser.prototype.parse = function(type,text) {
|
||||
this.source = text;
|
||||
this.nextMatch = 0;
|
||||
this.children = [];
|
||||
this.dependencies = {};
|
||||
this.dependencies = new Dependencies();
|
||||
this.output = null;
|
||||
this.subWikify(this.children);
|
||||
var tree = new WikiTextParseTree(this.children,this.dependencies,this.store);
|
||||
@@ -76,25 +77,6 @@ WikiTextParser.prototype.parse = function(type,text) {
|
||||
return tree;
|
||||
};
|
||||
|
||||
WikiTextParser.prototype.mergeDependencies = function(newDependencies) {
|
||||
for(var rel in newDependencies) {
|
||||
if(rel === "dependentAll") {
|
||||
this.dependencies.dependentAll = newDependencies.dependentAll;
|
||||
} else {
|
||||
if(!(rel in this.dependencies)) {
|
||||
this.dependencies[rel] = {};
|
||||
}
|
||||
for(var t in newDependencies[rel]) {
|
||||
if(this.dependencies[rel][t]) {
|
||||
this.dependencies[rel][t]++;
|
||||
} else {
|
||||
this.dependencies[rel][t] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
WikiTextParser.prototype.outputText = function(place,startPos,endPos) {
|
||||
if(startPos < endPos) {
|
||||
place.push(Renderer.TextNode(this.source.substring(startPos,endPos)));
|
||||
|
||||
Reference in New Issue
Block a user