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

Add the ability to instantiate a template from a string #192

Closed
granicz opened this Issue Sep 13, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@granicz
Member

granicz commented Sep 13, 2018

The current templating engine takes an input file and enables us to put content in its placeholders:

    type MasterTemplate = Template<"index.html", ...>
    ...
    let Page ctx =
        MasterTemplate.Main()
            .Hole(...)
            ...
            .Doc()

Quite often, it would be very useful to swap the template text, either from another text file or from a string, assuming both has the same placeholders:

    let Page ctx =
        MasterTemplate(File="index2.html").Main()
            .Hole(...)
            ...
            .Doc()
    let Page ctx =
        MasterTemplate(Content=myNewTemplateString).Main()
            .Hole(...)
            ...
            .Doc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment