pages and articles <-- should contains markdown files -------------// //---------------------- be warned that markdown implementation is not complete ---------------------------// //--------------- software needed --> ph7 and any scripting language that can compile into one ------------// //--------------- ic2blog.php is just a markdown to html compiler so dont expect too much! ----------------// $ts=microtime(true);$__t['^^ver']='1.0';$__t['^^gen']=date('l d-m-Y');$__t['^^title']='interpreterhell';//-// function mh($s){foreach(explode("\n",$s) as $l){$level=0;while($level0){$rv.="".trim(substr($l,$level))."\n";}else{$rv.=$l."\n";}}return$rv;} function mr($s){foreach(explode("\n",$s) as $l){switch(trim($l)){case"___":case'---':case'***':$rv.="
\n"; break;default:$rv.=$l."\n";}}return$rv;}function me($s){foreach(explode("\n",$s) as $l){if(strpos($l,'**')!== false){$st=strpos($l,'**')+2;$en=strrpos($l,'**');if($st<$en){$l=substr($l,0,$st-2).''.substr($l,$st, $en-$st).''.substr($l,$en+2);}}if(strpos($l,'__')!==false){$st=strpos($l,'__')+2;$en=strrpos($l,'__' );if($st<$en){$l=substr($l,0,$st-2).''.substr($l,$st,$en-$st).''.substr($l,$en+2);}}if(//-// strpos($l,'*')!==false){$st=strpos($l,'*')+1;$en=strrpos($l,'*');if($st<$en){$l=substr($l,0,$st-1).''//// .substr($l,$st,$en-$st).''.substr($l,$en+1);}}$rv.=$l."\n";}return$rv;}function mb(){}//--------------// function dp($s){$rv=explode("\n",$s);$rv=ltrim($rv[0],"# ");return$rv;}function hp($s){$rv=explode("\n",$s)// ;$rv=ltrim($rv[1],"## ");return$rv;}function pm($s){$rv=mh($s);$rv=mr($rv);$rv=me($rv);return$rv;}function gn ($s){return pathinfo($s,PATHINFO_FILENAME);}function ln($s,$d,$h){return''.$d ." $h
";}$_p=scandir('pages/');$_a=scandir('articles/');$__b=file_get_contents('_base.html');foreach( $_p as $x){$__p["$x"]=file_get_contents("pages/$x");}foreach($_a as $x){$__a["$x"]=file_get_contents(//----// "articles/$x");}foreach($__t as $x=>$y){$__b=str_replace($x,$y,$__b);}foreach($__p as $x=>$y){$fn=gn($x);$cn= pm($y);if($fn!=="index"){$cn.='

back';}else{foreach($_a as $x){$an=$__a[$x];$cn.=ln( gn($x),dp($an),hp($an));}}$cn=str_replace('^^content',$cn,$__b);file_put_contents("_temp/$fn.html",$cn);}//// foreach($__a as $x=>$y){$fn=gn($x);$cn=pm($y);$cn.='

back';$cn=str_replace(//---// '^^content',$cn,$__b);file_put_contents("_temp/articles/$fn.html",$cn);}$te=microtime(true)//--------------// ;$et=$te-$ts;echo'completed: '.$et.'sec';