rem:  var regex = new RegExp ("<[*]([^*]+)[*]>"); regex.ignoreCase=true;  var text = ""; var start = 0; while (true) { var found = regex.exec (src.substring(start)); var to = found == null ? src.length : start + found.index; text += src.substring(start, to); if (found == null) break; var name = ""+(new java.lang.String (found[1])).trim(); var item = res.handlers.site.topics.get (name); if (item == null && name.lastIndexOf("s") == name.length-1) item = res.handlers.site.topics.get (name.substring(0, name.length-1)); if (item == null || !item.size()) text += format(name)+" <small>[<a href=\""+res.handlers.site.stories.href("create")+"?topic="+escape(name)+"\">define "+format(name)+"</a>]</small>"; else text += "<a href=\""+item.href()+"\">"+name+"</a>"; start += found.index + found[1].length+4; } return text; 
add:  var regex = new RegExp ("<[*]([^*]+)[*]>"); regex.ignoreCase=true;  var text = ""; var start = 0; while (true) { var found = regex.exec (src.substring(start)); var to = found == null ? src.length : start + found.index; text += src.substring(start, to); if (found == null) break; var name = ""+(new java.lang.String (found[1])).trim(); var item = res.handlers.site.topics.get (name); if (item == null && name.lastIndexOf("s") == name.length-1) item = res.handlers.site.topics.get (name.substring(0, name.length-1)); if (item == null || !item.size()) text += format(name)+" <small>[<a href=\""+res.handlers.site.stories.href("create")+"?topic="+escape(name)+"\">define "+format(name)+"</a>]</small>"; else text += "<a href=\""+item.href()+"\">"+name+"</a>"; start += found.index + found[1].length+4; } return text; 
context: function doWikiStuff (src) {  // robert, disabled: didn't get the reason for this:  // var src= " "+src;  if (src == null || src.indexOf ("<*") < 0)     return src;  // do the Wiki link thing, <*asterisk style*>  var regex = new RegExp ("<[*]([^*]+)[*]>");  regex.ignoreCase=true;  var text = "";  var start = 0;  while (true) {    var found = regex.exec (src.substring(start));    var to = found == null ? src.length : start + found.index;    text += src.substring(start, to);    if (found == null)      break;    var name = ""+(new java.lang.String (found[1])).trim();    var item = res.handlers.site.topics.get (name);    if (item == null && name.lastIndexOf("s") == name.length-1)      item = res.handlers.site.topics.get (name.substring(0, name.length-1));    if (item == null || !item.size())      text += format(name)+" <small>[<a href=\""+res.handlers.site.stories.href("create")+"?topic="+escape(name)+"\">define "+format(name)+"</a>]</small>";    else      text += "<a href=\""+item.href()+"\">"+name+"</a>";    start += found.index + found[1].length+4;  }  return text;}
meta: 993	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/993/44c682473d920023add0283e889e229bac75d2ac/renderFunctions.js/buggy/code/Global/renderFunctions.js