This is a test

Bio's personal thoughts about stuff.

Moderator: BioHazard

Locked
User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

This is a test

Post by BioHazard » Tue Nov 15, 2005 11:51

This is just to see if my BBCode->XHTML function works.
If they called them "sad meals", nobody would buy them.

Code: Select all

(cool & stuff)+things*(generic_objects/stupidity) // Law of Xaser
[spoiler]Spoilers no worky without JS[/spoiler]
BioHazard wrote:Nested quotes
Should be no problem!
Nested quotes
neither should nested tags

Code: Select all

tags in [i]code segs[/i] should not get [b]applied[/b]
void eval(){
    sectors[q] = 0xW00T;
    linedefs[i] = 0x1337;
}
  • Drawing this list
    • Is the
    • biggest hack
    • mankind has
      • ever seen!
      • It makes
      • B.AV.E.'s
    • gamefile parser
    • look good
  • OMG!
linky

Well, that's it.
Last edited by BioHazard on Sat Nov 26, 2005 12:23, edited 6 times in total.

User avatar
BioHazard
Needs more free time.
Posts: 408
Joined: Mon Jul 25, 2005 10:02
Location: Middle of California where there is no air.
Contact:

Post by BioHazard » Tue Nov 15, 2005 13:18

Well here you go, the crappiest XHTM->BBCode parser ever.

Code: Select all

 ///////////////////////////////////////////////////////
// XHTM_BBCode : Converts most BBCode to valid XHTML or just butchers the code mercilessly
function XHTM_BBCode($in){
	while(preg_match("/\[b\](.+?)\[\/b\]/i",$in,$out)){$in=str_replace($out[0],"<b>".$out[1]."</b>",$in);}
	while(preg_match("/\[i\](.+?)\[\/i\]/i",$in,$out)){$in=str_replace($out[0],"<i>".$out[1]."</i>",$in);}
	while(preg_match("/\[u\](.+?)\[\/u\]/i",$in,$out)){$in=str_replace($out[0],"<u>".$out[1]."</u>",$in);}
	while(preg_match("/\[url=(.+?)\](.+?)\[\/url\]/i",$in,$out)){$in=str_replace($out[0],"<a href=\"".$out[1]."\">".$out[2]."</a>",$in);}
	// IYAA! I hate to do all these with <span>s
	while(preg_match("/\[quote:.+?=\"(.+?)\"\](.+?)\[\/quote\]/i",$in,$out)){$in=str_replace($out[0],"<br/><span class=\"quote\">".$out[1]." wrote:<span class=\"quotetxt\">".$out[2]."</span></span>",$in);}
	while(preg_match("/\[quote\](.+?)\[\/quote\]/i",$in,$out)){$in=str_replace($out[0],"<br/><span class=\"quote\">Quote:<span class=\"quotetxt\">".$out[1]."</span></span>",$in);}
	while(preg_match("/\[code\](.+?)\[\/code\]/i",$in,$out)){$in=str_replace($out[0],"<br/><span class=\"quote\">Code:<span class=\"code\">".str_replace("  ","&nbsp;&nbsp;",$out[1])."</span></span>",$in);}
	// GAH! Lists!
	while(preg_match("/\[\*\](.+?)\[\*\]/i",$in,$out)){$in=str_replace($out[0],"<li>".$out[1]."</li>[*]",$in);}
	while(preg_match("/\[\*\](.+?)\[\/list\]/i",$in,$out)){$in=str_replace($out[0],"<li>".$out[1]."</li>[/list]",$in);}
	while(preg_match("/\[list\](.+?)\[\/list\]/i",$in,$out)){$in=str_replace($out[0],"<ul>".str_replace("<br/>","",$out[1])."</ul>",$in);}
	$in = str_replace("<ul></li>","<ul>",$in); // nested lists quirk #1
	while(preg_match("/<br\/><ul>(.+?)<\/ul>\s/i",$in,$out)){$in=str_replace($out[0],"</p><ul>".$out[1]."</ul><p>\n",$in);} // DIRTIEST HACK EVER
	return $in;
}
Someone PLEASE submit an alternative!

Locked

Return to “Bio-Waste”

Who is online

Users browsing this forum: No registered users and 1 guest