type.properties are now parsed, mappings to other prototypes are linked

This commit is contained in:
stefanp 2002-12-02 12:19:36 +00:00
parent c52925d414
commit 428b1ab1ef

View file

@ -113,10 +113,28 @@ function parentPrototype_macro (param) {
function typeProperties_macro (param) {
var props = this.getTypeProperties ();
if (props!=null && props.getContent ()!="" ) {
var sb = new java.lang.StringBuffer ();
// map of all mappings....
var mappings = props.getMappings ();
// parse type.properties linewise:
var arr = props.getContent ().split ("\n");
for (var i=0; i<arr.length; i++) {
arr [i] = arr[i].trim ();
// look up in mappings table if line matches:
for (var e = mappings.keys (); e.hasMoreElements (); ) {
var key = e.nextElement ();
var reg = new RegExp ('^' + key + '\\W');
if (arr[i].match (reg)) {
// it matched, wrap line in a link to that prototype:
var docProtoObj = this.getApplication ().getPrototype (mappings.getProperty (key));
arr[i] = '<a href="' + docProtoObj.href ("main") + '#typeproperties">' + arr[i] + '</a>';
}
}
sb.append (arr[i] + "\n");
}
var tmp = new Object ();
tmp.content = props.getContent ();
tmp.content = sb.toString ();
var skinname = (param.skinname) ? param.skinname : "typeproperties";
this.renderSkin (skinname, tmp);
}
}