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

feat(lib): Add render tag #472

Closed
wants to merge 0 commits into from
Closed

Conversation

YuiYukihira
Copy link
Contributor

@YuiYukihira YuiYukihira commented Jun 22, 2022

Hey, here's my PR for #471.

See the description including

  • the selected template cannot access any variables from the parent scope
    • I've created a new OpaqueStackFrame struct, I needed a way to make sure that only the variables passed into the render tag could be accessed from inside it.
  • the selected template's variables do not leak into the parent scope
  • variables can be passed to the template with either key: value syntax or with with <var> [as <var>]
  • rendered content can be looped over with for <value> [as <var>] and the template has access to forloop
    • I moved the ForloopObject and Range structs into a parent module, this is because I wanted to use them for the for variant of the render tag.

}

fn description(&self) -> &str {
""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind putting one in?

@YuiYukihira YuiYukihira force-pushed the master branch 2 times, most recently from 82d9d0e to e414002 Compare June 23, 2022 09:24
Copy link
Member

@epage epage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry for the long delay; somehow I lost track of this.

Comment on lines 222 to 229
// given that we're at the end of the loop body
// already, dealing with a `continue` signal is just
// clearing the interrupt and carrying on as normal. A
// `break` requires some special handling, though.
let current_interrupt =
scope.registers().get_mut::<InterruptRegister>().reset();
if let Some(Interrupt::Break) = current_interrupt {
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need any tests for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is pretty much an exact copy from here, in this project. I can't see any specific tests for it there.

@YuiYukihira YuiYukihira force-pushed the master branch 2 times, most recently from e414002 to f92d84c Compare May 1, 2023 22:53
@YuiYukihira
Copy link
Contributor Author

No worries, I completely forgot about this too.

@epage
Copy link
Member

epage commented Jun 9, 2023

... no idea why my push closed this but it won't let me re-open. I'll create a new PR

@epage
Copy link
Member

epage commented Jun 9, 2023

This is now superseded by #506

Felt bad at how slow I've been at getting back to you so I went ahead and wrapped this up

  • Noticed that , variables can be used with with and for, so I adjusted that
  • Ported the ruby tests so we know what works and what doesn't.
    • The main thing we don't yet support is as being optional. It should take the file name of the partial to serve as the variable name

@epage
Copy link
Member

epage commented Jun 9, 2023

v0.26.4 is now out with render tag support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants