I'm still not convinced about this behavior. We definitely need a way of telling Haml not to add whitespace in/around a tag, but I'm not sure this is the best way. In particular, I kind of feel like there should be a more general way to do it that then might be automatically enabled for inline tags.
Dylan Bruzenak wrote: > Updated version to remove the list of auto closed tags from the list > of elements that start an inline block. > > http://pastie.caboo.se/109535 > > Looks like there is one failing test having to do with auto-wrapping > ruby lines inside of an inline tag. Shouldn't this be wrapped at 50 > chars ? I don't see that in the .xhtml output either. I'm too tired > to repro this at the moment: > > > 2) Failure: > > test_templates_should_render_correctly(TemplateTest) > > [C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:49:in `assert_renders_correctly' > > C:\Development\open_source\haml_trunk\trunk\lib/haml/engine.rb: > 422:in `each_with_index' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:47:in `each' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:47:in `each_with_index' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:47:in `assert_renders_correctly' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:53:in `call' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:53:in `assert_renders_correctly' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:69:in `test_templates_should_render_correctly' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:68:in `each' > > C:/Development/open_source/haml_trunk/trunk/test/haml/ > template_test.rb:68:in `test_templates_should_render_correctly']: > > template: standard > > line: 37. > > <" This is a really long ruby quote. It should be loved and > wrapped because its more than 50 characters. This value may change in > the future and this test may look stupid. "> expected but was > > <"This is a really long ruby quote. It should be loved and wrapped > because its more than 50 characters. This value may change in the > future and this test may look stupid. ">. > > > > > On Oct 21, 8:14 pm, Dylan Bruzenak <[EMAIL PROTECTED]> wrote: > >> 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 -~----------~----~----~----~------~----~------~--~---
