User:Kameejl/formatMAI.js

/* The vast majority of artist articles will be displayed correctly but there are some known issues: Known issues: Capitalization 1) Uppercase genres like IDM, R&B, NWOBHM will be displayed like Idm, R&b and Nwobhm if capitalization is enabled. See Raven (band), Autechre.   2) Capitalization can only be used correctly for enumerations where each entity is wikilinked. 3) All wikilinked entities in the capitalized sections will be capitalized. Special comments is like "(see below)" will be displayed as "(See below)". Comma replacement:    4) Commas used in a unconventional manner will be replaced by line breaks. Little comments like "Partial reunion in 1982, 1996, 2000" will be replaced by "Partial reunion in 1982 1996 2000". See The Who. 5) Line breaks used for improvement of lay out (f.e. to force entities on the next row like bla, bli, blo, blu) will not be removed and may result in empty rows or visible commas. function getElementByClassName(document,tagname,classname){ var superbanana = (tagname == "*" && document.all) ? document.all : document.getElementsByTagName(tagname);  var banana=new Array;  classname=classname.replace(/\-/g,"\\-");  var aeroplanedeluxorzz=new RegExp("(^|\\s)"+classname+"(\\s|$)");  var pritstift;  for(var i=0;i<superbanana.length;i++){    pritstift=superbanana[i];    if(aeroplanedeluxorzz.test(pritstift.className)){      banana.push(pritstift);    }  }  return (banana) } function ppp(text, capitalize){  var text;  var capitalize;  if(capitalize!="yes"){	capitalize="no";  }  var patat=getElementByClassName(document,"*","infobox vcard")[0];  var aeroplanedeluxe;  for(var i=0;i0){ var aeroplane=patat.getElementsByTagName("td")[aeroplanedeluxe].innerHTML; var aeroplanedelux=aeroplane; var aeroplanedeluxor=aeroplanedelux.indexOf(","); while (aeroplanedeluxor!=-1){ aeroplanedelux=aeroplanedelux.replace(","," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedelux=aeroplanedelux.replace(", "," "); aeroplanedeluxor=aeroplanedelux.indexOf(","); } var peer=aeroplanedelux; if(capitalize=="yes"){ var temp=new Array; var temppart=new Array; temp=aeroplanedelux.split('">');     peer="";      for(var z=0;z');

if(temppart[0]=="IDM"		  || temppart[0]=="NWOBHM"		   || temppart[0]=="R&amp;B"		   || temppart[0]=="Hi-NRG"		   || temppart[0]=="New Wave"		   || temppart[0]=="see below"		   || temppart[0]=="various"		   || temppart[0]=="various others"){ temp[z]=temppart[0]+""+temppart[1] }		else{ temp[z]=temppart[0].substr(0,1).toUpperCase+temppart[0].substr(1).toLowerCase+""+temppart[1] };	   if(z!=temp.length-1){ peer=peer+temp[z]+"\">"       }        else{          peer=peer+temp[temp.length-1]        };		      }      if(text=="Years active"){	    var tempcomment=new Array;        var tempcommentpart=new Array;        tempcomment=aeroplanedelux.split(' ');        var vlees=tempcomment[0].indexOf("-");	    var taart=tempcomment[0].indexOf(" - ");	    var groente=tempcomment[0].indexOf(" – ");	    var aardappels=tempcomment[0].indexOf(" – ");

while (vlees!=-1){ tempcomment[0]=tempcomment[0].replace("-","–"); vlees=tempcomment[0].indexOf("-"); }       while (taart!=-1){ tempcomment[0]=tempcomment[0].replace(" - ","–"); taart=tempcomment[0].indexOf(" - "); }       while (groente!=-1){ tempcomment[0]=tempcomment[0].replace(" – ","–"); groente=tempcomment[0].indexOf(" – "); }       while (aardappels!=-1){ tempcomment[0]=tempcomment[0].replace(" – ","–"); aardappels=tempcomment[0].indexOf(" – "); }		if(tempcomment.length>1){ var koek=tempcomment[1].indexOf(" "); while (koek!=-1){ tempcomment[1]=tempcomment[1].replace(" ",", "); koek=tempcomment[1].indexOf(" "); }	     peer = tempcomment[0] + " " + tempcomment[1]; }		else{ peer = tempcomment[0] };	 }    }    patat.getElementsByTagName("td")[aeroplanedeluxe].innerHTML=peer; } else{ return }; }