HAML syntax error "Waiting $ end"

I am trying to dry some code in HAML, but it seems to have stumbled upon a space error that I cannot completely wrap around.

I took the title and left the navigation code and put it in my respective files in the folder layouts.

In regular view files, I placed this at the top:

= render 'layouts/header'
  = render 'layouts/left_navigation'
  / center content column
  .centerContent.left.phm.rbm
    / start main center section
    / and the rest of the code goes below here

In the file headerI have:

/ main container area
#maincontainer
  / main content
  #maincontent.mhauto

And in the file left navigationI have:

/ left navigation column
#leftNav.leftNav.left
  / a bunch of code goes in here
/ end left navigation column

Now I expect this to be equivalent:

/ main container area
#maincontainer
  / main content
  #maincontent.mhauto
    / left navigation column
    #leftNav.leftNav.left
      / a bunch of code goes in here
    / end left navigation column
    / center content column
    .centerContent.left.phm.rbm
      / start main center section
      / and the rest of the code goes below here

But for some reason, it does not work correctly and instead gives me this syntax error syntax error, unexpected keyword_ensure, expecting $end, pointing to the last line in the file. What am I doing wrong? This is my first time using HAML, so it puzzles me quite a bit.

, , DRYing , .

+3
1

, . , :

= render 'layouts/header'
= render 'layouts/left_navigation'
/ center content column
.centerContent.left.phm.rbm
  / start main center section
  / and the rest of the code goes below here
+6

Source: https://habr.com/ru/post/1796131/


All Articles