Re: [Zope-dev] Rendering DTML Document / Folder properties as structured-text
Sorry to follow up my own post, but I think I understand the issue now. Since I saw at least one other person puzzled by this problem, I thought I'd try to explain (and let people shoot me down, if I am "even-less-than-an-egg").
I am trying to capture "free form" input as a property of a Folder / DTML Document, and display it using StructuredText.
For instance, I define a property, notes, with type text. I then attempt to display it, using this DTML:
<!--var notes fmt="structured-text"-->
I then enter values into the TEXTAREA for the property, e.g.:: * foo * bar
When I display the document, I get mixed results: sometimes it will be partly rendered as HTML, while sometimes I get the infamous "read only buffer, class" error.
What am I doing wrong?
The __doc__ comment in StructuredText.py specifies: - A paragraph that begins with a '-', '*', or 'o' is treated as an unordered list (bullet) element. This requirment prohibits "mashing" the lines together, as I naƮvely tried to do above. I must leave a blank line between list entries, or else ST cannot distinguish them. This has the unfortunate side effect that all lists emitted by ST look "double spaced", because list items are rendered "around" paragraphs, e.g: <UL> <LI> <P> Foo </P> <LI> <P> Bar </P> </UL> I will look at what it would take to strip the "enclosed" <P> from list items, and submit a patch if it looks simple enough (actually, a patch to allow parsing of list elements without the extra newline would be even better, methinks). -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
I will look at what it would take to strip the "enclosed" <P> from list items, and submit a patch if it looks simple enough (actually, a patch to allow parsing of list elements without the extra newline would be even better, methinks).
Here is my diff against the 1.10.2 version of StructuredText.py: 433a434,435
list_element_format = "<p>%s</p>"
450c452 < if p: p="<p>%s</p>" % strip(ctag(p)) ---
if p: p=self.list_element_format % strip(ctag(p))
455c457 < if p: p="<p>%s</p>" % strip(ctag(p)) ---
if p: p=self.list_element_format % strip(ctag(p))
This diff allows the creation of an ExternalMethod which replaces StructuredText.HTML.list_element_format on the fly (to compress the list, or further adorn its elements, for instance). -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
participants (1)
-
Tres Seaver