4

Hoping someone can help me out here...

To put it simply I am trying to use twirl to evaluate the string content that I render from a separate definition the same as if it were a template, within a template.

I know I can render the string val as an html within a template (using @html{} but what I really want to do is render the string the same as a scala.html template, so that I can include other @injectedstuff within that string and have it render as if it were in the template.

Here is an example of my use actual use case, where I am using a simplified markdown converter to read a markdown file and parse it into the page.

Example Usage in Template

@import scala.io.Source
@import com.gabechurch.ParseMarkdown

@Html {com.gabechurch.ParseMarkdown.parsemarkdown.kramdown((scala.io.Source.fromFile("/path/to/my/Test.md").getLines.mkString("\n").toString)
}

Sample Markdown (Test.md)

# This is my title

- I want these notes to be compiled with twirl after they are converted to an html string with my markdown converter. 

> Right here @myModal("Click here for my InlineMyModal") should add the modal defined in another template if twirl were used in evaluation.

I have tried a number of other things with controllers etc, suggested for other use cases, but nothing seems to accomplish my goal of using Twirl to dynamically render (rendered) pages from a string html.

Gabe Church
  • 161
  • 1
  • 7

0 Answers0