[haml] Re: Defining a class inside a .haml file and then using haml_tag, haml_concat from it?

2012-10-27 Thread sol.manager
Stop me if I am wrong, but Haml isn't for defining classes. It is for 
replacing HMTL. You can use inline Ruby, but I don't use Haml to define 
Ruby classes. I consider it to be for the View portion of the MVC model.

On Sunday, May 20, 2012 11:49:29 AM UTC-4, Fraser Murray wrote:

 I'm defining a class within Haml, and I'd like to be able to use the Haml 
 helpers within this class. For example:
 - class Whatever
- def self.write
  - haml_concat something

 - Whatever.write

 Ideally, Whatever.write would output something to the template, but it 
 simply fails with undefined method 'haml_concat' for 
 Haml::Engine::Whatever:Class. 

 Full stacktrace: haml_test.haml:5:in `write': undefined method 
 `haml_concat' for Haml::Engine::Whatever:Class (NoMethodError)
 from haml_test.haml:8:in `block in render'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/engine.rb:191:in
  
 `eval'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/engine.rb:191:in
  
 `render'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/exec.rb:281:in
  
 `process_result'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/exec.rb:41:in 
 `parse'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/exec.rb:21:in 
 `parse!'
 from /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/bin/haml:9:in 
 `top (required)'
 from /home/fraser/.rvm/gems/ruby-1.9.3-p125/bin/haml:19:in `load'
 from /home/fraser/.rvm/gems/ruby-1.9.3-p125/bin/haml:19:in `main'



 How can I get this to work properly? I've tried using both extend and 
 include Haml::Helpers, but they both fail too. Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
Haml group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/haml/-/pg1dqVIfIKgJ.
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: Defining a class inside a .haml file and then using haml_tag, haml_concat from it?

2012-10-27 Thread sol.manager
Stop me if I am wrong, but Haml isn't for defining classes. It is for 
replacing HTML. You can use inline Ruby, but I don't use Haml to define 
Ruby classes. I consider it to be for the View portion of the MVC model.

On Sunday, May 20, 2012 11:49:29 AM UTC-4, Fraser Murray wrote:

 I'm defining a class within Haml, and I'd like to be able to use the Haml 
 helpers within this class. For example:
 - class Whatever
- def self.write
  - haml_concat something

 - Whatever.write

 Ideally, Whatever.write would output something to the template, but it 
 simply fails with undefined method 'haml_concat' for 
 Haml::Engine::Whatever:Class. 

 Full stacktrace: haml_test.haml:5:in `write': undefined method 
 `haml_concat' for Haml::Engine::Whatever:Class (NoMethodError)
 from haml_test.haml:8:in `block in render'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/engine.rb:191:in
  
 `eval'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/engine.rb:191:in
  
 `render'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/exec.rb:281:in
  
 `process_result'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/exec.rb:41:in 
 `parse'
 from 
 /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/lib/haml/exec.rb:21:in 
 `parse!'
 from /home/fraser/.rvm/gems/ruby-1.9.3-p125/gems/haml-3.1.4/bin/haml:9:in 
 `top (required)'
 from /home/fraser/.rvm/gems/ruby-1.9.3-p125/bin/haml:19:in `load'
 from /home/fraser/.rvm/gems/ruby-1.9.3-p125/bin/haml:19:in `main'



 How can I get this to work properly? I've tried using both extend and 
 include Haml::Helpers, but they both fail too. Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
Haml group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/haml/-/M1wtHTlO1ysJ.
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 in Sublime Text 2 without Rails

2012-10-27 Thread Rhett Sutphin
Hi,

On Oct 25, 2012, at 2:18 AM, Hawk Phil wrote:

 There doesn't seem to be instructions to set things up for Sass and Haml. I 
 just want to have Middleman to set a watch for .haml and .sass files and 
 automatically detect changes to convert to .html and .css in certain folders. 
 How do I do that?

Middleman doesn't provide this exact workflow. But for the way your originally 
described your problem (My goal is to make it simple when I save Haml file and 
refresh browser to see the Html file.), it has a workflow that will work. 

The idea is that you have a middleman project (which may contain files in lots 
of different template languages, including Haml and Sass). Then you run the 
middleman server. When your browser connects to the middleman server, Middleman 
arranges for the template to be executed and sends the result it to the 
browser. So, in this normal cycle, you never actually generate static HTML or 
CSS. (Middleman does have a command to generate static files also, but from 
your use case I don't think you need it.)

Middleman's getting started page[1] outlines the specific commands for 
executing this workflow.

Rhett

[1]: http://middlemanapp.com/getting-started/welcome/

 
 I am a non-Ruby person so sorry for this basic question. Thanks.
 
 
 
 On Thursday, October 4, 2012 11:25:42 AM UTC-7, Rhett Sutphin wrote:
 Hi, 
 
 On Sep 30, 2012, at 3:27 PM, Hawk Phil wrote: 
 
  I am a front-end guy using Windows for design and html/js/css coding. My 
  work is separate from the back-end guy using .NET. I am also new to 
  Haml/Sass thing as well as Ruby. And definitely not using Rails. My goal is 
  to make it simple when I save Haml file and refresh browser to see the Html 
  file. So I am looking for either an automatic watch or build in a Build 
  System batch for Sublime Text 2. 
  
  I saw people mentioned a lot about StaticMatic. But there seems no update 
  for 2 years https://github.com/staticmatic/staticmatic 
 
 The successor to StaticMatic is Middleman[1]. It has Haml and Sass support 
 built in[2]. Also recommended: the middleman-livereload extension[3]. 
 
 Rhett 
 
 [1]: http://middlemanapp.com/ 
 [2]: http://middlemanapp.com/templates/templates-layouts-partials/ , under 
 Other Templating Languages 
 [3]: http://middlemanapp.com/extensions/livereload/ 
 
  
  There is also this site (Is it the same?): 
  http://staticmatic.rubyforge.org/how_to_use.html 
  
  So is StaticMatic safe to use any more? Or should I just create a build 
  file in Sublime Text for Haml CLI? Is there example to do this? 
  
  
  
  -- 
  You received this message because you are subscribed to the Google Groups 
  Haml group. 
  To view this discussion on the web visit 
  https://groups.google.com/d/msg/haml/-/7Tjx59zaUEIJ. 
  To post to this group, send email to ha...@googlegroups.com. 
  To unsubscribe from this group, send email to haml+uns...@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 view this discussion on the web visit 
 https://groups.google.com/d/msg/haml/-/MHdnFOo38qEJ.
 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.

-- 
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 in Sublime Text 2 without Rails

2012-10-27 Thread Hoc Phan
Are you saying that when I go to localhost:port/file.html, it automatically 
executes a build process before render the page?


On Saturday, October 27, 2012 2:43:27 PM UTC-7, Rhett Sutphin wrote:

 Hi, 

 On Oct 25, 2012, at 2:18 AM, Hawk Phil wrote: 

  There doesn't seem to be instructions to set things up for Sass and 
 Haml. I just want to have Middleman to set a watch for .haml and .sass 
 files and automatically detect changes to convert to .html and .css in 
 certain folders. How do I do that? 

 Middleman doesn't provide this exact workflow. But for the way your 
 originally described your problem (My goal is to make it simple when I 
 save Haml file and refresh browser to see the Html file.), it has a 
 workflow that will work. 

 The idea is that you have a middleman project (which may contain files in 
 lots of different template languages, including Haml and Sass). Then you 
 run the middleman server. When your browser connects to the middleman 
 server, Middleman arranges for the template to be executed and sends the 
 result it to the browser. So, in this normal cycle, you never actually 
 generate static HTML or CSS. (Middleman does have a command to generate 
 static files also, but from your use case I don't think you need it.) 

 Middleman's getting started page[1] outlines the specific commands for 
 executing this workflow. 

 Rhett 

 [1]: http://middlemanapp.com/getting-started/welcome/ 

  
  I am a non-Ruby person so sorry for this basic question. Thanks. 
  
  
  
  On Thursday, October 4, 2012 11:25:42 AM UTC-7, Rhett Sutphin wrote: 
  Hi, 
  
  On Sep 30, 2012, at 3:27 PM, Hawk Phil wrote: 
  
   I am a front-end guy using Windows for design and html/js/css coding. 
 My work is separate from the back-end guy using .NET. I am also new to 
 Haml/Sass thing as well as Ruby. And definitely not using Rails. My goal is 
 to make it simple when I save Haml file and refresh browser to see the Html 
 file. So I am looking for either an automatic watch or build in a Build 
 System batch for Sublime Text 2. 
   
   I saw people mentioned a lot about StaticMatic. But there seems no 
 update for 2 years https://github.com/staticmatic/staticmatic 
  
  The successor to StaticMatic is Middleman[1]. It has Haml and Sass 
 support built in[2]. Also recommended: the middleman-livereload 
 extension[3]. 
  
  Rhett 
  
  [1]: http://middlemanapp.com/ 
  [2]: http://middlemanapp.com/templates/templates-layouts-partials/ , 
 under Other Templating Languages 
  [3]: http://middlemanapp.com/extensions/livereload/ 
  
   
   There is also this site (Is it the same?): 
 http://staticmatic.rubyforge.org/how_to_use.html 
   
   So is StaticMatic safe to use any more? Or should I just create a 
 build file in Sublime Text for Haml CLI? Is there example to do this? 
   
   
   
   -- 
   You received this message because you are subscribed to the Google 
 Groups Haml group. 
   To view this discussion on the web visit 
 https://groups.google.com/d/msg/haml/-/7Tjx59zaUEIJ. 
   To post to this group, send email to ha...@googlegroups.com. 
   To unsubscribe from this group, send email to 
 haml+uns...@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 view this discussion on the web visit 
 https://groups.google.com/d/msg/haml/-/MHdnFOo38qEJ. 
  To post to this group, send email to ha...@googlegroups.comjavascript:. 

  To unsubscribe from this group, send email to 
 haml+uns...@googlegroups.com javascript:. 
  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 view this discussion on the web visit 
https://groups.google.com/d/msg/haml/-/59Z1tpDSYCoJ.
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 in Sublime Text 2 without Rails

2012-10-27 Thread Rhett Sutphin
Hi,

On Oct 27, 2012, at 7:35 PM, Hoc Phan wrote:

 Are you saying that when I go to localhost:port/file.html, it automatically 
 executes a build process before render the page?

That's right, that's what middleman server does out of the box. Try it and see.

For an even nicer workflow, you can use the middleman-livereload plugin I 
mentioned in my original message. When that plugin is part of your middleman 
project and you have a page from your project open in a relatively modern 
browser, the page will automatically be reloaded when you save any of the 
source files.

Rhett

 
 
 On Saturday, October 27, 2012 2:43:27 PM UTC-7, Rhett Sutphin wrote:
 Hi, 
 
 On Oct 25, 2012, at 2:18 AM, Hawk Phil wrote: 
 
  There doesn't seem to be instructions to set things up for Sass and Haml. I 
  just want to have Middleman to set a watch for .haml and .sass files and 
  automatically detect changes to convert to .html and .css in certain 
  folders. How do I do that? 
 
 Middleman doesn't provide this exact workflow. But for the way your 
 originally described your problem (My goal is to make it simple when I save 
 Haml file and refresh browser to see the Html file.), it has a workflow that 
 will work. 
 
 The idea is that you have a middleman project (which may contain files in 
 lots of different template languages, including Haml and Sass). Then you run 
 the middleman server. When your browser connects to the middleman server, 
 Middleman arranges for the template to be executed and sends the result it to 
 the browser. So, in this normal cycle, you never actually generate static 
 HTML or CSS. (Middleman does have a command to generate static files also, 
 but from your use case I don't think you need it.) 
 
 Middleman's getting started page[1] outlines the specific commands for 
 executing this workflow. 
 
 Rhett 
 
 [1]: http://middlemanapp.com/getting-started/welcome/ 
 
  
  I am a non-Ruby person so sorry for this basic question. Thanks. 
  
  
  
  On Thursday, October 4, 2012 11:25:42 AM UTC-7, Rhett Sutphin wrote: 
  Hi, 
  
  On Sep 30, 2012, at 3:27 PM, Hawk Phil wrote: 
  
   I am a front-end guy using Windows for design and html/js/css coding. My 
   work is separate from the back-end guy using .NET. I am also new to 
   Haml/Sass thing as well as Ruby. And definitely not using Rails. My goal 
   is to make it simple when I save Haml file and refresh browser to see the 
   Html file. So I am looking for either an automatic watch or build in a 
   Build System batch for Sublime Text 2. 
   
   I saw people mentioned a lot about StaticMatic. But there seems no update 
   for 2 years https://github.com/staticmatic/staticmatic 
  
  The successor to StaticMatic is Middleman[1]. It has Haml and Sass support 
  built in[2]. Also recommended: the middleman-livereload extension[3]. 
  
  Rhett 
  
  [1]: http://middlemanapp.com/ 
  [2]: http://middlemanapp.com/templates/templates-layouts-partials/ , under 
  Other Templating Languages 
  [3]: http://middlemanapp.com/extensions/livereload/ 
  
   
   There is also this site (Is it the same?): 
   http://staticmatic.rubyforge.org/how_to_use.html 
   
   So is StaticMatic safe to use any more? Or should I just create a build 
   file in Sublime Text for Haml CLI? Is there example to do this? 
   
   
   
   -- 
   You received this message because you are subscribed to the Google Groups 
   Haml group. 
   To view this discussion on the web visit 
   https://groups.google.com/d/msg/haml/-/7Tjx59zaUEIJ. 
   To post to this group, send email to ha...@googlegroups.com. 
   To unsubscribe from this group, send email to 
   haml+uns...@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 view this discussion on the web visit 
  https://groups.google.com/d/msg/haml/-/MHdnFOo38qEJ. 
  To post to this group, send email to ha...@googlegroups.com. 
  To unsubscribe from this group, send email to haml+uns...@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 view this discussion on the web visit 
 https://groups.google.com/d/msg/haml/-/59Z1tpDSYCoJ.
 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.

-- 
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: Interpolating underscore.js template with HAML

2012-10-27 Thread Duncan Beevers
I'm a big fan of jamesotron hamlbars https://github.com/jamesotron/hamlbars

The most basic thing the gem provides is a helper method for
generating expressions that will later hold interpolated values. The
helper method also accepts blocks, and automatically generates
appropriate opening/closing tags in the template source.

The gem is focused on generating templates that can be consumed and
processed by Handlebars/EmberJS so they're not exactly
underscore-compatible, so that may make this a non-starter for you,
but its an elegant way to deal with with difficulty of generating
closing tags in a template language that eschews them.

On Mon, Oct 15, 2012 at 5:51 PM, Bryan Li b...@bry.li wrote:
 This works great for getting the values off an variable. Would it work for
 if/else statements though? How do I translate the following?

 % if (boolean) { %
   divBlah blah/div
 % } %


 On Monday, August 20, 2012 10:34:46 AM UTC-7, Les Nightingill wrote:

 The delimiters for haml (erb) collide with the delimiters for the
 underscore templates...

 best way I've found is to change the underscore template settings to the
 mustache delimiters {{ and }}

 from the underscore.js docs:

 _.templateSettings = {
   interpolate : /\{\{(.+?)\}\}/g
 };



 On Thursday, August 16, 2012 10:31:31 AM UTC-7, Ritesh Nadhani wrote:

 So for my new project we are trying to use HAML/backbone.js/underscore.js
 templates. After reading the docs, I could figure out something like this:

 %script#album-row{ :type = 'text/template' }
   .album-row
 %a{ :href = '%= href %'}
   %= name %

 While templating, name is correctly interpolated but I cannot get
 href to work.

 Any thoughts?

 --
 You received this message because you are subscribed to the Google Groups
 Haml group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/haml/-/Ra7qHxN_k2cJ.

 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.

-- 
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.