Fraser Murray | 20 May 17:49
Picon

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

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/-/C_YAfyZH-W0J.
To post to this group, send email to haml-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to haml+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Luca G. Soave | 20 May 17:42
Picon
Gravatar

How does it works haml loops ?


Having the following rails view (haml):

.row
 
.span7
   
%h1 Listing categories
   
%p
     
- <at> categories.each do |category|
       
.accordion-group
         
.accordion-heading
           
.accordion-toggle{"data-toggle" => "collapse", "data-target" => "##{category.path}"}= link_to category.name, "##{category.path}"
     
- <at> competitors.each do |category_path, competitors|
       
.accordion-body.table.collapse.in{:id => "#{category_path}"}
         
%table.accordion-inner
           
%thead
             
%tr
               
%th= "Project"
               
%th= "Description"
               
%th= "Watchers"
               
%th= "Forks"
           
%tbody
             
- competitors.each do |competitor|
               
%tr
                 
%td
                   
= link_to "#{competitor["html_url"]}".sub( "https:\/\/github.com\/", "" ), "#{competitor["html_url"]}"
                 
%td
                   
%span »
                   
= competitor["description"]
                 
%td
                   
%span.badge.badge-info= competitor["watchers"]
                 
%td
                   
%span.badge.badge-warning= competitor["forks"]

I need css class .accordion-group, to contain both .accordion-heading ( which is inside the <at> categories.each loop ) and .accordion-body (which is inside the other loop: <at> competitors.each loop).

Note the two .each ruby loops, are at the same "node level" in haml, while their css classes .accordion-heading and .accordion-body have to be into .accordion-group css class container.

The resoulting html which I need, is like the following:

<div class="accordion-group">
 
<div class="accordion-heading">
 
<div class="accordion-body in collapse" id="collapse_id">
</div>
<div class="accordion-group">
  <div class="accordion-heading">
  <div class="accordion-body in collapse" id="collapse_id">
</
div>
<div class="accordion-group">
 
<div class="accordion-heading">
 
<div class="accordion-body in collapse" id="collapse_id">
</div>
...

... while I currently get this wrong html code :

<div class="accordion-group">
 
<div class="accordion-heading">
</div>
<div class="accordion-group">
  <div class="accordion-heading">
</
div>
<div class="accordion-group">
 
<div class="accordion-heading">
</div>
...
<div class="accordion-body in collapse" id="collapse_id">
<div class="accordion-body in collapse" id="collapse_id">
<div class="accordion-body in collapse" id="collapse_id">
...

I cannot find the right way for indent haml ...

--
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/-/oejaSjmM5UYJ.
To post to this group, send email to haml-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to haml+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Picon

Gedit syntax files

Hi,
Have just tried to download the files for sass editing on Gedit from
here, The rails.xml file if full of javascript and the zip file fails
to extract. Have they been compromised?

Have download the old files from riznlog.com to try.

cheers

Dave Hodson

--

-- 
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml@...
To unsubscribe from this group, send email to haml+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

kadoudal | 22 Apr 14:33
Picon

How to insert a javascript block in the %head , containing erb

