I am trying to DRY up some code in HAML, but seem to have stumbled into a whitespace error that I can't quite wrap my head around.
I took the header and left navigation code and put it into their own respective files in the layouts
folder.
In the regular view files, I placed this at the top:
= render 'layouts/header'
= render 'layouts/left_navigation'
/ cent开发者_运维知识库er content column
.centerContent.left.phm.rbm
/ start main center section
/ and the rest of the code goes below here
In the header
file, I have:
/ main container area
#maincontainer
/ main content
#maincontent.mhauto
And in the left navigation
file, I have:
/ left navigation column
#leftNav.leftNav.left
/ a bunch of code goes in here
/ end left navigation column
Now, I would expect this to be equivalent to:
/ 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 whatever reason, it is not working correctly and instead gives me this syntax error syntax error, unexpected keyword_ensure, expecting $end
while pointing to the last line in the file. What am I doing wrong? This is my first time using HAML, so this is rather perplexing to me.
By the way, it worked perfectly fine before I started DRYing up the code, so this seems to be a whitespace thing to me.
You have a render nested inside another render.. I think thats the problem:
= 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
精彩评论