On 04/07/07, Daisuke Maki <[EMAIL PROTECTED]> wrote:

One of the things that my HTML coders keep telling me about formfu is
that they want to create "block" elements that can be nested. A simple
example is something like

  - type: block
    tag: div
    elements:
      - type: block
        tag: span
        content: foo

that would produce <div><span>foo</span></div> taking this further, it
would be nice if you can specify a text block of sorts:

  - type: block
    tag: div
    elements:
      - type: plaintext
        content: foo
      - type: block
        tag: span
        content: bar
      - type: plaintext
        content: baz

Which would produce <div>foo<span>bar</span>baz</div>
This would mainly be used to generate HTML content that goes within a
form, like warnings or notes about the form inputs.

Does this sound reasonable?

I've changed the templates so that if the block's tag() is undef, the
start and end tags aren't rendered.

I've also added a new 'src' element which is a subclass of block.pm,
and it simply undef's the tag() for you.
You can use it's inherited content(), content_xml() and elements()
methods as usual.

So your example could be written like so:

- type: block
  tag: div
  elements:
    - type: src
      content: foo
    - type: block
      tag: span
      content: bar
    - type: src
      content: baz

Cheers,
Carl

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to