For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > September 2004 > Re: CGI.pm : Handling Carriage Returns from textarea()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: CGI.pm : Handling Carriage Returns from textarea()
Bruce Alderson

2004-09-12, 8:55 pm

Robert Page IV wrote:

> Considering I am not parsing HTML, I am actually trying to 'generate'
> the text formatting
> I want in a HTML page, there is no need for a HTMl parser that I see.
>


There are quite a few modules that do this too, like Markdown, Textism,
and some of the wiki-markup tools. I've written a few simple parsers
for this too, as blosxom plugins
(http://warpedvisions.org/dl/magiclink-final.tar.gz), which do something
like what you are looking for.

Generally you can ignore line-terminators from textareas, as far as
formatting the text as html. Line terminators in html/xhtml/xml are
mostly ignored, except in special blocks (like pre and cdata), and in
special cases where it is treated like whitespace (which can sometimes
result in odd spacing before/after divs in certain browsers).

Rather than covert carriage returns to breaks (<br /> ), I'd suggest to
use paragraphs (<p> ) or other blocks (divs, lists, definition lists,
tables, pre, blockquotes, etc.). Breaks don't style well using CSS,
and all of the effects you can get with breaks can be controlled more
completely with blocks and custom styles.

--
Bruce Alderson <mx@warpedvisions.org>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com