Convert vB code to HTML

Sarenji

leaf-faced
is a Battle Simulator Admin Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Contributor Alumnus
http://www.geocities.com/mr_james_b0nd_007/
(Don't ask about the terrible URL. Also Obi made me post this.)

This is something to help save time converting forum posts into HTML. If there are bugs, do report them!

The bullets at the top will encapsulate every line with either:
  • nothing (default) or
  • <p>text</p>.

It also converts every , , ,
  • , , [center], and [img] tag into thei...ad.php?p=1069160#post1069160]this post itself. Quote the post, put the contents in the top box, press "Use <p>", and convert. Also of note is that it won't fix everything. Just replace the rest yourself :)
 

Sarenji

leaf-faced
is a Battle Simulator Admin Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Contributor Alumnus
Thanks a lot for the help on regex stuff, chaos. All that's been fixed now, hopefully. > and < and & are now replaced for their HTML entities.

EDIT: Stuff below is fixed now.

"[*]text" has problems when I try to replace it with "<li>text</li>". I don't know how to group properly or something, I guess.
I have:
Code:
code = code.replace(/\[\*\]([^([\*\])]*)/gi, "<li>$1</li>")
If this
HTML:
[list][*]e[b]eeee[/b]
[*]regex is cool (but hard)[*]asdf
[/list]
is entered, then I get
HTML:
<ul><li>e</li><strong>eeee</strong>
<li>regex is cool </li>(but hard)<li>asdf</li>
</ul>
It leaves out the [ and (, how do I fix this? The regex should include all characters until it encounters another "[*]" or the end of the string.
 

Sarenji

leaf-faced
is a Battle Simulator Admin Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Contributor Alumnus
OK that took a while. If you want to use this, you can use it now. The below is now correctly converted.
HTML:
Outside of List[list][*]A [b]bullet[/b][*]e[u]e[/u]e[/list]between lists[list][*]adf[*]e[i]ee[/i][/list]outside!
Don't know what to do for nested lists, though.

Also added img and center (don't think people will use this one but whatever).
 
Not sure if it's OK to post here now, but I couldn't help noticing that the <img> tag is missing an alt attribute. =/;
 

chaos

is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Smogon Discord Contributoris a Contributor to Smogonis an Administratoris a Tournament Director Alumnusis a Researcher Alumnus
Owner
of course it's okay to post. sarenji, if you still check this, wanna fix that? just have it add alt=""
 

Sarenji

leaf-faced
is a Battle Simulator Admin Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Researcher Alumnusis a Contributor Alumnus
Okay, I added it. Sorry about the long delay for such a simple fix. I've been incredibly busy. You know the drill: research projects, APs, the SAT.
 

eric the espeon

maybe I just misunderstood
is a Forum Moderator Alumnusis a Researcher Alumnusis a Top CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Top Contributor Alumnus
Probably worth noting that GeoCities has permanently closed down, making the converter inaccessible. May be worth putting up somewhere else?
 

Desolate

Banned deucer.
I am not able to open this your URL its showing me error message "Sorry, the GeoCities web site you were trying to reach is no longer available". I think your link is broken or it is accessible in some of the countries and others are restricted.
GeoCities has been shut down. I'm sure no-one has gotten around to hosting it somewhere else, or had the purpose of hosting it elsewhere.
 
It's simple enough to do it manually anyway. If you hate writing out <p> and </p> or copy-pasting them, use a tag-wrap plugin for an editor like Notepad++. WebEdit is one I'm already testing.
 
Or, you could simply try using TinyMCE/FCKeditor's demo site. (Google them) They essentially are WYSIWYG editors that can be dropped in as replacements for most textarea forms in a web site.
 
WYSIWYG editors are largely terrible... some are worse than others, but I've not yet encountered one I'd be satisfied with. x_x
 

Oglemi

Borf
is a Forum Moderatoris a Top Contributoris a Tournament Director Alumnusis a Site Content Manager Alumnusis a Community Contributor Alumnusis a Researcher Alumnusis a Tiering Contributor Alumnusis a Top Smogon Media Contributor Alumnusis an Administrator Alumnusis a Top Dedicated Tournament Host Alumnus
geocities no longer exists, so this is going to get moved to L&O

I'm sure it was cool at one point though
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top