EXPERT BBCODE FRAMEWORK

By Endless World Last update Nov 18, 2008 — Installed 606 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 5 posts, 3 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Avindra V.G. Scriptwright

LOL! tunginobi tried to type the fix! He meant:

sauce = sauce.replace(/\n/g, "<br />");

and he is correct, although technically newline is a 2part character, \r\n, but since JavaScript is weakly typed, it works either way :/

For people having trouble with typing code, install my script here. When you click the new "fix code" button, it automatically escapes the code with their XML entities.

Simply sauce.replace(/\n/g, "<br />"); wouldn't do the trick, because String.replace()returns a new string, rather than assigning the new value to the old one. And yes, that is a somewhat ugly hack. You can include quantifiers to make it better, like /\n{1,3}/ or something to your discretion.

 
tungtn Scriptwright
Uh, pretend there's a
between those quotes.
 
tungtn Scriptwright
Oh, and line 47 should read
sauce = sauce.replace(/\n/g, "
");
 
tungtn Scriptwright

Delete line 280 and the preview should come out correctly.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel