#172 new

Delimited content for custom tags?

Reported by bahuvrihi | October 2nd, 2009 @ 05:08 PM

I've been playing around with custom tags to generate simple forms. The gist is here (but note it's in progress).

My current approach is quite hacky in that it re-parses content for the form tag, more or less doing this:

    module SimpleFormHTML
      include RedCloth::Formatters::HTML

      def form(opts)
        content = RedCloth.new(opts[:text]).to(SimpleFormHTML)

      ... methods for inputs ...

An inconvenience of this approach is that it doesn't appear possible to compose markup that has miscellaneous stuff in the form. Things like this can work:

    form. post /action
    input. Label [key=value]
    button. Submit

But things like this can't (the list signals the end of the form content and ends up fragmenting the output):

    form. post /action
    input. Label [key=value]

    * why a list?
    * I don't know.

    button. Submit

Nesting markup in with tags like dl is possible with the ':= =:' delimiters. For example:

    - A := a
    - B :=
    * ok, this list
    * is fully in the dl
    - C := c

Can there be something added (or is there something I'm missing) that can grant me the ability to parse delimited content in a custom tag extensions?

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

RedCloth is a Ruby library for converting Textile into HTML

Shared Ticket Bins

People watching this ticket