How do I use a subtemplate in tink_template without having it escaped?

I’m trying out tink_web and tink_template. I have one template (haxe flavour mtt) and I want to inject the result of another template into it. Something like this:

	public function home()
		return Views.renderLayout(
			"Home page title",
			"Normal content"

	public function about()
		return Views.renderLayout(
			"About page title",
			//I tried haxe.Resource.getString("about") but got the same result

My main template has something like:

				<div class="content" data-uf-partial="panel2Partial">

and viewContent is the 2nd parameter passed to renderLayout(). The About template is a chunk of static HTML right now, and is currently rendering with escaped HTML for the tags. How can I prevent this? I did read the part in the documentation related to escaping but couldn’t understand how to convert that to my needs.

Hej !
I think you should do ::new Html( viewContent )::

1 Like

That works!
But why didn’t it work when I did this?

	public function about()
		return Views.renderLayout(
			"About page title",
			new Html(haxe.Resource.getString("about"))

What’s the signature of Views.renderLayout?

Aha good question!
So viewContent in Views.renderLayout was typed as a String:

(title : String, viewContent : String) -> tink.template.Html

When I changed the type to Html I was able to change the template back to ::viewContent:: and then pass it in using new Html(haxe.Resource.getString("about"))

Thanks everyone!

Indeed. For further reference: GitHub - haxetink/tink_template: Tink Template Library