I am trying to insert this block  ( which is inning fine in an
application.html.erb

   <head>
       <script type="text/javascript">
            $(function() {
               <%= yield :document_ready %>
            });
      </script>
   </head>

I tried :

    %head
        :javascript
             = yield :document_ready

    %head
        :javascript
             '<%= yield :document_ready %>'

thanks for feedback

but no way , the yield :document_ready  is never executer

--

-- 
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml@...
To unsubscribe from this group, send email to haml+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Bernie | 21 Apr 18:53
Picon
Gravatar

Is there a good resource for learning Haml architecture, code structure?

Hi peeps,
I'd like to play with the Haml library a bit (perhaps add support for
handlebars delimeters "{{}}", but haven't been able to find a good
source that explains the structure of the Haml code base. Anyone know
where one might find that?

--

-- 
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml@...
To unsubscribe from this group, send email to haml+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Bernie | 21 Apr 19:40
Picon
Gravatar

Would people be interested if I added {{}} delimeters?

Just want to make sure I don't use time that could be spent somewhere
else. Here's the idea:

Many JS templating languages appear to use the "{{ some_content }}"
strategy for delimiting content, and Mustache and Handlebars appear to
be the most popular among those lang's.

Since Haml appears to not have an easy way to add custom delimeters
(parsing occurs all the way in the parser.rb file), would it make
sense to add these "{{" delimeters directly to haml?

The end result would be something like this:

%table
  %tbody
    {{# each MyApp.MyArray
      %tr
        %td {{ someValue }}
  %tfoot
    %tr
      %td Some footer content

Thoughts, concerns?

--

-- 
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml@...
To unsubscribe from this group, send email to haml+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

bert bruynooghe | 26 Mar 09:39
Picon
Gravatar

Re: Re: single quotes nested in double quotes

Sorry, I forgot the semicolumn in the example I posted. Anyway, I got
the same result, it still produces:
<div data-bind="attr: { " data-something': somevalue }'></div>

(If I copy and paste directly from  Chrome, I even got:
<div data-bind="attr: { " data-something':="" somevalue="" }'=""></div>,
but I suspect this to be a Chrome issue.)

FYI: I am doing this from a Ruby (1.9.3) on Rail (3.2.2) project, using
haml_assets (0.1.0).

Kind regards,
Bert Bruynooghe.

On Mon, Mar 26, 2012 at 9:36 AM, bert bruynooghe
<bert.bruynooghe@...> wrote:
> On 03/25/2012 07:11 PM, kadoudal wrote:
>>
>> did you try :
>>
>> %div{:'data-bind' =>  "attr: { 'data-something': someValue }"}
>>
>> On Mar 23, 12:53 pm, bert bruynooghe<bert.bruynoo...@...>
>> wrote:
>>>
>>> How do I produce HAML for this:
>>> <div data-bind="attr: { 'data-something': someValue }">...</div>
>>>
>>> Next line replaces all quotes by double quotes, rendering the result
>>> unusable:
>>> %div{'data-bind' =>  "attr{'data-something' : someValue}"}
>>>
>>> Kind regards,
>>> Bert Bruynooghe.
>
>
> Soory, I forgot the semicolumn in the example I posted. Anyway, I got the
> same result, it still produces:
>
> <div data-bind="attr: { " data-something': somevalue }'></div>
>
> (If I copy and paste directly from  Chrome, I even got:
> <div data-bind="attr: { " data-something':="" somevalue="" }'=""></div>,
> but I suspect this to be a Chrome issue.)
>
> FYI: I am doing this from a Ruby (1.9.3) on Rail (3.2.2) project, using
> haml_assets (0.1.0).
>
> Kind regards,
> Bert Bruynooghe.
>

--

-- 
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml@...
To unsubscribe from this group, send email to haml+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

bert bruynooghe | 23 Mar 11:53
Picon
Gravatar

single quotes nested in double quotes

How do I produce HAML for this:
<div data-bind="attr: { 'data-something': someValue }">...</div>

Next line replaces all quotes by double quotes, rendering the result
unusable:
%div{'data-bind' => "attr{'data-something' : someValue}"}

Kind regards,
Bert Bruynooghe.

--

-- 
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml@...
To unsubscribe from this group, send email to haml+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Russell Allen | 21 Feb 22:55
Picon

Most used Haml features

Hi all,


As some of you may know, I'm working on a .Net port of Haml (predictably enough, nHaml). I've got an engine now that handles what I think is the bare minimum Haml stuff, namely:
  • Tags - Normal, implicit div and self-closing tags (HTML4, XHTML4, HTML5)
  • Nested tags
  • Attributes - Normal, html-style and boolean attributes (HTML4, XHTML4, HTML5)
  • Comments- Silent and markup
  • Whitespace munching
  • Variable interpolation
  • C# code evaluation with = token
So I now have an engine I can just about use in production. But what Haml features should I be looking at next? At the moment, I can see I'm missing support for:
  1. C# code control with - token
  2. Line escaping with \ token
  3. Internal filters
  4. Ruby style attributes
  5. Doctype tags with !!! token
  6. Multiline strings with | token
  7. HTML Escaping with &=, =, !=
  8. Whitespace preservation
I've put the above list in order of what I think is most important, what do you all think? Am I missing some killer Haml feature that you live and die by? Does HTML escaping save you masses of time day in day out?

Any feedback much appreciated, thanks,

Russ

--
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/-/PI1g2icj2Z8J.
To post to this group, send email to haml-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to haml+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.
haml_newbie | 16 Feb 09:37
Picon

How to write this on HAML? Help please

<script type="text/template" id="comments-template">
      <ol class="comments">
        <% _.each(comments, function(c) { %>
          <li><%= c.title %></li>
        <% }); %>
      </ol>
</script>

It's template for backbone.js

--
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/-/6TG8dYhm5h4J.
To post to this group, send email to haml-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to haml+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.
Doug Mayer | 14 Feb 04:50

Re: Anyone reading bug reports?

To be fair, I actually need to modify the tests for #419, since it is actually testing for the IE-invalid output today. :)

But we have been using it in production since before I originally posted it, and have to support just about every old-busted and new-hotness browser out there. (Yay educational software.) If you're using something like Dojo where you need to encode JSON data in a data- attribute, while not killing IE, you need to run a patched version of Haml.

On Feb 13, 2012 9:22 PM, "Stephen Bannasch" <stephen.bannasch <at> deanbrook.org> wrote:
At 12:46 PM -0800 2/13/12, Nathan Weizenbaum wrote:
I read them, but Sass is currently much higher piority for the limited amount of time I have to spend on OSS.

Is there anybody else who you trust enough to delegate review of pull requests to?

I created tests for both of these pull requests when I made them.

If there is ANYTHING I can do to improve them to get them accepted I'd love to get the feedback,

At 5:13 PM -0400 9/18/11, Stephen Bannasch wrote:
Do you guys have time to review pull requests?

If not are you looking for another maintainer who can help?

Since April five pull requests have been closed but there are 12 outstanding pull requests since April with no comments from either of you.

I'm now using a fork with these two pull requests merged:
  Escape with key codes instead of named HTML entities (for IE support) #418
  July 22, 2011
  https://github.com/nex3/haml/pull/419

  ActionView::Template mime type of 'text/xml' forces :xhtml
  September 09, 2011
  https://github.com/nex3/haml/pull/427

Both of these have tests.

















On Thu, Feb 9, 2012 at 12:53 PM, Doug Mayer <doug-bpw83AvobkNiLUuM0BA3LQ@public.gmane.org> wrote:
What's a guy got to do to get a bug report looked at?
https://github.com/nex3/haml/pull/419

--
You received this message because you are subscribed to the Google Groups "Haml" group.
To post to this group, send email to haml-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm.
To unsubscribe from this group, send email to haml+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To unsubscribe from this group, send email to haml+unsubscribe <at> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To unsubscribe from this group, send email to haml+unsubscribe <at> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to haml+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Gmane