Take links into account when accumulating dependencies

This commit is contained in:
Jeremy Ruston
2012-01-07 10:30:50 +00:00
parent c716cdce20
commit b92183a3a7
4 changed files with 40 additions and 9 deletions

View File

@@ -50,6 +50,14 @@ WikiTextParser.prototype.parse = function(text) {
return new WikiTextParseTree(this.children,this.dependencies,this.store);
};
WikiTextParser.prototype.addDependency = function(dependency) {
if(dependency === null) {
this.dependencies = null;
} else if(this.dependencies && this.dependencies.indexOf(dependency) === -1) {
this.dependencies.push(dependency);
}
};
WikiTextParser.prototype.outputText = function(place,startPos,endPos) {
if(startPos < endPos) {
place.push({type: "text", value: this.source.substring(startPos,endPos)});