• Welcome to The Cave of Dragonflies forums, where the smallest bugs live alongside the strongest dragons.

    Guests are not able to post messages or even read certain areas of the forums. Now, that's boring, don't you think? Registration, on the other hand, is simple, completely free of charge, and does not require you to give out any personal information at all. As soon as you register, you can take part in some of the happy fun things at the forums such as posting messages, voting in polls, sending private messages to people and being told that this is where we drink tea and eat cod.

    Of course I'm not forcing you to do anything if you don't want to, but seriously, what have you got to lose? Five seconds of your life?

HTML to BBCode

Luxcario

'Humans are interesting.'
Pronoun
he
Feel free to move this if it's in the wrong place.
__________________________________
So, I found this thingy that turns HTML code/script into BBCode. Very useful. Anyways, this might be a help to you, so the link is ~¬here¬~
for all of you people to use.
 
it works somewhat like a translator that translates every word literally. thus, it chokes on anything that doesn't look more or less exactly as expected.
 
It works with image HTML. To prove, I'll use it now.

HTML:
<a href="http://s724.photobucket.com/albums/ww241/klinecars3/Pokemon%20Cascade%20and%20Agate%20Sprites/?action=view&current=Doramizu.gif" target="_blank"><img src="http://i724.photobucket.com/albums/ww241/klinecars3/Pokemon%20Cascade%20and%20Agate%20Sprites/Doramizu.gif" border="0" alt="Photobucket"></a>

Code:
[PLAIN][img]http://i724.photobucket.com/albums/ww241/klinecars3/Pokemon%20Cascade%20and%20Agate%20Sprites/Doramizu.gif[/img][/PLAIN]

Doramizu.gif
 
Last edited:
Dātura;553769 said:
I like how the converter's default text is the long-deprecated <font> tag.

Well, strictly speaking, <font color="..."> although deprecated is the direct equivalent of [color=...]. Since BBcode is presentational and not semantic, the best analogues for BBcode tags are the old deprecated presentational tags.

Its not that smart, either. It doesn't recognize CSS at all. It also converted
Code:
<font style="color: blue">blue</font>
to
Code:
blue[/color]
This was last updated five years ago and it shows. It uses a mixture of substring matching and regexes to do its parsing. A better approach would have been to use the browser's built-in HTML parser (because, y'know, browsers have those) to iterate through the DOM and translate each node into an appropriate bbcode tag. Hell, it'd even be possible to translate CSS colors that way.
 
Back
Top Bottom