Vanify.js: Difference between revisions
m (MediaWiki:Vanify.js moved to MediaWiki:Vanify.bak.js) |
m (MediaWiki:Vanify.bak.js moved to MediaWiki:Vanify.js over redirect) |
(No difference)
|
Latest revision as of 12:31, 24 March 2008
// Vanify function Vanify(obj) { obj = document.editform.wpTextbox1.value; //Select whole document //Call FixBAsic function for tidying up before replacements * MOVED TO END OF function * //WikEdFixBasic(obj.changed); //Regexes // //Codes for linking to Vanisource. Search will be base on these codes and the ref. given by Vedabase // //Get rid off unwanted data obj = obj.replace(/^[\ ]/mg, ""); obj = obj.replace(/\=> /g, ""); obj = obj.replace(/>\s/g, "\n"); obj = obj.replace(/SYNONYMS/g, ""); obj = obj.replace(/TRANSLATION/g, ""); obj = obj.replace(/PURPORT/g, ""); //clean this kind of refs: Ref. VedaBase Bg 2.42, Bg 2.43, Bg 2.42-43 obj = obj.replace(/Ref. VedaBase.+, (.+\d+-\d+)/g, "Ref. VedaBase $1"); //Titles obj = obj.replace(/TT:(.+)\b[\W]?$/mg, "====== $1 ======\n"); obj = obj.replace(/H1:(.+)\b[\W]?$/mg, "= $1 =\n"); obj = obj.replace(/H2:(.+)\b[\W]?$/mg, "== $1 ==\n"); obj = obj.replace(/H3:(.+)\b[\W]?$/mg, "=== $1 ===\n"); obj = obj.replace(/H4:(.+)\b[\W]?$/mg, "==== $1 ====\n"); obj = obj.replace(/H5:(.+)\b[\W]?$/mg, "===== $1 =====\n"); //get rid off the newlines \n(temporarily) for easier regex find and replace var nl = "YYY"; obj = obj.replace(/\n/g, nl); //Array with codes var codes = new Array("BGS","BGT","BGP","BGTP","BGF","BGI","BGL","BGG","CCS","CCT","CCP","CCTP","CCF","CCI","CCL","EJF","EJC","KBF","KBI","KBC","LBT","LBP","LBTP","LBF","MGI","MGC","NDF","NDI","NDC","NIS","NIT","NIP","NITP","NIF","RWI","RWC","SIS","SIT","SIP","SITP","SII","SBS","SBT","SBP","SBTP","SBF","SBI","SBM","TCF","TCI","TCC","TCL","AA","CM","CO","LE","DL","DI","FL","GL","IL","BSL","SIL","NDL","SBL","LD","PD","SP","WC"); var avoid = new RegExp('(BGS:|BGT:|BGP:|BGTP:|BGF:|BGI:|BGL:|BGG:|CCS:|CCT:|CCP:|CCTP:|CCF:|CCI:|CCL:|EJF:|EJC:|KBF:|KBI:|KBC:|LBT:|LBP:|LBTP:|LBF:|MGI:|MGC:|NDF:|NDI:|NDC:|NIS:|NIT:|NIP:|NITP:|NIF:|RWI:|RWC:|SIS:|SIT:|SIP:|SITP:|SII:|SBS:|SBT:|SBP:|SBTP:|SBF:|SBI:|TCF:|TCI:|TCC:|TCL:|AA:|CM:|CO:|LE:|DL:|DI:|FL:|GL:|IL:|BGL:|BSL:|SIL:|NDL:|SBL:|LD:|PD:|SP:|WC:)', "g"); for (i = 0; i < codes.length; i++) { var re = new RegExp(codes[i]); if (re.test(obj)) { var index = codes[i].substring(0,2); switch (index) { //GENERAL cases BG, CC, SB, ND, etc. case 'BG': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase (.+?)'+nl, 'g'); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'S': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?(?:Bg)? (.+?)'+nl, 'g'); obj = obj.replace(re2, "'''[[Vanisource:BG $2|BG $2 Synonyms]]: $1'''"+nl+nl); case 'T': if (codes[i].charAt(3) == 'P') { var re2 = new RegExp(nl+codes[i]+':(.+?)'+nl+'{2,}(.+?)Ref. VedaBase Bg (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:BG $3|BG $3, Tanslation and Purport]]: $1''' "+nl+nl+"$2 "+nl+nl); } else { var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?(?:Bg)? (.+?)'+nl, 'g'); obj = obj.replace(re2, "'''[[Vanisource:BG $2|BG $2, Translation]]: $1'''"+nl+nl); } case 'P': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?(?:Bg)? (.+?)'+nl, 'g'); obj = obj.replace(re2, "'''[[Vanisource:BG $2|BG $2, Purport]]:''' $1"+nl+nl); case 'F': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?(?:Bg)? (.+?)'+nl, 'g'); obj = obj.replace(re2, "'''[[Vanisource:BG $2|BG $2]]:''' $1 "+nl+nl); case 'I': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?(?:Bg)? (.+?)'+nl, 'g'); obj = obj.replace(re2, "'''[[Vanisource:BG $2|BG $2]]:''' $1 "+nl+nl); case 'L': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?Bhagavad-gita (.+?) -- (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:BGL $3|Bhagavad-Gita Lecture, text $2, $3]]:''' $1 "+nl+nl); case 'G': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:BGL ITG|Bhagavad-Gita Lecture, Introduction to Gitopani?ad]]:''' $1 "+nl+nl); } } } break; case 'CC': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+(?:Cc )?(Adi|Madhya|Antya)(.+?)'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'S': obj = obj.replace(re2, "'''[[Vanisource:CC $2$3|CC $2$3 Synonyms]]: $1''' "+nl+nl); case 'T': if (codes[i].charAt(3) == 'P') { var re2 = new RegExp(nl+codes[i]+':(.+?)'+nl+'{2,}(.+?)Ref. VedaBase[\ ]+(?:Cc )?(Adi|Madhya|Antya)(.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:CC $3$4|CC $3$4, Tanslation and Purport]]: $1''' "+nl+nl+"$2 "+nl+nl); } else { obj = obj.replace(re2, "'''[[Vanisource:CC $2$3|CC $2$3, Translation]]: $1''' "+nl+nl); } case 'P': obj = obj.replace(re2, "'''[[Vanisource:CC $2$3|CC $2$3, Purport]]:''' $1 "+nl+nl); case 'F': obj = obj.replace(re2, "'''[[Vanisource:CC $2$3|CC $2,$3]]:''' $1 "+nl+nl); case 'I': obj = obj.replace(re2, "'''[[Vanisource:CC $2$3|CC $2,$3]]:''' $1 "+nl+nl); case 'L': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.(.+?) -- (.+?)'+nl, "g"); //Ref. VedaBase Adi-lila 3.87-88 -- New York, December 27, 1966 //Ref. VedaBase Madhya-lila 6.149-50 -- Gorakhpur, February 13, 1971 obj = obj.replace(re2, "'''[[Vanisource:CCL $2|Lectures on CC $2, $3]]:''' $1 "+nl+nl); } } } break; case 'EJ': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+EJ (.+?).+?'+nl, "g");//Ref. VedaBase EJ 2: Varieties of Planetary Systems var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'F': obj = obj.replace(re2, "'''[[Vanisource:EJ Preface|Easy Journey to other Planets, Preface]]:''' $1YYY"); case 'C': obj = obj.replace(re2, "'''[[Vanisource:EJ $2|Easy Journey to other Planets, Chapter $2]]:''' $1 "+nl+nl); } } } break; case 'KB': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+KB.+?'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'F': obj = obj.replace(re2, "'''[[Vanisource:KB Preface|K???a Book, Preface]]:''' $1 "+nl+nl); case 'I': obj = obj.replace(re2, "'''[[Vanisource:KB Introduction|K???a Book, Introduction]]:''' $1 "+nl+nl); case 'C': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+KB (.+?):.+?'+nl,'g'); // Ref. VedaBase => KB 3: The Birth of Lord Kåñëa obj = obj.replace(re2, "'''[[Vanisource:KB $2|K???a Book, Chapter $2]]:''' $1 "+nl+nl); } } } break; case 'LB': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+LoB (?:verse )?(.+?)'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'T': if (codes[i].charAt(3) == 'P') { var re2 = new RegExp(nl+codes[i]+':(.+?)'+nl+'{2,}(.+?)Ref. VedaBase[\ ]+LoB (?:verse )?(.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:LB $3|Light of the Bhagavata, text $3, Tanslation and Purport]]: $1''' "+nl+nl+"$2 "+nl+nl); } else { obj = obj.replace(re2, "'''[[Vanisource:LB $2|Light of the Bhagavata, text $2, Translation]]: $1''' "+nl+nl); } case 'P': obj = obj.replace(re2, "'''[[Vanisource:LB $2|Light of the Bhagavata, text $2, Purport]]:''' $1 "+nl+nl); case 'F': obj = obj.replace(re2, "'''[[Vanisource:LB $2|Light of the Bhagavata, $2]]:''' $1 "+nl+nl); } } } break; case 'MG': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+MoG .+?'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'I': obj = obj.replace(re2, "'''[[Vanisource:MG Introduction|Message of Godhead, Introduction]]:''' $1 "+nl+nl); case 'C': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+MoG (.+?):.+?'+nl,'g'); // Ref. VedaBase => KB 3: The Birth of Lord Kåñëa obj = obj.replace(re2, "'''[[Vanisource:MG $2|Message of Godhead, Chapter $2]]:''' $1 "+nl+nl); } } } break; case 'ND': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?'+nl, "g");//NoD 15: Spontaneous Devotional Service var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'F': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+NoD (.+?)'+nl, "g");//NoD 15: Spontaneous Devotional Service obj = obj.replace(re2, "'''[[Vanisource:ND Preface|Nectar of Devotion, Preface]]:''' $1 "+nl+nl); case 'I': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+NoD (.+?)'+nl, "g");//NoD 15: Spontaneous Devotional Service obj = obj.replace(re2, "'''[[Vanisource:ND Introduction|Nectar of Devotion, Introduction]]:''' $1 "+nl+nl); case 'C': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+NoD (.+?):.+?'+nl,'g'); // Ref. VedaBase => Ref. VedaBase NoD 15: Spontaneous Devotional Service obj = obj.replace(re2, "'''[[Vanisource:ND $2|Nectar of Devotion, Chapter $2]]:''' $1 "+nl+nl); case 'L': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+? -- (.+?)'+nl, "g"); //Ref. VedaBase The Nectar of Devotion -- V?ndavana, October 16, 1972 //Ref. VedaBase The Nectar of Devotion -- Bombay, January 2, 1973 obj = obj.replace(re2, "'''[[Vanisource:NDL $2|Lectures on Nectar of Devotion, $2]]:''' $1 "+nl+nl); } } } break; case 'NI': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+NoI(?:: verse)? (.+?)'+nl, "g");//Ref. VedaBase NoI: verse 2 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'S': obj = obj.replace(re2, "'''[[Vanisource:NI $2|Nectar of Instruction text $2, Synonyms]]: $1''' "+nl+nl); case 'T': if (codes[i].charAt(3) == 'P') { var re2 = new RegExp(nl+codes[i]+':(.+?)'+nl+'{2,}(.+?)Ref. VedaBase[\ ]+NoI: (?:verse)? (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:NI $3|Nectar of Instruction, text $3, Tanslation and Purport]]: $1''' "+nl+nl+"$2 "+nl+nl); } else { obj = obj.replace(re2, "'''[[Vanisource:NI $2|Nectar of Instruction, text $2, Translation]]: $1''' "+nl+nl); } case 'P': obj = obj.replace(re2, "'''[[Vanisource:NI $2|Nectar of Instruction, text $2, Purport]]:''' $1 "+nl+nl); case 'F': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?'+nl, "g");//Ref. VedaBase NoI Preface obj = obj.replace(re2, "'''[[Vanisource:NI Preface|Nectar of Instruction, Preface]]:''' $1 "+nl+nl); } } } break; case 'RW': var re2 = new RegExp(nl+codes[i]+':(.+?)VedaBase[\ ]+.+?'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'I': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+.+?'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:RW Introduction|Renunciation Through Wisdom, Introduction]]:''' $1 "+nl+nl); case 'C': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+RTW (.+?):.+?'+nl, "g");// Ref. VedaBase => RTW 3.1: Extinguishing the Flames of obj = obj.replace(re2, "'''[[Vanisource:RW $2|Renunciation Through Wisdom, $2]]:''' $1 "+nl+nl); } } } break; case 'SI': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?'+nl, "g"); // Ref. VedaBase => Iso mantra 4 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'S': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?Iso.+?mantra (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:SI $2|Sri Isopanisad, text $2, Synonyms]]:''' $1 "+nl+nl); case 'T': if (codes[i].charAt(3) == 'P') { var re2 = new RegExp(nl+codes[i]+':(.+?)'+nl+'{2,}(.+?)Ref. VedaBase.+?Iso.+?mantra (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:SI $3|Sri Isopanisad, text $3, Tanslation and Purport]]: $1''' "+nl+nl+"$2 "+nl+nl); } else { var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?Iso.+?mantra (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:SI $2|Sri Isopanisad, text $2, Translation]]: $1''' "+nl+nl); } case 'P': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?Iso.+?mantra (.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:SI $2|Sri Isopanisad, text $2, Purport]]:''' $1 "+nl+nl); case 'I': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:SI Introduction|Sri Isopanisad, Introduction]]:''' $1 "+nl+nl); case 'L': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?Mantra (.+?) -- (.+?)'+nl, "g"); //Ref. VedaBase Sri Isopani?ad, Mantra 1 -- Los Angeles, May 2, 1970 //Ref. VedaBase Sri Isopani?ad, Mantra 8 -- Los Angeles, May 12, 1970 obj = obj.replace(re2, "'''[[Vanisource:SIL $3|Lectures on Sri Isopani?ad, text $2, $3]]:''' $1 "+nl+nl); } } } break; case 'SB': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+(.+?)'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'S': obj = obj.replace(re2, "'''[[Vanisource:$2|$2 Synonyms]]: $1''' "+nl+nl); case 'T': if (codes[i].charAt(3) == 'P') { var re2 = new RegExp(nl+codes[i]+':(.+?)'+nl+nl+'(.+?)Ref. VedaBase[\ ]+(.+?)'+nl, "g"); obj = obj.replace(re2, "'''[[Vanisource:$3|$3, Tanslation and Purport]]: $1''' YYYYYY$2 "+nl+nl); } else { obj = obj.replace(re2, "'''[[Vanisource:$2|$2, Translation]]: $1''' "+nl+nl); } case 'P': obj = obj.replace(re2, "'''[[Vanisource:$2|$2, Purport]]:''' $1 "+nl+nl); case 'F': obj = obj.replace(re2, "'''[[Vanisource:$2|$2]]:''' $1 "+nl+nl); case 'I': obj = obj.replace(re2, "'''[[Vanisource:$2|$2]]:''' $1 "+nl+nl); case 'M': obj = obj.replace(re2, "'''[[Vanisource:$2|$2]]:''' $1 "+nl+nl); case 'L': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase (.+?) -- (.+?)'+nl, "g"); //Ref. VedaBase Srimad-Bhagavatam 4.14.14 -- November 16, 1971, Delhi //Ref. VedaBase Srimad-Bhagavatam 11.3.21 -- New York, April 13, 1969 obj = obj.replace(re2, "'''[[Vanisource:SBL $3|$2, $3]]:''' $1 "+nl+nl); } } } break; case 'TC': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[\ ]+TLC (.+?)(:.+?)?'+nl, "g"); var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'F': obj = obj.replace(re2, "'''[[Vanisource:TC $2|Teachings of Lord Caitanya, $2]]:''' $1 "+nl+nl); case 'I': obj = obj.replace(re2, "'''[[Vanisource:TC $2|Teachings of Lord Caitanya, $2]]:''' $1 "+nl+nl); case 'C': obj = obj.replace(re2, "'''[[Vanisource:TC $2|Teachings of Lord Caitanya, Chapter $2]]:''' $1 "+nl+nl); case 'L': obj = obj.replace(re2, "'''[[Vanisource:TC $2|Teachings of Lord Caitanya, $2]]:''' $1 "+nl+nl); } } } break; //Lectures case 'AA': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?-- (.+?)'+nl, "g"); //Ref. VedaBase Arrival Address -- London, September 11, 1969 //Ref. VedaBase Arrival Lecture -- New Delhi, November 10, 1971 //Ref. VedaBase Srila Prabhupada Welcomed by Governor at Hotel De Ville -- Geneva, May 30, 1974 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:AA $2|Arrival Addresses and Talks, $2]]:''' $1 "+nl+nl); } } break; case 'CM': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase (.+?) -- (.+?)'+nl, "g"); //Ref. VedaBase Interview -- February 1, 1968, Los Angeles //Ref. VedaBase Morning Walk -- February 3, 1975, Hawaii var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:CM $3|Conversations and Morning Walks, $3]]:''' $1 "+nl+nl); } } break; case 'CO': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?-- (.+?)'+nl, "g"); //Ref. VedaBase Cornerstone Laying -- Bombay, January 23, 1975 //Ref. VedaBase Cornerstone Laying -- Bombay, January 23, 1975 //Ref. VedaBase Foundation Stone Ceremony Speech -- Bhuvanesvara, February 2, 1977 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:CO $2|Cornerstone Ceremonies, $2]]:''' $1 "+nl+nl); } } break; case 'LE': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?: (.+?)'+nl, "g"); //Ref. VedaBase Letter to: Mathura Prasad — Vrindaban 23 May, 1964 //Ref. VedaBase Letter to: Svati — India var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:LE $2|Letter to $2]]:''' $1 "+nl+nl+nl); } } break; case 'DL': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+?-- (.+?)'+nl, "g"); //Ref. VedaBase Departure Lecture -- Caracas, February 25, 1975 //Ref. VedaBase Conversation -- Hawaii, June 20, 1975 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:DL $2|Departure Talks, $2]]:''' $1 "+nl+nl); } } break; // Sould be edited after imported on Vanisource. Naming not defined yet. //case 'DI': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase[ ]+EJ (.+?).+?'+nl, "g"); //Ref. VedaBase JD: Preface //Ref. VedaBase JD: Introduction //Ref. VedaBase JD 5: The Journey- The Jaladuta sets sail for America var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { switch (codes[i].charAt(2)) { //Cases within this object: BGS, BGT, BGP, etc. case 'F': obj = obj.replace(re2, "'''[[Vanisource:EJ Preface|Easy Journey to other Planets, Preface]]:''' $1YYY"); case 'C': obj = obj.replace(re2, "'''[[Vanisource:EJ $2|Easy Journey to other Planets, Chapter $2]]:''' $1 "+nl+nl); } } } break; case 'FL': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+? -- (.+?)'+nl, "g"); //Ref. VedaBase Lecture-Day after Sri Gaura-Pur?ima -- Hawaii, March 5, 1969 //Ref. VedaBase N?si?ha-caturdasi Lord N?si?hadeva's Appearance Day -- Bombay, May 5, 1974 //Ref. VedaBase Ratha-yatra Lecture at The Family Dog Auditorium -- San Francisco, July 27, 1969 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:FL $2|Festival Lectures, $2]]:''' $1 "+nl+nl); } } break; case 'GL': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+? -- (.+?)'+nl, "g"); //Ref. VedaBase Lecture on Maha-mantra -- New York, September 8, 1966 //Ref. VedaBase Lecture -- Montreal, June 26, 1968 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:GL $2|General Lectures, $2]]:''' $1 "+nl+nl); } } break; case 'IL': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+? -- (.+?)'+nl, "g"); //Ref. VedaBase Initiation of Rukmi?i Dasi -- Montreal, August 15, 1968 //Ref. VedaBase Initiations -- Los Angeles, January 10, 1969 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:IL $2|Initiations, $2]]:''' $1 "+nl+nl); } } break; case 'BS': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+? -- (.+?)'+nl, "g"); //Ref. VedaBase Sri Brahma-sa?hita, Verse 32 -- New York, July 26, 1971 //Ref. VedaBase Sri Brahma-sa?hita, Lecture -- Los Angeles, November 9, 1968 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:BSL $2|Lectures on Brahma Samhita, $2]]:''' $1 "+nl+nl); } } break; case 'LD': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase (.+?):(.+?)'+nl, "g"); //Ref. VedaBase LD 6: Declaration of Will, June 1977 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:$2|Legal Documents, $3]]:''' $1 "+nl+nl); } } break; case 'PD': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase (.+?)'+nl, "g"); //Ref. VedaBase Immanuel Kant //Ref. VedaBase Jeremy Bentham //Ref. VedaBase St. Augustine var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:PD $2|, Philosophy Discussions, $2]]:''' $1 "+nl+nl); } } break; case 'SP': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase Purport to (.+?) --.+?'+nl, "g"); //Ref. VedaBase Purport to Bhajahu Re Mana -- San Francisco, March 16, 1967 //Ref. VedaBase Purport to Nitai-Pada-Kamala -- Los Angeles, December 21, 1968 //Ref. VedaBase Spelling of Prayers to the Six Gosvamis -- Los Angeles, December 26, 1968 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:SP $2|Song Purports, $2]]:''' $1 "+nl+nl); } } break; case 'WC': var re2 = new RegExp(nl+codes[i]+':(.+?)Ref. VedaBase.+? -- (.+?)'+nl, "g"); //Ref. VedaBase Wedding of Syama dasi and Hayagriva -- Los Angeles, December 25, 1968 //Ref. VedaBase Initiation of Sri-Caitanya dasa and Wedding of Pradyumna and Arundhati -- Columbus, May 14, 1969 //ef. VedaBase Wedding of Syama dasi and Hayagriva -- Los Angeles, December 25, 1968 var rearray = re2.exec(obj); if (rearray) { var result = rearray[1]; var quote = rearray[2]; // win1.document.write("found for "+codes[i]+":<br>"+rearray[1]+"<br><br>"); var found = result.match(avoid); if (!found) { obj = obj.replace(re2, "'''[[Vanisource:WC $2|Wedding Ceremonies, $2]]:''' $1 "+nl+nl); } } break; } } } //Replace intentionally removed newlines \n obj = obj.replace(/YYY/g, "\n"); //Clean up after function //WikEdFixBasic(obj); // keep the changed text selected, needed to remove the formatting with a second click //obj.keepSel = true; document.editform.wpTextbox1.value = obj; //Call Unify Unify(); return; } // end Vanify