I just realized I put the wrong method signatures here. I meant
haml_tag(name, *haml_attributes, html_attributes = {}) {...}
haml_tag(name, text, *haml_attributes, html_attributes = {}) {...}
We could also use less-verbose attribute names, e.g. haml_tag(:p, :>,
:<) { stuff }. Thoughts?
Nathan Weizenbaum wrote:
> Rymaï's solution would work. The problem with multiple methods is that
> we probably also want to add support for self-closing tags, which
> makes for way too many methods. Maybe something like
>
> haml_tag(name, html_attributes = {}, haml_attributes = {}) {...}
> haml_tag(name, text, html_attributes = {}, haml_attributes = {}) {...}
>
> So you could call it as haml_tag(:p, :chomp_outer_whitespace) { stuff }.
>
> On Tue, Jun 3, 2008 at 8:37 AM, [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> I think its easier if we separate in 3 diferent methods:
> haml_tag, haml_tag_inside and haml_tag_outside. This can be
> metaprogrammed easily (I think) and is compatible with older versions.
>
>
> On 2 jun, 15:18, Rymaï <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> > I don't really understand, do you mean that automatically
> > ":chomp_whitespace => :all" is transformed to
> > "chomp_whitespace='all'" ?
> >
> > In this case, maybe you should add an argument to the #haml_tag
> > method:
> >
> > haml_tag(name, html_attributes = {}, haml_attributes = {}) {...}
> > haml_tag(name, text, html_attributes = {}, haml_attributes = {})
> {...}
> >
> > Just a though...
> >
> > On Jun 2, 11:53 am, Nathan Weizenbaum <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > > The problem with this is that it makes it impossible to
> generate <img
> > > chomp_whitespace='all' /> and the like. While this probably
> won't come
> > > up in practice, the inconsistency worries me.
> >
> > > Rymaï wrote:
> > > > Something like:
> >
> > > > haml_tag(:blockquote, :chomp_whitespace => :outside) do
> > > > haml_tag(:p, :chomp_whitespace => :inside) do
> > > > Foo
> > > > Bar
> > > > end
> > > > haml_tag(:img, :chomp_whitespace => :all)
> > > > end
> >
> > > > Would be cool, though, maybe a more concise way would be
> better... :)
> >
> > > > On Jun 1, 6:25 pm, Nathan Weizenbaum <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > > >> Yeah, that would be good. I'd also like some way to create
> self-closing
> > > >> tags. I'm not sure what the syntax would be, though... any
> suggestions?
> >
> > > >> Rymaï wrote:
> >
> > > >>> Hi,
> >
> > > >>> Can we emulate '<' and '>' for #haml_tag method ?
> >
> > > >>> Thanks,
> >
> > > >>> Rémy.
> >
> > > >>> On May 10, 11:18 pm, Nathan Weizenbaum <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > > >>>> Hi folks,
> >
> > > >>>> The single longest-standing and most egregious lack of
> functionality in
> > > >>>> Haml, as detailed
> inhttp://nex-3.com/posts/75-haml-whitespace-handling-sucks-too
> <http://nex-3.com/posts/75-haml-whitespace-handling-sucks-too>, has
> > > >>>> finally been fixed. It's now possible to get Haml *not*
> to insertwhitespaceeither around or within tags.
> >
> > > >>>> The syntax for this is angle brackets, > or <, placed at
> the end of a
> > > >>>> tag (after the attributes but before = or / if you have
> them). You can
> > > >>>> think of them as alligators, chomping onwhitespace. > is
> chomping thewhitespaceon the outside:
> >
> > > >>>> %blockquote
> > > >>>> %p>
> > > >>>> Foo
> > > >>>> Bar
> >
> > > >>>> =>
> >
> > > >>>> <blockquote><p>
> > > >>>> Foo
> > > >>>> Bar
> > > >>>> </p></blockquote>
> >
> > > >>>> And < is chomping thewhitespaceon the inside:
> >
> > > >>>> %blockquote
> > > >>>> %p<
> > > >>>> Foo
> > > >>>> Bar
> >
> > > >>>> =>
> >
> > > >>>> <blockquote>
> > > >>>> <p>Foo
> > > >>>> Bar</p>
> > > >>>> </blockquote>
> >
> > > >>>> These aren't the best examples, because they're not
> terribly useful. But
> > > >>>> you can also do stuff like
> >
> > > >>>> %img
> > > >>>> %img>
> > > >>>> %img
> >
> > > >>>> =>
> >
> > > >>>> <img /><img /><img />
> >
> > > >>>> Or
> >
> > > >>>> %pre<
> > > >>>> :preserve
> > > >>>> Foo
> > > >>>> Bar
> > > >>>> Baz
> >
> > > >>>> =>
> >
> > > >>>> <pre>Foo
 Bar
 Baz
</pre>
> >
> > > >>>> You can use this right now by getting Haml from
> > > >>>> git://github.com/nex3/haml.git
> <http://github.com/nex3/haml.git> and running "rake install" to
> install it
> > > >>>> as a gem.
> >
> > > >>>> Many thanks to everyone who helped out with brainstorming
> how this
> > > >>>> feature should work, including Evgeny Zislis and Sunny
> Ripert on my
> > > >>>> blog, Nathan Sutton and Dustin Sallings on #haml on
> freenode, and many
> > > >>>> people in various conversations on this mailing list.
> >
> > > >>>> - Nathan
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---