[ZDP] Re: Structured Text in Vars/DTML Methods

Martijn Pieters mj@antraciet.nl
Fri, 05 Mar 1999 15:43:15 +0100


At 14:57 05/03/99 , Pavlos Christoforou wrote:
>Martijn
>
>The reason I did not include support for Structured Text was situations
>where one might want to include examples like:
>... this is an example::
><!--# var title-->
>
>last I checked Zope would not render the above correctly. If I do some
>hackery I might get it to work but then I still have the problem where one
>might mix html and dtml in non-example sections. I will play around with
>your read_raw() suggestion.
>

With read_raw it renders it perfectly. All HTML codes within examples are
HTML escaped, all other text is taken as is, exactly as it should be. You
could then use arbitrary HTML in your text (outside example blocks) to get
special effects like tables and links. Please use it.

>If you have any ideas let me know.
>
>I really want to have Structured Text support.
>
>Pavlos
>
>PS Do you think is too much to ask for people to declare when an entry is
>in structured text? ie 
><answer fmt='structured-text'>A beer</answer>
>I wanted to make the submission as easy as possible.

I really do think all submissions should be structured text, but making it
an option like that would be fine as well.

BTW, why does your FAQ DTD support multiple QUESTION and ANSWER tags? How
do you know which answer goes with which question? I don't think assuming
that if one follows the other they belong together.

I am asking this because I think we should also support unanswered
questions. So maybe the structure should be:

<FAQ>
    <ENTRY>
        <SECTION>Section title</SECTION>
        <QUESTION>Duh?</QUESTION>
	<ANSWER fmt="fmt spec">Because!</ANSWER>
    </ENTRY>
    <ENTRY>
        <SECTION>Other Section title</SECTION>
        <QUESTION>Why because?</QUESTION>
        <!-- note: no answer.. -->
    </ENTRY>
</FAQ>

Eg. your DTD would be:
<?xml version="1.0"?>
<!DOCTYPE faq [
  <!ELEMENT faq (entry*)>
  <!ELEMENT entry (section, question, answer?, author?, email?, submitted?)>

  <!ELEMENT section   (#PCDATA)>  
  <!ELEMENT question  (#PCDATA)>  
  <!ELEMENT answer    (#PCDATA)>  
  <!ELEMENT author    (#PCDATA)>  
  <!ELEMENT email     (#PCDATA)>  
  <!ELEMENT submitted (#PCDATA)>

  <!ATTLIST answer
	fmt CDATA "structured-text">
]>

Using this DTD, all FAQ entries MUST have a section and question, but
answer, author, email and submitted are optional. If fmt is not specified,
it defaults to structured-text, so we can override this by using <ANSWER
fmt="">, or maybe fmt="none". This allows for future additional formats.

--
M.J. Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------