You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I wanna make a block helper that encloses the inner template with a <template></template> as well as functionality similar to the {{{raw}}} helper. How would I go about doing that?
If I'm correct, I should make a new Template with a single TemplateElement, which is a HTMLExpression, which references the original template, but I'm unsure if that is indeed correct, nor do I know how to achieve the escaping functionality of {{{raw}}}.
fnclient_only<'reg,'rc>(h:&Helper<'reg,'rc>,r:&'reg Handlebars<'reg>,ctx:&'rc Context,rc:&mutRenderContext<'reg,'rc>,out:&mutdynOutput,) -> HelperResult{let template = h.template();letmut new_template = Template::new();
new_template.elements = vec![TemplateElement::HtmlExpression(Box::new(HelperTemplate{// not sure what to do for most of these fields
name: todo!(),
params: todo!(),
hash: todo!(),
block_param: todo!(),
template: template.cloned(),
inverse: todo!(),
block: todo!(),
}))];
new_template.render(r, ctx, rc, out);Ok(());}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So, I wanna make a block helper that encloses the inner template with a
<template></template>
as well as functionality similar to the{{{raw}}}
helper. How would I go about doing that?If I'm correct, I should make a new
Template
with a singleTemplateElement
, which is aHTMLExpression
, which references the original template, but I'm unsure if that is indeed correct, nor do I know how to achieve the escaping functionality of{{{raw}}}
.Am I doing this right? What am I missing here?
Beta Was this translation helpful? Give feedback.
All reactions