Sourcecode in Global/renderFunctions.js:
1: function doWikiStuff (src) {
2: // robert, disabled: didn't get the reason for this:
3: // var src= " "+src;
4: if (src == null || !src.contains("<*"))
5: return src;
6:
7: // do the Wiki link thing, <*asterisk style*>
8: var regex = new RegExp ("<[*]([^*]+)[*]>");
9: regex.ignoreCase=true;
10:
11: var text = "";
12: var start = 0;
13: while (true) {
14: var found = regex.exec (src.substring(start));
15: var to = found == null ? src.length : start + found.index;
16: text += src.substring(start, to);
17: if (found == null)
18: break;
19: var name = ""+(new java.lang.String (found[1])).trim();
20: var item = res.handlers.site.topics.get (name);
21: if (item == null && name.lastIndexOf("s") == name.length-1)
22: item = res.handlers.site.topics.get (name.substring(0, name.length-1));
23: if (item == null || !item.size())
24: text += format(name)+" <small>[<a href=\""+res.handlers.site.stories.href("create")+"?topic="+escape(name)+"\">define "+format(name)+"</a>]</small>";
25: else
26: text += "<a href=\""+item.href()+"\">"+name+"</a>";
27: start += found.index + found[1].length+4;
28: }
29: return text;
30: }
|