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

Marko v3: include tag #178

Closed
patrick-steele-idem opened this Issue Dec 8, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@patrick-steele-idem
Copy link
Contributor

patrick-steele-idem commented Dec 8, 2015

NOTE: New syntax not finalized.

New Syntax

<include("./include-target.marko") name='Frank' count=20/>
<include("./include-target.marko", {name: 'Frank', count: 20})/>
<include("./include-nested-content.marko") name="Frank" count=20>
    Have a 
    <b>
        wonderful
    </b>
    day!
</include>

NOTE: When body content is provided, a special data.renderBody = function(out) { ... } function should be added to the template data for the target template.

Old Syntax

<include template="./include-target.marko" name="${'Frank'}" count="20"/>
<include template="./include-target.marko" name="Frank" count="${20}"/>
<include template="./include-target.marko" template-data="{name: 'Frank', count: 20}"/>
<include template="./include-nested-content.marko" name="Frank" count="${20}">
    Have a 
    <b>
        wonderful
    </b>
    day!
</include>
@BryceEWatson

This comment has been minimized.

Copy link
Contributor

BryceEWatson commented Dec 30, 2015

What do you think about keeping the template-data attribute in the new syntax? I like the new simplified syntax as well, I just wonder if template-data might be more intuitive for some.

@patrick-steele-idem

This comment has been minimized.

Copy link
Contributor Author

patrick-steele-idem commented Dec 30, 2015

In general, I think we should avoid having two ways to do the same thing. I don't like that template-data would be a special attribute so I am in favor of only allowing template data to be the second argument inside the <include(path, templateData)> tag.

@philidem What do you think?

@BryceEWatson

This comment has been minimized.

Copy link
Contributor

BryceEWatson commented Jan 5, 2016

@patrick-steele-idem, are there any examples of what the test file include-nested-content.marko would look like?

@patrick-steele-idem

This comment has been minimized.

Copy link
Contributor Author

patrick-steele-idem commented Jan 5, 2016

Not yet @BryceEWatson, but I can add some code. Nested content should always be passed in as a data.renderBody(out) method.

patrick-steele-idem referenced this issue in laggingreflex/marko Jan 22, 2016

patrick-steele-idem added a commit that referenced this issue Feb 9, 2016

@patrick-steele-idem

This comment has been minimized.

Copy link
Contributor Author

patrick-steele-idem commented Feb 9, 2016

@BryceEWatson I went ahead and implemented support for <include> since I needed to move on to migration testing. Please review the code (commit: a3d76a3) and let me know if you see any issues. Thanks for your help earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.