Here is a first shot patch for this:
http://pastie.caboo.se/109517
Take this with a grain of salt, since this is my first time playing
with the internals. There has to be a cleaner way of handling this
than using global variables to track state...
I also added some test cases. I'm sure I missed some instances, but I
tried to test the main ones.
Inline tags covered: ['a', 'abbr', 'acronym', 'area', 'base', 'bdo',
'big',
'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd',
'dfn',
'em', 'frame', 'hr', 'img', 'input', 'ins', 'kbd', 'label',
'legend',
'link', 'option', 'param', 'q', 'samp', 'select', 'small',
'span',
'strong', 'sub', 'sup', 'textarea', 'tt', 'var']
These should be customizable using the :inline_tags option.
I've provided this mostly for playing around until Hampton or Nathan
decides what should go in. Hopefully this will give a better feel for
what the results will be. I'll update the readme if the patch gets
accepted.
Have fun :)
On Oct 21, 3:57 pm, "s.ross" <[EMAIL PROTECTED]> wrote:
> On Oct 21, 2007, at 4:08 AM, Tom Stuart wrote:
>
>
>
>
>
>
>
>
>
> > On 21 Oct 2007, at 11:44, Evgeny wrote:
> >> My point was that sometimes the same element can be both block and
> >> inline, depending on where you use it.
> >> For example I would like my <li> to be inline everywhere - except
> >> the place where I make them display:block.
>
> > True enough -- some elements (div, object, ins, del, dd, li,
> > fieldset, button, th, td) can contain both inline- and block-level
> > content, so this is an interesting problem. Again I guess the most
> > magical solution is to render them inline-style if they don't contain
> > any block-level elements, and block-style if they do, but I don't
> > know how much effort it'd be to get the Haml parser to support that!
>
> > Cheers,
> > -Tom
>
> Why not take a different tack and shift the burden to the user:
>
> %li this is a list item
> %li
> so is this
> %li) this is an inline list item
> %li)
> so is this
> %li{:style => "display:inline;"})
> this list item display inline
>
> Maybe the right paren is a poor choice, but if the user can
> explicitly suppress the newline/indent, the all is hunky-dory, right?
> And nobody has to worry about what's valid HTML except the
> standardistas :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---