Skip to content

content_for helper disrupts Haml indentation #331

@emarthinsen

Description

@emarthinsen

Okay, this is a very strange issue that seems inconsistent and difficult to reproduce. I have one project that this error doesn't occur on and one where it always does.

The error that I get is the typical Haml indentation error. It looks like this:

Haml::SyntaxError: Illegal nesting: nesting within plain text is illegal.

What brings it about is more random. Here is a link to a minimal nanoc site that recreates the issue:

https://s3.amazonaws.com/code_share/indent.zip

Just unzip the file, run bundle, then nanoc compile and you should see the same error.

In the file content/projects/client-1.haml, I use a content_for block to capture some content. It then gets rendered out on the content/portfolio.haml page.

If you get rid of the capture block on the client page, then the error does not go away. If you get rid of where the captured content is rendered out on the portfolio page, then the error does go away. Here's the strange one. If you go into the default layout and remove the line that renders the _ga partial, then the error does go away.

There's an unusual interaction going on that I'm having some difficulty tracking down. Any ideas?

Regards,
Eric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions