diff --git a/js/Formatter.js b/js/Formatter.js index cb51405c3..98b2b78e0 100755 --- a/js/Formatter.js +++ b/js/Formatter.js @@ -70,19 +70,19 @@ Formatter.enclosedTextHelper = function(w) { Formatter.isExternalLink = function(link) { if(store.tiddlerExists(link) || store.isShadowTiddler(link)) { - //# Definitely not an external link + // Definitely not an external link return false; } var urlRegExp = new RegExp(config.textPrimitives.urlPattern,"mg"); if(urlRegExp.exec(link)) { - //# Definitely an external link + // Definitely an external link return true; } if(link.indexOf(".")!=-1 || link.indexOf("\\")!=-1 || link.indexOf("/")!=-1 || link.indexOf("#")!=-1) { - //# Link contains . / \ or # so is probably an external link + // Link contains . / \ or # so is probably an external link return true; } - //# Otherwise assume it is not an external link + // Otherwise assume it is not an external link return false; }; @@ -445,7 +445,7 @@ Formatter.formatters = [ { name: "image", match: "\\[[<>]?[Ii][Mm][Gg]\\[", - //# [<] sequence below is to avoid lessThan-questionMark sequence so TiddlyWikis can be included in PHP files + // [<] sequence below is to avoid lessThan-questionMark sequence so TiddlyWikis can be included in PHP files lookaheadRegExp: /\[([<]?)(>?)[Ii][Mm][Gg]\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg, handler: function(w) { diff --git a/js/Wikifier.js b/js/Wikifier.js index 45d10bdd0..5f71b907a 100755 --- a/js/Wikifier.js +++ b/js/Wikifier.js @@ -6,11 +6,11 @@ var Tiddler = require("./Tiddler.js").Tiddler, utils = require("./Utils.js"), util = require("util"); -//# Construct a wikifier object -//# source - source string that's going to be wikified -//# formatter - Formatter() object containing the list of formatters to be used -//# highlightRegExp - regular expression of the text string to highlight -//# tiddler - reference to the tiddler that's taken to be the container for this wikification +// Construct a wikifier object +// source - source string that's going to be wikified +// formatter - Formatter() object containing the list of formatters to be used +// highlightRegExp - regular expression of the text string to highlight +// tiddler - reference to the tiddler that's taken to be the container for this wikification var Wikifier = function(source,formatter,highlightRegExp,tiddler) { this.source = source; @@ -40,7 +40,7 @@ Wikifier.prototype.wikifyPlain = function() Wikifier.prototype.subWikify = function(output,terminator) { - //# Handle the terminated and unterminated cases separately, this speeds up wikifikation by about 30% + // Handle the terminated and unterminated cases separately, this speeds up wikifikation by about 30% try { if(terminator) this.subWikifyTerm(output,new RegExp("(" + terminator + ")","mg")); @@ -53,10 +53,10 @@ Wikifier.prototype.subWikify = function(output,terminator) Wikifier.prototype.subWikifyUnterm = function(output) { - //# subWikify can be indirectly recursive, so we need to save the old output pointer + // subWikify can be indirectly recursive, so we need to save the old output pointer var oldOutput = this.output; this.output = output; - //# Get the first match + // Get the first match this.formatter.formatterRegExp.lastIndex = this.nextMatch; var formatterMatch = this.formatter.formatterRegExp.exec(this.source); while(formatterMatch) { @@ -68,7 +68,7 @@ Wikifier.prototype.subWikifyUnterm = function(output) this.matchLength = formatterMatch[0].length; this.matchText = formatterMatch[0]; this.nextMatch = this.formatter.formatterRegExp.lastIndex; - //# Figure out which formatter matched and call its handler + // Figure out which formatter matched and call its handler var t; for(t=1; t this.nextMatch) this.outputText(this.output,this.nextMatch,terminatorMatch.index); - //# Set the match parameters + // Set the match parameters this.matchText = terminatorMatch[1]; this.matchLength = terminatorMatch[1].length; this.matchStart = terminatorMatch.index; this.nextMatch = this.matchStart + this.matchLength; - //# Restore the output pointer + // Restore the output pointer this.output = oldOutput; return; } - //# It must be a formatter match; output any text before the match + // It must be a formatter match; output any text before the match if(formatterMatch.index > this.nextMatch) this.outputText(this.output,this.nextMatch,formatterMatch.index); - //# Set the match parameters + // Set the match parameters this.matchStart = formatterMatch.index; this.matchLength = formatterMatch[0].length; this.matchText = formatterMatch[0]; this.nextMatch = this.formatter.formatterRegExp.lastIndex; - //# Figure out which formatter matched and call its handler + // Figure out which formatter matched and call its handler var t; for(t=1; t startPos) && (this.highlightMatch.index < endPos) && (startPos < endPos)) { - //# Deal with any plain text before the highlight + // Deal with any plain text before the highlight if(this.highlightMatch.index > startPos) { createTiddlyText(place,this.source.substring(startPos,this.highlightMatch.index)); startPos = this.highlightMatch.index; } - //# Deal with the highlight + // Deal with the highlight var highlightEnd = Math.min(this.highlightRegExp.lastIndex,endPos); createTiddlyElement(place,"span",null,"highlight",this.source.substring(startPos,highlightEnd)); startPos = highlightEnd; - //# Nudge along to the next highlight if we're done with this one + // Nudge along to the next highlight if we're done with this one if(startPos >= this.highlightRegExp.lastIndex) this.highlightMatch = this.highlightRegExp.exec(this.source); } - //# Do the unhighlighted text left over + // Do the unhighlighted text left over if(startPos < endPos) { createTiddlyText(place,this.source.substring(startPos,endPos)); } @@ -196,10 +196,10 @@ Wikifier.wikifyStatic = function(source,highlightRegExp,tiddler,format) return html; }; -//# Wikify a string to plain text -//# text - text to wikify -//# limit - maximum number of characters to generate -//# tiddler - optional reference to the tiddler containing this text +// Wikify a string to plain text +// text - text to wikify +// limit - maximum number of characters to generate +// tiddler - optional reference to the tiddler containing this text Wikifier.wikifyPlainText = function(text,limit,tiddler) { if(limit > 0)