Skip to content

Instantly share code, notes, and snippets.

@k33g
Created February 2, 2011 08:00
Show Gist options
  • Save k33g/807390 to your computer and use it in GitHub Desktop.
Save k33g/807390 to your computer and use it in GitHub Desktop.
Annotations for js
function Annotations(){
var arr = arguments[0].toString().split("@@"),arr_annot={},i,j,tmp={};
for(i=0;i<arr.length;i++){
if(arr[i][0]=="-"){
arr_annot[arr[i].split("-")[1]] ={};
tmp = arr[i].split("-")[2].split(",");
tmp[0]=tmp[0].replace(/\n/g,"").replace(/\r/g,"").replace(/^\s+|\s+$/,"");
tmp[1]=tmp[1].replace(/\n/g,"").replace(/\r/g,"").replace(/^\s+|\s+$/,"");
for(j=0;j<tmp.length;j++){
arr_annot[arr[i].split("-")[1]][tmp[j].split(":")[0]]=
tmp[j].split(":")[1].replace(/\n/g,"").replace(/\r/g,"").replace(/^\s+|\s+$/,"");
}
}
}
return arr_annot;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment