Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

element with many attributes and children #155

Closed
punund opened this issue Mar 20, 2013 · 4 comments
Closed

element with many attributes and children #155

punund opened this issue Mar 20, 2013 · 4 comments
Assignees

Comments

@punund
Copy link

punund commented Mar 20, 2013

I am trying to lay out attributes line by line, and can't figure how to define children elements after that:

div.my-class(
    foo='aaaa'
    bar='bbbb'
    baz='ccc'
  )
  div ...

It's an error, wherever I move the closing parenthesis.

@ghost ghost assigned bminer Mar 20, 2013
@bminer
Copy link
Owner

bminer commented Mar 20, 2013

I copied/pasted the above code into Blade, and it parsed it correctly. The rendered output was:

<div foo="aaaa" bar="bbbb" baz="ccc" class="my-class"><div>...</div></div>

Although... that might not help answer your question. :) Basically, what you have above is correct. Please ensure that if you are using spaces to indent items in your Blade document, that you stick with the same number of spaces. You can also use tabs.

As soon as the end parenthesis appears, you should follow the line with a newline \n, then indent one level from the parent element's indent level (not relative to the attributes' indent level).

@bminer
Copy link
Owner

bminer commented Mar 20, 2013

Closing this issue for now. If you still run into problems, please feel free to post code here. Full stack traces are always nice, too. :)

@bminer bminer closed this as completed Mar 20, 2013
@punund
Copy link
Author

punund commented Mar 21, 2013

I have found that another enclosing element is what makes it fail. Try this code:

div
  div(
    aaa='a'
    bbb='b'
    )
    div ccc

The attributes may be indented less or more, it fails for me.

@bminer bminer reopened this Mar 21, 2013
@bminer
Copy link
Owner

bminer commented Mar 21, 2013

Nice catch! I stand corrected! I will work on a bugfix for this. As it turns out, the same bug exists for function parameters.

@bminer bminer closed this as completed in 1ea24e7 Apr 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants