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

added runtime "static templates" fix #16 #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

WebFreak001
Copy link
Contributor

Ironically the runtime filters don't work at runtime yet.

@s-ludwig
Copy link
Member

Looks good as far as I can see. The only real question to me is in which direction this could be extended and consequently how the API should be layed out. What I'm currently thinking is something like this:

enum RuntimeRenderMode {
    static_, /// Allows only static contents, any embedded code will trigger an exception
    debug_, /// Embeds D code into the output without executing them
    dynamic /// Builds the template as a shared library by invoking the compiler and executes the generated code
}
void renderRuntimeHTMLDiet(..., RuntimeRenderMode.static_);

The second option could even output in a format that is compatible with a plain-text template engine like Mustache or similar (or that could be left for another mode). Of course for now there would just be the static_ option.

@WebFreak001
Copy link
Contributor Author

Great idea! What would be even cooler is a callback function for embedded code so you can for example embed lua or js

@schveiguy
Copy link
Contributor

I just submitted a PR for a new type of diet parsing I called "Live Mode" which outputs HTML data that it rereads from the view file at runtime. I had to do quite a bit of the same things you did here. It does support embedded D code, but only if the code hasn't changed structure at all. See the result here: #70

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.

3 participants