Since I make a lot of games and tools for ESL, I like to automate making small changes to long sections. Most of the time this is fine, but now I have a game where I need to preserve paragraph breaks. I'm running into the problem where my JavaScript is spitting out visible html tags instead of breaks. I didn't put the tags there; they appear wherever I had an empty line. The best I can do so far is remove the tags. but "\n" isn't acting any different than just "".
var text_to_monkey_with = squiffy.ui.processText("{section_with_multiple_paragraphs}").replace(/<p>|<\/p>/g, "\n");
Thanks, everybody!
I didn't put the tags there; they appear wherever I had an empty line.
A lot of the plaintext-to-HTML conversion is squiffy is done when you publish (or preview) the game; so when it's running, all the line breaks in the text parts will have been converted to <p>
blocks; and all the section/passage links will have been converted to <a>
tags with a bunch of markup.
If you're extracting the text to do other stuff, you'll want to keep those tags in (or put them back when you're finished doing whatever with it)