", render: renderTableRow } )
];
/*===================================*/
/* Converts OpenForum Markup to HTML
*
* pageName - Name of page to render for
* input - raw text to render to html
*
*/
self.render = function(pageName,text) {
try{
var input = EOL+text+EOL;
var rendererStack = [];
var output = "";
//While there is input text left to render
while(input.length>0) {
//Find the next instance of marked up text
//and return the required renderer
var renderer = findFirstMatch( input,markUp );
//If no renderer found in remaining text, add text to output and end
if(renderer===null) {
output+=input;
break;
} else {
//Record the start and cut start as the start of the markup
var startPoint = regexIndexOf(input,renderer.getStart());
var startCutPoint = startPoint;
//If the first character of the cut is new line and markup is not a title, move cut point past it
if(input.substring(startCutPoint,1)===EOL && renderer.getStart().charAt(0)!=="!") {
startCutPoint++;
}
//Record the string before the markup start
var before = input.substring(0,startCutPoint);
//Record the string after the markup start
var after = input.substring( indexAfter(input,renderer.getStart()) );
//Record the index of the start of the end markup
var endPoint = regexIndexOf(after,renderer.getEnd());
//Record the string within the markup
var content = after.substring( 0,endPoint );
//If the markup does not end at the line end
if(renderer.getEnd()!==EOL) {
//Record the end of the markup as after the end markup
endPoint += renderer.getEnd().length;
}
//Fix to render links in lists
if(renderer.canBeStacked()===true) {
content = self.render(pageName,content);
}
//Record the string after the markup end
after = after.substring( endPoint );
//Add the string before the markup to the output
output += before;
//Add the rendered markup to the output
output += renderer.render(pageName,content);
//Set the input as the string after the markup
input = after;
if(input.substring(0,2)==="\n\n") {
output += "\n"+renderer.renderClose();
input = input.substring(1);
} else {
rendererStack.push(renderer);
}
}
}
output = output.substring(1,output.length-1);
while(rendererStack.length>0) {
var poppedRenderer = rendererStack.pop();
output = output + poppedRenderer.renderClose();
}
return output;
} catch(e){
if(log) {
log.error("Error in /OpenForum/Javascript/Renderer/DefaultRenderer. Excpetion "+e+" on line "+e.lineNumber);
}
}
};
}