Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 378761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:49:33+00:00 2026-05-12T14:49:33+00:00

Using the (intentionally) strange multi-line format for HAML, I’d like to have the following

  • 0

Using the (intentionally) strange multi-line format for HAML, I’d like to have the following lines in my template:

= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |

-# and

= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |

However, they can not run up against one another, or they are read as one single multi-line block.

-# This fails:
= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |
= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |

And separating with a line break, interestingly enough, does no better:

-# This fails, too:
= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |

= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |

The only working solution I have found is to run a blank line of Ruby code between. Which looks really ugly.

= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |
-
= call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
  :foo4 => 'bar4', :foo5 => 'bar5' |

Is there anything better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:49:34+00:00Added an answer on May 12, 2026 at 2:49 pm

    This is a feature, not a bug. Haml multiline blocks are intentionally unwieldy – including hard to follow one after another – because almost all the time it’s better to put that Ruby code into a helper. Even if the helper is only called once, it will make your template much easier to read. For instance:

    def blatz_link
      call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3',
        :foo4 => 'bar4', :foo5 => 'bar5'
    end
    
    def blootz_link
      call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3',
        :foo4 => 'bar4', :foo5 => 'bar5'
    end
    

    Then in your Haml, just do

    = blatz_link
    = blootz_link
    

    which will be much more readable and easier to understand.


    If you absolutely must follow one multiline block with another, just add a comment in between:

    = call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
      :foo4 => 'bar4', :foo5 => 'bar5' |
    -#
    = call_to_helper :foo1 => 'bar1', :foo2 => 'bar2', :foo3 => 'bar3', |
      :foo4 => 'bar4', :foo5 => 'bar5' |
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I'm not (intentionally) using threads in my C# app. In fact my main method
I have an object: map<A*, string> collection; I would like to call the map::find
Let say I have the following desire, to simplify the IConvertible's to allow me
I'm using the following xml file to read the contents of a file that
I'm doing lists concatenation in the following ways (an example, using GHC): myConcat ::
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.