22 April 2009
ParagraphFormat() ? where art thou..
Interesting night for me, as I’ve spent the last 4 hours fumbling around in the Google dark trying to find a way to take “comments” for the team.silverlight blog, sanitize them but preserve their natural format in which the user typed them.
In that for example, I like to sign my signature in most comments on blogs like this:
-
Scott Barnes
Rich Platforms Product Manager
Microsoft.
3 Lines basically, but to do this in most of the libraries I've seen, they always end up like this:
- Scott Barnes Rich Platforms Product Manager Microsoft.
The only way i can preserve the said format, is to use <pre> tags and via CSS make them look more natural.
The downside, is I then sacrifice basic html which is one feature I want to implement.
Any magical RegEx formulas out there than can handle both shift+linefeed as well as preserve double space line feeds with <p></p> tags I’m all ears.
As the intended format of a comment should end up like this:
start
<p>
Your comment goes here
</p>
<p>
-<br />
Scott Barnes</br>
Rich Platforms Product Manager </br>
Microsoft</br>
</p>
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.
Scott Barnes currently is a Rich Platform Product Manager (WPF & Silverlight). He has been working with Adobe/Macromedia technology for the past 10 years with a main focus specifically on Internet Applications (aka. RIA, Rich Client Technology etc).
Scott first started out as a graphic designer in the late 90’s and over the years developed a passion for programmatic art (Designer + Developer mind). He recently has branched out further into 3D modelling and animation making full use of both his designer + developer mindset.
"..The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man..." - George Bernard Shaw