Re: [haml] escape a js snippet inside a view helper
Maybe call .html_safe on the string? (of course, you're gonna want to be *really* sure it's actually html safe) :brad On Tue, Apr 19, 2011 at 12:43 PM, Les Nightingill codehac...@comcast.netwrote: I have a view helper that I invoke from my haml view with: - text_field_with_clear_button(object, method) in application_helper.rb: def text_field_with_clear_button(*args) haml_tag :script, ...javascript snippet haml_tag :table do ..etc... end end The javascript snippet includes a , and this is being escaped as an html entity gt; Any idea how I can circumvent the html escaping, so that the properly appears in my js? thanks in advance for any ideas Les -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Re: Haml talk at upcoming Red Dirt RubyConf
Hey all, Sorry to double the advertising on this, but come to Red Dirt RubyConf! I'll be speaking on the awesomeness that is Haml and Compass. :brad On Tue, Apr 5, 2011 at 3:19 PM, ThirtySixthSpan derrick.parkhu...@gmail.com wrote: Limited late registration for 2 days of Red Dirt RubyConf for just $199 We are super excited to announce that we are now able to offer a special last-minute late registration for Red Dirt RubyConf to help anyone who might not otherwise have been able to afford to attend. Not already registered? You can still JOIN US for two days of conference presentations and hands-on training for the much reduced price of just $199 for a bare-bones access pass. http://reddirtrubyconf.com/program This is a limited offer that we expect will sell out. Red Dirt has one of the best conference lineups that you will see at any Ruby conference. Our speakers are world-class contributors in the Ruby and Javascript communities working for leaders in the industry including Obtiva, Intridea, ATT Interactive, Hewlett Packard, Heroku, ThoughtBot, and Engine Yard. Red Dirt is a content rich two-day conference to be held in Oklahoma City on April 21st and 22nd, 2011. http://reddirtrubyconf.com/schedule Can't make it? Join the live video stream or order the conference videos! http://reddirtrubyconf.com/program On Feb 18, 3:29 pm, ThirtySixthSpan derrick.parkhu...@gmail.com wrote: We're excited to have a talk on Haml at this year's conference: Haml and Compass: Pure, Uncut Awesome by Bradley Grzesiak of Bendyworkshttp://reddirtrubyconf.com/schedule --- Red Dirt RubyConf Program and Registration We are proud to announce the Red Dirt RubyConf 2011 program. http://reddirtrubyconf.com/schedule Red Dirt is a content rich two-day conference to be held in Oklahoma City on April 21st and 22nd, 2011. The conference program focuses on four themes including Ruby Implementations, Rails Extentions, Rails Redux and Javascript. We have 2 keynotes, 6 training tracks and 3 contribute to open source tracks. http://reddirtrubyconf.com/ Red Dirt has one of the best conference lineups that you will see at any Ruby conference. Our speakers are world-class contributors in the Ruby and Javascript communities working for leaders in the industry including Obtiva, Intridea, ATT Interactive, Hewlett Packard, Heroku, ThoughtBot, and Engine Yard. Red Dirt prides itself on being an all inclusive event. From beginning to end, this will be a great experience. You will have some of the best food you have ever had, there will be entertainment and plenty of time and comfortable space to meet, interact and learn from Ruby leaders and Heros. Registration is now open:http://reddirtrubyconf.com/program Don't miss early bird registration which ends March 1st. Can't make it? Catch the live video stream or get the conference videos!http://reddirtrubyconf.com/program -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] several open body tags in conditional statements?
Yeah, you pretty much have to write a helper. Or copy a helper that someone else has already made: https://github.com/sporkd/compass-html5-boilerplate/blob/master/lib/app/helpers/html5_boilerplate_helper.rb#L4 FWIW: I highly recommend starting all projects bootstrapped with the compass-html5-boilerplate gem. :brad On Mon, Mar 21, 2011 at 5:10 AM, Pietro Giorgianni giorg...@gmail.comwrote: Hi, I'm trying to use the solution described here: paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ with the addition of a ruby-determined class. This is what I'm trying to get: !--[if lt IE 7 ] body class=ie6 #{some ruby expression} ![endif]-- !--[if IE 7 ]body class=ie7 #{some ruby expression} ![endif]-- !--[if IE 8 ]body class=ie8 #{some ruby expression} ![endif]-- !--[if IE 9 ]body class=ie9 #{some ruby expression} ![endif]-- !--[if gt IE 9] body class=#{some ruby expression} ![endif]-- !--[if !IE]!-- body class=#{some ruby expression} !--![endif]-- my html /body Is there a way to get haml to do this, or am I forced to write an helper method that emits the open body tags as a string? P.S. I'm using Ruby on Rails, but I don't think it matters. thanks pietro -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Using tap with Haml to create scoped local variables
I haven't seen this behavior with tap and HAML. For me, it works as you expect: it doesn't output the tapped variable. Are you sure you used a '-' rather than a '='? :brad On Thu, Mar 17, 2011 at 5:51 AM, Szymon Nowak szi...@gmail.com wrote: I know, but in ERB I prefer using #tap to scope local variable - this way it's only available inside the block where it's needed and not in the whole view. Usually the code can be simply refactored into a helper method, but sometimes it was useful. Thanks, Szymon -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] HAML * operator returns em instead of px
Maybe try this? $line-height-multiplier: 1.3; $line-height: $line-height-multiplier * 1em; $font-size: 18px; $height: $line-height-multiplier * $font-size; Yeah, it's one extra var to keep track of, but it should get you the desired functionality. :brad On Tue, Jan 4, 2011 at 3:30 PM, Abhik Pramanik abh...@gmail.com wrote: That would make sense for pixels * pixels, but em is essentially a multipler, right? Abhik -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Configure sass not to autocompile?
Presuming you're using Bundler, you could possibly move Sass into the development group, and do: heroku config:add BUNDLE_WITHOUT=development:test Just a thought... :brad On Sat, Dec 18, 2010 at 4:53 PM, Andrew Burleson burles...@gmail.comwrote: I have a site that runs on Heroku... I'm sure you've heard the story. So I made a simple rake task that compiles everything, and I can run this before deploying to Heroku so all my CSS is up-to-date and checked in as static assets. This is working fine, and I haven't encountered a problem yet, but I've been warned that if, for some reason, Sass tries to update a file for me (while running on Heroku) that it's going to throw an exception. The easy fix for this would be to just tell Sass not to autocompile in Production, but I haven't been able to find how to do that. Any pointers? Thanks! -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Re: How do I put a strong tag inside of a link_to
haven't tested it, but this should work. %li= link_to 'Create strongFREE/strong Whatever'.html_safe, new_path Remember, though, that playing with .html_safe is like playing with knives. very sharp, stabby knives. :brad On Mon, Nov 15, 2010 at 8:07 AM, Sean seanmay...@gmail.com wrote: Actually that didn't work it outputs the lt;'s etc to the screen - I had to install RedCloth for :textile %li %a{ :href = new_path} :textile Create *FREE* Whatever On Nov 14, 8:54 pm, Nathan Weizenbaum nex...@gmail.com wrote: That's probably the easiest way to do it. On Sun, Nov 14, 2010 at 4:58 PM, Sean seanmay...@gmail.com wrote: %li= link_to 'Create strongFREE/strong Whatever', new_path -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.comhaml%2bunsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.comhaml%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] stucked in trying to align a button and a string
The underlying issue is that the Rails button_to helper generates a form around the button. Forms are block-level elements unless styled otherwise. So the quickfix would be to do some CSS like: form { display: inline; } The meta-problem is that you're using a button to perform a non-data-modifying request. In general, you should be using a link to do this. If you want the link to look like a button, check out fancy-buttonshttp://github.com/imathis/fancy-buttons/, for which you'd need to use Compasshttp://github.com/chriseppstein/compass . :brad On Mon, Oct 11, 2010 at 12:14 PM, kadoudal kadou...@gmail.com wrote: writing = button_to #{I18n.t('sign_up')}, new_user_registration_path, :method = :get = or Continue as guest gives me the button as block and then the string on the following line... any trick to display the string on the same line with the button ? thanks fro any suggestion ... erwin -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Multiple Backgrounds
s/Try (.*)$/Patch \1 then use it/ My bad. :brad On Tue, Jul 27, 2010 at 1:39 PM, Chris Eppstein ch...@eppsteins.net wrote: We don't handle multiple backgrounds in compass yet. I'd love to see some recommendation about how that would work. I think we might actually need some sass support to do it right. chris On Tue, Jul 27, 2010 at 11:35 AM, Bradley Grzesiak listro...@gmail.comwrote: Try compass. http://compass-style.org/ :brad On Tue, Jul 27, 2010 at 10:38 AM, Igbanam xigba...@gmail.com wrote: Is there an implementation of multiple backgrounds in the sass or scss? -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Javascript / CSS minification
You could just write your own :jsmin filter. :brad On Tue, Jul 20, 2010 at 1:00 PM, David Balatero dbalat...@gmail.com wrote: It feels a little out of scope of the haml project, but that's just my first instinct. Maybe there's a simple way to drop in that functionality (optionally) -- via a separate plugin gem, maybe? On Tue, Jul 20, 2010 at 10:58 AM, Nathan Weizenbaum nex...@gmail.comwrote: That's true, that would also work. The question then is how to do the minification itself. On Tue, Jul 20, 2010 at 10:42 AM, David Balatero dbalat...@gmail.comwrote: Unless it was a global setting, not a per-filter setting? On Tue, Jul 20, 2010 at 10:41 AM, Nathan Weizenbaum nex...@gmail.comwrote: This is not possible currently, since filters don't take options. On Tue, Jul 20, 2010 at 10:36 AM, rafudu raf...@gmail.com wrote: Hi! Is it possible to minify the code inside the :javascript blocks automatically? It would be good if the :sass / :css could have the same option. regards, rapha -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.comhaml%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Deprecated Block Helpers
I'm under the impression that this is how it should be done these days: - foo.each do |bar| %p= bar = form_for :foo do |f| = f.text_field :bar The difference is that `form_for` represents a form tag (among other semantics) while `each` doesn't represent an HTML entity. Please (!!) correct me if I'm wrong. :brad On Wed, Jul 7, 2010 at 10:17 PM, Bryce Thornton brycethorn...@gmail.comwrote: I'm a bit confused about the deprecated block helpers in haml3. I get this warning: DEPRECATION WARNING: - style block helpers are deprecated. Please use =. When I go to use = instead of - I can't get it to work the way I expect. It seems to always output the return value of the block once it completes. Here's an example: statuses = ['foo','bar'] = statuses.each do |status| = status This will output foo bar foobar whereas it will properly output foo bar when using the deprecated style. Can someone explain this new block helper format? Thanks! -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] erb renders in production
I think it's actually a problem with Rails, which is fixed in Rails 3. Anyway, why keep them around? That's what source control is for! And if you don't know how to use your source control tool that well, now's a great time to learn. :brad Bradley Grzesiak co-founder, bendyworks llc On Jun 18, 2010, at 12:10 PM, newellista newelli...@gmail.com wrote: I have a mixed HTML/HAML rails site. In a few cases, we have converted the erb files to haml, but have left the erb file in the directory. In development, the .haml files always render, but in production, it appears that the .erb files render instead. I realize I can (and should) remove the offending .erb files, but this behavior seems to indicate a problem with the haml system. Is this working as designed and I am confused? Or should the .haml files always be rendered, if available? Thanks, Steve -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] getting started with haml..
I'd give more info, but I've gotta get to a frisbee game. Take a look at http://staticmatic.rubyforge.org/ :brad On Mon, Jun 14, 2010 at 5:30 PM, Jaime rogal...@gmail.com wrote: Hello! This is probably a stupid question, but I'm really hoping someone here can help me out. The situation: I'm a web designer, I write all my pages in Notepad2, save them as .html and then check the result in firefox. nice, easy, simple. I've never touched ruby, rails, or pretty my anything more complicated than a php include. I do graphic work for a programmer, making designs and the basic page and he makes it work. We're starting a big project soon and he has asked me to take a look at haml and write the pages with that instead of html. The language itself looks like it will be easy enough to pick up. The problem I'm having is I can't figure out how to get a .html.haml file to show up in a browser as a web page. I've been to haml-lang.com, installed ruby on my machine, and I'm pretty sure i installed haml correctly using the start command prompt with ruby thing as per the tutorial...and that's where I get lost. this all seems like so much work just to write a simple html page without any scripts or anything! any help/tips/advice anyone has would be GREATLY appreciated! Thanks! -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Re: HTML5 Naked Attributes
FWIW, an attribute like autofocus=autofocus is perfectly valid HTML 5. It's slightly more verbose than necessary, but it shouldn't throw any validation errors. I don't think it's even set for deprecation. :brad On Thu, May 13, 2010 at 6:01 AM, Mislav Marohnić mislav.maroh...@gmail.comwrote: On Thu, May 13, 2010 at 07:28, Nathan Weizenbaum nex...@gmail.com wrote: Form helpers are a completely separate thing from Haml tags. They're provided by Rails and don't make any use of the Haml tag-rendering infrastructure. So it's not that surprising that they don't support boolean attributes. Also, it's worth noting that Rails 2.3 tag helpers always generate XHTML. I monkeypatched this in my Standardista plugin: http://github.com/mislav/standardista/blob/master/lib/standardista/rails_override.rb http://github.com/mislav/standardista/blob/master/lib/standardista/rails_override.rbI believe they handle some boolean tags like checked or disabled, but it's a small whitelist and definitely doesn't support HTML5. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Reason for SCSS Change?
%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Conditionally setting an attribute
You'd have to do something like: %a{:href = post.link, :title = (post == posts.last ? last post : )} With your way, :title was being set to nil, which throws an error. Frankly, I see a feature request coming out of this: if an attribute is set to nil, don't render the attribute. Thoughts? :brad On Thu, Mar 18, 2010 at 12:45 AM, Nathan Weizenbaum nex...@gmail.comwrote: Can you post the whole error backtrace? On Wed, Mar 17, 2010 at 8:57 PM, jbrennan i.jasonbren...@gmail.comwrote: As a simplified example of what I'm trying to do, say I'm displaying a bunch of Posts on a page. My partial would look something like this: - @posts.each do |post| %a{:href = post.link} %p= post.body But what I want to do is set an attribute on the link for the *last* post of the page like - @posts.each do |post| %a{:href = post.link, :title = (last post if post == posts.last)} %p= post.body I've tried the above code but I get an error saying can't compare to nilClass, and I'm not sure why either the sender or receiver would be nil, as the things I'm rendering show properly (all of them). Any ideas what I'm doing wrong? Thanks in advance. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Improve output indentation?
I wouldn't keep this enabled in production, but you should be able write a Rack output filter that does a regex on XML files. Just a thought. :brad Brevity disclaimer: Sent from my iPhone --- bradley grzesiak co-founder, bendyworks llc On Feb 28, 2010, at 10:59, dreamcat four dreamc...@gmail.com wrote: On Sat, Feb 27, 2010 at 9:18 PM, Nathan Weizenbaum nex...@gmail.com wrote: The problem is not so much that the specific indentation has been hard-coded (it has in a few places for reasons of simplicity, but not enough that they would be terribly difficult to change). The bigger problem is that there are numerous places where indentation is important for more than generation: re-indenting code that's already indented, for instance. This is the stuff that would be difficult to track down and get exactly right, especially with an arbitrary string as indentation. Thank you for explaining Nathan. Thats good to know. So its all these surrounding features which affect / are affected by and expecting the fixed 2spc haml indentation level. Perfectly understandable. Expect me to stay away from this until I feel confident enough about those feature set. Unfortunately this is a bit beyond me just at the moment. So, for later then. :) dreamcat4 dreamc...@gmail.com -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en . -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Breaking up a long line of code in HAML
Nathan's got it. I always feel elitist when I say this, but here goes: needing to wrap a haml line is generally a code smell. In addition to creating a well-named helper, you may want to look at reducing the number of instance variables passed to your view. Without knowing your application logic at all, it seems like you should be able to combine @users and @roles_array. Just a suggestion. :brad Brevity disclaimer: Sent from my iPhone --- bradley grzesiak co-founder, bendyworks llc On Feb 27, 2010, at 18:12, Nathan Weizenbaum nex...@gmail.com wrote: The best solution is to move this into a well-named helper method and call that from your template. On Sat, Feb 27, 2010 at 2:56 PM, Bharat bcrupa...@yahoo.com wrote: Please take a look at the following line of HAML code (it works): = render :partial = 'shared/crud_maint_table', :object = @users, :locals = {:controller_name = 'users', :columns = ['id','username','email','active'], :search_fields_array = @search_fields_array, :status_array = @role_array, :actions = 'user_actions'} Someone with more experience in HAML, please advise on how to break it up into multiple lines using | character (or something better) so that it is readable? Thanks. Bharat -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en . -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en . -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] issues with text decoration and underline
Here ya go! http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#whitespace_removal__and_ :brad Brevity disclaimer: Sent from my iPhone --- bradley grzesiak co-founder, bendyworks llc On Feb 13, 2010, at 2:00, Patrick Aljord patc...@gmail.com wrote: Hey all, If I do the following: %span.state foo and in sass: .state text-decoration: underline It create a span like that: span class=state foo /span The problem is that it adds a white space after the inner text foo in that case and as a consequence it underlines that white space after foo which I don't want. Any way to fix that? Thanks in advance, Pat -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/haml?hl=en . -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Re: Inconsistent indentation
The call to 'strip' is unnecessary. Also, I suggest this instead, since you don't want to change the 'number_of_spaces' parameter when you refactor: module Shamaoke module StringAdditions def lcolstrip spaces = self.lines.select do |l| l.match /\S/ end.reduce(self.length) do |m, l| (x = l.length - l.lstrip.length) m ? x : m end self.gsub /^ {#{spaces}}/, '' end end end String.send(:include, Shamaoke::StringAdditions) Cheers! :brad On Fri, Jan 29, 2010 at 8:24 AM, P.A. shama...@hotmail.com wrote: I've found another solution combining your idiom and my method. # begin require 'haml' template = %{ %html --%head %title --%body %div }.strip.gsub(/^\s{4}/, '') Haml.Engine.new(template).render # end Of course, you feel free to make a helper method to improve this awkwardness. # begin class String --def adtemp(number_of_spaces) # adjust_template self.strip.gsub(/^\s{#{number_of_spaces}}/, '') --end end new_template = %{ %html --%head %title --%body %div }.adtemp(4) # end Of course, we can improve it further. We need to add the adtemp method in the HAML code and use it in a begin-rescue block which will watch over the Inconsistent Indentation error. On Jan 29, 4:13 pm, P.A. shama...@hotmail.com wrote: Brilliant! That's exactly what I want. The problem was to organize controller, view and spec code in a single file. And now it's done. If you interested in that code what I got, please see below. (It might be problems with an indentation in email.) # gems: # - rack; # - sinatra; # - haml; # - rspec; # - rack-test. # controller.rb # application require 'sinatra' require 'haml' class Controller Sinatra::Base set :environment, ($*[0].to_sym if $*[0].respond_to? :to_sym) || :test template :layout do -haml.gsub(/^\s{6}/, '') %html %head %title %body %div = yield haml end template :test do -haml.gsub(/^\s{6}/, '') %div Works! haml end get '/' do content_type 'text/html; charset=utf-8' haml :test end end # run code if Controller.development? Controller.run! end # spec require 'spec' require 'rack/test' describe 'Sinatra application' do include Rack::Test::Methods def app Controller end it 'should response to /' do get '/' last_response.status.should == 200 end it 'should return a text/html document' do get '/' last_response.headers['content-type'].should == 'text/html; charset=utf-8' end it 'should return a standart html template' do get '/' template = /html.*\/html/m last_response.body.should =~ template end it 'should return a standart html template with a partial included' do get '/' template = /html.*divWorks!\/div.*\/html/m last_response.body.should =~ template end end # how it works # spec $ spec controller.rb # app $ ruby controller.rb development Thank you for the help. On Jan 28, 11:30 pm, Bradley Grzesiak listro...@gmail.com wrote: You could do this: # dashes are actually spaces, for clarity in email template = -EOF.gsub(/^\s{4}/, '') %html --%head %title --%body EOF I tweeted about this last August. =Phttp:// twitter.com/listrophy/status/3382558239 :brad On Thu, Jan 28, 2010 at 1:35 PM, Nathan Weizenbaum nex...@gmail.com wrote: The problem is that, as the error message says, your indentation is inconsistent. Once you strip your template, it looks like this: https://gist.github.com/c50eed9d9965aae844bc. The first indentation Haml sees is for %head, which is indented 8 spaces. It then expects 8 spaces to be the amount you'll indent by in the future, but %title is only indented by 2 spaces beyond %head. Thus, it raises an error. On Thu, Jan 28, 2010 at 7:49 AM, P.A. shama...@hotmail.com wrote: Hi. I have next code. # begin require 'haml' template = %{ --%html %head %body }.strip Haml::Engine.new(template).render # end It works fine and render the template. But if I add the %title tag inside the %head... # begin require 'haml' template = %{ --%html %head --%title %body }.strip Haml::Engine.new(template).render # end ...I get the error: Inconsistent indentation: 10 spaces were used for indentation, but the rest of the document was indented using 8 spaces. What is the problem of this error? How can I resolve it? Thanks. Debian GNU/Linux 5.0.3; Ruby 1.9.2; Haml 2.2.17. -- You received this message
Re: [haml] Changing form context within a td?
Can't you just pull the fields_for call outside the %tr? fields_for doesn't actually output anything, so as long as you're careful with your 'a' and 'b' objects, you should be fine. ...I think. :brad On Thu, Jan 28, 2010 at 3:41 PM, John Wells jbwell...@gmail.com wrote: Guys, I ran across something today I'm not sure haml can handle, and I'd really appreciate any guidance you can offer me. We're converting our erb over to haml and enjoying it so far. However, we have a form that places fields within the same td into to different contexts with fields_for. Additionally, follow on tds are in the second context. So, in erb, it looks like this: % form_for @obj do |a| % table tr td %= a.label :name % %= a.text_field :name % % fields_for :address, @address do |b| % %= b.label :street % %= b.text_field :street % /td td %= b.label :city % %= b.text_field :city % /td /tr /table % end % % end % This example is very contrived and not the real example, but you get the idea. Translated to haml, this becomes: - form_for @obj do |a| %table %tr %td = a.label :name = a.text_field :name - fields_for :address, @address do |b| = b.label :street = b.text_field :street %td = b.label :city = b.text_field :city See the problem? Introducing a block within a %td, that should really transcend %tds breaks haml's assumptions here, I think. If I indent the second %td to be within the - fields_for block, haml thinks it's a td nested within a td. It's not. I'm not sure this is even possible in haml, although I think there are occasionally valid reasons to do this. Can anyone help? Thanks! John -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Which companies are using Haml?
While we're not exactly as big as NVIDIA, bendyworks [1] exclusively works with HAML and SASS. It's part of our unofficial employ-the-most-effective-tool-that's-enjoyable-to-use policy. :brad [1] http://bendyworks.com/ On Mon, Jan 18, 2010 at 7:52 AM, Gavin Kistner phr...@mac.com wrote: On Jan 18, 2010, at 12:49 AM, Amy Lee wrote: I'm giving a presentation to the San Francisco Ruby Meetup group on a quick intro to Haml. I'd like to include a slide about some companies using Haml right now. Does anyone have a list? - Unspace - Hashrocket - Wikipedia Mobile I work for NVIDIA[1] and am using it personally as part of a budding documentation system[2] for the PhysX Plug-ins for 3ds Max[3], and am in the process of trying to convince some other teams to use this same system. (In a week I might be able to say what larger team/software group was using it, but it's not sure yet.) [1] http://www.nvidia.com/ [2] http://github.com/Phrogz/docubot [3] http://developer.nvidia.com/forums/index.php?showtopic=3990 -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] WTF
The professor wrote L' = -ρVΓ on the board. We all marveled at the simplicity when he told us that it defines the lift of a 2-D wing. What? That can't be, someone said. It is. In fact, it describes the lift of any 2-D body in an incompressible fluid, he stated. Span-wise lift equals the negative fluid density times the free-flow velocity times the circulation. We then spent the next few classes of this aerodynamics class learning the proof behind this incredibly simple equation. We dove into Taylor expansions, Green's Theorem, and (if I recall correctly) Laplacian Transforms. Once we got done, we each had a number of pages that fully decomposed this simple equation into something that was finally intuitively provable. We then spent another couple weeks applying the formula to various shapes as point vortices and finally panel vortices. I bring this all up because it took me a long time in school to get to the point where I could even keep up with the professor. Even though the equation looked simple, showing that it actually meant something took a ton of effort. Blueprint is great. Compass is awesome. Haml, as far as I'm concerned, absolutely rocks. But I say this as someone who has spent years making my way to the point where I can read the quick start guide and simply go. When I found out about Haml, Sass, Compass, and Blueprint, I had already made it 95% of the way there. I already knew linux, os x, ruby, rails, etc. I had, in effect, taken all of the pre-requisites for something like an Aerodynamics class. DogBot, you're not there yet, but I wish you the best. When you get stuck, ask for help from friends, IRC, mailing lists... whatever is at your disposal. If you stay positive and open your mind like a sponge, you'll get there with the help of your persistence and various communities. I'm not intending to talk down to anyone... just trying to explain that something may look simple at first blush, but there's bound to be plenty of knowledge required to work with it correctly. Best, :brad PS: As someone who doesn't use Windows for development, I can't help you with installation issues. I can say, however, that you can work with any non-rich-text text editor (eg: notepad, notepad++, scite, etc). Also, rails is not necessary for sass, but you'll likely find the most documentation (and community members) relating the two. PPS: Emacs navigation keys are neat once you get them into muscle memory. I navigate most text fields in os x with them. On Mon, Jan 18, 2010 at 8:37 PM, DogBot alejo.col...@gmail.com wrote: I know that is really vulgar. Sorry. But this is the first time in my life I have ever said that so many times as I try to understand something new. It all starts when I see this cool video about coding for blueprint. A framework ...Compass..The idea rocks! so Im like..lets get this..but then it says I need SASS...hmmm ok...another framework??? hmmm WTF...fine lets get that too!! wait..IT says that I need Haml..WTF??? ok what is that...dont know..another framework...ok ...fine...let's get that too.WAIT...it runs on Ruby??huh? WTF??? ok lets see what that is all abouthmmm..a programming language!!!WTF!!!...not for windows..WTF.kinda for macs..WTF..but hey It has a WIN distribution after all..ok lets get that..the instructions are like just ruby install/done WTF??? where??? I download install a webpage opens..it's effing broken..where do I put ruby install/done..after a day I figure out I have to use windows command promt!!! WTF ok this this ruby is finally working..it like a server or something, WTF..it is running..now I need a GEM??WTF! something about Ruby on Rails..multiple versions some older that others I am getting a massive headache... back to the haml site one way or another it seems I need something called EMACS..WTF..! I dare you to install it and see how many WTFsss you will sayit's like some text editor that is so smart that you dont use the mouse dont even use the cursor keys..if you want to go back one character you hit control then B!!! Brilliant!!! two random keys instead of one with an arrowWWWTTT!! ok I might not need this crap lost a day learning to use the Rubik cube of text editors. back to haml. back to sass. back to compass. Install: sudo gem install compass WHAT THE FUCK! where do I put that??!!! -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak co-founder, bendyworks llc http://bendyworks.com/ -- You received this message because you are subscribed
[haml] switching to bundler kills layout templates
Hey all, I'm trying to switch to bundler for gem maintenance, but I'm running into an issue. When running script/server and viewing the app in development mode, everything works fine. When I try to run it in the cucumber environment, the application layout doesn't get used. In other words, instead of wrapping a view in the application layout, rails just renders the view. This leaves me with some really basic views. The HAML is indeed being translated into HTML, but I don't understand why the application layout isn't being used. In my Gemfile, the cucumber environment mimics development with the addition of cucumber-related gems. I don't know if this is strictly a HAML issue... the non-inclusion of app/views/layouts/application.html.haml leads me to think it might. TIA, :brad -- Bradley Grzesiak listro...@gmail.com -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
[haml] undefined method `rails_root' for Haml::Util:Module
Hey all. I'm getting this error message when running rake on my rails app: undefined method `rails_root' for Haml::Util:Module /Library/Ruby/Gems/1.8/gems/haml-2.2.15/rails/../lib/haml/template.rb:64 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' [...rest of stack trace...] This happens on my dev machine and the staging and production servers, but not my coworker's dev machine. Any ideas? Thanks! :brad -- Bradley Grzesiak listro...@gmail.com -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Re: [haml] Showell Markup
I agree with Chris, but on a separate level. While I agree that content is very important, the corresponding context is also important. By implementing HTML in a semantic way, we – as authors – provide (hopefully) minimal hints at the context just before the content. Of course, this falls away as we start piling on extra markup like a giant style attribute (which, arguably, is poor semantic authoring). Anyway, I appreciate Steve thinking outside the box, but in the end... it's not for me. :brad On Fri, Nov 27, 2009 at 3:13 PM, Chris Eppstein ch...@eppsteins.net wrote: The haml-spec project is creating a standard test suite for haml implementations. A python implementation of Haml seems like a no-brainer... I'm surprised one doesn't exist yet. As far as your new syntax ideas go with putting the content before the markup, I'm not a big fan. Content may be king on the internet but it is rarely the most important part for the programmer. I care about what the ID and classes are for my elements and this is the part that haml optimizes so nicely. Haml is awesome for structural markup. When it comes to markup for content I often use markdown via the haml markdown filter. Chris On Fri, Nov 27, 2009 at 10:43 AM, Steve Howell showel...@yahoo.comwrote: Hi everybody, I found about HAML recently and think the concept is pure genius! Since I work mostly in Django, I decided to create a markup that is similar to HAML. I use it as a preprocessor for Django templates. You can read more here: http://groups.google.com/group/django-users/browse_thread/thread/7a8fbac4572d5c25# I have an idea that I think might resonate with the HAML community. First, let me say that HAML does a great job of providing indentation- based syntax, and that is 80% of the pain when dealing with non-HAML solutions. I have made no innovations there; instead, I have just ported the concept to Django use cases. Where I differ from HAML is in HTML one-liners. HAML puts the markup on the left: %strong{:class = code, :id = message} Hello, World! Showell Markup puts the markup on the right: Hello, World! | strong class=code id=message The idea is that Content is King! Markup is just an afterthought. And you can also chain markup as follows Hello, World | strong | span class=greeting Start with the content, and then apply markup from left to right, with each new element surrounding the previous. You get this result: span class=greetingstrongHello, World/strong/span I hope this makes sense. Good luck bringing HAML to the masses! It is important stuff. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com haml%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en. -- Bradley Grzesiak listro...@gmail.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. -- You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to h...@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
[haml] Re: get all assigned variables used in teh templates (HAML/PHP)
First of all, this doesn't really seem to be a HAML question. Not that I care... just saying it's more of a Rails question. Anyway, I haven't used it yet, but Rack::Bug looks super-awesome and similar to what you might be looking for: http://www.brynary.com/2009/4/22/rack-bug-debugging-toolbar-in-four-minutes :brad On Sat, Nov 7, 2009 at 11:36 AM, annemarie tannengrund annemarie.tannengr...@googlemail.com wrote: hi, im looking for a HAML function that does something similar to the smarty debug. in smarty you can put {debug} in your template, this opens a popup wich gives a overview over used assignments and their variables. also it gives a list of used/included templates. is there something similar in php HAML? -- Bradley Grzesiak listro...@gmail.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Table question.. not sure what to put as a subject..
On my iPhone, so I'll keep it brief... Google rails in_groups_of - [1,2,3,4,5,6,7].in_groups_of(3, 'nbsp;') do |group| %tr - group.each do |item| %td= item This should at least be reasonably close to what you need. No guarantees on my syntax. :brad On Sep 6, 2009, at 18:57, Tim W tiwat...@gmail.com wrote: How does one do this in Haml? Say I have an array [1,2,3,4,5,6] and I want a table like... table tr td1/td td2/td td3/td /tr tr td4/td td5/td td6/td /tr /table I have done it may times, but never in haml.. %table - [1,2,3,4,5,6].each_with_index do |n,i| - if i%3 == 0 %tr %td= n This gives a result of... table tr/tr td1/td td2/td td3/td tr/tr td4/td td5/td td6/td /table How do I get the tr to wrap the 3 td's? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: SASS won't allow space before colon in property definition
Two things: 1. If you use textmate, no plugin is required to perform css2sass. Just right click in the editor area and choose Filter through Command (or press cmd-opt-R). Choose the right settings in the dialog box, fill in css2sass and voilà. 2. There are Haml syntax plugins for Textmate that will highlight *some* invalid syntax. Specifically, semicolons at the end of lines and an extra colon around a selector (eg. :color: ) I suppose this only helps if you're on a mac with textmate. If you aren't... why not? =P :brad On Aug 27, 2009, at 23:41, Nathan Weizenbaum nex...@gmail.com wrote: This is something that will probably become allowed as we move to allow more CSS-like syntax. On Wed, Aug 19, 2009 at 5:51 PM, Bill Burcham bill.burc...@gmail.com wrote: New to SASS so I naturally started w/ the colon after the property name syntax since it's close to CSS. However I notice the colon has to be right next to the property name. No whitespace is allowed. So this works: text-transform: none But this does not: text-transform : none The SASS doc says simply that the colon must be between the property name and its value (not that whitespace is illegal before the colon). IIRC CSS also allows space before. (at least this person thinks so: http://www.css-zibaldone.com/articles/syntax/css-syntax.html) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Haml 2.2, Sass 2.2, and Compass 0.8.3 have been released!
Nicely done! I noticed the veritable crapload of commits on github. Thanks! :brad On Mon, Jul 6, 2009 at 10:26 AM, Chris Eppstein ch...@eppsteins.net wrote: In case you haven't yet heard, Nathan released haml sass 2.2 early this morning after a marathon weekend of coding. Please read his blog post here: http://nex-3.com/posts/84-haml-sass-2-2-released Haml Sass have new websites: http://haml-lang.com http://sass-lang.com Read the change logs: http://haml-lang.com/docs/yardoc/HAML_CHANGELOG.md.html http://sass-lang.com/docs/yardoc/SASS_CHANGELOG.md.html Compass 0.8.3 was also released to change the gem dependencies and add a couple features: http://github.com/chriseppstein/compass/blob/master/CHANGELOG.markdown Important note: If you're upgrading from the stable version of sass, you must be aware that silent comments (//) will now comment out the content indented below them. If you use silent comments, please upgrade to 2.0.10 (also released last night) to get deprecation warnings and fix them before upgrading to 2.2. -- Bradley Grzesiak listro...@gmail.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: how to render a haml subtemplate
Because it is a subtemplate - or partial - you need a leading underscore on its filename. :brad On Jun 23, 2009, at 0:50, Doug dgoldi...@gmail.com wrote: I just tried to use a subtemplate to render the login view my main page. ...both the subtemplate and the current template are haml. render user_session/new = render user_session/new.html = render user_session/new.html.haml I tried all three; it couldn't find any of them. ex: Missing template user_session/_new.html.haml in view path app/views What am I doing wrong? ...I'm sure it's silly. thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Best way to do conditional body tag in HAML
right... the hyphen... don't forget that. *slaps forehead* nice helper by the way. i look forward to never having to use it because all browsers are standards compliant (in about 40 years). =) :brad On Tue, Jun 23, 2009 at 11:46 PM, Chris Eppstein ch...@eppsteins.netwrote: Like this: !!! %html %head %title This is the tile - conditional_body do %p This is text in the body. -chris On Tue, Jun 23, 2009 at 9:39 PM, Noel wwydi...@gmail.com wrote: how do you use that? ...n00b On Tue, Jun 23, 2009 at 8:48 PM, Chris Eppsteinch...@eppsteins.net wrote: That's pretty sweet. chris On Tue, Jun 23, 2009 at 8:45 PM, Nathan Weizenbaum nex...@gmail.com wrote: For this sort of thing, I just use a simple string-manipulating helper: http://gist.github.com/134988 On Tue, Jun 23, 2009 at 1:11 PM, scottwb scot...@gmail.com wrote: I bet somebody has a better way, but here's something I've done before - capture the haml and then render it with or without the %body based on your conditional. Not real pretty, but at least the ugliness is mostly just confined to the top and bottom of the file. Something like this: - body = capture_haml do - ...haml for everything in layout... - if request.env['HTTP_USER_AGENT'] !~ /msie/i %body= body - else = body Noel_g wrote: Following up on this compass thread http://groups.google.com/group/compass-users/browse_thread/thread/fbe8470caccec27b What would be the best way to implement the conditional body tag in my HAML layout? http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ I thought I could do /[if !IE] %body /[endif] but that doesn't work. On the Compass thread someone mentioned that it would need to be done in erb. So would I do :erb !--[if !IE]-- body !--![endif]-- Is this the best way to do this? -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: debugger doesn't work while inside haml templates
While I might agree that it would be annoying to have any part of an application immune to debugger calls, the view is the least important area for it. Using the debugger immediately before leaving the controller should suffice, assuming you adhere to strict no-code-in-the-view standards and have full test coverage of your helpers. ...just sayin'. :brad On Mon, Jun 8, 2009 at 11:14 AM, Dan Z danielza...@gmail.com wrote: Here's what happens when the debugger is called (anywhere) while the Haml template is being processed: INTERNAL ERROR!!! wrong argument type StringIO (expected File) /var/lib/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/interface.rb: 112:in `readline' /var/lib/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/interface.rb: 112:in `readline' /var/lib/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/interface.rb: 62:in `read_command' /var/lib/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/processor.rb: 246:in `process_commands' /var/lib/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug/processor.rb: 171:in `__at_line' (eval):5:in `at_line' (eval):3:in `synchronize' (eval):3:in `at_line' /var/lib/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb: 54:in `at_line' [ backtrace continues in my application code ] This is a very annoying problem because almost all my templates are Haml, and therefore, I can't debug any code that's run while inside the template. -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: nested tags not showing up nested
From http://www.w3.org/TR/html401/struct/text.html#h-9.3.1 The P element represents a paragraph. It *cannot* contain block-level elements (including P itself). [emphasis mine] On Fri, Jun 5, 2009 at 8:11 AM, Josh josh.m.sha...@gmail.com wrote: To be cute I did this as a temporary placeholder... %h3 Calendar %p This is %p where the %p calendar %p will go This is the resulting markup: div id=calendar h3Calendar/h3 p This is /pp where the /pp calendar /ppwill go/p /div Notice that the P tags are not nested. Is this expected behavior? Maybe nesting P tags is illegal in which case shouldn't HAML be throwing an error? Either way I think something is a bit awry. -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: 'HamlHelper locale_attrs should set the right XHTML header with default locale' FAILED
use this: x.should == y instead of: x.should eql(y) This looks like an rspec issue, not a haml one. On Wed, May 27, 2009 at 8:13 AM, Mark A. Richman markarich...@gmail.comwrote: I have the following helper, which fails when I run rake spec: 1) 'HamlHelper locale_attrs should set the right XHTML header with default locale' FAILED expected {:xmlns=http://www.w3.org/1999/xhtml;, xml:lang=en, :lang=en} got {:xmlns=http://www.w3.org/1999/xhtml;, xml:lang=en, :lang=en} (compared using eql?) ./spec/helpers/haml_helper_spec.rb:9: 2) 'HamlHelper locale_attrs should set the right XHML header with :es locale' FAILED expected {:xmlns=http://www.w3.org/1999/xhtml;, xml:lang=es, :lang=es} got {:xmlns=http://www.w3.org/1999/xhtml;, xml:lang=es, :lang=es} (compared using eql?) describe HamlHelper do describe locale_attrs do it should set the right XHTML header with default locale do attr_hash = {:lang=en, :xmlns=http://www.w3.org/1999/ xhtml, xml:lang=en} helper.locale_attrs.should eql(attr_hash) end it should set the right XHML header with :es locale do attr_hash = {:lang=es, :xmlns=http://www.w3.org/1999/ xhtml, xml:lang=es} with_locale(:es) do helper.locale_attrs.should eql(attr_hash) end end end Any ideas? Thanks, Mark -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: haml pipe and multiline without spaces
I realize you *may* have found a legitimate bug, but what about the workaround: %hoo aaa | (bbb) | ccc | Syntactically, this makes more sense than putting the parentheses on the first and last line of your example. Of course, this is probably just a dumbed-down example, but my suggested way looks more like English and therefore, I assert, is prettier. Proof by assertion. QED. :brad On Wed, May 13, 2009 at 8:45 AM, Steve Wagner li...@lanwin.de wrote: Can you check the haml unit tests. May they have include this situation. But i think trimming the space would be the best solution, since this is what the user expect. Simon Cropp schrieb: There was an interesting question asked about spaces and multilines in nhaml. I figured I would see how the scenerio works in haml So i went to haml labs http://lab.hamptoncatlin.com/play/with/haml Lets say i want to output hooaaa (bbb) ccc/hoo but i want to do it over multiple lines in this manner %hoo aaa ( | bbb | ) ccc | but this give me hooaaa ( bbb ) ccc/hoo Note the extra spaces. So i try to remove the spaces before the pipe %hoo aaa (| bbb| ) ccc| and i get no output. (u may need to refresh the page to clear the ouput) From the Haml doco The pipe character designates a multiline string. It‘s placed at the end of a line and means that all following lines that end with pipe will be evaluated as though they were on the same line. Note it says nothing about needing a preceding space to work. So what is the correct behaviour here? Should haml match pipe without a space? or should it trim the space on output? Regards Simon -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Failing to re-compile
Rather than pushing this code to production to find the bug/feature (depending on your point of view), it would be worthwhile to have a staging server that mimics production. Besides, the only time production code should be changed is during a deploy which, if you write your capistrano or vlad tasks properly, should restart your mongrels (or other app server). Just an observation. :brad On Mon, May 4, 2009 at 10:06 PM, Chris Eppstein ch...@eppsteins.net wrote: First: It's Sass. Sure it's an acronym, but Hampton hath decreed it shall not be capitalized. Second: That's a feature. Production has different options by default. You don't want your production server checking all the time if it should recompile -- it's pretty inefficient as it must look inside the files for imports, etc. So by default the Sass plugin just checks once at startup. If you change your sass files, you simply need to restart (at least one mongrel per server). Chris On Mon, May 4, 2009 at 6:33 PM, Martin Streicher martin.streic...@gmail.com wrote: I moved my app from one machine to the production server and the SaSS files fail to recompile to CSS when a change is made (in production mode). Is the fix to manually specify the options I want (:template_location, :css_location, :always_check, etc.) in the production.rb file? Is the default behavior different between development and production? Martin -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Sass Loops on Arrays
While I almost completely agree with the separate layout from markup idea, there are a few systems that help immensely with prototyping. They are born from the idea that it's easier (as in workflow-easier) for a designer to change the class of an element in HTML (or templating language) than to change the corresponding CSS. Obviously, Sass was designed to make that correct workflow a bit easier, but these systems still have some merit. The idea is to create a whole bunch of CSS classes that you might never use, but are immediately available to you when writing the HTML. One example: The 960 Grid System at http://960.gs/ :brad On Fri, Apr 24, 2009 at 10:46 AM, Chris Eppstein ch...@eppsteins.netwrote: There is a school of thought that says that structural classes that control layout are OK in markup, because you generally have to change your markup if you change your layout -- mostly because CSS isn't powerful enough to describe complex layouts. I don't subscribe to this school of thought, but I understand it. But one of your examples was a .border-N set of classes. So I only give you a partial pass ;-) chris On Fri, Apr 24, 2009 at 2:10 AM, Steven Garcia stevendgar...@gmail.comwrote: Normally I agree Chris, as I dont like my view cluttered with too many classes, but this particular solution is for a customized grid solution, which I find to be the only acceptable exception. On a related note - I was wondering when the Sass documentation would be updated - most of the iterator/loop/conditional stuff is not in there yet and I find myself using one of your posts on this group as reference. -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: auto href='#'
Call me old fashioned, but I still occasionally use A links as they were partially originally intended: as anchors. For example: a name=section1/. I know this can technically be achieved through other means, but those other ways lose their semantic meaning. :brad On Thu, Feb 26, 2009 at 8:08 AM, Mislav Marohnić mislav.maroh...@gmail.comwrote: On Thu, Feb 26, 2009 at 15:01, Lawrence Pit lawrence@gmail.comwrote: Fortunately I don't have to give a monkey's if someone has javascript disabled. My user base has javascript enabled. That's great, so you expect Haml to help you with not giving a monkey's ass? If we're going that route, I suggest that all header elements get output as paragraphs: %h1 Welcome to my website p class=headingWelcome to my website/p I mean, let's face it -- the majority of our user base is sighted. -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Universal #{} in 2.1, please?
I've been barely reviewing most of the HAML-list emails the last few months, so please pardon any ignorance. Has anyone given consideration to adding a suffix to the parent node to generate meaning? For example: %span{:style = 'blah'}# Note the trailing '#'. I'm not sure what havoc it might wreak on older versions of HAML, but semantically, it looks like an :id attribute with no value... therefore it must have special meaning in newer versions and get ignored by older ones. The same could be done with a period character. Just my 2 cents. :brad On Tue, Feb 24, 2009 at 3:05 PM, Chris Eppstein ch...@eppsteins.net wrote: I think we need a way to turn it off for a whole node tree or filter. Escaping like that gets really tedious. Hunt pecked on my iPhone... Sorry if it's brief! On Feb 24, 2009, at 12:04 PM, Jacques Crocker merbj...@gmail.com wrote: Similar to filter blocks (:javascript, etc), you can escape any interpolated section easily using \ So \#{blah} will output \#{blah} On Feb 24, 12:01 pm, Wincent Colaiuta w...@wincent.com wrote: On Feb 22, 4:45 am, Jacques Crocker merbj...@gmail.com wrote: Hi. I've updated the universal interpolation to work with the latest trunk of HAMLhttp://github.com/merbjedi/haml/commit/ 00717bfc9a098bcbcbc05cf3312d9d... This fix allows #{} to be used in markup bodies without the use of ==. This makes things consistent with HAML filter bodies which already all #{} to be used anywhere. I'd strongly urge consideration for this fix into 2.1. It's a very light fix on the precompiler, so it will have a minuscule performance impact. And the commit includes lots of unit tests, and has been tested to be stable through several my internal projects. Please let Nathan know if you support this change. Thanks! I'm just wondering... if interpolation is turned on everywhere by default without the user asking for it, how then will the user be able to selectively turn it off? Cheers, Wincent -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Haml [ ] default div element
My guess is that it precludes one from using the '[' character at the beginning of a text element. You've now made that character special and it would need to be escaped if is intended to be a text character rather than a haml element. Of course, that doesn't mean I'm against it... it's just something to think about. :brad On Fri, Dec 12, 2008 at 3:37 PM, Evgeny evgeny.zis...@gmail.com wrote: I just noticed that the [ ] notation does not assume the default %div tag like #id and .class do. So when I expected this to work : [...@product]= This div had the products class and object id of the product It only works when I explicitly tell it to be a %div, like so: %d...@product]= This div had the products class and object id of the product Is there any reason why it should not just work with the default? - evgeny -- Bradley Grzesiak listro...@gmail.com http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/haml?hl=en -~--~~~~--~~--~--~---
[haml] Re: Please review and comment
It looks like you have the form_tag line indented further than the h2 line above it. As a result, haml thinks you are trying to put a form tag _inside_ an h2 tag, something that is not allowed. :brad On Nov 26, 2008, at 20:43, Bharat [EMAIL PROTECTED] wrote: This is not a promising start. My first attempt at creating Haml bombs at line 3 of the following code: - column_div :type = :primary do %h2 Sign In - form_tag session_path do #standard .form_row %label{:for = email} Email address = text_field_tag 'email', nil, :maxlength = Person::MAX_EMAIL = set_focus_to 'email' .form_row %label{:for = password} Password = password_field_tag 'password', params [:password], :maxlength = Person::MAX_PASSWORD #openid.form_row %label{:for = 'openid_url'} OpenID = text_field_tag 'openid_url' .form_row %label.checkbox{:for = 'remember_me'} Remember me: = check_box_tag 'remember_me', '1', true, :class = checkbox .form_row = submit_tag 'Sign in', :class = button %div{:style = text-align: center; font-size: 12px; padding: 10px;} = link_to or Sign up, signup_path %br/ -if global_prefs.can_send_email? = link_to I forgot my password!, new_password_reminder_path %span{:id=noscript, :style=display:none;} %span#openid_link %a{:href = #, :onclick = show_openid(); return false;} Login using OpenID %span#standard_link %a{:href = #, onclick = show_openid(); return false;} Login using OpenID And here is the error message: Illegal nesting: content can't be both given on the same line as %h2 and nested within it. Extracted source (around line #3): 1: - column_div :type = :primary do 2: %h2 Sign In 3: - form_tag session_path do 4: #standard 5: .form_row 6: %label{:for = email} Email address What am I doing wrong? I was following this example in the documentation: !!! XML !!! %html %head %title Myspace %body %h1 I am the international space station %p Sign my guestbook --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com 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 -~--~~~~--~~--~--~---
[haml] Re: Easy attributes (feature suggestion)
If I'm not mistaken, ruby 1.9 provides a more concise way to declare hash key-value pairs. I don't have the beta pickaxe in front of me, but I believe it looks like this: new_style_hash = { key1: value1, key2: value2, ... } Perhaps haml could use that? On Wed, Nov 12, 2008 at 11:22 AM, Nathan Weizenbaum [EMAIL PROTECTED]wrote: We're currently considering alternative, more concise attribute syntaxes. weepy wrote: or perhaps square brackets would be better ? #td[colspan=2 style=color: red] (note that I even made a mistake in my conversion to ruby in the first example!) On 12 Nov, 10:55, weepy [EMAIL PROTECTED] wrote: The only thing in HAML that I find is a PITA is having to specify attributes as a hash. This is particularily annoying when converting some HTML - HAML (yes I know there's a converter - but it's not always that straight forward e.g. if it's actually ERB) :) Would it be possible to do something like #td(colspan=2 style=color: red) as an alternative to #td{ :colspan=2 :style=color: red} ? -- Bradley Grzesiak [EMAIL PROTECTED] http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com 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 -~--~~~~--~~--~--~---
[haml] Re: Feature Request: Component Tags
Even if this feature were to be included (I'm kinda on Chris' side anyway), it ought to use a different control character than '$'. I can think of plenty of times when one would want the first character of a text node to be a dollar sign. This is a good reason why the '%' is such a good control character... who starts off a piece of text with that character? And besides, if you want to decouple it from Rails, wouldn't = load or = require work just as well? %p Just my %b $0.02 :brad On Thu, Oct 23, 2008 at 2:32 PM, Lex [EMAIL PROTECTED] wrote: The primary advantage isn't syntactic. How I see it is that a designer who knows HAML, but not Ruby could create components out of partials without having to write any Ruby code. It also adds functionality when using HAML apart from Rails w/o having to roll your own helpers framework. This would help to further decouple HAML from Rails and encourage its use in other environments. There is also a clear syntactic advantage over: = render :partial = 'foo' which would become $foo On Oct 23, 12:14 pm, Chris Eppstein [EMAIL PROTECTED] wrote: -1 There's no syntactic advantage here over helpers. = calendar(:month = 'January') = datagrid(:data = @my_hash, :sort_by = 'date', :order = 'asc') -chris On Thu, Oct 23, 2008 at 8:05 AM, Lex [EMAIL PROTECTED] wrote: First off, I just wanted to say Kudos to Hampton Catlin (and everyone else involved) for creating HAML, it's the first templating language that I've actually liked. Super easy to learn too, I'm in looove! BUT... I think it could be made better...How about this: $component{ :localvar = @vartobind } Some J**a-based templating systems use this idea (groovy/gsp, and jsf/ facelets/jsp) to compose templates out of partials, though they use the xml namespacing method (i.e. taglib:tag attr=value /) I think this is a great way to make templates more DRY, it allows partials to be extracted, reused, and distributed as components, and it discourages use of inline code in a template. A backing class could be attached to a partial to aid in complex logic. Some ideas: $calendar{ :month = 'January' } $datagrid{ :data = @my_hash, :sort_by = 'date', :order = 'asc' } What do you all think? -- Bradley Grzesiak [EMAIL PROTECTED] http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com 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 -~--~~~~--~~--~--~---
[haml] a little self-promotion for my new oss project
Suprails: a customizable wrapper for rails Why put this on the haml mailing list? I wrote a plugin architecture for the project and haml is the only official plugin (as of now). Take a look at the README http://github.com/listrophy/suprails There's also a gem: gem install listrophy-suprails --source http://gems.github.com Let me know what you think! :brad -- Bradley Grzesiak [EMAIL PROTECTED] http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com 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 -~--~~~~--~~--~--~---
[haml] Re: Clash of SASS and CSS syntax
fyi: according to the CSS spec, you can (should?) specify the url without single or double quotes. For example, this should work... and is possibly even the preferred way: url(../images/blah.png) Of course, I have no idea if this fixes the SASS issue... probably not. :brad On Thu, Sep 25, 2008 at 11:24 AM, Lorin Tackett [EMAIL PROTECTED]wrote: I also can't quick fix it by doing something like :background :image= !url and then calling the mixin like: +image-replacement(24px,50px,url('../images.blah.png')) On Sep 25, 9:11 am, Lorin Takett [EMAIL PROTECTED] wrote: I'm doing a mixin like: =image-replacement(!height, !width, !url) :display block :height= !height :width= !width :background :image= url('!url') :repeat no-repeat .. so as to simplify image replacement, but SASS thinks !url is invalid arithmetic due to the perens. -- Bradley Grzesiak [EMAIL PROTECTED] http://toleoandbeyond.blogspot.com * You have received an email from my personal account. Please do not divulge this address to any website (eg: evite, shutterfly, etc). I have another address for such uses; please ask me for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Haml group. To post to this group, send email to haml@googlegroups.com 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 -~--~~~~--~~--~--~---