/*************************************** * * Javascript Textile->HTML conversion * * ben@ben-daglish.net (with thanks to John Hughes for improvements) * Issued under the "do what you like with it - I take no respnsibility" licence ****************************************/ function convert_textile(t) { var inpr,inbq,inbqq,html; var aliases = new Array; var alg={'>':'right','<':'left','=':'center','<>':'justify','~':'bottom','^':'top'}; var ent={"'":"’"," - ":" – ","--":"—"," x ":" × ","\\.\\.\\.":"…","\\(C\\)":"©","\\(R\\)":"®","\\(TM\\)":"™"}; var tags={"b":"\\*\\*","i":"__","em":"_","strong":"\\*","cite":"\\?\\?","sup":"\\^","sub":"~","span":"\\%","del":"-","code":"@","ins":"\\+","del":"-"}; var le="\n\n"; var lstlev=0,lst="",elst="",intable=0,mm=""; var para = /^p(\S*)\.\s*(.*)/; var rfn = /^fn(\d+)\.\s*(.*)/; var bq = /^bq\.(\.)?\s*/; var table=/^table\s*{(.*)}\..*/; var trstyle = /^\{(\S+)\}\.\s*\|/; function convert(t) { var lines = t.split(/\r?\n/); html=""; inpr=inbq=inbqq=0; for(var i=0;i"+prep(mm[2]));continue;} if(mm = /^h(\d)(\S*)\.\s*(.*)/.exec(lines[i])){stp(1);html += tag("h"+mm[1],make_attr(mm[2]),prep(mm[3]))+le;continue;} if(mm=rfn.exec(lines[i])){stp(1);inpr=1;html+=lines[i].replace(rfn,'

'+mm[1]+'<\/sup>'+prep(mm[2]));continue;} if (lines[i].indexOf("*") == 0) {lst="