Closed treaves closed 10 years ago
I find no discussion on templating. I can think of several ways to implement a templating system with tufao, but, would like to hear why it's not there already?
Basically I don't know what is the right answer. What is the right template system? Are you sure? Why? Will your answer be the same tomorrow?
Maybe I could spend some time thinking about a good interface that could abstract all template systems, then I wouldn't mind to include the most popular template systems on Tufão.
I can only assume no one has though it necessary, and everyone is just using strings for HTML. Which is incredibly cumbersome.
I think template is important. qt-mustache is mentioned on the wiki.
If you think there is a right answer (or that a single answer is even possible), you don't understand software (or, more generally, problem solving). The goal with software specifically is to pick something reasonable, make sure the interface is in place, so that as better solutions come along, they are painless to implement. It's called 'refactoring'.
If it is easy to incorporate something like qt-mustache, there is nothing wrong to deferring the templating to it. An example would be great. Actually, an example on returning more than a little HTML would be great.
I just created a resource file (qrc) with some HTML files in it, and compiled it into my "hello" app. The HTML files use the standard Qt string templating, with the QString::arg() calls. I'd never say it's the 'right' solution, but it works, and could very easily be abstracted out, into something like qt-mustache. Then, it would be easy to have a Template class, that return codes , headers, & what-not could be set on, and the return from the handle requests would simply be to template.renderTemplate(args) or some-such.
A solution doesn't need to be large & daunting. And a poor solution is often better than no solution.
@treaves, fair enough. Let me express my concern reasonably.
I don't want to Tufão users to refactor their code after every Tufão release because I didn't invest enough time thinking about a good interface.
There is no code and there is a link to another template system on the wiki. So we can say the reason is laziness or lack of interest (or time).
@treaves, PS: I liked your comment.
I've been watching tufao for some time. In my experience, much of the web is moving towards client side html rendering. (You know, Google's AngularJS, EmberJS, etc.) In other words you may not have to do anything other than helping the users deliver data easily in various formats such as Json, Protobuf, Xml or even Base91.
I find no discussion on templating. I can think of several ways to implement a templating system with tufao, but, would like to hear why it's not there already? I can only assume no one has though it necessary, and everyone is just using strings for HTML. Which is incredibly cumbersome.