[Zope] structured text -- again

Jim Fulton jim.fulton@digicool.com
Mon, 08 Feb 1999 10:31:27 -0500


Service Informatique CHSR wrote:
> 
> ************************************************************
> Hello,
> 
> let InputTestForm be:
> ---------------------8<------------------------
> <form action=Render>
> <textarea name=data cols=64 rows=5></textarea>
> <input type=submit value="Without :text">
> </form>
> 
> <form action=Render>
> <textarea name=data:text cols=64 rows=5></textarea>
> <input type=submit value="With :text">
> </form>
> ---------------------8<------------------------
> And Render be:
> ---------------------8<------------------------
> <!--#var data fmt="structured-text"-->
> ---------------------8<------------------------
> 
> Try to fill data and data:text with random values, and you'll see that:
> 
> - in etiher case, font attributes such as *emphasis* and **bold** are
> correctly rendered.
> - but list constructs such as:
> 
> ---------------------8<------------------------
> There are my **items**:
> 
> - first
> 
> - second
> ---------------------8<------------------------
> 
> work with "data:text" but do not with "data".

Data from textareas HTML forms normally have 
\r\n (or \n\r, I can never remember the order)
line endings which confuse structured text
(which expects \n line endings).  The ":text"
conversion feature causes \n\r and \r\n
line endings to be converted to \n line endings.

(snop)

> This is especially annoying because i get "data" from a database (not from
> InputTestForm), and
> 
> SELECT data as data:text from MyTable
> 
> doesn't work.
> I have to miss something, or perhaps this is a bug???

What are the line endings in the database text?  If they
are not '\n's, then you need to convert them to such.
Alternatively, someone could change the parsing code
in structured text to deal with extra '\r's.

Are you sure you have a problem with data from databases?
 
Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.