- Will 043
- |
- Exalted Member
When he was younger, he was the one who always had the jokes and riddles that would keep the spirits of the Spartans high. Over the years however, his lifetime of combat had hardened him, as it had all of the Spartans. Within Will, John thought, something special had been lost.
--------------------------------------------------------------------------------------------------------------------------------------
Forgive me if I'm wrong, but doesn't html have an element called <pre> that preserves just this kind of formatting? I too use double spaces. I am indifferent to paragraph indentation, but it seems like an easy thing to accomplish all of it. It would just display exactly as the user typed it, errors and all.
I imagine the current formatting in forum posts does indeed use <p></p>. Just make it display exactly as typed. Just make all the "<p>"s into "<pre>"s. It's not like B.net would have to parse whats a sentence and what's not. Just switch out all of the <p> fields that get populated by user submitted text with <pre> tags instead.
Posted by: dazarobbo
Posted by: Oddley765
It's to do with HTML formatting and specifications. Double spaces aren't valid HTML.
link for referenceExcessive whitespace doesn't invalidate a HTML document, browsers just truncate it down to a single space (ASCII 0x20).
That being said, if you wanted double spacing, it would need to be controlled with extra markup, like non-breaking spaces or wrapped sentences (ie. span tags). But then, you run into all sorts of problems.
If you use a regex to add in a nbsp, how do you identify it? Is it "\. {2}"? Maybe "\. {2,}\S"?
If you try to identify sentences... what is a sentence? Where do they begin and end? Remember you're dealing with user-generated content here; it's not always going to be correct.
[Edited on 11.29.2012 9:08 PM PST]